Documentation
¶
Overview ¶
Create, manage, and control the lifecycle of sandboxes -- isolated, pre-configured, low-latency Serverless compute environments for running code.
Index ¶
- type Command
- type ComputeSpec
- type CreateDirectoryRequest
- type CreateDirectoryResponse
- type CreateSandboxRequest
- type DeletePathRequest
- type DeletePathResponse
- type DeleteSandboxRequest
- type DownloadFileRequest
- type DownloadFileResponse
- type EnvironmentSpec
- type ExecuteCommandStatus
- type ExecuteCommandSyncRequest
- type ExecuteCommandSyncResponse
- type GetMetadataRequest
- type GetMetadataResponse
- type GetSandboxRequest
- type ListCommandsRequest
- type ListCommandsResponse
- type ListDirectoryContentsRequest
- type ListDirectoryContentsResponse
- type ListSandboxesRequest
- type ListSandboxesResponse
- type RenamePathRequest
- type RenamePathResponse
- type Sandbox
- type SandboxAPI
- func (a *SandboxAPI) CreateDirectory(ctx context.Context, request CreateDirectoryRequest) (*CreateDirectoryResponse, error)
- func (a *SandboxAPI) CreateSandbox(ctx context.Context, request CreateSandboxRequest) (*Sandbox, error)
- func (a *SandboxAPI) DeletePath(ctx context.Context, request DeletePathRequest) (*DeletePathResponse, error)
- func (a *SandboxAPI) DeleteSandbox(ctx context.Context, request DeleteSandboxRequest) error
- func (a *SandboxAPI) DownloadFile(ctx context.Context, request DownloadFileRequest) (*DownloadFileResponse, error)
- func (a *SandboxAPI) ExecuteCommandSync(ctx context.Context, request ExecuteCommandSyncRequest) (*ExecuteCommandSyncResponse, error)
- func (a *SandboxAPI) GetMetadata(ctx context.Context, request GetMetadataRequest) (*GetMetadataResponse, error)
- func (a *SandboxAPI) GetSandbox(ctx context.Context, request GetSandboxRequest) (*Sandbox, error)
- func (a *SandboxAPI) ListCommands(ctx context.Context, request ListCommandsRequest) (*ListCommandsResponse, error)
- func (a *SandboxAPI) ListDirectoryContents(ctx context.Context, request ListDirectoryContentsRequest) listing.Iterator[SandboxFileInfo]
- func (a *SandboxAPI) ListDirectoryContentsAll(ctx context.Context, request ListDirectoryContentsRequest) ([]SandboxFileInfo, 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) RenamePath(ctx context.Context, request RenamePathRequest) (*RenamePathResponse, 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)
- func (a *SandboxAPI) UploadFile(ctx context.Context, request UploadFileRequest) error
- type SandboxFileInfo
- type SandboxFileType
- type SandboxInterface
- type SandboxMetadata
- type SandboxServicedeprecated
- type SandboxSpec
- type SandboxState
- type SandboxStatus
- type StartSandboxRequest
- type StopSandboxRequest
- type UpdateSandboxRequest
- type UploadFileRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// Arguments passed to the program.
Args []string `json:"args,omitempty"`
// The program that was executed.
Cmd string `json:"cmd,omitempty"`
// Stable identifier for this command.
CommandId string `json:"command_id,omitempty"`
// Process exit code. Only present when finished is true and the process
// exited normally (not killed by signal or failed to start).
ExitCode int `json:"exit_code,omitempty"`
// Whether the command has finished executing.
Finished bool `json:"finished,omitempty"`
// PID of the spawned process. Absent if the process failed to start.
Pid int64 `json:"pid,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
A single command execution.
func (Command) MarshalJSON ¶
func (*Command) UnmarshalJSON ¶
type ComputeSpec ¶
type ComputeSpec struct {
// Idle time after which the sandbox is automatically stopped. Unset or 0
// disables inactivity auto-stop. Negative values are rejected. Can be
// changed on an existing sandbox with UpdateSandbox.
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 CreateDirectoryRequest ¶
type CreateDirectoryRequest struct {
Parent string `json:"-" url:"-"`
// Defaults to true, which also succeeds when the directory already exists.
Parents bool `json:"parents,omitempty"`
// Absolute UTF-8 path of the directory.
Path string `json:"path"`
ForceSendFields []string `json:"-" url:"-"`
}
Selects a sandbox directory to create and whether to create its parents.
func (CreateDirectoryRequest) MarshalJSON ¶
func (s CreateDirectoryRequest) MarshalJSON() ([]byte, error)
func (*CreateDirectoryRequest) UnmarshalJSON ¶
func (s *CreateDirectoryRequest) UnmarshalJSON(b []byte) error
type CreateDirectoryResponse ¶
type CreateDirectoryResponse struct {
}
Confirms that the requested directory exists.
func (*CreateDirectoryResponse) UnmarshalJSON ¶
func (s *CreateDirectoryResponse) UnmarshalJSON(b []byte) error
type CreateSandboxRequest ¶
type CreateSandboxRequest struct {
// The sandbox to create. An empty body creates a sandbox with the default
// configuration.
Sandbox Sandbox `json:"sandbox"`
// Client-supplied ID that becomes the final path segment of the resource
// name. It must start with a lowercase letter, contain only lowercase
// letters, digits and hyphens, end with a letter or digit, and be at most
// 63 characters long. Values shaped like a UUID are rejected.
SandboxId string `json:"-" url:"sandbox_id"`
}
func (*CreateSandboxRequest) UnmarshalJSON ¶
func (s *CreateSandboxRequest) UnmarshalJSON(b []byte) error
type DeletePathRequest ¶
type DeletePathRequest struct {
Parent string `json:"-" url:"-"`
// Absolute UTF-8 path of the entry to delete.
Path string `json:"path"`
// Required for a non-empty directory.
Recursive bool `json:"recursive,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
Selects a sandbox path to delete and whether to delete its contents.
func (DeletePathRequest) MarshalJSON ¶
func (s DeletePathRequest) MarshalJSON() ([]byte, error)
func (*DeletePathRequest) UnmarshalJSON ¶
func (s *DeletePathRequest) UnmarshalJSON(b []byte) error
type DeletePathResponse ¶
type DeletePathResponse struct {
}
Confirms that the requested path is absent.
func (*DeletePathResponse) UnmarshalJSON ¶
func (s *DeletePathResponse) UnmarshalJSON(b []byte) error
type DeleteSandboxRequest ¶
type DeleteSandboxRequest struct {
// Resource name of the sandbox to delete, in the form
// `sandboxes/{sandbox_id}`.
Name string `json:"-" url:"-"`
}
func (*DeleteSandboxRequest) UnmarshalJSON ¶
func (s *DeleteSandboxRequest) UnmarshalJSON(b []byte) error
type DownloadFileRequest ¶
type DownloadFileRequest struct {
// A single byte range, such as bytes=0-1023 or bytes=-1024. Equivalent to
// the Range header.
ByteRange string `json:"-" url:"byte_range,omitempty"`
// Entity tags or *. A mismatch returns 412 Precondition Failed. Equivalent
// to the If-Match header.
IfMatch string `json:"-" url:"if_match,omitempty"`
// An HTTP-date. Returns 304 if the file has not changed since this time.
// Ignored when If-None-Match is present. Equivalent to the
// If-Modified-Since header.
IfModifiedSince string `json:"-" url:"if_modified_since,omitempty"`
// Entity tags or *. A match returns 304 Not Modified. Equivalent to the
// If-None-Match header.
IfNoneMatch string `json:"-" url:"if_none_match,omitempty"`
// A strong entity tag. A mismatch, weak entity tag, or HTTP-date causes a
// full download. Equivalent to the If-Range header.
IfRange string `json:"-" url:"if_range,omitempty"`
// An HTTP-date. Returns 412 if the file has changed since this time.
// Ignored when If-Match is present. Equivalent to the If-Unmodified-Since
// header.
IfUnmodifiedSince string `json:"-" url:"if_unmodified_since,omitempty"`
// The sandbox resource name, in the form sandboxes/{sandbox_id}.
Parent string `json:"-" url:"-"`
// The absolute UTF-8 path of the file inside the sandbox.
Path string `json:"-" url:"path"`
ForceSendFields []string `json:"-" url:"-"`
}
func (DownloadFileRequest) MarshalJSON ¶
func (s DownloadFileRequest) MarshalJSON() ([]byte, error)
func (*DownloadFileRequest) UnmarshalJSON ¶
func (s *DownloadFileRequest) UnmarshalJSON(b []byte) error
type DownloadFileResponse ¶
type DownloadFileResponse struct {
// The supported range unit: bytes.
AcceptRanges string `json:"-" url:"-" header:"Accept-Ranges,omitempty"`
// The length of the response body in bytes.
ContentLength int64 `json:"-" url:"-" header:"Content-Length,omitempty"`
// The returned byte range and full file length, for a partial response.
ContentRange string `json:"-" url:"-" header:"Content-Range,omitempty"`
// The media type of the response body: application/octet-stream.
ContentType string `json:"-" url:"-" header:"Content-Type,omitempty"`
Contents io.ReadCloser `json:"-"`
// The entity tag used for conditional requests.
Etag string `json:"-" url:"-" header:"etag,omitempty"`
// The modification time as an HTTP-date, when representable.
LastModified string `json:"-" url:"-" header:"Last-Modified,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (DownloadFileResponse) MarshalJSON ¶
func (s DownloadFileResponse) MarshalJSON() ([]byte, error)
func (*DownloadFileResponse) UnmarshalJSON ¶
func (s *DownloadFileResponse) UnmarshalJSON(b []byte) error
type EnvironmentSpec ¶
type EnvironmentSpec struct {
// The Unity Catalog container image to run the sandbox from, in the form
// `catalog.schema.artifact:tag`, or
// `catalog.schema.artifact@sha256:<digest>` to pin an exact version. When
// omitted, the sandbox runs the default sandbox image. See [custom images].
//
// [custom images]: https://docs.databricks.com/en/compute/serverless/sandbox-custom-image
ImageUri string `json:"image_uri,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
func (EnvironmentSpec) MarshalJSON ¶
func (s EnvironmentSpec) MarshalJSON() ([]byte, error)
func (*EnvironmentSpec) UnmarshalJSON ¶
func (s *EnvironmentSpec) 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 GetMetadataRequest ¶
type GetMetadataRequest struct {
Parent string `json:"-" url:"-"`
// Absolute UTF-8 path of the entry to inspect.
Path string `json:"-" url:"path"`
}
func (*GetMetadataRequest) UnmarshalJSON ¶
func (s *GetMetadataRequest) UnmarshalJSON(b []byte) error
type GetMetadataResponse ¶
type GetMetadataResponse struct {
File *SandboxFileInfo `json:"file,omitempty"`
}
Contains metadata for the requested path without following its final symlink.
func (*GetMetadataResponse) UnmarshalJSON ¶
func (s *GetMetadataResponse) UnmarshalJSON(b []byte) error
type GetSandboxRequest ¶
type GetSandboxRequest struct {
// Resource name of the sandbox to retrieve, in the form
// `sandboxes/{sandbox_id}`.
Name string `json:"-" url:"-"`
}
func (*GetSandboxRequest) UnmarshalJSON ¶
func (s *GetSandboxRequest) UnmarshalJSON(b []byte) error
type ListCommandsRequest ¶
type ListCommandsRequest struct {
// Maximum number of commands to return. The server may return fewer. If
// unspecified, the server returns all commands.
PageSize int `json:"-" url:"page_size,omitempty"`
// Page token returned by a previous ListCommands call. Use this to retrieve
// the next page of results.
PageToken string `json:"-" url:"page_token,omitempty"`
// The sandbox whose commands to list, in the form `sandboxes/{sandbox_id}`.
Parent string `json:"-" url:"-"`
ForceSendFields []string `json:"-" url:"-"`
}
func (ListCommandsRequest) MarshalJSON ¶
func (s ListCommandsRequest) MarshalJSON() ([]byte, error)
func (*ListCommandsRequest) UnmarshalJSON ¶
func (s *ListCommandsRequest) UnmarshalJSON(b []byte) error
type ListCommandsResponse ¶
type ListCommandsResponse struct {
// Commands in this page of results.
Commands []Command `json:"commands,omitempty"`
// Token to retrieve the next page. Empty when there are no more results.
NextPageToken string `json:"next_page_token,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
Response listing tracked command executions.
func (ListCommandsResponse) MarshalJSON ¶
func (s ListCommandsResponse) MarshalJSON() ([]byte, error)
func (*ListCommandsResponse) UnmarshalJSON ¶
func (s *ListCommandsResponse) UnmarshalJSON(b []byte) error
type ListDirectoryContentsRequest ¶
type ListDirectoryContentsRequest struct {
// Zero uses the default of 1000; values above 1000 are clamped to 1000.
PageSize int `json:"-" url:"page_size,omitempty"`
// The token from a prior response. Keep parent and path unchanged between
// pages.
PageToken string `json:"-" url:"page_token,omitempty"`
Parent string `json:"-" url:"-"`
// Absolute UTF-8 path of the directory.
Path string `json:"-" url:"path"`
ForceSendFields []string `json:"-" url:"-"`
}
func (ListDirectoryContentsRequest) MarshalJSON ¶
func (s ListDirectoryContentsRequest) MarshalJSON() ([]byte, error)
func (*ListDirectoryContentsRequest) UnmarshalJSON ¶
func (s *ListDirectoryContentsRequest) UnmarshalJSON(b []byte) error
type ListDirectoryContentsResponse ¶
type ListDirectoryContentsResponse struct {
Contents []SandboxFileInfo `json:"contents,omitempty"`
NextPageToken string `json:"next_page_token,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
Contains a page of immediate directory entries and an optional continuation token. An empty token marks the final page. Pages reflect concurrent directory changes.
func (ListDirectoryContentsResponse) MarshalJSON ¶
func (s ListDirectoryContentsResponse) MarshalJSON() ([]byte, error)
func (*ListDirectoryContentsResponse) UnmarshalJSON ¶
func (s *ListDirectoryContentsResponse) UnmarshalJSON(b []byte) error
type ListSandboxesRequest ¶
type ListSandboxesRequest struct {
// Maximum number of sandboxes to return in one page. When unset or 0 the
// server returns up to 1000 sandboxes; values above 5000 are reduced to
// 5000.
PageSize int `json:"-" url:"page_size,omitempty"`
// Page token from the `next_page_token` of a previous ListSandboxes
// response. Omit it to retrieve the first page.
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 {
// Token for retrieving the next page of results. Empty when there are no
// more results.
NextPageToken string `json:"next_page_token,omitempty"`
// Sandboxes in this page of results.
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 RenamePathRequest ¶
type RenamePathRequest struct {
// Exact absolute UTF-8 destination; it must not already exist.
Destination string `json:"destination"`
// Sandbox resource name, for example `sandboxes/my-sandbox`.
Parent string `json:"-" url:"-"`
// Absolute UTF-8 path to move.
Source string `json:"source"`
}
Identifies the source and exact destination for a sandbox path rename.
func (*RenamePathRequest) UnmarshalJSON ¶
func (s *RenamePathRequest) UnmarshalJSON(b []byte) error
type RenamePathResponse ¶
type RenamePathResponse struct {
}
Confirms that the sandbox path was renamed.
func (*RenamePathResponse) UnmarshalJSON ¶
func (s *RenamePathResponse) 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 characters.
DisplayName string `json:"display_name,omitempty"`
// Tags and other metadata associated with the sandbox.
Metadata *SandboxMetadata `json:"metadata,omitempty"`
// The sandbox resource name, in the form `sandboxes/{sandbox_id}`. Derived
// from `sandbox_id`; any value supplied in a create or update request body
// is ignored.
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:"-"`
}
An isolated, pre-configured, low-latency Serverless compute environment for running code. Create a sandbox, wait until its state is `SANDBOX_STATE_RUNNING`, then run commands in it with ExecuteCommandSync. The data in its home directory persists across stop and start and is removed when the sandbox is deleted. See Databricks Sandbox.
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) CreateDirectory ¶
func (a *SandboxAPI) CreateDirectory(ctx context.Context, request CreateDirectoryRequest) (*CreateDirectoryResponse, error)
func (*SandboxAPI) CreateSandbox ¶
func (a *SandboxAPI) CreateSandbox(ctx context.Context, request CreateSandboxRequest) (*Sandbox, error)
func (*SandboxAPI) DeletePath ¶
func (a *SandboxAPI) DeletePath(ctx context.Context, request DeletePathRequest) (*DeletePathResponse, error)
func (*SandboxAPI) DeleteSandbox ¶
func (a *SandboxAPI) DeleteSandbox(ctx context.Context, request DeleteSandboxRequest) error
func (*SandboxAPI) DownloadFile ¶
func (a *SandboxAPI) DownloadFile(ctx context.Context, request DownloadFileRequest) (*DownloadFileResponse, error)
func (*SandboxAPI) ExecuteCommandSync ¶
func (a *SandboxAPI) ExecuteCommandSync(ctx context.Context, request ExecuteCommandSyncRequest) (*ExecuteCommandSyncResponse, error)
func (*SandboxAPI) GetMetadata ¶
func (a *SandboxAPI) GetMetadata(ctx context.Context, request GetMetadataRequest) (*GetMetadataResponse, error)
func (*SandboxAPI) GetSandbox ¶
func (a *SandboxAPI) GetSandbox(ctx context.Context, request GetSandboxRequest) (*Sandbox, error)
func (*SandboxAPI) ListCommands ¶
func (a *SandboxAPI) ListCommands(ctx context.Context, request ListCommandsRequest) (*ListCommandsResponse, error)
func (*SandboxAPI) ListDirectoryContents ¶
func (a *SandboxAPI) ListDirectoryContents(ctx context.Context, request ListDirectoryContentsRequest) listing.Iterator[SandboxFileInfo]
Lists a directory's immediate children in UTF-8 name order. Later pages may reflect concurrent changes.
func (*SandboxAPI) ListDirectoryContentsAll ¶
func (a *SandboxAPI) ListDirectoryContentsAll(ctx context.Context, request ListDirectoryContentsRequest) ([]SandboxFileInfo, error)
Lists a directory's immediate children in UTF-8 name order. Later pages may reflect concurrent changes.
func (*SandboxAPI) ListSandboxes ¶
func (a *SandboxAPI) ListSandboxes(ctx context.Context, request ListSandboxesRequest) listing.Iterator[Sandbox]
Lists the sandboxes in the workspace that are visible to the caller, including stopped sandboxes. Sandboxes that are being deleted are not returned.
func (*SandboxAPI) ListSandboxesAll ¶
func (a *SandboxAPI) ListSandboxesAll(ctx context.Context, request ListSandboxesRequest) ([]Sandbox, error)
Lists the sandboxes in the workspace that are visible to the caller, including stopped sandboxes. Sandboxes that are being deleted are not returned.
func (*SandboxAPI) RenamePath ¶
func (a *SandboxAPI) RenamePath(ctx context.Context, request RenamePathRequest) (*RenamePathResponse, error)
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)
func (*SandboxAPI) UploadFile ¶
func (a *SandboxAPI) UploadFile(ctx context.Context, request UploadFileRequest) error
type SandboxFileInfo ¶
type SandboxFileInfo struct {
FileType SandboxFileType `json:"file_type,omitempty"`
Group string `json:"group,omitempty"`
Mode int `json:"mode,omitempty"`
// Nanosecond precision is preserved on the wire.
ModifyTime *time.Time `json:"modify_time,omitempty"`
Name string `json:"name,omitempty"`
Owner string `json:"owner,omitempty"`
Path string `json:"path,omitempty"`
Permissions string `json:"permissions,omitempty"`
Size int64 `json:"size,omitempty"`
SymlinkTarget string `json:"symlink_target,omitempty"`
ForceSendFields []string `json:"-" url:"-"`
}
Metadata for a sandbox filesystem entry, describing a final symlink itself.
func (SandboxFileInfo) MarshalJSON ¶
func (s SandboxFileInfo) MarshalJSON() ([]byte, error)
func (*SandboxFileInfo) UnmarshalJSON ¶
func (s *SandboxFileInfo) UnmarshalJSON(b []byte) error
type SandboxFileType ¶
type SandboxFileType string
Type of a sandbox filesystem entry without following its final symlink.
const SandboxFileTypeSandboxFileTypeDirectory SandboxFileType = `SANDBOX_FILE_TYPE_DIRECTORY`
const SandboxFileTypeSandboxFileTypeFile SandboxFileType = `SANDBOX_FILE_TYPE_FILE`
const SandboxFileTypeSandboxFileTypeOther SandboxFileType = `SANDBOX_FILE_TYPE_OTHER`
const SandboxFileTypeSandboxFileTypeSymlink SandboxFileType = `SANDBOX_FILE_TYPE_SYMLINK`
func (*SandboxFileType) Set ¶
func (f *SandboxFileType) Set(v string) error
Set raw string value and validate it against allowed values
func (*SandboxFileType) String ¶
func (f *SandboxFileType) String() string
String representation for fmt.Print
func (*SandboxFileType) Type ¶
func (f *SandboxFileType) Type() string
Type always returns SandboxFileType to satisfy [pflag.Value] interface
func (*SandboxFileType) Values ¶
func (f *SandboxFileType) Values() []SandboxFileType
Values returns all possible values for SandboxFileType.
There is no guarantee on the order of the values in the slice.
type SandboxInterface ¶
type SandboxInterface interface {
// Creates a directory in a sandbox, including missing parents by default.
CreateDirectory(ctx context.Context, request CreateDirectoryRequest) (*CreateDirectoryResponse, error)
// Creates a sandbox with the given `sandbox_id` and starts provisioning it.
// Provisioning is asynchronous: the response usually shows the sandbox in
// `SANDBOX_STATE_PENDING`, so poll GetSandbox until the state is
// `SANDBOX_STATE_RUNNING` before running commands in it. A sandbox that fails
// to provision ends in `SANDBOX_STATE_STOPPED`. Returns ALREADY_EXISTS if a
// sandbox with the same ID already exists in the workspace.
CreateSandbox(ctx context.Context, request CreateSandboxRequest) (*Sandbox, error)
// Deletes a file, symlink, or empty directory, with an option for recursive
// deletion. Succeeds if the path is already absent.
DeletePath(ctx context.Context, request DeletePathRequest) (*DeletePathResponse, error)
// Deletes a sandbox, including the data in its home directory. A pending or
// running sandbox is stopped first and is removed once the teardown completes,
// after which GetSandbox returns NOT_FOUND. Deleting a sandbox that is already
// being deleted succeeds.
DeleteSandbox(ctx context.Context, request DeleteSandboxRequest) error
// Downloads a regular file from a sandbox as an application/octet-stream body.
// The sandbox starts automatically if it is stopped. Filesystem access uses the
// sandbox user's permissions and follows symbolic links.
//
// A full download returns 200 OK. A satisfiable single byte range returns 206
// Partial Content. Multiple byte ranges are unsupported and return 400. Invalid
// ranges are ignored; an unsatisfiable range returns 416 with Content-Range
// describing the file length. Range is ignored for empty files.
//
// Conditional requests can return 304 Not Modified or 412 Precondition Failed.
// If-Range selects a partial response only when its strong entity tag matches;
// otherwise, the entire file is returned. HTTP-date validators in If-Range
// cause a full download. Reads are not snapshots: concurrent in-place writes
// can affect the returned bytes. HEAD is unsupported.
//
// Range and conditional options may be supplied as query parameters or HTTP
// headers. A parameter and one header may both be supplied when their values
// match exactly. Conflicting values or repeated parameters return 400.
DownloadFile(ctx context.Context, request DownloadFileRequest) (*DownloadFileResponse, 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)
// Returns metadata for a path without following its final symlink.
GetMetadata(ctx context.Context, request GetMetadataRequest) (*GetMetadataResponse, error)
// Retrieves a Sandbox by name.
GetSandbox(ctx context.Context, request GetSandboxRequest) (*Sandbox, error)
// Lists the tracked command executions (running and completed) in a sandbox.
ListCommands(ctx context.Context, request ListCommandsRequest) (*ListCommandsResponse, error)
// Lists a directory's immediate children in UTF-8 name order. Later pages may
// reflect concurrent changes.
//
// This method is generated by Databricks SDK Code Generator.
ListDirectoryContents(ctx context.Context, request ListDirectoryContentsRequest) listing.Iterator[SandboxFileInfo]
// Lists a directory's immediate children in UTF-8 name order. Later pages may
// reflect concurrent changes.
//
// This method is generated by Databricks SDK Code Generator.
ListDirectoryContentsAll(ctx context.Context, request ListDirectoryContentsRequest) ([]SandboxFileInfo, error)
// Lists the sandboxes in the workspace that are visible to the caller,
// including stopped sandboxes. Sandboxes that are being deleted are not
// returned.
//
// This method is generated by Databricks SDK Code Generator.
ListSandboxes(ctx context.Context, request ListSandboxesRequest) listing.Iterator[Sandbox]
// Lists the sandboxes in the workspace that are visible to the caller,
// including stopped sandboxes. Sandboxes that are being deleted are not
// returned.
//
// This method is generated by Databricks SDK Code Generator.
ListSandboxesAll(ctx context.Context, request ListSandboxesRequest) ([]Sandbox, error)
// Renames a path within a sandbox. The destination must be absent and on the
// same filesystem.
RenamePath(ctx context.Context, request RenamePathRequest) (*RenamePathResponse, error)
// Starts a previously stopped sandbox under the same sandbox name, with the
// data in its home directory intact. Starting is asynchronous: the response
// usually shows the sandbox in `SANDBOX_STATE_PENDING`, so poll GetSandbox
// until the state is `SANDBOX_STATE_RUNNING`. Returns NOT_FOUND if the sandbox
// does not exist, FAILED_PRECONDITION if it is pending or running, and ABORTED
// while it is still stopping.
StartSandbox(ctx context.Context, request StartSandboxRequest) (*Sandbox, error)
// Stops a running sandbox, preserving it so it can later be restarted with a
// Start request. Stopping is asynchronous: the response usually shows the
// sandbox in `SANDBOX_STATE_STOPPING`, and it settles to
// `SANDBOX_STATE_STOPPED` once the shutdown completes. The data in the home
// directory is kept; other local changes are discarded. Stopping a sandbox that
// is already stopped or stopping succeeds without changes.
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)
// Uploads an application/octet-stream body to a sandbox. The sandbox starts
// automatically if it is stopped. Filesystem access uses the sandbox user's
// permissions. Replacements follow symbolic links.
//
// Creates the file or replaces its entire contents, creating parent directories
// if missing. The completed upload becomes visible atomically. A failure before
// commit leaves an existing destination unchanged; a lost response after commit
// does not undo the upload. Completion does not guarantee crash durability.
//
// Returns 201 Created for a new file or 204 No Content for a replacement. Set
// overwrite=false or supply If-None-Match: * to create a file only if the
// destination does not exist. An existing entry, including a symbolic link,
// returns 412 Precondition Failed. Conflicting options or repeated overwrite
// parameters return 400. Other If-None-Match values, Content-Range, If-Match,
// and If-Unmodified-Since are unsupported and return 400.
UploadFile(ctx context.Context, request UploadFileRequest) error
}
type SandboxMetadata ¶
type SandboxMetadata struct {
// Key-value tags associated with the sandbox. Supports up to 54 tags. Keys
// must be between 1 and 512 characters, and values must not exceed 256
// characters.
CustomTags map[string]string `json:"custom_tags,omitempty"`
}
Metadata associated with a sandbox.
func (*SandboxMetadata) UnmarshalJSON ¶
func (s *SandboxMetadata) UnmarshalJSON(b []byte) error
type SandboxService
deprecated
type SandboxService interface {
// Creates a directory in a sandbox, including missing parents by default.
CreateDirectory(ctx context.Context, request CreateDirectoryRequest) (*CreateDirectoryResponse, error)
// Creates a sandbox with the given `sandbox_id` and starts provisioning it.
// Provisioning is asynchronous: the response usually shows the sandbox in
// `SANDBOX_STATE_PENDING`, so poll GetSandbox until the state is
// `SANDBOX_STATE_RUNNING` before running commands in it. A sandbox that
// fails to provision ends in `SANDBOX_STATE_STOPPED`. Returns
// ALREADY_EXISTS if a sandbox with the same ID already exists in the
// workspace.
CreateSandbox(ctx context.Context, request CreateSandboxRequest) (*Sandbox, error)
// Deletes a file, symlink, or empty directory, with an option for recursive
// deletion. Succeeds if the path is already absent.
DeletePath(ctx context.Context, request DeletePathRequest) (*DeletePathResponse, error)
// Deletes a sandbox, including the data in its home directory. A pending or
// running sandbox is stopped first and is removed once the teardown
// completes, after which GetSandbox returns NOT_FOUND. Deleting a sandbox
// that is already being deleted succeeds.
DeleteSandbox(ctx context.Context, request DeleteSandboxRequest) error
// Downloads a regular file from a sandbox as an application/octet-stream
// body. The sandbox starts automatically if it is stopped. Filesystem
// access uses the sandbox user's permissions and follows symbolic links.
//
// A full download returns 200 OK. A satisfiable single byte range returns
// 206 Partial Content. Multiple byte ranges are unsupported and return 400.
// Invalid ranges are ignored; an unsatisfiable range returns 416 with
// Content-Range describing the file length. Range is ignored for empty
// files.
//
// Conditional requests can return 304 Not Modified or 412 Precondition
// Failed. If-Range selects a partial response only when its strong entity
// tag matches; otherwise, the entire file is returned. HTTP-date validators
// in If-Range cause a full download. Reads are not snapshots: concurrent
// in-place writes can affect the returned bytes. HEAD is unsupported.
//
// Range and conditional options may be supplied as query parameters or HTTP
// headers. A parameter and one header may both be supplied when their
// values match exactly. Conflicting values or repeated parameters return
// 400.
DownloadFile(ctx context.Context, request DownloadFileRequest) (*DownloadFileResponse, 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)
// Returns metadata for a path without following its final symlink.
GetMetadata(ctx context.Context, request GetMetadataRequest) (*GetMetadataResponse, error)
// Retrieves a Sandbox by name.
GetSandbox(ctx context.Context, request GetSandboxRequest) (*Sandbox, error)
// Lists the tracked command executions (running and completed) in a
// sandbox.
ListCommands(ctx context.Context, request ListCommandsRequest) (*ListCommandsResponse, error)
// Lists a directory's immediate children in UTF-8 name order. Later pages
// may reflect concurrent changes.
ListDirectoryContents(ctx context.Context, request ListDirectoryContentsRequest) (*ListDirectoryContentsResponse, error)
// Lists the sandboxes in the workspace that are visible to the caller,
// including stopped sandboxes. Sandboxes that are being deleted are not
// returned.
ListSandboxes(ctx context.Context, request ListSandboxesRequest) (*ListSandboxesResponse, error)
// Renames a path within a sandbox. The destination must be absent and on
// the same filesystem.
RenamePath(ctx context.Context, request RenamePathRequest) (*RenamePathResponse, error)
// Starts a previously stopped sandbox under the same sandbox name, with the
// data in its home directory intact. Starting is asynchronous: the response
// usually shows the sandbox in `SANDBOX_STATE_PENDING`, so poll GetSandbox
// until the state is `SANDBOX_STATE_RUNNING`. Returns NOT_FOUND if the
// sandbox does not exist, FAILED_PRECONDITION if it is pending or running,
// and ABORTED while it is still stopping.
StartSandbox(ctx context.Context, request StartSandboxRequest) (*Sandbox, error)
// Stops a running sandbox, preserving it so it can later be restarted with
// a Start request. Stopping is asynchronous: the response usually shows the
// sandbox in `SANDBOX_STATE_STOPPING`, and it settles to
// `SANDBOX_STATE_STOPPED` once the shutdown completes. The data in the home
// directory is kept; other local changes are discarded. Stopping a sandbox
// that is already stopped or stopping succeeds without changes.
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)
// Uploads an application/octet-stream body to a sandbox. The sandbox starts
// automatically if it is stopped. Filesystem access uses the sandbox user's
// permissions. Replacements follow symbolic links.
//
// Creates the file or replaces its entire contents, creating parent
// directories if missing. The completed upload becomes visible atomically.
// A failure before commit leaves an existing destination unchanged; a lost
// response after commit does not undo the upload. Completion does not
// guarantee crash durability.
//
// Returns 201 Created for a new file or 204 No Content for a replacement.
// Set overwrite=false or supply If-None-Match: * to create a file only if
// the destination does not exist. An existing entry, including a symbolic
// link, returns 412 Precondition Failed. Conflicting options or repeated
// overwrite parameters return 400. Other If-None-Match values,
// Content-Range, If-Match, and If-Unmodified-Since are unsupported and
// return 400.
UploadFile(ctx context.Context, request UploadFileRequest) 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 settings requested for the sandbox, such as the inactivity
// timeout.
Compute *ComputeSpec `json:"compute,omitempty"`
// Software environment for the sandbox, such as the container image it
// runs.
Environment *EnvironmentSpec `json:"environment,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.
//
// - `SANDBOX_STATE_PENDING`: The sandbox is being provisioned after a
// create or start request and cannot run commands yet. -
// `SANDBOX_STATE_RUNNING`: The sandbox is ready and commands can run in it.
// - `SANDBOX_STATE_STOPPING`: The sandbox is shutting down. It settles to
// `SANDBOX_STATE_STOPPED`, or disappears if it is being deleted. -
// `SANDBOX_STATE_STOPPED`: The sandbox is stopped, by a stop request,
// inactivity auto-stop, or a failed provisioning. Its home directory is
// kept and it can be started again with StartSandbox.
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
type UploadFileRequest ¶
type UploadFileRequest struct {
// The complete file contents. An empty body creates an empty file.
Contents io.ReadCloser `json:"-"`
// Whether to replace an existing file. Defaults to true when omitted. If
// false, the upload atomically creates the file only if the destination
// does not exist, equivalent to If-None-Match: *. An existing entry returns
// 412 Precondition Failed. Explicit true conflicts with If-None-Match: *.
Overwrite bool `json:"-" url:"overwrite,omitempty"`
// The sandbox resource name, in the form sandboxes/{sandbox_id}.
Parent string `json:"-" url:"-"`
// The absolute UTF-8 destination path inside the sandbox.
Path string `json:"-" url:"path"`
ForceSendFields []string `json:"-" url:"-"`
}
func (UploadFileRequest) MarshalJSON ¶
func (s UploadFileRequest) MarshalJSON() ([]byte, error)
func (*UploadFileRequest) UnmarshalJSON ¶
func (s *UploadFileRequest) UnmarshalJSON(b []byte) error