curl --request DELETE \
--url https://api.cwsandbox.com/v1/sandboxes/{sandboxId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cwsandbox.com/v1/sandboxes/{sandboxId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cwsandbox.com/v1/sandboxes/{sandboxId}', 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.cwsandbox.com/v1/sandboxes/{sandboxId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cwsandbox.com/v1/sandboxes/{sandboxId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.cwsandbox.com/v1/sandboxes/{sandboxId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cwsandbox.com/v1/sandboxes/{sandboxId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"sandbox": {
"spec": {
"containers": [
{
"name": "<string>",
"image": "<string>",
"command": "<string>",
"args": [
"<string>"
],
"environmentVariables": {},
"resources": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
},
"files": [
{
"path": "<string>",
"content": "<string>"
}
],
"volumeMounts": [
{
"volume": "<string>",
"mountPath": "<string>",
"readOnly": true,
"subPath": "<string>"
}
],
"secretStores": [
{
"storeName": "<string>",
"secrets": [
{
"path": "<string>",
"envVar": "<string>",
"field": "<string>"
}
]
}
],
"workingDir": "<string>",
"resourceRequirements": {
"requests": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
},
"limits": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
}
},
"securityContext": {
"runAsUser": 123,
"runAsGroup": 123,
"privileged": true,
"allowPrivilegeEscalation": true,
"readOnlyRootFilesystem": true,
"capabilitiesAdd": [
"<string>"
],
"capabilitiesDrop": [
"<string>"
],
"seccompProfile": "<string>"
},
"imagePullCredentials": {
"registry": "<string>",
"credentials": {
"storeName": "<string>",
"path": "<string>",
"field": "<string>"
}
},
"primary": true,
"startupProbe": {
"exec": [
"<string>"
],
"periodSeconds": 123,
"timeoutSeconds": 123,
"failureThreshold": 123,
"initialDelaySeconds": 123
}
}
],
"volumes": [
{
"name": "<string>",
"scratch": {
"size": "<string>",
"medium": "STORAGE_MEDIUM_UNSPECIFIED",
"restoreFromSnapshotId": "<string>"
},
"volumeId": "<string>"
}
],
"services": [
{
"port": 123,
"name": "<string>",
"protocol": "SERVICE_PROTOCOL_UNSPECIFIED",
"visibility": "VISIBILITY_UNSPECIFIED",
"endpoint": {
"kind": "ENDPOINT_KIND_UNSPECIFIED",
"auth": "ENDPOINT_AUTH_UNSPECIFIED",
"requestTimeoutSeconds": 123
}
}
],
"maxLifetimeSeconds": 123,
"networkIds": [
"<string>"
],
"objectStorageAccess": {
"buckets": [
"<string>"
],
"permission": "OBJECT_STORAGE_PERMISSION_UNSPECIFIED",
"objectPrefix": "<string>"
},
"tags": [
"<string>"
],
"runnerIds": [
"<string>"
],
"annotations": {},
"instanceType": "<string>",
"mode": "SANDBOX_MODE_UNSPECIFIED",
"runtimeClass": "<string>",
"networkConfigId": "<string>",
"runtimeClassSelection": "RUNTIME_CLASS_UNSPECIFIED",
"headlessServices": true
},
"sandboxId": "<string>",
"status": {
"state": "STATE_UNSPECIFIED",
"stateReason": "<string>",
"createTime": "2023-11-07T05:31:56Z",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"services": [
{
"port": 123,
"name": "<string>",
"protocol": "SERVICE_PROTOCOL_UNSPECIFIED",
"visibility": "VISIBILITY_UNSPECIFIED",
"endpoint": {
"kind": "ENDPOINT_KIND_UNSPECIFIED",
"auth": "ENDPOINT_AUTH_UNSPECIFIED",
"url": "<string>",
"requestTimeoutSeconds": 123,
"address": "<string>"
},
"url": "<string>"
}
],
"resourceUsage": {
"cpuMillicores": "<string>",
"memoryMb": "<string>",
"gpuCount": "<string>"
},
"exitCode": 123,
"effectiveResources": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
},
"effectiveMaxLifetimeSeconds": 123,
"containerStatuses": [
{
"name": "<string>",
"state": "STATE_UNSPECIFIED",
"exitCode": 123,
"restartCount": 123
}
],
"runnerId": "<string>",
"runnerGroupId": "<string>",
"effectiveIngress": [
{
"cidr": {
"cidr": "<string>",
"except": [
"<string>"
]
},
"tenant": "TENANT_SCOPE_UNSPECIFIED",
"any": true,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
]
}
],
"effectiveEgress": [
{
"cidr": {
"cidr": "<string>",
"except": [
"<string>"
]
},
"httpsHostname": "<string>",
"tenant": "TENANT_SCOPE_UNSPECIFIED",
"any": true,
"selector": {
"podLabels": {},
"namespaceLabels": {}
},
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
],
"httpsHostnameExcept": [
"<string>"
]
}
],
"effectiveResourceRequirements": {
"requests": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
},
"limits": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
}
},
"attachedVolumeIds": [
"<string>"
],
"effectiveRuntimeClass": "<string>",
"effectiveDnsEgress": "DNS_EGRESS_MODE_UNSPECIFIED"
},
"sourceTemplateId": "<string>",
"sourceTemplateRevision": "<string>",
"displayName": "<string>",
"endpointShareToken": "<string>",
"control": "CONTROL_UNSPECIFIED"
},
"fileSystemSnapshotIds": [
"<string>"
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Delete sandbox
Terminate a sandbox, optionally draining it gracefully and snapshotting its volumes first.
curl --request DELETE \
--url https://api.cwsandbox.com/v1/sandboxes/{sandboxId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cwsandbox.com/v1/sandboxes/{sandboxId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cwsandbox.com/v1/sandboxes/{sandboxId}', 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.cwsandbox.com/v1/sandboxes/{sandboxId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cwsandbox.com/v1/sandboxes/{sandboxId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.cwsandbox.com/v1/sandboxes/{sandboxId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cwsandbox.com/v1/sandboxes/{sandboxId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"sandbox": {
"spec": {
"containers": [
{
"name": "<string>",
"image": "<string>",
"command": "<string>",
"args": [
"<string>"
],
"environmentVariables": {},
"resources": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
},
"files": [
{
"path": "<string>",
"content": "<string>"
}
],
"volumeMounts": [
{
"volume": "<string>",
"mountPath": "<string>",
"readOnly": true,
"subPath": "<string>"
}
],
"secretStores": [
{
"storeName": "<string>",
"secrets": [
{
"path": "<string>",
"envVar": "<string>",
"field": "<string>"
}
]
}
],
"workingDir": "<string>",
"resourceRequirements": {
"requests": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
},
"limits": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
}
},
"securityContext": {
"runAsUser": 123,
"runAsGroup": 123,
"privileged": true,
"allowPrivilegeEscalation": true,
"readOnlyRootFilesystem": true,
"capabilitiesAdd": [
"<string>"
],
"capabilitiesDrop": [
"<string>"
],
"seccompProfile": "<string>"
},
"imagePullCredentials": {
"registry": "<string>",
"credentials": {
"storeName": "<string>",
"path": "<string>",
"field": "<string>"
}
},
"primary": true,
"startupProbe": {
"exec": [
"<string>"
],
"periodSeconds": 123,
"timeoutSeconds": 123,
"failureThreshold": 123,
"initialDelaySeconds": 123
}
}
],
"volumes": [
{
"name": "<string>",
"scratch": {
"size": "<string>",
"medium": "STORAGE_MEDIUM_UNSPECIFIED",
"restoreFromSnapshotId": "<string>"
},
"volumeId": "<string>"
}
],
"services": [
{
"port": 123,
"name": "<string>",
"protocol": "SERVICE_PROTOCOL_UNSPECIFIED",
"visibility": "VISIBILITY_UNSPECIFIED",
"endpoint": {
"kind": "ENDPOINT_KIND_UNSPECIFIED",
"auth": "ENDPOINT_AUTH_UNSPECIFIED",
"requestTimeoutSeconds": 123
}
}
],
"maxLifetimeSeconds": 123,
"networkIds": [
"<string>"
],
"objectStorageAccess": {
"buckets": [
"<string>"
],
"permission": "OBJECT_STORAGE_PERMISSION_UNSPECIFIED",
"objectPrefix": "<string>"
},
"tags": [
"<string>"
],
"runnerIds": [
"<string>"
],
"annotations": {},
"instanceType": "<string>",
"mode": "SANDBOX_MODE_UNSPECIFIED",
"runtimeClass": "<string>",
"networkConfigId": "<string>",
"runtimeClassSelection": "RUNTIME_CLASS_UNSPECIFIED",
"headlessServices": true
},
"sandboxId": "<string>",
"status": {
"state": "STATE_UNSPECIFIED",
"stateReason": "<string>",
"createTime": "2023-11-07T05:31:56Z",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"services": [
{
"port": 123,
"name": "<string>",
"protocol": "SERVICE_PROTOCOL_UNSPECIFIED",
"visibility": "VISIBILITY_UNSPECIFIED",
"endpoint": {
"kind": "ENDPOINT_KIND_UNSPECIFIED",
"auth": "ENDPOINT_AUTH_UNSPECIFIED",
"url": "<string>",
"requestTimeoutSeconds": 123,
"address": "<string>"
},
"url": "<string>"
}
],
"resourceUsage": {
"cpuMillicores": "<string>",
"memoryMb": "<string>",
"gpuCount": "<string>"
},
"exitCode": 123,
"effectiveResources": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
},
"effectiveMaxLifetimeSeconds": 123,
"containerStatuses": [
{
"name": "<string>",
"state": "STATE_UNSPECIFIED",
"exitCode": 123,
"restartCount": 123
}
],
"runnerId": "<string>",
"runnerGroupId": "<string>",
"effectiveIngress": [
{
"cidr": {
"cidr": "<string>",
"except": [
"<string>"
]
},
"tenant": "TENANT_SCOPE_UNSPECIFIED",
"any": true,
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
]
}
],
"effectiveEgress": [
{
"cidr": {
"cidr": "<string>",
"except": [
"<string>"
]
},
"httpsHostname": "<string>",
"tenant": "TENANT_SCOPE_UNSPECIFIED",
"any": true,
"selector": {
"podLabels": {},
"namespaceLabels": {}
},
"ports": [
{
"port": 123,
"protocol": "<string>",
"endPort": 123
}
],
"httpsHostnameExcept": [
"<string>"
]
}
],
"effectiveResourceRequirements": {
"requests": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
},
"limits": {
"cpu": "<string>",
"memory": "<string>",
"gpu": {
"count": "<string>",
"type": "<string>",
"memoryGb": "<string>"
}
}
},
"attachedVolumeIds": [
"<string>"
],
"effectiveRuntimeClass": "<string>",
"effectiveDnsEgress": "DNS_EGRESS_MODE_UNSPECIFIED"
},
"sourceTemplateId": "<string>",
"sourceTemplateRevision": "<string>",
"displayName": "<string>",
"endpointShareToken": "<string>",
"control": "CONTROL_UNSPECIFIED"
},
"fileSystemSnapshotIds": [
"<string>"
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}인증
쿼리 매개변수
Names of scratch SandboxSpec.volumes to snapshot before terminating; empty snapshots nothing. Each name must reference a scratch (not registered) volume declared on the sandbox spec: a registered-Volume-backed name is rejected with CWSANDBOX_VOLUME_NOT_SNAPSHOTTABLE, an unknown name with INVALID_ARGUMENT. Asynchronous — see the response.
Field 3 formerly held a bool snapshot; it was repurposed to this repeated
string as a deliberate breaking change while v1 is pre-GA (no live clients).
Old bool snapshot=true senders are unsupported — the value is dropped.
Optional receipt for a snapshot-on-delete request. Retrying the same request with the same token returns the original snapshot ids without redispatching the destructive command. Reusing it with different known request fields is rejected. This field is ignored when snapshot_volumes is empty: Plain Delete is naturally idempotent, does not inspect or persist a snapshot receipt, and retains the v1beta2 cancel-then-stop lifecycle. Snapshot volume order is part of request identity. Without a token, retrying snapshot-on-delete may create and dispatch a new batch. An exact replay returns the original receipt even when its snapshots failed; inspect the returned sandbox and snapshot states before retrying the delete with a new token. Tokens are limited to 128 UTF-8 bytes.
응답
OK
One id per DeleteSandboxRequest.snapshot_volumes entry, in request order; poll GetFileSystemSnapshot for terminal status. A returned id always means a snapshot row exists (never a silent no-op). Termination proceeds regardless of snapshot outcome — for a guaranteed snapshot, call CreateFileSystemSnapshot and confirm READY before deleting.
이 페이지가 도움이 되었나요?