mirror of
https://github.com/hanzoai/runtime.git
synced 2026-10-30 18:23:13 +00:00
- Add main Dockerfile for production builds - Add Dockerfile.runtime for secure code execution - Add Dockerfile.runtime.fixed with improved configuration - Include .dockerignore for build optimization - Add integration documentation and publishing guides - Update API and CLI components for better runtime support - Enhance sandbox and container management features
1325 lines
44 KiB
Go
Generated
1325 lines
44 KiB
Go
Generated
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
|
package docs
|
|
|
|
import "github.com/swaggo/swag"
|
|
|
|
const docTemplate = `{
|
|
"schemes": {{ marshal .Schemes }},
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "{{escape .Description}}",
|
|
"title": "{{.Title}}",
|
|
"contact": {},
|
|
"version": "{{.Version}}"
|
|
},
|
|
"host": "{{.Host}}",
|
|
"basePath": "{{.BasePath}}",
|
|
"paths": {
|
|
"/": {
|
|
"get": {
|
|
"description": "Health check",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "Health check",
|
|
"operationId": "HealthCheck",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sandboxes": {
|
|
"post": {
|
|
"description": "Create a sandbox",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"sandbox"
|
|
],
|
|
"summary": "Create a sandbox",
|
|
"operationId": "Create",
|
|
"parameters": [
|
|
{
|
|
"description": "Create sandbox",
|
|
"name": "sandbox",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/CreateSandboxDTO"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sandboxes/{sandboxId}": {
|
|
"get": {
|
|
"description": "Get sandbox info",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"sandbox"
|
|
],
|
|
"summary": "Get sandbox info",
|
|
"operationId": "Info",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Sandbox info",
|
|
"schema": {
|
|
"$ref": "#/definitions/SandboxInfoResponse"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"description": "Remove a sandbox that has been previously destroyed",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"sandbox"
|
|
],
|
|
"summary": "Remove a destroyed sandbox",
|
|
"operationId": "RemoveDestroyed",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Sandbox removed",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sandboxes/{sandboxId}/backup": {
|
|
"post": {
|
|
"description": "Create sandbox backup",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"sandbox"
|
|
],
|
|
"summary": "Create sandbox backup",
|
|
"operationId": "CreateBackup",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Create backup",
|
|
"name": "sandbox",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/CreateBackupDTO"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Backup created",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sandboxes/{sandboxId}/destroy": {
|
|
"post": {
|
|
"description": "Destroy sandbox",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"sandbox"
|
|
],
|
|
"summary": "Destroy sandbox",
|
|
"operationId": "Destroy",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Sandbox destroyed",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sandboxes/{sandboxId}/resize": {
|
|
"post": {
|
|
"description": "Resize sandbox",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"sandbox"
|
|
],
|
|
"summary": "Resize sandbox",
|
|
"operationId": "Resize",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Resize sandbox",
|
|
"name": "sandbox",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/ResizeSandboxDTO"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Sandbox resized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sandboxes/{sandboxId}/start": {
|
|
"post": {
|
|
"description": "Start sandbox",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"sandbox"
|
|
],
|
|
"summary": "Start sandbox",
|
|
"operationId": "Start",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Sandbox started",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sandboxes/{sandboxId}/stop": {
|
|
"post": {
|
|
"description": "Stop sandbox",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"sandbox"
|
|
],
|
|
"summary": "Stop sandbox",
|
|
"operationId": "Stop",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Sandbox stopped",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sandboxes/{sandboxId}/toolbox/{path}": {
|
|
"get": {
|
|
"description": "Forwards the request to the specified sandbox's container",
|
|
"tags": [
|
|
"toolbox"
|
|
],
|
|
"summary": "Proxy requests to the sandbox toolbox",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Path to forward",
|
|
"name": "path",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Proxied response",
|
|
"schema": {}
|
|
},
|
|
"400": {
|
|
"description": "Bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Sandbox container not found",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Sandbox container conflict",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"description": "Forwards the request to the specified sandbox's container",
|
|
"tags": [
|
|
"toolbox"
|
|
],
|
|
"summary": "Proxy requests to the sandbox toolbox",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Path to forward",
|
|
"name": "path",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Proxied response",
|
|
"schema": {}
|
|
},
|
|
"400": {
|
|
"description": "Bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Sandbox container not found",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Sandbox container conflict",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"description": "Forwards the request to the specified sandbox's container",
|
|
"tags": [
|
|
"toolbox"
|
|
],
|
|
"summary": "Proxy requests to the sandbox toolbox",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Sandbox ID",
|
|
"name": "sandboxId",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Path to forward",
|
|
"name": "path",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Proxied response",
|
|
"schema": {}
|
|
},
|
|
"400": {
|
|
"description": "Bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Sandbox container not found",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Sandbox container conflict",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/snapshots/build": {
|
|
"post": {
|
|
"description": "Build a snapshot from a Dockerfile and context hashes",
|
|
"tags": [
|
|
"snapshots"
|
|
],
|
|
"summary": "Build a snapshot",
|
|
"operationId": "BuildSnapshot",
|
|
"parameters": [
|
|
{
|
|
"description": "Build snapshot request",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/BuildSnapshotRequestDTO"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Snapshot successfully built",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/snapshots/exists": {
|
|
"get": {
|
|
"description": "Check if a specified snapshot exists locally",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"snapshots"
|
|
],
|
|
"summary": "Check if a snapshot exists",
|
|
"operationId": "SnapshotExists",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Snapshot name and tag",
|
|
"name": "snapshot",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/SnapshotExistsResponse"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/snapshots/logs": {
|
|
"get": {
|
|
"description": "Stream build logs",
|
|
"tags": [
|
|
"snapshots"
|
|
],
|
|
"summary": "Get build logs",
|
|
"operationId": "GetBuildLogs",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Snapshot ID or snapshot ref without the tag",
|
|
"name": "snapshotRef",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "boolean",
|
|
"description": "Whether to follow the log output",
|
|
"name": "follow",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Build logs stream",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/snapshots/pull": {
|
|
"post": {
|
|
"description": "Pull a snapshot from a registry",
|
|
"tags": [
|
|
"snapshots"
|
|
],
|
|
"summary": "Pull a snapshot",
|
|
"operationId": "PullSnapshot",
|
|
"parameters": [
|
|
{
|
|
"description": "Pull snapshot",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/PullSnapshotRequestDTO"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Snapshot successfully pulled",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/snapshots/remove": {
|
|
"post": {
|
|
"description": "Remove a specified snapshot from the local system",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"snapshots"
|
|
],
|
|
"summary": "Remove a snapshot",
|
|
"operationId": "RemoveSnapshot",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Snapshot name and tag",
|
|
"name": "snapshot",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Snapshot successfully removed",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Conflict",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"BuildSnapshotRequestDTO": {
|
|
"type": "object",
|
|
"required": [
|
|
"dockerfile",
|
|
"organizationId"
|
|
],
|
|
"properties": {
|
|
"context": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"dockerfile": {
|
|
"type": "string"
|
|
},
|
|
"organizationId": {
|
|
"type": "string"
|
|
},
|
|
"pushToInternalRegistry": {
|
|
"type": "boolean"
|
|
},
|
|
"registry": {
|
|
"$ref": "#/definitions/RegistryDTO"
|
|
},
|
|
"snapshot": {
|
|
"description": "Snapshot ID and tag or the build's hash",
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"CreateBackupDTO": {
|
|
"type": "object",
|
|
"required": [
|
|
"registry",
|
|
"snapshot"
|
|
],
|
|
"properties": {
|
|
"registry": {
|
|
"$ref": "#/definitions/RegistryDTO"
|
|
},
|
|
"snapshot": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"CreateSandboxDTO": {
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"osUser",
|
|
"snapshot",
|
|
"userId"
|
|
],
|
|
"properties": {
|
|
"cpuQuota": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"entrypoint": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"env": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"fromVolumeId": {
|
|
"type": "string"
|
|
},
|
|
"gpuQuota": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"memoryQuota": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"osUser": {
|
|
"type": "string"
|
|
},
|
|
"registry": {
|
|
"$ref": "#/definitions/RegistryDTO"
|
|
},
|
|
"snapshot": {
|
|
"type": "string"
|
|
},
|
|
"storageQuota": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"userId": {
|
|
"type": "string"
|
|
},
|
|
"volumes": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/dto.VolumeDTO"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"ErrorResponse": {
|
|
"description": "Error response",
|
|
"type": "object",
|
|
"required": [
|
|
"code",
|
|
"message",
|
|
"method",
|
|
"path",
|
|
"statusCode",
|
|
"timestamp"
|
|
],
|
|
"properties": {
|
|
"code": {
|
|
"type": "string",
|
|
"example": "BAD_REQUEST"
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"example": "Bad request"
|
|
},
|
|
"method": {
|
|
"type": "string",
|
|
"example": "GET"
|
|
},
|
|
"path": {
|
|
"type": "string",
|
|
"example": "/api/resource"
|
|
},
|
|
"statusCode": {
|
|
"type": "integer",
|
|
"example": 400
|
|
},
|
|
"timestamp": {
|
|
"type": "string",
|
|
"example": "2023-01-01T12:00:00Z"
|
|
}
|
|
}
|
|
},
|
|
"PullSnapshotRequestDTO": {
|
|
"type": "object",
|
|
"required": [
|
|
"snapshot"
|
|
],
|
|
"properties": {
|
|
"registry": {
|
|
"$ref": "#/definitions/RegistryDTO"
|
|
},
|
|
"snapshot": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"RegistryDTO": {
|
|
"type": "object",
|
|
"required": [
|
|
"password",
|
|
"url",
|
|
"username"
|
|
],
|
|
"properties": {
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"project": {
|
|
"type": "string"
|
|
},
|
|
"url": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"ResizeSandboxDTO": {
|
|
"type": "object",
|
|
"properties": {
|
|
"cpu": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
},
|
|
"gpu": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"memory": {
|
|
"type": "integer",
|
|
"minimum": 1
|
|
}
|
|
}
|
|
},
|
|
"SandboxInfoResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"backupState": {
|
|
"$ref": "#/definitions/enums.BackupState"
|
|
},
|
|
"state": {
|
|
"$ref": "#/definitions/enums.SandboxState"
|
|
}
|
|
}
|
|
},
|
|
"SnapshotExistsResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"exists": {
|
|
"type": "boolean",
|
|
"example": true
|
|
}
|
|
}
|
|
},
|
|
"dto.VolumeDTO": {
|
|
"type": "object",
|
|
"properties": {
|
|
"mountPath": {
|
|
"type": "string"
|
|
},
|
|
"volumeId": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"enums.BackupState": {
|
|
"type": "string",
|
|
"enum": [
|
|
"NONE",
|
|
"PENDING",
|
|
"IN_PROGRESS",
|
|
"COMPLETED",
|
|
"FAILED"
|
|
],
|
|
"x-enum-varnames": [
|
|
"BackupStateNone",
|
|
"BackupStatePending",
|
|
"BackupStateInProgress",
|
|
"BackupStateCompleted",
|
|
"BackupStateFailed"
|
|
]
|
|
},
|
|
"enums.SandboxState": {
|
|
"type": "string",
|
|
"enum": [
|
|
"creating",
|
|
"restoring",
|
|
"destroyed",
|
|
"destroying",
|
|
"started",
|
|
"stopped",
|
|
"starting",
|
|
"stopping",
|
|
"resizing",
|
|
"error",
|
|
"unknown",
|
|
"pulling_snapshot"
|
|
],
|
|
"x-enum-varnames": [
|
|
"SandboxStateCreating",
|
|
"SandboxStateRestoring",
|
|
"SandboxStateDestroyed",
|
|
"SandboxStateDestroying",
|
|
"SandboxStateStarted",
|
|
"SandboxStateStopped",
|
|
"SandboxStateStarting",
|
|
"SandboxStateStopping",
|
|
"SandboxStateResizing",
|
|
"SandboxStateError",
|
|
"SandboxStateUnknown",
|
|
"SandboxStatePullingSnapshot"
|
|
]
|
|
}
|
|
},
|
|
"securityDefinitions": {
|
|
"Bearer": {
|
|
"description": "Type \"Bearer\" followed by a space and an API token.",
|
|
"type": "apiKey",
|
|
"name": "Authorization",
|
|
"in": "header"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"Bearer": []
|
|
}
|
|
]
|
|
}`
|
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
var SwaggerInfo = &swag.Spec{
|
|
Version: "v0.0.0-dev",
|
|
Host: "",
|
|
BasePath: "",
|
|
Schemes: []string{},
|
|
Title: "Runtime Runner API",
|
|
Description: "Runtime Runner API",
|
|
InfoInstanceName: "swagger",
|
|
SwaggerTemplate: docTemplate,
|
|
LeftDelim: "{{",
|
|
RightDelim: "}}",
|
|
}
|
|
|
|
func init() {
|
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
|
}
|