Create a sandbox
By default, the sandbox is created without starting. Use start=true to
start it immediately and wait_for=running to wait until it is ready.
curl --request POST \
--url https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "",
"reference": "<string>",
"source": "oci",
"env": [],
"init": {
"cmd": "<string>",
"args": [
"<string>"
],
"env": [
[
"<string>",
"<string>"
]
]
},
"labels": {},
"lifecycle": {
"ephemeral": false,
"idle_timeout_secs": null,
"max_duration_secs": null
},
"mounts": [],
"network": {
"enabled": true,
"strict": false
},
"rlimits": [],
"runtime": {
"cmd": null,
"entrypoint": null,
"log_level": null,
"scripts": {},
"shell": null,
"user": null,
"workdir": null
},
"security_profile": "default",
"patches": [
{
"content": "<string>",
"path": "<string>",
"replace": true,
"type": "text",
"mode": 1
}
],
"resources": {
"disk_size_mib": null,
"memory_mib": 512,
"vcpus": 1
},
"registry": {
"mode": "auto"
},
"slug": "<string>"
}
'import requests
url = "https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes"
payload = {
"name": "",
"reference": "<string>",
"source": "oci",
"env": [],
"init": {
"cmd": "<string>",
"args": ["<string>"],
"env": [["<string>", "<string>"]]
},
"labels": {},
"lifecycle": {
"ephemeral": False,
"idle_timeout_secs": None,
"max_duration_secs": None
},
"mounts": [],
"network": {
"enabled": True,
"strict": False
},
"rlimits": [],
"runtime": {
"cmd": None,
"entrypoint": None,
"log_level": None,
"scripts": {},
"shell": None,
"user": None,
"workdir": None
},
"security_profile": "default",
"patches": [
{
"content": "<string>",
"path": "<string>",
"replace": True,
"type": "text",
"mode": 1
}
],
"resources": {
"disk_size_mib": None,
"memory_mib": 512,
"vcpus": 1
},
"registry": { "mode": "auto" },
"slug": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '',
reference: '<string>',
source: 'oci',
env: [],
init: {cmd: '<string>', args: ['<string>'], env: [['<string>', '<string>']]},
labels: {},
lifecycle: {ephemeral: false, idle_timeout_secs: null, max_duration_secs: null},
mounts: [],
network: {enabled: true, strict: false},
rlimits: [],
runtime: {
cmd: null,
entrypoint: null,
log_level: null,
scripts: {},
shell: null,
user: null,
workdir: null
},
security_profile: 'default',
patches: [{content: '<string>', path: '<string>', replace: true, type: 'text', mode: 1}],
resources: {disk_size_mib: null, memory_mib: 512, vcpus: 1},
registry: {mode: 'auto'},
slug: '<string>'
})
};
fetch('https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '',
'reference' => '<string>',
'source' => 'oci',
'env' => [
],
'init' => [
'cmd' => '<string>',
'args' => [
'<string>'
],
'env' => [
[
'<string>',
'<string>'
]
]
],
'labels' => [
],
'lifecycle' => [
'ephemeral' => false,
'idle_timeout_secs' => null,
'max_duration_secs' => null
],
'mounts' => [
],
'network' => [
'enabled' => true,
'strict' => false
],
'rlimits' => [
],
'runtime' => [
'cmd' => null,
'entrypoint' => null,
'log_level' => null,
'scripts' => [
],
'shell' => null,
'user' => null,
'workdir' => null
],
'security_profile' => 'default',
'patches' => [
[
'content' => '<string>',
'path' => '<string>',
'replace' => true,
'type' => 'text',
'mode' => 1
]
],
'resources' => [
'disk_size_mib' => null,
'memory_mib' => 512,
'vcpus' => 1
],
'registry' => [
'mode' => 'auto'
],
'slug' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes"
payload := strings.NewReader("{\n \"name\": \"\",\n \"reference\": \"<string>\",\n \"source\": \"oci\",\n \"env\": [],\n \"init\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ]\n },\n \"labels\": {},\n \"lifecycle\": {\n \"ephemeral\": false,\n \"idle_timeout_secs\": null,\n \"max_duration_secs\": null\n },\n \"mounts\": [],\n \"network\": {\n \"enabled\": true,\n \"strict\": false\n },\n \"rlimits\": [],\n \"runtime\": {\n \"cmd\": null,\n \"entrypoint\": null,\n \"log_level\": null,\n \"scripts\": {},\n \"shell\": null,\n \"user\": null,\n \"workdir\": null\n },\n \"security_profile\": \"default\",\n \"patches\": [\n {\n \"content\": \"<string>\",\n \"path\": \"<string>\",\n \"replace\": true,\n \"type\": \"text\",\n \"mode\": 1\n }\n ],\n \"resources\": {\n \"disk_size_mib\": null,\n \"memory_mib\": 512,\n \"vcpus\": 1\n },\n \"registry\": {\n \"mode\": \"auto\"\n },\n \"slug\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"\",\n \"reference\": \"<string>\",\n \"source\": \"oci\",\n \"env\": [],\n \"init\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ]\n },\n \"labels\": {},\n \"lifecycle\": {\n \"ephemeral\": false,\n \"idle_timeout_secs\": null,\n \"max_duration_secs\": null\n },\n \"mounts\": [],\n \"network\": {\n \"enabled\": true,\n \"strict\": false\n },\n \"rlimits\": [],\n \"runtime\": {\n \"cmd\": null,\n \"entrypoint\": null,\n \"log_level\": null,\n \"scripts\": {},\n \"shell\": null,\n \"user\": null,\n \"workdir\": null\n },\n \"security_profile\": \"default\",\n \"patches\": [\n {\n \"content\": \"<string>\",\n \"path\": \"<string>\",\n \"replace\": true,\n \"type\": \"text\",\n \"mode\": 1\n }\n ],\n \"resources\": {\n \"disk_size_mib\": null,\n \"memory_mib\": 512,\n \"vcpus\": 1\n },\n \"registry\": {\n \"mode\": \"auto\"\n },\n \"slug\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"\",\n \"reference\": \"<string>\",\n \"source\": \"oci\",\n \"env\": [],\n \"init\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ]\n },\n \"labels\": {},\n \"lifecycle\": {\n \"ephemeral\": false,\n \"idle_timeout_secs\": null,\n \"max_duration_secs\": null\n },\n \"mounts\": [],\n \"network\": {\n \"enabled\": true,\n \"strict\": false\n },\n \"rlimits\": [],\n \"runtime\": {\n \"cmd\": null,\n \"entrypoint\": null,\n \"log_level\": null,\n \"scripts\": {},\n \"shell\": null,\n \"user\": null,\n \"workdir\": null\n },\n \"security_profile\": \"default\",\n \"patches\": [\n {\n \"content\": \"<string>\",\n \"path\": \"<string>\",\n \"replace\": true,\n \"type\": \"text\",\n \"mode\": 1\n }\n ],\n \"resources\": {\n \"disk_size_mib\": null,\n \"memory_mib\": 512,\n \"vcpus\": 1\n },\n \"registry\": {\n \"mode\": \"auto\"\n },\n \"slug\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"ephemeral": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"status": "created",
"automatic_recovery_ends_at": "2023-11-07T05:31:56Z",
"last_failure_message": "<string>",
"spec": {
"env": [
{
"key": "<string>",
"value": "<string>"
}
],
"labels": {},
"lifecycle": {
"ephemeral": true,
"idle_timeout_secs": 1,
"max_duration_secs": 1
},
"mounts": [
{
"guest": "<string>",
"host_permissions": "private",
"options": {
"nodev": false,
"noexec": false,
"nosuid": false,
"override_gid": null,
"override_uid": null,
"readonly": false
},
"stat_virtualization": "strict",
"type": "Bind",
"quota_mib": 1
}
],
"network": {
"enabled": true,
"ports": [
{
"guest_port": 1,
"host_bind": "<string>",
"host_port": 1,
"protocol": "tcp"
}
],
"trust_host_cas": true,
"dns": {
"nameservers": [],
"query_timeout_ms": 5000,
"rebind_protection": true
},
"interface": {
"ipv4_address": null,
"ipv4_pool": null,
"ipv6_address": null,
"ipv6_pool": null,
"mac": null,
"mtu": null
},
"max_connections": 1,
"policy": {
"default_egress": "allow",
"default_ingress": "allow",
"rules": [
{
"action": "allow",
"destination": "any",
"direction": "egress",
"ports": [
{
"end": 1,
"start": 1
}
],
"protocols": [
"tcp"
]
}
]
},
"secrets": [
{
"allowed_hosts": [
{}
],
"env_var": "<string>",
"injection": {},
"placeholder": "<string>",
"on_violation": {}
}
],
"tls": {
"block_quic_on_intercept": true,
"bypass": [
"<string>"
],
"cache": {
"capacity": 1,
"validity_hours": 1
},
"enabled": true,
"intercept_ca": {
"cert_path": "<string>",
"key_path": "<string>"
},
"intercepted_ports": [
1
],
"scoped_upstream_ca_cert": [
{
"path": "<string>",
"pattern": "<string>"
}
],
"scoped_verify_upstream": [
{
"pattern": "<string>",
"verify": true
}
],
"upstream_ca_cert": [
"<string>"
],
"verify_upstream": true
}
},
"resources": {
"disk_size_mib": null,
"memory_mib": 512,
"vcpus": 1
},
"rlimits": [
{
"hard": 1,
"resource": "Cpu",
"soft": 1
}
],
"runtime": {
"cmd": null,
"disable_metrics_sample": false,
"entrypoint": null,
"hostname": null,
"log_level": "error",
"metrics_sample_interval_ms": 1000,
"scripts": {},
"shell": null,
"user": null,
"workdir": null
},
"image": "<string>"
},
"started_at": "2023-11-07T05:31:56Z",
"status_reason": "scheduling",
"stopped_at": "2023-11-07T05:31:56Z",
"temporarily_unavailable_since": "2023-11-07T05:31:56Z"
}Authorizations
Personal access token (msb_pat_…) or session JWT - the credential an agent acts with on a user's behalf.
Path Parameters
Organization slug
Query Parameters
If true, durably queue the sandbox for immediate orchestrator dispatch.
Optional lifecycle state to wait for after durable start admission. Lifecycle state an opt-in create request may wait to observe.
running Server-side wait budget in seconds; valid only with wait_for.
x >= 0Body
- Option 1
- Option 2
- Option 3
- Option 4
What the user sends in POST /v1/sandboxes.
The body carries the shared microsandbox [CloudCreateSandboxRequest] union.
Its source-specific and common [CloudSandboxSpec] fields stay flat on the
wire beside the cloud-only SSH slug and registry-credential selection.
Unique sandbox name.
OCI image reference.
oci Environment variables visible to commands in the sandbox.
Show child attributes
Show child attributes
Hand off PID 1 to a guest init binary after agentd setup.
Show child attributes
Show child attributes
User-defined labels attached to the sandbox.
Show child attributes
Show child attributes
Sandbox lifecycle policy.
Show child attributes
Show child attributes
Volume mounts.
Persistent volume mounted at a path inside the sandbox.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Network specification.
Show child attributes
Show child attributes
Sandbox-wide resource limits inherited by guest processes.
Show child attributes
Show child attributes
Guest runtime options.
Show child attributes
Show child attributes
In-guest security profile.
default, restricted Rootfs patches applied before VM start.
Filesystem change applied before the sandbox starts. The type field selects the operation.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
Show child attributes
Show child attributes
OCI image pull policy.
if_missing, always, never CPU, memory, and writable-disk resources.
Show child attributes
Show child attributes
Registry-credential selection for the image pull. Absent ⇒ Auto
(infer the credential from the image's registry host). Credential-only:
this never changes where the image is pulled from - the image string
controls that - only which stored credential, if any, is presented.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Optional globally-unique slug - the SSH username token. Lowercase letters, digits, and single hyphens; 3-63 chars. Omitted ⇒ a dictionary slug is generated. Must be globally unique (409 on conflict).
Response
Sandbox created
Sandbox details and resolved configuration.
Sandbox lifecycle status.
created, starting, running, temporarily_unavailable, recovery_decision_required, stopping, stopped, failed When an explicit recovery choice becomes necessary.
Human-readable reason for the last failure.
Curated projection of the resolved spec; absent until resolved.
Show child attributes
Show child attributes
Latest run's start time; null if the sandbox has never run.
Scheduler condition while status is starting.
scheduling, insufficient_capacity Latest run's stop time; null while open or never run.
When the current worker outage became user-visible.
Was this page helpful?
curl --request POST \
--url https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "",
"reference": "<string>",
"source": "oci",
"env": [],
"init": {
"cmd": "<string>",
"args": [
"<string>"
],
"env": [
[
"<string>",
"<string>"
]
]
},
"labels": {},
"lifecycle": {
"ephemeral": false,
"idle_timeout_secs": null,
"max_duration_secs": null
},
"mounts": [],
"network": {
"enabled": true,
"strict": false
},
"rlimits": [],
"runtime": {
"cmd": null,
"entrypoint": null,
"log_level": null,
"scripts": {},
"shell": null,
"user": null,
"workdir": null
},
"security_profile": "default",
"patches": [
{
"content": "<string>",
"path": "<string>",
"replace": true,
"type": "text",
"mode": 1
}
],
"resources": {
"disk_size_mib": null,
"memory_mib": 512,
"vcpus": 1
},
"registry": {
"mode": "auto"
},
"slug": "<string>"
}
'import requests
url = "https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes"
payload = {
"name": "",
"reference": "<string>",
"source": "oci",
"env": [],
"init": {
"cmd": "<string>",
"args": ["<string>"],
"env": [["<string>", "<string>"]]
},
"labels": {},
"lifecycle": {
"ephemeral": False,
"idle_timeout_secs": None,
"max_duration_secs": None
},
"mounts": [],
"network": {
"enabled": True,
"strict": False
},
"rlimits": [],
"runtime": {
"cmd": None,
"entrypoint": None,
"log_level": None,
"scripts": {},
"shell": None,
"user": None,
"workdir": None
},
"security_profile": "default",
"patches": [
{
"content": "<string>",
"path": "<string>",
"replace": True,
"type": "text",
"mode": 1
}
],
"resources": {
"disk_size_mib": None,
"memory_mib": 512,
"vcpus": 1
},
"registry": { "mode": "auto" },
"slug": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '',
reference: '<string>',
source: 'oci',
env: [],
init: {cmd: '<string>', args: ['<string>'], env: [['<string>', '<string>']]},
labels: {},
lifecycle: {ephemeral: false, idle_timeout_secs: null, max_duration_secs: null},
mounts: [],
network: {enabled: true, strict: false},
rlimits: [],
runtime: {
cmd: null,
entrypoint: null,
log_level: null,
scripts: {},
shell: null,
user: null,
workdir: null
},
security_profile: 'default',
patches: [{content: '<string>', path: '<string>', replace: true, type: 'text', mode: 1}],
resources: {disk_size_mib: null, memory_mib: 512, vcpus: 1},
registry: {mode: 'auto'},
slug: '<string>'
})
};
fetch('https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '',
'reference' => '<string>',
'source' => 'oci',
'env' => [
],
'init' => [
'cmd' => '<string>',
'args' => [
'<string>'
],
'env' => [
[
'<string>',
'<string>'
]
]
],
'labels' => [
],
'lifecycle' => [
'ephemeral' => false,
'idle_timeout_secs' => null,
'max_duration_secs' => null
],
'mounts' => [
],
'network' => [
'enabled' => true,
'strict' => false
],
'rlimits' => [
],
'runtime' => [
'cmd' => null,
'entrypoint' => null,
'log_level' => null,
'scripts' => [
],
'shell' => null,
'user' => null,
'workdir' => null
],
'security_profile' => 'default',
'patches' => [
[
'content' => '<string>',
'path' => '<string>',
'replace' => true,
'type' => 'text',
'mode' => 1
]
],
'resources' => [
'disk_size_mib' => null,
'memory_mib' => 512,
'vcpus' => 1
],
'registry' => [
'mode' => 'auto'
],
'slug' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes"
payload := strings.NewReader("{\n \"name\": \"\",\n \"reference\": \"<string>\",\n \"source\": \"oci\",\n \"env\": [],\n \"init\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ]\n },\n \"labels\": {},\n \"lifecycle\": {\n \"ephemeral\": false,\n \"idle_timeout_secs\": null,\n \"max_duration_secs\": null\n },\n \"mounts\": [],\n \"network\": {\n \"enabled\": true,\n \"strict\": false\n },\n \"rlimits\": [],\n \"runtime\": {\n \"cmd\": null,\n \"entrypoint\": null,\n \"log_level\": null,\n \"scripts\": {},\n \"shell\": null,\n \"user\": null,\n \"workdir\": null\n },\n \"security_profile\": \"default\",\n \"patches\": [\n {\n \"content\": \"<string>\",\n \"path\": \"<string>\",\n \"replace\": true,\n \"type\": \"text\",\n \"mode\": 1\n }\n ],\n \"resources\": {\n \"disk_size_mib\": null,\n \"memory_mib\": 512,\n \"vcpus\": 1\n },\n \"registry\": {\n \"mode\": \"auto\"\n },\n \"slug\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"\",\n \"reference\": \"<string>\",\n \"source\": \"oci\",\n \"env\": [],\n \"init\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ]\n },\n \"labels\": {},\n \"lifecycle\": {\n \"ephemeral\": false,\n \"idle_timeout_secs\": null,\n \"max_duration_secs\": null\n },\n \"mounts\": [],\n \"network\": {\n \"enabled\": true,\n \"strict\": false\n },\n \"rlimits\": [],\n \"runtime\": {\n \"cmd\": null,\n \"entrypoint\": null,\n \"log_level\": null,\n \"scripts\": {},\n \"shell\": null,\n \"user\": null,\n \"workdir\": null\n },\n \"security_profile\": \"default\",\n \"patches\": [\n {\n \"content\": \"<string>\",\n \"path\": \"<string>\",\n \"replace\": true,\n \"type\": \"text\",\n \"mode\": 1\n }\n ],\n \"resources\": {\n \"disk_size_mib\": null,\n \"memory_mib\": 512,\n \"vcpus\": 1\n },\n \"registry\": {\n \"mode\": \"auto\"\n },\n \"slug\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.microsandbox.dev/v1/orgs/{slug}/sandboxes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"\",\n \"reference\": \"<string>\",\n \"source\": \"oci\",\n \"env\": [],\n \"init\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ]\n },\n \"labels\": {},\n \"lifecycle\": {\n \"ephemeral\": false,\n \"idle_timeout_secs\": null,\n \"max_duration_secs\": null\n },\n \"mounts\": [],\n \"network\": {\n \"enabled\": true,\n \"strict\": false\n },\n \"rlimits\": [],\n \"runtime\": {\n \"cmd\": null,\n \"entrypoint\": null,\n \"log_level\": null,\n \"scripts\": {},\n \"shell\": null,\n \"user\": null,\n \"workdir\": null\n },\n \"security_profile\": \"default\",\n \"patches\": [\n {\n \"content\": \"<string>\",\n \"path\": \"<string>\",\n \"replace\": true,\n \"type\": \"text\",\n \"mode\": 1\n }\n ],\n \"resources\": {\n \"disk_size_mib\": null,\n \"memory_mib\": 512,\n \"vcpus\": 1\n },\n \"registry\": {\n \"mode\": \"auto\"\n },\n \"slug\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"ephemeral": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"status": "created",
"automatic_recovery_ends_at": "2023-11-07T05:31:56Z",
"last_failure_message": "<string>",
"spec": {
"env": [
{
"key": "<string>",
"value": "<string>"
}
],
"labels": {},
"lifecycle": {
"ephemeral": true,
"idle_timeout_secs": 1,
"max_duration_secs": 1
},
"mounts": [
{
"guest": "<string>",
"host_permissions": "private",
"options": {
"nodev": false,
"noexec": false,
"nosuid": false,
"override_gid": null,
"override_uid": null,
"readonly": false
},
"stat_virtualization": "strict",
"type": "Bind",
"quota_mib": 1
}
],
"network": {
"enabled": true,
"ports": [
{
"guest_port": 1,
"host_bind": "<string>",
"host_port": 1,
"protocol": "tcp"
}
],
"trust_host_cas": true,
"dns": {
"nameservers": [],
"query_timeout_ms": 5000,
"rebind_protection": true
},
"interface": {
"ipv4_address": null,
"ipv4_pool": null,
"ipv6_address": null,
"ipv6_pool": null,
"mac": null,
"mtu": null
},
"max_connections": 1,
"policy": {
"default_egress": "allow",
"default_ingress": "allow",
"rules": [
{
"action": "allow",
"destination": "any",
"direction": "egress",
"ports": [
{
"end": 1,
"start": 1
}
],
"protocols": [
"tcp"
]
}
]
},
"secrets": [
{
"allowed_hosts": [
{}
],
"env_var": "<string>",
"injection": {},
"placeholder": "<string>",
"on_violation": {}
}
],
"tls": {
"block_quic_on_intercept": true,
"bypass": [
"<string>"
],
"cache": {
"capacity": 1,
"validity_hours": 1
},
"enabled": true,
"intercept_ca": {
"cert_path": "<string>",
"key_path": "<string>"
},
"intercepted_ports": [
1
],
"scoped_upstream_ca_cert": [
{
"path": "<string>",
"pattern": "<string>"
}
],
"scoped_verify_upstream": [
{
"pattern": "<string>",
"verify": true
}
],
"upstream_ca_cert": [
"<string>"
],
"verify_upstream": true
}
},
"resources": {
"disk_size_mib": null,
"memory_mib": 512,
"vcpus": 1
},
"rlimits": [
{
"hard": 1,
"resource": "Cpu",
"soft": 1
}
],
"runtime": {
"cmd": null,
"disable_metrics_sample": false,
"entrypoint": null,
"hostname": null,
"log_level": "error",
"metrics_sample_interval_ms": 1000,
"scripts": {},
"shell": null,
"user": null,
"workdir": null
},
"image": "<string>"
},
"started_at": "2023-11-07T05:31:56Z",
"status_reason": "scheduling",
"stopped_at": "2023-11-07T05:31:56Z",
"temporarily_unavailable_since": "2023-11-07T05:31:56Z"
}