Documentation
¶
Overview ¶
Create, manage, and control the lifecycle of sandboxes -- isolated, pre-configured, low-latency Serverless compute environments for running code.
Index ¶
- type ComputeSpec
- type CreateSandboxRequest
- type DeleteSandboxRequest
- type ExecuteCommandStatus
- type ExecuteCommandSyncRequest
- type ExecuteCommandSyncResponse
- type GetSandboxRequest
- type ListSandboxesRequest
- type ListSandboxesResponse
- type Sandbox
- type SandboxAPI
- func (a *SandboxAPI) CreateSandbox(ctx context.Context, request CreateSandboxRequest) (*Sandbox, error)
- func (a *SandboxAPI) DeleteSandbox(ctx context.Context, request DeleteSandboxRequest) error
- func (a *SandboxAPI) ExecuteCommandSync(ctx context.Context, request ExecuteCommandSyncRequest) (*ExecuteCommandSyncResponse, error)
- func (a *SandboxAPI) GetSandbox(ctx context.Context, request GetSandboxRequest) (*Sandbox, error)
- func (a *SandboxAPI) ListSandboxes(ctx context.Context, request ListSandboxesRequest) listing.Iterator[Sandbox]
- func (a *SandboxAPI) ListSandboxesAll(ctx context.Context, request ListSandboxesRequest) ([]Sandbox, error)
- func (a *SandboxAPI) StartSandbox(ctx context.Context, request StartSandboxRequest) (*Sandbox, error)
- func (a *SandboxAPI) StopSandbox(ctx context.Context, request StopSandboxRequest) (*Sandbox, error)
- func (a *SandboxAPI) UpdateSandbox(ctx context.Context, request UpdateSandboxRequest) (*Sandbox, error)
- type SandboxInterface
- type SandboxServicedeprecated
- type SandboxSpec
- type SandboxState
- type SandboxStatus
- type StartSandboxRequest
- type StopSandboxRequest
- type UpdateSandboxRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComputeSpec ¶
type ComputeSpec struct {
// Idle duration after which the sandbox is automatically terminated.
InactivityTimeout *duration.Duration `json:"inactivity_timeout,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (ComputeSpec) MarshalJSON ¶
func (s ComputeSpec) MarshalJSON() ([]byte, error)
func (*ComputeSpec) UnmarshalJSON ¶
func (s *ComputeSpec) UnmarshalJSON(b []byte) error
type CreateSandboxRequest ¶
type CreateSandboxRequest struct {
// The sandbox to create.
Sandbox Sandbox `json:"sandbox"`
// Client-supplied ID that becomes the final path segment of the resource
// name.
SandboxId string `json:"-" url:"sandbox_id"`
}
func (*CreateSandboxRequest) UnmarshalJSON ¶
func (s *CreateSandboxRequest) UnmarshalJSON(b []byte) error
type DeleteSandboxRequest ¶
type DeleteSandboxRequest struct {
Name string `json:"-" url:"-"`
}
func (*DeleteSandboxRequest) UnmarshalJSON ¶
func (s *DeleteSandboxRequest) UnmarshalJSON(b []byte) error
type ExecuteCommandStatus ¶
type ExecuteCommandStatus string
Terminal status of a unary command execution.
const ExecuteCommandStatusExecuteCommandStatusCompleted ExecuteCommandStatus = `EXECUTE_COMMAND_STATUS_COMPLETED`
const ExecuteCommandStatusExecuteCommandStatusFailed ExecuteCommandStatus = `EXECUTE_COMMAND_STATUS_FAILED`
const ExecuteCommandStatusExecuteCommandStatusTimedOut ExecuteCommandStatus = `EXECUTE_COMMAND_STATUS_TIMED_OUT`
func (*ExecuteCommandStatus) Set ¶
func (f *ExecuteCommandStatus) Set(v string) error
Set raw string value and validate it against allowed values
func (*ExecuteCommandStatus) String ¶
func (f *ExecuteCommandStatus) String() string
String representation for fmt.Print
func (*ExecuteCommandStatus) Type ¶
func (f *ExecuteCommandStatus) Type() string
Type always returns ExecuteCommandStatus to satisfy [pflag.Value] interface
func (*ExecuteCommandStatus) Values ¶
func (f *ExecuteCommandStatus) Values() []ExecuteCommandStatus
Values returns all possible values for ExecuteCommandStatus.
There is no guarantee on the order of the values in the slice.
type ExecuteCommandSyncRequest ¶
type ExecuteCommandSyncRequest struct {
// Arguments passed to `cmd`.
Args []string `json:"args,omitempty"`
// Executable or command to run (e.g. `/bin/echo`, `python3`).
Cmd string `json:"cmd"`
// Extra environment variables for the command's process, merged over the
// sandbox's default environment.
Envs map[string]string `json:"envs,omitempty"`
// Maximum time to wait for the command to finish. When it elapses the
// command is terminated and the response carries status `TIMED_OUT`. The
// server applies a default when unset and clamps to an upper bound;
// negative or otherwise invalid durations are rejected with
// `INVALID_ARGUMENT`.
ExecutionTimeout *duration.Duration `json:"execution_timeout,omitempty"`
// Resource name of the sandbox to run the command in, in the form
// `sandboxes/{sandbox_id}`. Bound from the URL path.
Name string `json:"-" url:"-"`
ForceSendFields []string `json:"-" url:"-"`
}
Request to run a command in the given sandbox and wait for it to finish.
func (ExecuteCommandSyncRequest) MarshalJSON ¶
func (s ExecuteCommandSyncRequest) MarshalJSON() ([]byte, error)
func (*ExecuteCommandSyncRequest) UnmarshalJSON ¶
func (s *ExecuteCommandSyncRequest) UnmarshalJSON(b []byte) error
type ExecuteCommandSyncResponse ¶
type ExecuteCommandSyncResponse struct {
// Daemon-generated identifier for this command execution, for correlation
// (for example in `ListCommands`).
CommandId string `json:"command_id,omitempty"`
// Process exit code. Unset when the process was terminated by a signal
// (e.g. on `TIMED_OUT`) or never started (`FAILED`) rather than exiting
// normally.
ExitCode int `json:"exit_code,omitempty"`
// Terminal status of the command execution. Always set on a successful
// response; never `EXECUTE_COMMAND_STATUS_UNSPECIFIED`.
Status ExecuteCommandStatus `json:"status,omitempty"`
// Captured standard error, with the same UTF-8 semantics as `stdout`.
Stderr string `json:"stderr,omitempty"`
// Captured standard output as UTF-8 text. Invalid UTF-8 bytes are replaced
// with the Unicode replacement character (U+FFFD).
Stdout string `json:"stdout,omitempty"`
// True when `stdout` / `stderr` were truncated because the captured output
// exceeded the server's per-response size cap. The dropped output is not
// included in this response and is not recoverable through this unary API.
Truncated bool `json:"truncated,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
Result of a completed unary command execution: captured output, exit code, and terminal status.
func (ExecuteCommandSyncResponse) MarshalJSON ¶
func (s ExecuteCommandSyncResponse) MarshalJSON() ([]byte, error)
func (*ExecuteCommandSyncResponse) UnmarshalJSON ¶
func (s *ExecuteCommandSyncResponse) UnmarshalJSON(b []byte) error
type GetSandboxRequest ¶
type GetSandboxRequest struct {
Name string `json:"-" url:"-"`
}
func (*GetSandboxRequest) UnmarshalJSON ¶
func (s *GetSandboxRequest) UnmarshalJSON(b []byte) error
type ListSandboxesRequest ¶
type ListSandboxesRequest struct {
PageSize int `json:"-" url:"page_size,omitempty"`
PageToken string `json:"-" url:"page_token,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (ListSandboxesRequest) MarshalJSON ¶
func (s ListSandboxesRequest) MarshalJSON() ([]byte, error)
func (*ListSandboxesRequest) UnmarshalJSON ¶
func (s *ListSandboxesRequest) UnmarshalJSON(b []byte) error
type ListSandboxesResponse ¶
type ListSandboxesResponse struct {
NextPageToken string `json:"next_page_token,omitempty"`
Sandboxes []Sandbox `json:"sandboxes,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
A list of Sandboxes.
func (ListSandboxesResponse) MarshalJSON ¶
func (s ListSandboxesResponse) MarshalJSON() ([]byte, error)
func (*ListSandboxesResponse) UnmarshalJSON ¶
func (s *ListSandboxesResponse) UnmarshalJSON(b []byte) error
type Sandbox ¶
type Sandbox struct {
// Output only. The creation time of the sandbox.
CreateTime *time.Time `json:"create_time,omitempty"`
// Human-readable display label for the sandbox. At most 256 bytes.
DisplayName string `json:"display_name,omitempty"`
// The AIP-compliant resource name, such as "sandboxes/my-sandbox".
Name string `json:"name,omitempty"`
// The desired configuration of the sandbox, supplied by the caller at
// creation time.
Spec *SandboxSpec `json:"spec,omitempty"`
// The observed runtime state of the sandbox, populated by the server.
Status *SandboxStatus `json:"status,omitempty"`
// Output only. The last update time of the sandbox metadata and spec.
UpdateTime *time.Time `json:"update_time,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
A Sandbox resource representing an execution environment.
func (Sandbox) MarshalJSON ¶
func (*Sandbox) UnmarshalJSON ¶
type SandboxAPI ¶
type SandboxAPI struct {
// contains filtered or unexported fields
}
Create, manage, and control the lifecycle of sandboxes -- isolated, pre-configured, low-latency Serverless compute environments for running code.
func NewSandbox ¶
func NewSandbox(client *client.DatabricksClient) *SandboxAPI
func (*SandboxAPI) CreateSandbox ¶
func (a *SandboxAPI) CreateSandbox(ctx context.Context, request CreateSandboxRequest) (*Sandbox, error)
func (*SandboxAPI) DeleteSandbox ¶
func (a *SandboxAPI) DeleteSandbox(ctx context.Context, request DeleteSandboxRequest) error
func (*SandboxAPI) ExecuteCommandSync ¶
func (a *SandboxAPI) ExecuteCommandSync(ctx context.Context, request ExecuteCommandSyncRequest) (*ExecuteCommandSyncResponse, error)
func (*SandboxAPI) GetSandbox ¶
func (a *SandboxAPI) GetSandbox(ctx context.Context, request GetSandboxRequest) (*Sandbox, error)
func (*SandboxAPI) ListSandboxes ¶
func (a *SandboxAPI) ListSandboxes(ctx context.Context, request ListSandboxesRequest) listing.Iterator[Sandbox]
Lists all Sandboxes.
func (*SandboxAPI) ListSandboxesAll ¶
func (a *SandboxAPI) ListSandboxesAll(ctx context.Context, request ListSandboxesRequest) ([]Sandbox, error)
Lists all Sandboxes.
func (*SandboxAPI) StartSandbox ¶
func (a *SandboxAPI) StartSandbox(ctx context.Context, request StartSandboxRequest) (*Sandbox, error)
func (*SandboxAPI) StopSandbox ¶
func (a *SandboxAPI) StopSandbox(ctx context.Context, request StopSandboxRequest) (*Sandbox, error)
func (*SandboxAPI) UpdateSandbox ¶
func (a *SandboxAPI) UpdateSandbox(ctx context.Context, request UpdateSandboxRequest) (*Sandbox, error)
type SandboxInterface ¶
type SandboxInterface interface {
// Creates a new Sandbox.
CreateSandbox(ctx context.Context, request CreateSandboxRequest) (*Sandbox, error)
// Deletes a Sandbox.
DeleteSandbox(ctx context.Context, request DeleteSandboxRequest) error
// Runs a command in the sandbox and blocks until it exits, returning the
// captured stdout, stderr and exit code in a single response.
ExecuteCommandSync(ctx context.Context, request ExecuteCommandSyncRequest) (*ExecuteCommandSyncResponse, error)
// Retrieves a Sandbox by name.
GetSandbox(ctx context.Context, request GetSandboxRequest) (*Sandbox, error)
// Lists all Sandboxes.
//
// This method is generated by Databricks SDK Code Generator.
ListSandboxes(ctx context.Context, request ListSandboxesRequest) listing.Iterator[Sandbox]
// Lists all Sandboxes.
//
// This method is generated by Databricks SDK Code Generator.
ListSandboxesAll(ctx context.Context, request ListSandboxesRequest) ([]Sandbox, error)
// Starts a previously stopped Sandbox under the same sandbox name. Returns
// NOT_FOUND if there is no stopped sandbox to start for the given name.
StartSandbox(ctx context.Context, request StartSandboxRequest) (*Sandbox, error)
// Stops a running Sandbox, preserving it so it can later be restarted with a
// Start request.
StopSandbox(ctx context.Context, request StopSandboxRequest) (*Sandbox, error)
// Updates mutable fields on an existing Sandbox. Allowlisted update_mask paths
// today: display_name, spec.compute.inactivity_timeout. Returns
// INVALID_PARAMETER_VALUE for empty masks or unknown paths; NOT_FOUND if the
// sandbox does not exist.
UpdateSandbox(ctx context.Context, request UpdateSandboxRequest) (*Sandbox, error)
}
type SandboxService
deprecated
type SandboxService interface {
// Creates a new Sandbox.
CreateSandbox(ctx context.Context, request CreateSandboxRequest) (*Sandbox, error)
// Deletes a Sandbox.
DeleteSandbox(ctx context.Context, request DeleteSandboxRequest) error
// Runs a command in the sandbox and blocks until it exits, returning the
// captured stdout, stderr and exit code in a single response.
ExecuteCommandSync(ctx context.Context, request ExecuteCommandSyncRequest) (*ExecuteCommandSyncResponse, error)
// Retrieves a Sandbox by name.
GetSandbox(ctx context.Context, request GetSandboxRequest) (*Sandbox, error)
// Lists all Sandboxes.
ListSandboxes(ctx context.Context, request ListSandboxesRequest) (*ListSandboxesResponse, error)
// Starts a previously stopped Sandbox under the same sandbox name. Returns
// NOT_FOUND if there is no stopped sandbox to start for the given name.
StartSandbox(ctx context.Context, request StartSandboxRequest) (*Sandbox, error)
// Stops a running Sandbox, preserving it so it can later be restarted with
// a Start request.
StopSandbox(ctx context.Context, request StopSandboxRequest) (*Sandbox, error)
// Updates mutable fields on an existing Sandbox. Allowlisted update_mask
// paths today: display_name, spec.compute.inactivity_timeout. Returns
// INVALID_PARAMETER_VALUE for empty masks or unknown paths; NOT_FOUND if
// the sandbox does not exist.
UpdateSandbox(ctx context.Context, request UpdateSandboxRequest) (*Sandbox, error)
}
Create, manage, and control the lifecycle of sandboxes -- isolated, pre-configured, low-latency Serverless compute environments for running code.
Deprecated: Do not use this interface, it will be removed in a future version of the SDK.
type SandboxSpec ¶
type SandboxSpec struct {
// Compute configuration (size, inactivity timeout) requested for the
// sandbox.
Compute *ComputeSpec `json:"compute,omitempty"`
}
func (*SandboxSpec) UnmarshalJSON ¶
func (s *SandboxSpec) UnmarshalJSON(b []byte) error
type SandboxState ¶
type SandboxState string
Lifecycle state of a Sandbox resource. STOPPING is the transient state while the sandbox is being stopped -- by a Stop request or inactivity auto-termination -- and settles to STOPPED once the operation completes.
const SandboxStateSandboxStatePending SandboxState = `SANDBOX_STATE_PENDING`
const SandboxStateSandboxStateRunning SandboxState = `SANDBOX_STATE_RUNNING`
const SandboxStateSandboxStateStopped SandboxState = `SANDBOX_STATE_STOPPED`
const SandboxStateSandboxStateStopping SandboxState = `SANDBOX_STATE_STOPPING`
func (*SandboxState) Set ¶
func (f *SandboxState) Set(v string) error
Set raw string value and validate it against allowed values
func (*SandboxState) String ¶
func (f *SandboxState) String() string
String representation for fmt.Print
func (*SandboxState) Type ¶
func (f *SandboxState) Type() string
Type always returns SandboxState to satisfy [pflag.Value] interface
func (*SandboxState) Values ¶
func (f *SandboxState) Values() []SandboxState
Values returns all possible values for SandboxState.
There is no guarantee on the order of the values in the slice.
type SandboxStatus ¶
type SandboxStatus struct {
// Lifecycle state of the sandbox.
State SandboxState `json:"state,omitempty"`
}
func (*SandboxStatus) UnmarshalJSON ¶
func (s *SandboxStatus) UnmarshalJSON(b []byte) error
type StartSandboxRequest ¶
type StartSandboxRequest struct {
// Resource name of the sandbox to start, in the form
// `sandboxes/{sandbox_id}`.
Name string `json:"-" url:"-"`
}
A request to start a Sandbox.
func (*StartSandboxRequest) UnmarshalJSON ¶
func (s *StartSandboxRequest) UnmarshalJSON(b []byte) error
type StopSandboxRequest ¶
type StopSandboxRequest struct {
// Resource name of the sandbox to stop, in the form
// `sandboxes/{sandbox_id}`.
Name string `json:"-" url:"-"`
}
A request to stop a Sandbox.
func (*StopSandboxRequest) UnmarshalJSON ¶
func (s *StopSandboxRequest) UnmarshalJSON(b []byte) error
type UpdateSandboxRequest ¶
type UpdateSandboxRequest struct {
// Resource name of the sandbox to update, in the form
// `sandboxes/{sandbox_id}`.
Name string `json:"-" url:"-"`
// The Sandbox resource carrying new field values. Only fields named in
// `update_mask` are read; unmasked fields are ignored.
Sandbox Sandbox `json:"sandbox"`
// Field paths to update. Must be a non-empty subset of: - display_name -
// spec.compute.inactivity_timeout Any other path returns
// INVALID_PARAMETER_VALUE.
UpdateMask fieldmask.FieldMask `json:"-" url:"update_mask"`
}
func (*UpdateSandboxRequest) UnmarshalJSON ¶
func (s *UpdateSandboxRequest) UnmarshalJSON(b []byte) error