Files
sdk/docs/SandboxAPI.md

44 KiB

\SandboxAPI

All URIs are relative to https://api.hanzo.ai

Method HTTP request Description
DeleteSandboxById Delete /v1/sandbox/{id} Ends a sandbox and releases the compute behind it.
EndSandbox Post /v1/sandbox/end End a sandbox and release it
GetSandbox Get /v1/sandbox Lists the sandboxes the caller holds, newest first.
GetSandboxById Get /v1/sandbox/{id} Returns one sandbox: its class, project, image, the runtime it was given, its status and when its lease ends.
GetSandboxByIdFs Get /v1/sandbox/{id}/fs Read a file, or list a directory
GetSandboxByIdPorts Get /v1/sandbox/{id}/ports Lists the TCP ports something listens on in a sandbox the caller holds, each with the preview host that serves it — what the sandbox's Browser can open.
GetSandboxByIdScreen Get /v1/sandbox/{id}/screen The screen, as a page
GetSandboxByIdScreenWs Get /v1/sandbox/{id}/screen/ws The screen, as a socket
GetSandboxByIdTerminal Get /v1/sandbox/{id}/terminal The terminal, as a page
GetSandboxByIdTerminalWs Get /v1/sandbox/{id}/terminal/ws The terminal, as a socket
GetSandboxQuota Get /v1/sandbox/quota Answers the caller's sandbox quota: the account it belongs to — the org, or a person in the signup org — how many of that account's paid sandboxes are running, and how many may run at once (-1 for no bound).
LeaseSandbox Post /v1/sandbox/lease Lease a sandbox — a real computer — or resume one you hold
PostSandbox Post /v1/sandbox Leases a sandbox — a real computer — for the caller's org.
PostSandboxByIdAgent Post /v1/sandbox/{id}/agent Have a model work a sandbox
PostSandboxByIdExec Post /v1/sandbox/{id}/exec Runs one command in a sandbox the caller holds and answers with its exit code, stdout and stderr.
PostSandboxByIdFs Post /v1/sandbox/{id}/fs Write a file
PostSandboxByIdPause Post /v1/sandbox/{id}/pause Stops the pod, keeps the row and the volume, and settles the tail: POST /v1/sandbox/:id/pause.
PostSandboxByIdPreview Post /v1/sandbox/{id}/preview Opens a port of a sandbox the caller holds in a browser.
PostSandboxByIdResume Post /v1/sandbox/{id}/resume Gives a parked sandbox a pod again: POST /v1/sandbox/:id/resume.
PostSandboxByIdScreenTicket Post /v1/sandbox/{id}/screen/ticket Mints a short-lived grant to open the screen of a desktop sandbox.
PostSandboxByIdTerminalTicket Post /v1/sandbox/{id}/terminal/ticket Mints a short-lived grant to open a terminal on a sandbox.
ReadSandboxFile Post /v1/sandbox/read Read a file from a sandbox you hold
RunInSandbox Post /v1/sandbox/run Run a command in a sandbox you hold and read its output
StopRun Post /v1/sandbox/stop Stop what a sandbox is running, and keep the sandbox
WriteSandboxFile Post /v1/sandbox/write Write a file into a sandbox you hold

DeleteSandboxById

DeleteSandboxById(ctx, id).Purge(purge).Execute()

Ends a sandbox and releases the compute behind it.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox to end, from the path.
	purge := "purge_example" // string |  (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.DeleteSandboxById(context.Background(), id).Purge(purge).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.DeleteSandboxById``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox to end, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiDeleteSandboxByIdRequest struct via the builder pattern

Name Type Description Notes

purge | string | |

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

EndSandbox

EndSandbox(ctx).SandboxEndIn(sandboxEndIn).Execute()

End a sandbox and release it

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	sandboxEndIn := *openapiclient.NewSandboxEndIn() // SandboxEndIn | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.EndSandbox(context.Background()).SandboxEndIn(sandboxEndIn).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.EndSandbox``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiEndSandboxRequest struct via the builder pattern

Name Type Description Notes
sandboxEndIn SandboxEndIn

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandbox

SandboxSandboxList GetSandbox(ctx).Project(project).Status(status).Execute()

Lists the sandboxes the caller holds, newest first.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	project := "project_example" // string |  (optional)
	status := "status_example" // string |  (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.GetSandbox(context.Background()).Project(project).Status(status).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandbox``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSandbox`: SandboxSandboxList
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.GetSandbox`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxRequest struct via the builder pattern

Name Type Description Notes
project string
status string

Return type

SandboxSandboxList

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandboxById

SandboxSandbox GetSandboxById(ctx, id).Execute()

Returns one sandbox: its class, project, image, the runtime it was given, its status and when its lease ends.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox to address, from the path.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.GetSandboxById(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandboxById``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSandboxById`: SandboxSandbox
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.GetSandboxById`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox to address, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxByIdRequest struct via the builder pattern

Name Type Description Notes

Return type

SandboxSandbox

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandboxByIdFs

GetSandboxByIdFs(ctx, id).Execute()

Read a file, or list a directory

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.GetSandboxByIdFs(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandboxByIdFs``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxByIdFsRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandboxByIdPorts

SandboxPorts GetSandboxByIdPorts(ctx, id).Execute()

Lists the TCP ports something listens on in a sandbox the caller holds, each with the preview host that serves it — what the sandbox's Browser can open.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox, from the path.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.GetSandboxByIdPorts(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandboxByIdPorts``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSandboxByIdPorts`: SandboxPorts
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.GetSandboxByIdPorts`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxByIdPortsRequest struct via the builder pattern

Name Type Description Notes

Return type

SandboxPorts

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandboxByIdScreen

GetSandboxByIdScreen(ctx, id).Execute()

The screen, as a page

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.GetSandboxByIdScreen(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandboxByIdScreen``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxByIdScreenRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandboxByIdScreenWs

GetSandboxByIdScreenWs(ctx, id).Execute()

The screen, as a socket

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.GetSandboxByIdScreenWs(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandboxByIdScreenWs``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxByIdScreenWsRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandboxByIdTerminal

GetSandboxByIdTerminal(ctx, id).Execute()

The terminal, as a page

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.GetSandboxByIdTerminal(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandboxByIdTerminal``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxByIdTerminalRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandboxByIdTerminalWs

GetSandboxByIdTerminalWs(ctx, id).Execute()

The terminal, as a socket

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.GetSandboxByIdTerminalWs(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandboxByIdTerminalWs``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxByIdTerminalWsRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSandboxQuota

SandboxQuota GetSandboxQuota(ctx).Execute()

Answers the caller's sandbox quota: the account it belongs to — the org, or a person in the signup org — how many of that account's paid sandboxes are running, and how many may run at once (-1 for no bound).

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.GetSandboxQuota(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.GetSandboxQuota``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetSandboxQuota`: SandboxQuota
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.GetSandboxQuota`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetSandboxQuotaRequest struct via the builder pattern

Return type

SandboxQuota

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

LeaseSandbox

SandboxLeased LeaseSandbox(ctx).SandboxLeaseIn(sandboxLeaseIn).Execute()

Lease a sandbox — a real computer — or resume one you hold

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	sandboxLeaseIn := *openapiclient.NewSandboxLeaseIn() // SandboxLeaseIn | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.LeaseSandbox(context.Background()).SandboxLeaseIn(sandboxLeaseIn).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.LeaseSandbox``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `LeaseSandbox`: SandboxLeased
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.LeaseSandbox`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiLeaseSandboxRequest struct via the builder pattern

Name Type Description Notes
sandboxLeaseIn SandboxLeaseIn

Return type

SandboxLeased

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandbox

SandboxSandbox PostSandbox(ctx).SandboxSandboxIn(sandboxSandboxIn).Execute()

Leases a sandbox — a real computer — for the caller's org.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	sandboxSandboxIn := *openapiclient.NewSandboxSandboxIn() // SandboxSandboxIn | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.PostSandbox(context.Background()).SandboxSandboxIn(sandboxSandboxIn).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandbox``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostSandbox`: SandboxSandbox
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.PostSandbox`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxRequest struct via the builder pattern

Name Type Description Notes
sandboxSandboxIn SandboxSandboxIn

Return type

SandboxSandbox

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandboxByIdAgent

PostSandboxByIdAgent(ctx, id).Execute()

Have a model work a sandbox

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.PostSandboxByIdAgent(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandboxByIdAgent``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxByIdAgentRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandboxByIdExec

SandboxExecResult PostSandboxByIdExec(ctx, id).SandboxExecRequest(sandboxExecRequest).Execute()

Runs one command in a sandbox the caller holds and answers with its exit code, stdout and stderr.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox to run in, from the path.
	sandboxExecRequest := *openapiclient.NewSandboxExecRequest() // SandboxExecRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.PostSandboxByIdExec(context.Background(), id).SandboxExecRequest(sandboxExecRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandboxByIdExec``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostSandboxByIdExec`: SandboxExecResult
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.PostSandboxByIdExec`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox to run in, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxByIdExecRequest struct via the builder pattern

Name Type Description Notes

sandboxExecRequest | SandboxExecRequest | |

Return type

SandboxExecResult

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandboxByIdFs

PostSandboxByIdFs(ctx, id).Execute()

Write a file

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.SandboxAPI.PostSandboxByIdFs(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandboxByIdFs``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxByIdFsRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandboxByIdPause

SandboxSandbox PostSandboxByIdPause(ctx, id).Execute()

Stops the pod, keeps the row and the volume, and settles the tail: POST /v1/sandbox/:id/pause.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox to address, from the path.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.PostSandboxByIdPause(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandboxByIdPause``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostSandboxByIdPause`: SandboxSandbox
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.PostSandboxByIdPause`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox to address, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxByIdPauseRequest struct via the builder pattern

Name Type Description Notes

Return type

SandboxSandbox

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandboxByIdPreview

SandboxPreviewGrant PostSandboxByIdPreview(ctx, id).SandboxPreviewIn(sandboxPreviewIn).Execute()

Opens a port of a sandbox the caller holds in a browser.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox, from the path.
	sandboxPreviewIn := *openapiclient.NewSandboxPreviewIn() // SandboxPreviewIn | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.PostSandboxByIdPreview(context.Background(), id).SandboxPreviewIn(sandboxPreviewIn).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandboxByIdPreview``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostSandboxByIdPreview`: SandboxPreviewGrant
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.PostSandboxByIdPreview`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxByIdPreviewRequest struct via the builder pattern

Name Type Description Notes

sandboxPreviewIn | SandboxPreviewIn | |

Return type

SandboxPreviewGrant

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandboxByIdResume

SandboxSandbox PostSandboxByIdResume(ctx, id).Execute()

Gives a parked sandbox a pod again: POST /v1/sandbox/:id/resume.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox to address, from the path.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.PostSandboxByIdResume(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandboxByIdResume``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostSandboxByIdResume`: SandboxSandbox
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.PostSandboxByIdResume`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox to address, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxByIdResumeRequest struct via the builder pattern

Name Type Description Notes

Return type

SandboxSandbox

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandboxByIdScreenTicket

SandboxTicketGrant PostSandboxByIdScreenTicket(ctx, id).Execute()

Mints a short-lived grant to open the screen of a desktop sandbox.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox to address, from the path.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.PostSandboxByIdScreenTicket(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandboxByIdScreenTicket``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostSandboxByIdScreenTicket`: SandboxTicketGrant
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.PostSandboxByIdScreenTicket`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox to address, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxByIdScreenTicketRequest struct via the builder pattern

Name Type Description Notes

Return type

SandboxTicketGrant

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostSandboxByIdTerminalTicket

SandboxTicketGrant PostSandboxByIdTerminalTicket(ctx, id).Execute()

Mints a short-lived grant to open a terminal on a sandbox.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	id := "id_example" // string | ID is the sandbox to address, from the path.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.PostSandboxByIdTerminalTicket(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.PostSandboxByIdTerminalTicket``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostSandboxByIdTerminalTicket`: SandboxTicketGrant
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.PostSandboxByIdTerminalTicket`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
id string ID is the sandbox to address, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiPostSandboxByIdTerminalTicketRequest struct via the builder pattern

Name Type Description Notes

Return type

SandboxTicketGrant

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ReadSandboxFile

SandboxBlob ReadSandboxFile(ctx).SandboxPathIn(sandboxPathIn).Execute()

Read a file from a sandbox you hold

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	sandboxPathIn := *openapiclient.NewSandboxPathIn() // SandboxPathIn | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.ReadSandboxFile(context.Background()).SandboxPathIn(sandboxPathIn).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.ReadSandboxFile``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ReadSandboxFile`: SandboxBlob
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.ReadSandboxFile`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiReadSandboxFileRequest struct via the builder pattern

Name Type Description Notes
sandboxPathIn SandboxPathIn

Return type

SandboxBlob

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RunInSandbox

SandboxRan RunInSandbox(ctx).SandboxRunIn(sandboxRunIn).Execute()

Run a command in a sandbox you hold and read its output

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	sandboxRunIn := *openapiclient.NewSandboxRunIn() // SandboxRunIn | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.RunInSandbox(context.Background()).SandboxRunIn(sandboxRunIn).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.RunInSandbox``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `RunInSandbox`: SandboxRan
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.RunInSandbox`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiRunInSandboxRequest struct via the builder pattern

Name Type Description Notes
sandboxRunIn SandboxRunIn

Return type

SandboxRan

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

StopRun

SandboxStopped StopRun(ctx).SandboxStopIn(sandboxStopIn).Execute()

Stop what a sandbox is running, and keep the sandbox

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	sandboxStopIn := *openapiclient.NewSandboxStopIn() // SandboxStopIn | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.StopRun(context.Background()).SandboxStopIn(sandboxStopIn).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.StopRun``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `StopRun`: SandboxStopped
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.StopRun`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiStopRunRequest struct via the builder pattern

Name Type Description Notes
sandboxStopIn SandboxStopIn

Return type

SandboxStopped

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

WriteSandboxFile

SandboxWrote WriteSandboxFile(ctx).SandboxWriteIn(sandboxWriteIn).Execute()

Write a file into a sandbox you hold

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	sandboxWriteIn := *openapiclient.NewSandboxWriteIn() // SandboxWriteIn | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SandboxAPI.WriteSandboxFile(context.Background()).SandboxWriteIn(sandboxWriteIn).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SandboxAPI.WriteSandboxFile``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `WriteSandboxFile`: SandboxWrote
	fmt.Fprintf(os.Stdout, "Response from `SandboxAPI.WriteSandboxFile`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiWriteSandboxFileRequest struct via the builder pattern

Name Type Description Notes
sandboxWriteIn SandboxWriteIn

Return type

SandboxWrote

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]