Go API reference¶
Package github.com/nebius/contree-client/go/v1.
Generated from the exported Go declarations and doc comments, including client methods, models, helpers, and test doubles. See the Go client guide for usage.
Package contree provides a generated, typed client for the Contree v1 API.
Construct a Client with NewClient, or use ResolveProfile and NewClientFromProfile for saved credentials. Pass contexts to every operation, and close byte download streams. Event and pagination methods return iter.Seq2 iterators; check their errors inside the range loop. Event streams close automatically when iteration ends.
Constants¶
const AuthTypeIAM (group)¶
const (
// AuthTypeIAM identifies an IAM token profile.
AuthTypeIAM = "iam"
// AuthTypeJWT identifies a JWT token profile.
AuthTypeJWT = "jwt"
// ProfileSectionPrefix prefixes profile sections in Contree INI files.
ProfileSectionPrefix = "profile:"
// DefaultProfileName is selected when the configuration has no active profile.
DefaultProfileName = "default"
// DefaultIAMURL is used when an IAM profile does not specify a URL.
DefaultIAMURL = DefaultBaseURL
)
const ClosableStreamReprEncodingAscii¶
ClosableStreamReprEncodingAscii is a documented ClosableStreamReprEncoding value.
const ClosableStreamReprEncodingAscii = "ascii"
const ClosableStreamReprEncodingBase64¶
ClosableStreamReprEncodingBase64 is a documented ClosableStreamReprEncoding value.
const ClosableStreamReprEncodingBase64 = "base64"
const DefaultBaseURL¶
const DefaultBaseURL = "https://api.tokenfactory.nebius.com/sandboxes"
const EventDataFileUploadStatusCancelled¶
EventDataFileUploadStatusCancelled is a documented EventDataFileUploadStatus value.
const EventDataFileUploadStatusCancelled = "cancelled"
const EventDataFileUploadStatusError¶
EventDataFileUploadStatusError is a documented EventDataFileUploadStatus value.
const EventDataFileUploadStatusError = "error"
const EventDataFileUploadStatusSuccess¶
EventDataFileUploadStatusSuccess is a documented EventDataFileUploadStatus value.
const EventDataFileUploadStatusSuccess = "success"
const EventDataFileUploadStatusTimeout¶
EventDataFileUploadStatusTimeout is a documented EventDataFileUploadStatus value.
const EventDataFileUploadStatusTimeout = "timeout"
const EventDataInspectMethodArchive¶
EventDataInspectMethodArchive is a documented EventDataInspectMethod value.
const EventDataInspectMethodArchive = "archive"
const EventDataInspectMethodClose¶
EventDataInspectMethodClose is a documented EventDataInspectMethod value.
const EventDataInspectMethodClose = "close"
const EventDataInspectMethodFinish¶
EventDataInspectMethodFinish is a documented EventDataInspectMethod value.
const EventDataInspectMethodFinish = "finish"
const EventDataInspectMethodGrep¶
EventDataInspectMethodGrep is a documented EventDataInspectMethod value.
const EventDataInspectMethodGrep = "grep"
const EventDataInspectMethodList¶
EventDataInspectMethodList is a documented EventDataInspectMethod value.
const EventDataInspectMethodList = "list"
const EventDataInspectMethodOpen¶
EventDataInspectMethodOpen is a documented EventDataInspectMethod value.
const EventDataInspectMethodOpen = "open"
const EventDataInspectMethodRead¶
EventDataInspectMethodRead is a documented EventDataInspectMethod value.
const EventDataInspectMethodRead = "read"
const EventDataInspectMethodStat¶
EventDataInspectMethodStat is a documented EventDataInspectMethod value.
const EventDataInspectMethodStat = "stat"
const EventDataInspectMethodUpload¶
EventDataInspectMethodUpload is a documented EventDataInspectMethod value.
const EventDataInspectMethodUpload = "upload"
const EventDataInspectMethodWrite¶
EventDataInspectMethodWrite is a documented EventDataInspectMethod value.
const EventDataInspectMethodWrite = "write"
const EventDataInspectPhaseCompleted¶
EventDataInspectPhaseCompleted is a documented EventDataInspectPhase value.
const EventDataInspectPhaseCompleted = "completed"
const EventDataInspectPhaseStarted¶
EventDataInspectPhaseStarted is a documented EventDataInspectPhase value.
const EventDataInspectPhaseStarted = "started"
const EventDataInspectStatusCancelled¶
EventDataInspectStatusCancelled is a documented EventDataInspectStatus value.
const EventDataInspectStatusCancelled = "cancelled"
const EventDataInspectStatusError¶
EventDataInspectStatusError is a documented EventDataInspectStatus value.
const EventDataInspectStatusError = "error"
const EventDataInspectStatusSuccess¶
EventDataInspectStatusSuccess is a documented EventDataInspectStatus value.
const EventDataInspectStatusSuccess = "success"
const EventDataInspectStatusTimeout¶
EventDataInspectStatusTimeout is a documented EventDataInspectStatus value.
const EventDataInspectStatusTimeout = "timeout"
const EventDataShutdownReasonJobComplete¶
EventDataShutdownReasonJobComplete is a documented EventDataShutdownReason value.
const EventDataShutdownReasonJobComplete = "job_complete"
const EventDataShutdownReasonSignal¶
EventDataShutdownReasonSignal is a documented EventDataShutdownReason value.
const EventDataShutdownReasonSignal = "signal"
const EventDataShutdownReasonSpawnFailed¶
EventDataShutdownReasonSpawnFailed is a documented EventDataShutdownReason value.
const EventDataShutdownReasonSpawnFailed = "spawn_failed"
const EventDataShutdownReasonTimeout¶
EventDataShutdownReasonTimeout is a documented EventDataShutdownReason value.
const EventDataShutdownReasonTimeout = "timeout"
const EventDataStreamEncodingAscii¶
EventDataStreamEncodingAscii is a documented EventDataStreamEncoding value.
const EventDataStreamEncodingAscii = "ascii"
const EventDataStreamEncodingBase64¶
EventDataStreamEncodingBase64 is a documented EventDataStreamEncoding value.
const EventDataStreamEncodingBase64 = "base64"
const EventDataTruncatedStreamStderr¶
EventDataTruncatedStreamStderr is a documented EventDataTruncatedStream value.
const EventDataTruncatedStreamStderr = "stderr"
const EventDataTruncatedStreamStdin¶
EventDataTruncatedStreamStdin is a documented EventDataTruncatedStream value.
const EventDataTruncatedStreamStdin = "stdin"
const EventDataTruncatedStreamStdout¶
EventDataTruncatedStreamStdout is a documented EventDataTruncatedStream value.
const EventDataTruncatedStreamStdout = "stdout"
const GrepMatchTypeContext¶
GrepMatchTypeContext is a documented GrepMatchType value.
const GrepMatchTypeContext = "context"
const GrepMatchTypeMatch¶
GrepMatchTypeMatch is a documented GrepMatchType value.
const GrepMatchTypeMatch = "match"
const InspectImageGrepCaseInsensitive¶
InspectImageGrepCaseInsensitive is a documented InspectImageGrepCase value.
const InspectImageGrepCaseInsensitive = "insensitive"
const InspectImageGrepCaseSensitive¶
InspectImageGrepCaseSensitive is a documented InspectImageGrepCase value.
const InspectImageGrepCaseSensitive = "sensitive"
const InspectImageGrepCaseSmart¶
InspectImageGrepCaseSmart is a documented InspectImageGrepCase value.
const InspectImageGrepCaseSmart = "smart"
const InspectInstanceGrepCaseInsensitive¶
InspectInstanceGrepCaseInsensitive is a documented InspectInstanceGrepCase value.
const InspectInstanceGrepCaseInsensitive = "insensitive"
const InspectInstanceGrepCaseSensitive¶
InspectInstanceGrepCaseSensitive is a documented InspectInstanceGrepCase value.
const InspectInstanceGrepCaseSensitive = "sensitive"
const InspectInstanceGrepCaseSmart¶
InspectInstanceGrepCaseSmart is a documented InspectInstanceGrepCase value.
const InspectInstanceGrepCaseSmart = "smart"
const ListOperationsKindImageImport¶
ListOperationsKindImageImport is a documented ListOperationsKind value.
const ListOperationsKindImageImport = "image_import"
const ListOperationsKindInstance¶
ListOperationsKindInstance is a documented ListOperationsKind value.
const ListOperationsKindInstance = "instance"
const NetworkPolicyCidrRuleProtoTcp¶
NetworkPolicyCidrRuleProtoTcp is a documented NetworkPolicyCidrRuleProto value.
const NetworkPolicyCidrRuleProtoTcp = "tcp"
const NetworkPolicyCidrRuleProtoUdp¶
NetworkPolicyCidrRuleProtoUdp is a documented NetworkPolicyCidrRuleProto value.
const NetworkPolicyCidrRuleProtoUdp = "udp"
const OperationResponseKindImageImport¶
OperationResponseKindImageImport is a documented OperationResponseKind value.
const OperationResponseKindImageImport = "image_import"
const OperationResponseKindInstance¶
OperationResponseKindInstance is a documented OperationResponseKind value.
const OperationResponseKindInstance = "instance"
const OperationSubprocessStdinEncodingAscii¶
OperationSubprocessStdinEncodingAscii is a documented OperationSubprocessStdinEncoding value.
const OperationSubprocessStdinEncodingAscii = "ascii"
const OperationSubprocessStdinEncodingBase64¶
OperationSubprocessStdinEncodingBase64 is a documented OperationSubprocessStdinEncoding value.
const OperationSubprocessStdinEncodingBase64 = "base64"
const OperationSummaryKindImageImport¶
OperationSummaryKindImageImport is a documented OperationSummaryKind value.
const OperationSummaryKindImageImport = "image_import"
const OperationSummaryKindInstance¶
OperationSummaryKindInstance is a documented OperationSummaryKind value.
const OperationSummaryKindInstance = "instance"
const SpecSHA256¶
SpecSHA256 identifies the exact OpenAPI input document.
const SpecSHA256 = "0c77136174a41b99c59fb4b98e5d8b1e660dee2243a24cff2da56fa84b836a0d"
const StreamReprEncodingAscii¶
StreamReprEncodingAscii is a documented StreamReprEncoding value.
const StreamReprEncodingAscii = "ascii"
const StreamReprEncodingBase64¶
StreamReprEncodingBase64 is a documented StreamReprEncoding value.
const StreamReprEncodingBase64 = "base64"
Variables¶
var OpApplyInstanceFile¶
OpApplyInstanceFile configures the mock result for ApplyInstanceFile.
var OpApplyInstanceFile Operation[struct{}]
var OpCancelOperation¶
OpCancelOperation configures the mock result for CancelOperation.
var OpCancelOperation Operation[struct{}]
var OpCheckFileExists¶
OpCheckFileExists configures the mock result for CheckFileExists.
var OpCheckFileExists Operation[bool]
var OpCheckImageArchive¶
OpCheckImageArchive configures the mock result for CheckImageArchive.
var OpCheckImageArchive Operation[bool]
var OpCheckImageFile¶
OpCheckImageFile configures the mock result for CheckImageFile.
var OpCheckImageFile Operation[bool]
var OpCheckInstanceArchive¶
OpCheckInstanceArchive configures the mock result for CheckInstanceArchive.
var OpCheckInstanceArchive Operation[bool]
var OpCheckInstanceFile¶
OpCheckInstanceFile configures the mock result for CheckInstanceFile.
var OpCheckInstanceFile Operation[bool]
var OpCreateNetworkPolicy¶
OpCreateNetworkPolicy configures the mock result for CreateNetworkPolicy.
var OpCreateNetworkPolicy Operation[NetworkPolicy]
var OpDeleteImageTag¶
OpDeleteImageTag configures the mock result for DeleteImageTag.
var OpDeleteImageTag Operation[struct{}]
var OpDeleteNetworkPolicy¶
OpDeleteNetworkPolicy configures the mock result for DeleteNetworkPolicy.
var OpDeleteNetworkPolicy Operation[struct{}]
var OpDeleteNetworkPolicyTag¶
OpDeleteNetworkPolicyTag configures the mock result for DeleteNetworkPolicyTag.
var OpDeleteNetworkPolicyTag Operation[struct{}]
var OpGetFile¶
OpGetFile configures the mock result for GetFile.
var OpGetFile Operation[File]
var OpGetNetworkPolicy¶
OpGetNetworkPolicy configures the mock result for GetNetworkPolicy.
var OpGetNetworkPolicy Operation[NetworkPolicy]
var OpGetNetworkPolicyTag¶
OpGetNetworkPolicyTag configures the mock result for GetNetworkPolicyTag.
var OpGetNetworkPolicyTag Operation[NetworkPolicyTag]
var OpGetOperationStatus¶
OpGetOperationStatus configures the mock result for GetOperationStatus.
var OpGetOperationStatus Operation[OperationResponse]
var OpImportImage¶
OpImportImage configures the mock result for ImportImage.
var OpImportImage Operation[string]
var OpInspectFindImageByTag¶
OpInspectFindImageByTag configures the mock result for InspectFindImageByTag.
var OpInspectFindImageByTag Operation[string]
var OpInspectImage¶
OpInspectImage configures the mock result for InspectImage.
var OpInspectImage Operation[Image]
var OpInspectImageArchive¶
OpInspectImageArchive configures the mock result for InspectImageArchive.
var OpInspectImageArchive Operation[[]byte]
var OpInspectImageDownload¶
OpInspectImageDownload configures the mock result for InspectImageDownload.
var OpInspectImageDownload Operation[[]byte]
var OpInspectImageGrep¶
OpInspectImageGrep configures the mock result for InspectImageGrep.
var OpInspectImageGrep Operation[GrepResult]
var OpInspectImageList¶
OpInspectImageList configures the mock result for InspectImageList.
var OpInspectImageList Operation[DirectoryList]
var OpInspectInstanceArchive¶
OpInspectInstanceArchive configures the mock result for InspectInstanceArchive.
var OpInspectInstanceArchive Operation[[]byte]
var OpInspectInstanceDownload¶
OpInspectInstanceDownload configures the mock result for InspectInstanceDownload.
var OpInspectInstanceDownload Operation[[]byte]
var OpInspectInstanceGrep¶
OpInspectInstanceGrep configures the mock result for InspectInstanceGrep.
var OpInspectInstanceGrep Operation[GrepResult]
var OpInspectInstanceList¶
OpInspectInstanceList configures the mock result for InspectInstanceList.
var OpInspectInstanceList Operation[DirectoryList]
var OpIterOperationEvents¶
OpIterOperationEvents configures the mock result for IterOperationEvents.
var OpIterOperationEvents Operation[[]OperationEvent]
var OpListFiles¶
OpListFiles configures the mock result for ListFiles.
var OpListFiles Operation[FilesListResponse]
var OpListImages¶
OpListImages configures the mock result for ListImages.
var OpListImages Operation[ImageListResponse]
var OpListNetworkPolicies¶
OpListNetworkPolicies configures the mock result for ListNetworkPolicies.
var OpListNetworkPolicies Operation[NetworkPolicyListResponse]
var OpListOperations¶
OpListOperations configures the mock result for ListOperations.
var OpListOperations Operation[[]OperationSummary]
var OpOperationSubprocess¶
OpOperationSubprocess configures the mock result for OperationSubprocess.
var OpOperationSubprocess Operation[InstanceResult]
var OpOperationSubprocessCreate¶
OpOperationSubprocessCreate configures the mock result for OperationSubprocessCreate.
var OpOperationSubprocessCreate Operation[int64]
var OpOperationSubprocessKill¶
OpOperationSubprocessKill configures the mock result for OperationSubprocessKill.
var OpOperationSubprocessKill Operation[struct{}]
var OpOperationSubprocessStdin¶
OpOperationSubprocessStdin configures the mock result for OperationSubprocessStdin.
var OpOperationSubprocessStdin Operation[struct{}]
var OpSetNetworkPolicyTag¶
OpSetNetworkPolicyTag configures the mock result for SetNetworkPolicyTag.
var OpSetNetworkPolicyTag Operation[NetworkPolicyTag]
var OpSpawnInstance¶
OpSpawnInstance configures the mock result for SpawnInstance.
var OpSpawnInstance Operation[InstanceSpawnResponse]
var OpUpdateImageTag¶
OpUpdateImageTag configures the mock result for UpdateImageTag.
var OpUpdateImageTag Operation[Image]
var OpUploadFile¶
OpUploadFile configures the mock result for UploadFile.
var OpUploadFile Operation[FileResponse]
var OpWhoAmI¶
OpWhoAmI configures the mock result for WhoAmI.
var OpWhoAmI Operation[WhoAmIResponse]
Functions¶
ContreeHome¶
ContreeHome returns the directory that contains Contree configuration files. CONTREE_HOME has priority over XDG_CONFIG_HOME and ~/.config/contree.
func ContreeHome() (string, error)
DecodeChunk¶
DecodeChunk decodes a typed stream payload, raw JSON, or a raw object to bytes. Unknown shapes and invalid base64 return empty bytes so a live stream can continue.
func DecodeChunk(data any) []byte
DecodeStream¶
DecodeStream decodes a stream payload to text, replacing invalid UTF-8.
func DecodeStream(data any) string
IsTerminalStatus¶
IsTerminalStatus reports whether status cannot change again.
func IsTerminalStatus(status OperationStatus) bool
LoadProfiles¶
LoadProfiles reads cli.ini and auth.ini and returns profiles and the active profile name. auth.ini values override cli.ini values. Pass no path to use the default auth.ini location, or pass one explicit auth.ini path.
func LoadProfiles(path ...string) (map[string]Profile, string, error)
NewTestClient¶
NewTestClient constructs a normal Client and its offline MockTransport. It uses “test-token” and https://contree.test by default. Options can change normal client settings; the mock HTTP transport is always installed last. No request can fall back to a network transport.
For code that constructs its own client, supply a zero-value MockTransport through WithHTTPClient instead.
func NewTestClient(options ...ClientOption) (*Client, *MockTransport, error)
Example
package main
import (
"context"
"fmt"
"log"
contree "github.com/nebius/contree-client/go/v1"
)
func permissions(ctx context.Context, client *contree.Client) (map[string]bool, error) {
me, err := client.WhoAmI(ctx)
if err != nil {
return nil, fmt.Errorf("get token permissions: %w", err)
}
return me.Permissions, nil
}
func main() {
client, mock, err := contree.NewTestClient()
if err != nil {
log.Fatalf("create test client: %v", err)
}
err = mock.Mock(contree.OpWhoAmI, contree.WhoAmIResponse{
Permissions: map[string]bool{"spawn": true},
OperationsStat: map[string]int64{},
})
if err != nil {
log.Fatalf("mock token permissions: %v", err)
}
allowed, err := permissions(context.Background(), client)
if err != nil {
log.Fatalf("load permissions: %v", err)
}
fmt.Println(allowed["spawn"])
fmt.Println(len(mock.CallsFor("WhoAmI")))
}
Output:
true
1
Types¶
type APIConnectionError¶
APIConnectionError reports a connection or response-read failure. TimedOut distinguishes deadline and socket timeout failures.
type APIConnectionError struct {
Method string
URL string
TimedOut bool
Err error
}
APIConnectionError.Error¶
func (e *APIConnectionError) Error() string
APIConnectionError.Timeout¶
Timeout reports whether the transport failure was caused by a deadline or socket timeout.
func (e *APIConnectionError) Timeout() bool
APIConnectionError.Unwrap¶
Unwrap returns the original transport error.
func (e *APIConnectionError) Unwrap() error
type APIError¶
APIError identifies normalized connection, HTTP status, and SSE errors. Use errors.As with this interface to recognize them through wrapped errors.
type APIError interface {
error
// contains filtered or unexported methods
}
type APIStatusError¶
APIStatusError reports an HTTP response that the operation did not accept. Body contains at most the runtime error-body limit. Details contains the decoded “error” property when present, or the decoded response otherwise. A non-nil RetryAfter preserves the header even when its value is zero.
type APIStatusError struct {
StatusCode int
Method string
URL string
RequestID string
Body []byte
Details any
Traceback []string
RetryAfter *time.Duration
}
APIStatusError.Error¶
func (e *APIStatusError) Error() string
type ApplyInstanceFileOptions¶
ApplyInstanceFileOptions contains optional arguments for ApplyInstanceFile.
type ApplyInstanceFileOptions struct {
Unpack Optional[bool]
Replace Optional[bool]
Merge Optional[bool]
}
type AuthenticationError¶
AuthenticationError is returned for an unexpected HTTP 401 response.
type AuthenticationError struct{ *APIStatusError }
AuthenticationError.Error¶
func (e AuthenticationError) Error() string
AuthenticationError.Unwrap¶
func (e *AuthenticationError) Unwrap() error
type BadRequestError¶
BadRequestError is returned for an unexpected HTTP 400 response.
type BadRequestError struct{ *APIStatusError }
BadRequestError.Error¶
func (e BadRequestError) Error() string
BadRequestError.Unwrap¶
func (e *BadRequestError) Unwrap() error
type Client¶
Client calls the generated Contree API surface through net/http.
type Client struct {
// contains filtered or unexported fields
}
NewClient¶
NewClient constructs a client. An empty token omits Authorization for public endpoints.
func NewClient(token string, options ...ClientOption) (*Client, error)
NewClientFromProfile¶
NewClientFromProfile constructs a client from a loaded profile. Resolve and construct a saved profile as follows:
profile, err := ResolveProfile("")
if err != nil {
return err
}
client, err := NewClientFromProfile(profile)
ClientOption values are applied after the profile settings. Thus, caller options override the profile URL and project.
func NewClientFromProfile(profile Profile, options ...ClientOption) (*Client, error)
Client.ApplyInstanceFile¶
ApplyInstanceFile calls POST /operations/{operation_uuid}/files.
func (c *Client) ApplyInstanceFile(
ctx context.Context,
operationUUID string,
fileUUID string,
path string,
options *ApplyInstanceFileOptions,
) error
Client.BaseURL¶
BaseURL returns the normalized service origin.
func (c *Client) BaseURL() string
Client.CancelOperation¶
CancelOperation calls DELETE /operations/{operationId}.
func (c *Client) CancelOperation(
ctx context.Context,
operationID string,
) error
Client.CheckFileExists¶
CheckFileExists calls HEAD /files/{sha256}.
func (c *Client) CheckFileExists(
ctx context.Context,
sha256 string,
) (bool, error)
Client.CheckImageArchive¶
CheckImageArchive calls HEAD /inspect/{image_uuid}/archive.
func (c *Client) CheckImageArchive(
ctx context.Context,
imageUUID string,
path string,
) (bool, error)
Client.CheckImageFile¶
CheckImageFile calls HEAD /inspect/{image_uuid}/download.
func (c *Client) CheckImageFile(
ctx context.Context,
imageUUID string,
path string,
) (bool, error)
Client.CheckInstanceArchive¶
CheckInstanceArchive calls HEAD /operations/{operation_uuid}/inspect/archive.
func (c *Client) CheckInstanceArchive(
ctx context.Context,
operationUUID string,
path string,
) (bool, error)
Client.CheckInstanceFile¶
CheckInstanceFile calls HEAD /operations/{operation_uuid}/inspect/download.
func (c *Client) CheckInstanceFile(
ctx context.Context,
operationUUID string,
path string,
) (bool, error)
Client.CreateNetworkPolicy¶
CreateNetworkPolicy calls POST /network/policies.
func (c *Client) CreateNetworkPolicy(
ctx context.Context,
cidrs []NetworkPolicyCidrRule,
) (NetworkPolicy, error)
Client.DeleteImageTag¶
DeleteImageTag calls DELETE /images/{imageUUID}/tag.
func (c *Client) DeleteImageTag(
ctx context.Context,
imageUUID string,
options *DeleteImageTagOptions,
) error
Client.DeleteNetworkPolicy¶
DeleteNetworkPolicy calls DELETE /network/policies/{uuid}.
func (c *Client) DeleteNetworkPolicy(
ctx context.Context,
uuid string,
) error
Client.DeleteNetworkPolicyTag¶
DeleteNetworkPolicyTag calls DELETE /network/tags/{tag}.
func (c *Client) DeleteNetworkPolicyTag(
ctx context.Context,
tag string,
) error
Client.EnsureFile¶
EnsureFile returns the existing file with the content digest, or uploads content when the server returns NotFoundError for that digest.
If options does not contain SHA256, EnsureFile hashes seekable readers from their current position and restores that position before the server probe. Non-seekable readers upload directly. Therefore, callers can pass *os.File without loading the file into memory.
func (c *Client) EnsureFile(
ctx context.Context,
content io.Reader,
options *EnsureFileOptions,
) (EnsureFileResult, error)
Client.FollowOperationEvents¶
FollowOperationEvents lazily yields events and reconnects interrupted streams. Each traversal starts from the supplied options. A terminal error is yielded once with a zero event. Ending iteration closes the active response body.
func (c *Client) FollowOperationEvents(
ctx context.Context,
operationID string,
options *FollowOperationEventsOptions,
) iter.Seq2[OperationEvent, error]
Client.GetFile¶
GetFile calls GET /files/{sha256}.
func (c *Client) GetFile(
ctx context.Context,
sha256 string,
) (File, error)
Client.GetNetworkPolicy¶
GetNetworkPolicy calls GET /network/policies/{uuid}.
func (c *Client) GetNetworkPolicy(
ctx context.Context,
uuid string,
) (NetworkPolicy, error)
Client.GetNetworkPolicyTag¶
GetNetworkPolicyTag calls GET /network/tags/{tag}.
func (c *Client) GetNetworkPolicyTag(
ctx context.Context,
tag string,
) (NetworkPolicyTag, error)
Client.GetOperationStatus¶
GetOperationStatus calls GET /operations/{operationId}.
func (c *Client) GetOperationStatus(
ctx context.Context,
operationID string,
options *GetOperationStatusOptions,
) (OperationResponse, error)
Client.ImportImage¶
ImportImage calls POST /images/import.
func (c *Client) ImportImage(
ctx context.Context,
registry ImageImportRegistry,
options *ImportImageOptions,
) (string, error)
Client.InspectFindImageByTag¶
InspectFindImageByTag calls GET /inspect/.
func (c *Client) InspectFindImageByTag(
ctx context.Context,
tag string,
) (string, error)
Client.InspectImage¶
InspectImage calls GET /inspect/{image_uuid}/.
func (c *Client) InspectImage(
ctx context.Context,
imageUUID string,
) (Image, error)
Client.InspectImageArchive¶
InspectImageArchive calls GET /inspect/{image_uuid}/archive.
func (c *Client) InspectImageArchive(
ctx context.Context,
imageUUID string,
path string,
) (io.ReadCloser, error)
Client.InspectImageArchiveRaw¶
InspectImageArchiveRaw streams the encoded response body from InspectImageArchive.
func (c *Client) InspectImageArchiveRaw(
ctx context.Context,
imageUUID string,
path string,
) (io.ReadCloser, error)
Client.InspectImageDownload¶
InspectImageDownload calls GET /inspect/{image_uuid}/download.
func (c *Client) InspectImageDownload(
ctx context.Context,
imageUUID string,
path string,
) ([]byte, error)
Client.InspectImageDownloadStream¶
InspectImageDownloadStream streams the response body from InspectImageDownload.
func (c *Client) InspectImageDownloadStream(
ctx context.Context,
imageUUID string,
path string,
) (io.ReadCloser, error)
Client.InspectImageGrep¶
InspectImageGrep calls GET /inspect/{image_uuid}/grep.
func (c *Client) InspectImageGrep(
ctx context.Context,
imageUUID string,
pattern []string,
options *InspectImageGrepOptions,
) (GrepResult, error)
Client.InspectImageList¶
InspectImageList calls GET /inspect/{image_uuid}/list.
func (c *Client) InspectImageList(
ctx context.Context,
imageUUID string,
path string,
) (DirectoryList, error)
Client.InspectInstanceArchive¶
InspectInstanceArchive calls GET /operations/{operation_uuid}/inspect/archive.
func (c *Client) InspectInstanceArchive(
ctx context.Context,
operationUUID string,
path string,
) (io.ReadCloser, error)
Client.InspectInstanceArchiveRaw¶
InspectInstanceArchiveRaw streams the encoded response body from InspectInstanceArchive.
func (c *Client) InspectInstanceArchiveRaw(
ctx context.Context,
operationUUID string,
path string,
) (io.ReadCloser, error)
Client.InspectInstanceDownload¶
InspectInstanceDownload calls GET /operations/{operation_uuid}/inspect/download.
func (c *Client) InspectInstanceDownload(
ctx context.Context,
operationUUID string,
path string,
) ([]byte, error)
Client.InspectInstanceDownloadStream¶
InspectInstanceDownloadStream streams the response body from InspectInstanceDownload.
func (c *Client) InspectInstanceDownloadStream(
ctx context.Context,
operationUUID string,
path string,
) (io.ReadCloser, error)
Client.InspectInstanceGrep¶
InspectInstanceGrep calls GET /operations/{operation_uuid}/inspect/grep.
func (c *Client) InspectInstanceGrep(
ctx context.Context,
operationUUID string,
pattern []string,
options *InspectInstanceGrepOptions,
) (GrepResult, error)
Client.InspectInstanceList¶
InspectInstanceList calls GET /operations/{operation_uuid}/inspect/list.
func (c *Client) InspectInstanceList(
ctx context.Context,
operationUUID string,
path string,
) (DirectoryList, error)
Client.IterFiles¶
IterFiles lazily iterates ListFiles pages. Each traversal starts from the first page. The first error is yielded with a zero item, then iteration stops. Break stops fetching pages.
func (c *Client) IterFiles(
ctx context.Context,
options *IterFilesOptions,
) iter.Seq2[File, error]
Client.IterImages¶
IterImages lazily iterates ListImages pages. Each traversal starts from the first page. The first error is yielded with a zero item, then iteration stops. Break stops fetching pages.
func (c *Client) IterImages(
ctx context.Context,
options *IterImagesOptions,
) iter.Seq2[Image, error]
Client.IterOperationEvents¶
IterOperationEvents lazily yields operation events. Each traversal opens a new stream and closes it when iteration ends. The first error is yielded with a zero event, then iteration stops.
func (c *Client) IterOperationEvents(
ctx context.Context,
operationID string,
options *IterOperationEventsOptions,
) iter.Seq2[OperationEvent, error]
Client.IterOperations¶
IterOperations lazily iterates ListOperations pages. Each traversal starts from the first page. The first error is yielded with a zero item, then iteration stops. Break stops fetching pages.
func (c *Client) IterOperations(
ctx context.Context,
options *IterOperationsOptions,
) iter.Seq2[OperationSummary, error]
Client.ListFiles¶
ListFiles calls GET /files.
func (c *Client) ListFiles(
ctx context.Context,
options *ListFilesOptions,
) (FilesListResponse, error)
Client.ListImages¶
ListImages calls GET /images.
func (c *Client) ListImages(
ctx context.Context,
options *ListImagesOptions,
) (ImageListResponse, error)
Client.ListNetworkPolicies¶
ListNetworkPolicies calls GET /network/policies.
func (c *Client) ListNetworkPolicies(
ctx context.Context,
options *ListNetworkPoliciesOptions,
) (NetworkPolicyListResponse, error)
Client.ListOperations¶
ListOperations calls GET /operations.
func (c *Client) ListOperations(
ctx context.Context,
options *ListOperationsOptions,
) ([]OperationSummary, error)
Client.OperationSubprocess¶
OperationSubprocess calls GET /operations/{operationId}/subprocesses/{spid}.
func (c *Client) OperationSubprocess(
ctx context.Context,
operationID string,
spid int64,
) (InstanceResult, error)
Client.OperationSubprocessCreate¶
OperationSubprocessCreate calls POST /operations/{operationId}/subprocesses.
func (c *Client) OperationSubprocessCreate(
ctx context.Context,
operationID string,
command string,
options *OperationSubprocessCreateOptions,
) (int64, error)
Client.OperationSubprocessKill¶
OperationSubprocessKill calls DELETE /operations/{operationId}/subprocesses/{spid}.
func (c *Client) OperationSubprocessKill(
ctx context.Context,
operationID string,
spid int64,
options *OperationSubprocessKillOptions,
) error
Client.OperationSubprocessStdin¶
OperationSubprocessStdin calls POST /operations/{operationId}/subprocesses/{spid}/stdin.
func (c *Client) OperationSubprocessStdin(
ctx context.Context,
operationID string,
spid int64,
valueArg string,
options *OperationSubprocessStdinOptions,
) error
Client.OperationTerminal¶
OperationTerminal reports whether an operation has reached a terminal status. Transient transport and server failures return false without an error, so callers can retry the probe.
func (c *Client) OperationTerminal(
ctx context.Context,
operationID string,
) (bool, error)
Client.ResolveImage¶
ResolveImage resolves a UUID, a tag:NAME reference, or a bare tag to an image UUID. UUID references do not make a request.
func (c *Client) ResolveImage(ctx context.Context, ref string) (string, error)
Client.SetNetworkPolicyTag¶
SetNetworkPolicyTag calls PUT /network/tags/{tag}.
func (c *Client) SetNetworkPolicyTag(
ctx context.Context,
tag string,
uuid string,
) (NetworkPolicyTag, error)
Client.SpawnInstance¶
SpawnInstance starts an instance and returns the full response without waiting for execution to finish. Image accepts a tag:NAME reference or a bare image UUID. Pass SpawnInstanceOptions{} to use the server defaults.
The response preserves all documented fields and their absent, null, and value states. Check response.UUID before using it to wait for or follow the operation. Use SpawnInstanceWithResponse for exact JSON states in request options.
func (c *Client) SpawnInstance(
ctx context.Context,
command string,
image string,
options SpawnInstanceOptions,
) (InstanceSpawnResponse, error)
Example
package main
import (
"context"
"fmt"
"log"
"time"
contree "github.com/nebius/contree-client/go/v1"
)
func main() {
client, mock, err := contree.NewTestClient()
if err != nil {
log.Fatalf("create test client: %v", err)
}
if err := mock.Mock(contree.OpSpawnInstance, contree.InstanceSpawnResponse{UUID: contree.Some("operation-1")}); err != nil {
log.Fatalf("mock instance creation: %v", err)
}
response, err := client.SpawnInstance(
context.Background(),
"wc -l < /work/data.txt",
"tag:ubuntu:latest",
contree.SpawnInstanceOptions{
Shell: true,
Env: map[string]string{"LC_ALL": "C"},
Cwd: "/work",
Timeout: time.Minute,
Disposable: true,
},
)
if err != nil {
log.Fatalf("spawn word-count command: %v", err)
}
operationID, ok := response.UUID.Value()
if !ok || operationID == "" {
log.Fatal("spawn response has no operation ID")
}
fmt.Println(operationID)
}
Output:
operation-1
Client.SpawnInstanceWithResponse¶
SpawnInstanceWithResponse calls POST /instances.
func (c *Client) SpawnInstanceWithResponse(
ctx context.Context,
command string,
image string,
options *SpawnInstanceWithResponseOptions,
) (InstanceSpawnResponse, error)
Client.UpdateImageTag¶
UpdateImageTag calls PATCH /images/{imageUUID}/tag.
func (c *Client) UpdateImageTag(
ctx context.Context,
imageUUID string,
tag string,
) (Image, error)
Client.UploadFile¶
UploadFile calls POST /files.
func (c *Client) UploadFile(
ctx context.Context,
content io.Reader,
) (FileResponse, error)
Client.UserAgent¶
UserAgent returns the value sent by this client.
func (c *Client) UserAgent() string
Client.WaitOperation¶
WaitOperation returns the terminal response, including failed and cancelled responses unchanged. By default it reads the operation kind, follows instance events, and polls image imports every 500 milliseconds. An unknown kind uses events. Supply at most one options value to select a mode explicitly. The event stream stays open until completion, EOF, a transport error, or context cancellation, or an inactivity timeout. Ping frames keep it open. IdleTimeout defaults to 15 seconds and resets on incoming data, including ping frames. It never extends the overall context deadline. A completion event still requires a terminal status response. The context bounds the entire wait, including status reads and polling delays.
func (c *Client) WaitOperation(
ctx context.Context,
operationID string,
options ...WaitOperationOptions,
) (OperationResponse, error)
Client.WhoAmI¶
WhoAmI calls GET /whoami.
func (c *Client) WhoAmI(
ctx context.Context,
) (WhoAmIResponse, error)
type ClientOption¶
ClientOption changes one Client setting.
type ClientOption func(*clientConfig) error
WithBaseURL¶
WithBaseURL overrides the service origin. The client appends /v1 and the generated operation path.
func WithBaseURL(value string) ClientOption
WithHTTPClient¶
WithHTTPClient supplies the transport settings used by the client. NewClient copies the value and disables automatic redirects so generated 3xx responses remain observable. Callers retain ownership of the supplied client.
func WithHTTPClient(value *http.Client) ClientOption
WithIdentity¶
WithIdentity prepends an application product token to the User-Agent.
func WithIdentity(value string) ClientOption
WithProject¶
WithProject sets the Project request header. An empty value omits it.
func WithProject(value string) ClientOption
WithRetry¶
WithRetry enables retries for idempotent buffered requests.
func WithRetry(policy RetryPolicy) ClientOption
WithTimeout¶
WithTimeout sets the whole-request deadline for buffered operations, including retries and response reads. Caller-owned streams use their context. A zero value disables the client deadline.
func WithTimeout(value time.Duration) ClientOption
WithUserAgent¶
WithUserAgent replaces the complete generated User-Agent value.
func WithUserAgent(value string) ClientOption
WithoutRetry¶
WithoutRetry disables retries. This is the default.
func WithoutRetry() ClientOption
type ClosableStreamRepr¶
ClosableStreamRepr is generated from the ClosableStreamRepr schema.
type ClosableStreamRepr struct {
Value string `json:"value"`
Encoding Optional[string] `json:"encoding"`
Close Optional[bool] `json:"close"`
}
NewClosableStreamReprFromBytes¶
NewClosableStreamReprFromBytes constructs a stream payload from bytes.
func NewClosableStreamReprFromBytes(value []byte) ClosableStreamRepr
NewClosableStreamReprFromText¶
NewClosableStreamReprFromText constructs a stream payload from text.
func NewClosableStreamReprFromText(value string) ClosableStreamRepr
ClosableStreamRepr.AsBytes¶
AsBytes decodes the stream payload to bytes.
func (m ClosableStreamRepr) AsBytes() []byte
ClosableStreamRepr.AsText¶
AsText decodes the stream payload to valid UTF-8 text.
func (m ClosableStreamRepr) AsText() string
ClosableStreamRepr.MarshalJSON¶
MarshalJSON encodes ClosableStreamRepr with exact wire names.
func (m ClosableStreamRepr) MarshalJSON() ([]byte, error)
ClosableStreamRepr.String¶
String returns the decoded payload text.
func (m ClosableStreamRepr) String() string
ClosableStreamRepr.UnmarshalJSON¶
UnmarshalJSON decodes ClosableStreamRepr and checks required fields.
func (m *ClosableStreamRepr) UnmarshalJSON(data []byte) error
type ConflictError¶
ConflictError is returned for an unexpected HTTP 409 response.
type ConflictError struct{ *APIStatusError }
ConflictError.Error¶
func (e ConflictError) Error() string
ConflictError.Unwrap¶
func (e *ConflictError) Unwrap() error
type DeleteImageTagOptions¶
DeleteImageTagOptions contains optional arguments for DeleteImageTag.
type DeleteImageTagOptions struct {
Tag *string
}
type DirectoryList¶
DirectoryList is generated from the DirectoryList schema.
type DirectoryList struct {
Path string `json:"path"`
Files []FileItem `json:"files"`
}
DirectoryList.AsText¶
AsText formats entries like ls -l; pass true to return one path per line.
func (m DirectoryList) AsText(short ...bool) string
DirectoryList.MarshalJSON¶
MarshalJSON encodes DirectoryList with exact wire names.
func (m DirectoryList) MarshalJSON() ([]byte, error)
DirectoryList.String¶
String returns the detailed directory listing.
func (m DirectoryList) String() string
DirectoryList.UnmarshalJSON¶
UnmarshalJSON decodes DirectoryList and checks required fields.
func (m *DirectoryList) UnmarshalJSON(data []byte) error
type EnsureFileOptions¶
EnsureFileOptions configures EnsureFile.
type EnsureFileOptions struct {
// SHA256 is a known content digest. EnsureFile trusts a non-empty value
// and does not read content before the server probe.
SHA256 string
}
type EnsureFileResult¶
EnsureFileResult identifies a stored file. CreatedAt and UpdatedAt are set when the server returns an existing file. Upload responses omit them.
type EnsureFileResult struct {
UUID string `json:"uuid"`
SHA256 string `json:"sha256"`
Size int64 `json:"size"`
CreatedAt Optional[time.Time] `json:"created_at"`
UpdatedAt Optional[time.Time] `json:"updated_at"`
}
type Error¶
Error is generated from the Error schema.
type Error struct {
Error any `json:"error"`
Status Optional[int64] `json:"status"`
Traceback Optional[[]string] `json:"traceback"`
}
Error.MarshalJSON¶
MarshalJSON encodes Error with exact wire names.
func (m Error) MarshalJSON() ([]byte, error)
Error.UnmarshalJSON¶
UnmarshalJSON decodes Error and checks required fields.
func (m *Error) UnmarshalJSON(data []byte) error
type EventData¶
EventData contains typed event data or a raw fallback value.
type EventData interface{}
type EventDataCompletion¶
EventDataCompletion is generated from the EventDataCompletion schema.
type EventDataCompletion struct {
Status OperationStatus `json:"status"`
ResultImageUUID Optional[string] `json:"result_image_uuid"`
Error Optional[string] `json:"error"`
DurationMs int64 `json:"duration_ms"`
ImageSizeBytes Optional[int64] `json:"image_size_bytes"`
ConsumedCPU Optional[float64] `json:"consumed_cpu"`
ConsumedMemory Optional[int64] `json:"consumed_memory"`
}
EventDataCompletion.MarshalJSON¶
MarshalJSON encodes EventDataCompletion with exact wire names.
func (m EventDataCompletion) MarshalJSON() ([]byte, error)
EventDataCompletion.UnmarshalJSON¶
UnmarshalJSON decodes EventDataCompletion and checks required fields.
func (m *EventDataCompletion) UnmarshalJSON(data []byte) error
type EventDataExit¶
EventDataExit is generated from the EventDataExit schema.
type EventDataExit struct {
OomKilled Optional[bool] `json:"oom_killed"`
Pid int64 `json:"pid"`
Code int64 `json:"code"`
Signal int64 `json:"signal"`
CoreDump Optional[bool] `json:"core_dump"`
TimedOut bool `json:"timed_out"`
DurationMs int64 `json:"duration_ms"`
Resources EventResources `json:"resources"`
}
EventDataExit.MarshalJSON¶
MarshalJSON encodes EventDataExit with exact wire names.
func (m EventDataExit) MarshalJSON() ([]byte, error)
EventDataExit.UnmarshalJSON¶
UnmarshalJSON decodes EventDataExit and checks required fields.
func (m *EventDataExit) UnmarshalJSON(data []byte) error
type EventDataFileUpload¶
EventDataFileUpload is generated from the EventDataFileUpload schema.
type EventDataFileUpload struct {
Handle string `json:"handle"`
FileUUID string `json:"file_uuid"`
Path string `json:"path"`
Unpack bool `json:"unpack"`
Replace bool `json:"replace"`
Merge bool `json:"merge"`
Bytes int64 `json:"bytes"`
Status string `json:"status"`
Error *string `json:"error"`
}
EventDataFileUpload.MarshalJSON¶
MarshalJSON encodes EventDataFileUpload with exact wire names.
func (m EventDataFileUpload) MarshalJSON() ([]byte, error)
EventDataFileUpload.UnmarshalJSON¶
UnmarshalJSON decodes EventDataFileUpload and checks required fields.
func (m *EventDataFileUpload) UnmarshalJSON(data []byte) error
type EventDataInit¶
EventDataInit is generated from the EventDataInit schema.
type EventDataInit struct {
StartedAt time.Time `json:"started_at"`
RuntimePath string `json:"runtime_path"`
Verbose bool `json:"verbose"`
InitPid int64 `json:"init_pid"`
Hostname Optional[string] `json:"hostname"`
Kernel Optional[string] `json:"kernel"`
Machine Optional[string] `json:"machine"`
BootID Optional[string] `json:"boot_id"`
}
EventDataInit.MarshalJSON¶
MarshalJSON encodes EventDataInit with exact wire names.
func (m EventDataInit) MarshalJSON() ([]byte, error)
EventDataInit.UnmarshalJSON¶
UnmarshalJSON decodes EventDataInit and checks required fields.
func (m *EventDataInit) UnmarshalJSON(data []byte) error
type EventDataInspect¶
EventDataInspect is generated from the EventDataInspect schema.
type EventDataInspect struct {
RequestID string `json:"request_id"`
Method string `json:"method"`
Phase string `json:"phase"`
Params Optional[EventInspectParameters] `json:"params"`
Status Optional[string] `json:"status"`
Error Optional[string] `json:"error"`
Handle Optional[string] `json:"handle"`
Bytes Optional[int64] `json:"bytes"`
Eof Optional[bool] `json:"eof"`
}
EventDataInspect.MarshalJSON¶
MarshalJSON encodes EventDataInspect with exact wire names.
func (m EventDataInspect) MarshalJSON() ([]byte, error)
EventDataInspect.UnmarshalJSON¶
UnmarshalJSON decodes EventDataInspect and checks required fields.
func (m *EventDataInspect) UnmarshalJSON(data []byte) error
type EventDataNetwork¶
EventDataNetwork is generated from the EventDataNetwork schema.
type EventDataNetwork struct {
Interfaces []NetworkInterface `json:"interfaces"`
Configured Optional[EventDataNetworkConfigured] `json:"configured"`
Error Optional[string] `json:"error"`
}
EventDataNetwork.MarshalJSON¶
MarshalJSON encodes EventDataNetwork with exact wire names.
func (m EventDataNetwork) MarshalJSON() ([]byte, error)
EventDataNetwork.UnmarshalJSON¶
UnmarshalJSON decodes EventDataNetwork and checks required fields.
func (m *EventDataNetwork) UnmarshalJSON(data []byte) error
type EventDataNetworkConfigured¶
EventDataNetworkConfigured is generated from the EventDataNetworkConfigured schema.
type EventDataNetworkConfigured struct {
IP4 Optional[string] `json:"ip4"`
IP4Gw Optional[string] `json:"ip4_gw"`
IP6 Optional[string] `json:"ip6"`
IP6Gw Optional[string] `json:"ip6_gw"`
GwMac Optional[string] `json:"gw_mac"`
Nameserver Optional[string] `json:"nameserver"`
}
EventDataNetworkConfigured.MarshalJSON¶
MarshalJSON encodes EventDataNetworkConfigured with exact wire names.
func (m EventDataNetworkConfigured) MarshalJSON() ([]byte, error)
EventDataNetworkConfigured.UnmarshalJSON¶
UnmarshalJSON decodes EventDataNetworkConfigured and checks required fields.
func (m *EventDataNetworkConfigured) UnmarshalJSON(data []byte) error
type EventDataShutdown¶
EventDataShutdown is generated from the EventDataShutdown schema.
type EventDataShutdown struct {
StoppedAt time.Time `json:"stopped_at"`
Reason string `json:"reason"`
}
EventDataShutdown.MarshalJSON¶
MarshalJSON encodes EventDataShutdown with exact wire names.
func (m EventDataShutdown) MarshalJSON() ([]byte, error)
EventDataShutdown.UnmarshalJSON¶
UnmarshalJSON decodes EventDataShutdown and checks required fields.
func (m *EventDataShutdown) UnmarshalJSON(data []byte) error
type EventDataSizeCap¶
EventDataSizeCap is generated from the EventDataSizeCap schema.
type EventDataSizeCap struct {
LimitBytes int64 `json:"limit_bytes"`
FileSize int64 `json:"file_size"`
}
EventDataSizeCap.MarshalJSON¶
MarshalJSON encodes EventDataSizeCap with exact wire names.
func (m EventDataSizeCap) MarshalJSON() ([]byte, error)
EventDataSizeCap.UnmarshalJSON¶
UnmarshalJSON decodes EventDataSizeCap and checks required fields.
func (m *EventDataSizeCap) UnmarshalJSON(data []byte) error
type EventDataSpawn¶
EventDataSpawn is generated from the EventDataSpawn schema.
type EventDataSpawn struct {
ResourcesLimits Optional[ProcessResourcesLimits] `json:"resources_limits"`
CPUAffinity Optional[[]int64] `json:"cpu_affinity"`
Pid int64 `json:"pid"`
Command string `json:"command"`
Args []string `json:"args"`
Shell bool `json:"shell"`
Cwd string `json:"cwd"`
UID int64 `json:"uid"`
GID int64 `json:"gid"`
Timeout int64 `json:"timeout"`
TruncateAt int64 `json:"truncate_at"`
Env Optional[map[string]string] `json:"env"`
}
EventDataSpawn.MarshalJSON¶
MarshalJSON encodes EventDataSpawn with exact wire names.
func (m EventDataSpawn) MarshalJSON() ([]byte, error)
EventDataSpawn.UnmarshalJSON¶
UnmarshalJSON decodes EventDataSpawn and checks required fields.
func (m *EventDataSpawn) UnmarshalJSON(data []byte) error
type EventDataStream¶
EventDataStream is generated from the EventDataStream schema.
type EventDataStream struct {
Value string `json:"value"`
Encoding string `json:"encoding"`
Truncated Optional[bool] `json:"truncated"`
}
NewEventDataStreamFromBytes¶
NewEventDataStreamFromBytes constructs a stream payload from bytes.
func NewEventDataStreamFromBytes(value []byte) EventDataStream
NewEventDataStreamFromText¶
NewEventDataStreamFromText constructs a stream payload from text.
func NewEventDataStreamFromText(value string) EventDataStream
EventDataStream.AsBytes¶
AsBytes decodes the stream payload to bytes.
func (m EventDataStream) AsBytes() []byte
EventDataStream.AsText¶
AsText decodes the stream payload to valid UTF-8 text.
func (m EventDataStream) AsText() string
EventDataStream.MarshalJSON¶
MarshalJSON encodes EventDataStream with exact wire names.
func (m EventDataStream) MarshalJSON() ([]byte, error)
EventDataStream.String¶
String returns the decoded payload text.
func (m EventDataStream) String() string
EventDataStream.UnmarshalJSON¶
UnmarshalJSON decodes EventDataStream and checks required fields.
func (m *EventDataStream) UnmarshalJSON(data []byte) error
type EventDataTruncated¶
EventDataTruncated is generated from the EventDataTruncated schema.
type EventDataTruncated struct {
Stream string `json:"stream"`
BytesEmitted int64 `json:"bytes_emitted"`
BytesDropped int64 `json:"bytes_dropped"`
}
EventDataTruncated.MarshalJSON¶
MarshalJSON encodes EventDataTruncated with exact wire names.
func (m EventDataTruncated) MarshalJSON() ([]byte, error)
EventDataTruncated.UnmarshalJSON¶
UnmarshalJSON decodes EventDataTruncated and checks required fields.
func (m *EventDataTruncated) UnmarshalJSON(data []byte) error
type EventInspectParameters¶
EventInspectParameters is generated from the EventInspectParameters schema.
type EventInspectParameters struct {
Path Optional[string] `json:"path"`
FileUUID Optional[string] `json:"file_uuid"`
Unpack Optional[bool] `json:"unpack"`
Replace Optional[bool] `json:"replace"`
Merge Optional[bool] `json:"merge"`
Handle Optional[string] `json:"handle"`
Offset Optional[int64] `json:"offset"`
Size Optional[int64] `json:"size"`
Options Optional[EventInspectParametersOptions] `json:"options"`
}
EventInspectParameters.MarshalJSON¶
MarshalJSON encodes EventInspectParameters with exact wire names.
func (m EventInspectParameters) MarshalJSON() ([]byte, error)
EventInspectParameters.UnmarshalJSON¶
UnmarshalJSON decodes EventInspectParameters and checks required fields.
func (m *EventInspectParameters) UnmarshalJSON(data []byte) error
type EventInspectParametersOptions¶
EventInspectParametersOptions is generated from the EventInspectParametersOptions schema.
type EventInspectParametersOptions struct {
Patterns *[]string `json:"patterns"`
Globs *[]string `json:"globs"`
Case string `json:"case"`
MaxCount int64 `json:"max_count"`
MaxTotal int64 `json:"max_total"`
Before int64 `json:"before"`
After int64 `json:"after"`
}
EventInspectParametersOptions.MarshalJSON¶
MarshalJSON encodes EventInspectParametersOptions with exact wire names.
func (m EventInspectParametersOptions) MarshalJSON() ([]byte, error)
EventInspectParametersOptions.UnmarshalJSON¶
UnmarshalJSON decodes EventInspectParametersOptions and checks required fields.
func (m *EventInspectParametersOptions) UnmarshalJSON(data []byte) error
type EventResources¶
EventResources is generated from the EventResources schema.
type EventResources struct {
UserTimeUs int64 `json:"user_time_us"`
SysTimeUs int64 `json:"sys_time_us"`
MaxRssKb int64 `json:"max_rss_kb"`
SharedMemory int64 `json:"shared_memory"`
UnsharedMemory int64 `json:"unshared_memory"`
Swaps int64 `json:"swaps"`
MinorFaults int64 `json:"minor_faults"`
MajorFaults int64 `json:"major_faults"`
VoluntaryCtxSwitches int64 `json:"voluntary_ctx_switches"`
InvoluntaryCtxSwitches int64 `json:"involuntary_ctx_switches"`
BlockInputOps int64 `json:"block_input_ops"`
BlockOutputOps int64 `json:"block_output_ops"`
IpcMsgsSent int64 `json:"ipc_msgs_sent"`
IpcMsgsReceived int64 `json:"ipc_msgs_received"`
SignalsReceived int64 `json:"signals_received"`
}
EventResources.MarshalJSON¶
MarshalJSON encodes EventResources with exact wire names.
func (m EventResources) MarshalJSON() ([]byte, error)
EventResources.UnmarshalJSON¶
UnmarshalJSON decodes EventResources and checks required fields.
func (m *EventResources) UnmarshalJSON(data []byte) error
type ExecSpec¶
ExecSpec is generated from the ExecSpec schema.
type ExecSpec struct {
ResourcesLimits Optional[ProcessResourcesLimits] `json:"resources_limits"`
Command string `json:"command"`
Args Optional[[]string] `json:"args"`
Shell Optional[bool] `json:"shell"`
Env Optional[map[string]string] `json:"env"`
Cwd Optional[string] `json:"cwd"`
UID Optional[int64] `json:"uid"`
GID Optional[int64] `json:"gid"`
Stdin Optional[ClosableStreamRepr] `json:"stdin"`
TruncateOutputAt Optional[int64] `json:"truncate_output_at"`
}
ExecSpec.MarshalJSON¶
MarshalJSON encodes ExecSpec with exact wire names.
func (m ExecSpec) MarshalJSON() ([]byte, error)
ExecSpec.UnmarshalJSON¶
UnmarshalJSON decodes ExecSpec and checks required fields.
func (m *ExecSpec) UnmarshalJSON(data []byte) error
type File¶
File is generated from the File schema.
type File struct {
UUID string `json:"uuid"`
SHA256 string `json:"sha256"`
Size int64 `json:"size"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
File.MarshalJSON¶
MarshalJSON encodes File with exact wire names.
func (m File) MarshalJSON() ([]byte, error)
File.UnmarshalJSON¶
UnmarshalJSON decodes File and checks required fields.
func (m *File) UnmarshalJSON(data []byte) error
type FileItem¶
FileItem is generated from the FileItem schema.
type FileItem struct {
Size int64 `json:"size"`
Path string `json:"path"`
Owner StringOrInt64 `json:"owner"`
Group StringOrInt64 `json:"group"`
UID int64 `json:"uid"`
GID int64 `json:"gid"`
Mode int64 `json:"mode"`
Mtime int64 `json:"mtime"`
Nlink int64 `json:"nlink"`
IsDir bool `json:"is_dir"`
IsRegular bool `json:"is_regular"`
IsSymlink bool `json:"is_symlink"`
IsSocket bool `json:"is_socket"`
IsFifo bool `json:"is_fifo"`
SymlinkTo string `json:"symlink_to"`
}
FileItem.MarshalJSON¶
MarshalJSON encodes FileItem with exact wire names.
func (m FileItem) MarshalJSON() ([]byte, error)
FileItem.UnmarshalJSON¶
UnmarshalJSON decodes FileItem and checks required fields.
func (m *FileItem) UnmarshalJSON(data []byte) error
type FileResponse¶
FileResponse is generated from the FileResponse schema.
type FileResponse struct {
UUID string `json:"uuid"`
SHA256 string `json:"sha256"`
Size int64 `json:"size"`
}
FileResponse.MarshalJSON¶
MarshalJSON encodes FileResponse with exact wire names.
func (m FileResponse) MarshalJSON() ([]byte, error)
FileResponse.UnmarshalJSON¶
UnmarshalJSON decodes FileResponse and checks required fields.
func (m *FileResponse) UnmarshalJSON(data []byte) error
type FileSpec¶
FileSpec is generated from the FileSpec schema.
type FileSpec struct {
UUID Optional[string] `json:"uuid"`
UID Optional[int64] `json:"uid"`
GID Optional[int64] `json:"gid"`
Mode Optional[StringOrInt64] `json:"mode"`
}
FileSpec.MarshalJSON¶
MarshalJSON encodes FileSpec with exact wire names.
func (m FileSpec) MarshalJSON() ([]byte, error)
FileSpec.NormalizeMode¶
NormalizeMode converts an integer mode to its wire-format octal string.
func (m *FileSpec) NormalizeMode()
FileSpec.SetMode¶
SetMode stores mode in the wire-format octal representation.
func (m *FileSpec) SetMode(mode int64)
FileSpec.UnmarshalJSON¶
UnmarshalJSON decodes FileSpec and checks required fields.
func (m *FileSpec) UnmarshalJSON(data []byte) error
type FilesListResponse¶
FilesListResponse is generated from the FilesListResponse schema.
type FilesListResponse struct {
Files Optional[[]File] `json:"files"`
}
FilesListResponse.MarshalJSON¶
MarshalJSON encodes FilesListResponse with exact wire names.
func (m FilesListResponse) MarshalJSON() ([]byte, error)
FilesListResponse.UnmarshalJSON¶
UnmarshalJSON decodes FilesListResponse and checks required fields.
func (m *FilesListResponse) UnmarshalJSON(data []byte) error
type FollowOperationEventsOptions¶
FollowOperationEventsOptions controls a reconnecting operation event stream. Live following switches to a finite retained-event read after terminal status.
type FollowOperationEventsOptions struct {
SPID *int64
Since *int64
LastEventID *int64
// IdleTimeout is the maximum gap between incoming SSE data in seconds.
// Nil uses 15 seconds. Zero disables the limit. Ping frames reset it.
IdleTimeout *float64
}
type GetOperationStatusOptions¶
GetOperationStatusOptions contains optional arguments for GetOperationStatus.
type GetOperationStatusOptions struct {
Inflight bool
}
type GoneError¶
GoneError is returned for an unexpected HTTP 410 response.
type GoneError struct{ *APIStatusError }
GoneError.Error¶
func (e GoneError) Error() string
GoneError.Unwrap¶
func (e *GoneError) Unwrap() error
type GrepMatch¶
GrepMatch is generated from the GrepMatch schema.
type GrepMatch struct {
Path string `json:"path"`
LineNumber int64 `json:"line_number"`
AbsoluteOffset int64 `json:"absolute_offset"`
LineText string `json:"line_text"`
LineBytes int64 `json:"line_bytes"`
Submatches []GrepSubmatch `json:"submatches"`
Type string `json:"type"`
}
GrepMatch.AsText¶
AsText formats one grep row with its path, line number, and trailing newline.
func (m GrepMatch) AsText() string
GrepMatch.MarshalJSON¶
MarshalJSON encodes GrepMatch with exact wire names.
func (m GrepMatch) MarshalJSON() ([]byte, error)
GrepMatch.String¶
String returns the formatted grep row.
func (m GrepMatch) String() string
GrepMatch.UnmarshalJSON¶
UnmarshalJSON decodes GrepMatch and checks required fields.
func (m *GrepMatch) UnmarshalJSON(data []byte) error
type GrepResult¶
GrepResult is generated from the GrepResult schema.
type GrepResult struct {
Path string `json:"path"`
Patterns []string `json:"patterns"`
Matches []GrepMatch `json:"matches"`
Truncated bool `json:"truncated"`
}
GrepResult.AsText¶
AsText formats grep rows in response order, separating disjoint context groups.
func (m GrepResult) AsText() string
GrepResult.MarshalJSON¶
MarshalJSON encodes GrepResult with exact wire names.
func (m GrepResult) MarshalJSON() ([]byte, error)
GrepResult.String¶
String returns the formatted grep results.
func (m GrepResult) String() string
GrepResult.UnmarshalJSON¶
UnmarshalJSON decodes GrepResult and checks required fields.
func (m *GrepResult) UnmarshalJSON(data []byte) error
type GrepSubmatch¶
GrepSubmatch is generated from the GrepSubmatch schema.
type GrepSubmatch struct {
Text string `json:"text"`
Start int64 `json:"start"`
End int64 `json:"end"`
}
GrepSubmatch.MarshalJSON¶
MarshalJSON encodes GrepSubmatch with exact wire names.
func (m GrepSubmatch) MarshalJSON() ([]byte, error)
GrepSubmatch.UnmarshalJSON¶
UnmarshalJSON decodes GrepSubmatch and checks required fields.
func (m *GrepSubmatch) UnmarshalJSON(data []byte) error
type Image¶
Image is generated from the Image schema.
type Image struct {
UUID Optional[string] `json:"uuid"`
Tag Optional[string] `json:"tag"`
CreatedAt Optional[string] `json:"created_at"`
OperationUUID Optional[string] `json:"operation_uuid"`
}
Image.MarshalJSON¶
MarshalJSON encodes Image with exact wire names.
func (m Image) MarshalJSON() ([]byte, error)
Image.UnmarshalJSON¶
UnmarshalJSON decodes Image and checks required fields.
func (m *Image) UnmarshalJSON(data []byte) error
type ImageImportMetadata¶
ImageImportMetadata is generated from the ImageImportMetadata schema.
type ImageImportMetadata struct {
Registry Optional[ImageImportMetadataRegistry] `json:"registry"`
Tag Optional[string] `json:"tag"`
Timeout Optional[int64] `json:"timeout"`
}
ImageImportMetadata.MarshalJSON¶
MarshalJSON encodes ImageImportMetadata with exact wire names.
func (m ImageImportMetadata) MarshalJSON() ([]byte, error)
ImageImportMetadata.UnmarshalJSON¶
UnmarshalJSON decodes ImageImportMetadata and checks required fields.
func (m *ImageImportMetadata) UnmarshalJSON(data []byte) error
type ImageImportMetadataRegistry¶
ImageImportMetadataRegistry is generated from the ImageImportMetadataRegistry schema.
type ImageImportMetadataRegistry struct {
URL Optional[string] `json:"url"`
Credentials Optional[ImageImportMetadataRegistryCredentials] `json:"credentials"`
}
ImageImportMetadataRegistry.MarshalJSON¶
MarshalJSON encodes ImageImportMetadataRegistry with exact wire names.
func (m ImageImportMetadataRegistry) MarshalJSON() ([]byte, error)
ImageImportMetadataRegistry.UnmarshalJSON¶
UnmarshalJSON decodes ImageImportMetadataRegistry and checks required fields.
func (m *ImageImportMetadataRegistry) UnmarshalJSON(data []byte) error
type ImageImportMetadataRegistryCredentials¶
ImageImportMetadataRegistryCredentials is generated from the ImageImportMetadataRegistryCredentials schema.
type ImageImportMetadataRegistryCredentials struct {
Username Optional[string] `json:"username"`
Password Optional[string] `json:"password"`
}
ImageImportMetadataRegistryCredentials.MarshalJSON¶
MarshalJSON encodes ImageImportMetadataRegistryCredentials with exact wire names.
func (m ImageImportMetadataRegistryCredentials) MarshalJSON() ([]byte, error)
ImageImportMetadataRegistryCredentials.UnmarshalJSON¶
UnmarshalJSON decodes ImageImportMetadataRegistryCredentials and checks required fields.
func (m *ImageImportMetadataRegistryCredentials) UnmarshalJSON(data []byte) error
type ImageImportRegistry¶
ImageImportRegistry is generated from the ImageImportRegistry schema.
type ImageImportRegistry struct {
URL string `json:"url"`
Credentials Optional[ImageImportRegistryCredentials] `json:"credentials"`
}
ImageImportRegistry.MarshalJSON¶
MarshalJSON encodes ImageImportRegistry with exact wire names.
func (m ImageImportRegistry) MarshalJSON() ([]byte, error)
ImageImportRegistry.UnmarshalJSON¶
UnmarshalJSON decodes ImageImportRegistry and checks required fields.
func (m *ImageImportRegistry) UnmarshalJSON(data []byte) error
type ImageImportRegistryCredentials¶
ImageImportRegistryCredentials is generated from the ImageImportRegistryCredentials schema.
type ImageImportRegistryCredentials struct {
Username Optional[string] `json:"username"`
Password Optional[string] `json:"password"`
}
ImageImportRegistryCredentials.MarshalJSON¶
MarshalJSON encodes ImageImportRegistryCredentials with exact wire names.
func (m ImageImportRegistryCredentials) MarshalJSON() ([]byte, error)
ImageImportRegistryCredentials.UnmarshalJSON¶
UnmarshalJSON decodes ImageImportRegistryCredentials and checks required fields.
func (m *ImageImportRegistryCredentials) UnmarshalJSON(data []byte) error
type ImageImportRequest¶
ImageImportRequest is generated from the ImageImportRequest schema.
type ImageImportRequest struct {
Registry ImageImportRegistry `json:"registry"`
Tag Optional[string] `json:"tag"`
Timeout Optional[int64] `json:"timeout"`
}
ImageImportRequest.MarshalJSON¶
MarshalJSON encodes ImageImportRequest with exact wire names.
func (m ImageImportRequest) MarshalJSON() ([]byte, error)
ImageImportRequest.UnmarshalJSON¶
UnmarshalJSON decodes ImageImportRequest and checks required fields.
func (m *ImageImportRequest) UnmarshalJSON(data []byte) error
type ImageListResponse¶
ImageListResponse is generated from the ImageListResponse schema.
type ImageListResponse struct {
Images Optional[[]Image] `json:"images"`
}
ImageListResponse.MarshalJSON¶
MarshalJSON encodes ImageListResponse with exact wire names.
func (m ImageListResponse) MarshalJSON() ([]byte, error)
ImageListResponse.UnmarshalJSON¶
UnmarshalJSON decodes ImageListResponse and checks required fields.
func (m *ImageListResponse) UnmarshalJSON(data []byte) error
type ImportImageOptions¶
ImportImageOptions contains optional arguments for ImportImage.
type ImportImageOptions struct {
Tag Optional[string]
Timeout Optional[int64]
}
type InspectImageGrepOptions¶
InspectImageGrepOptions contains optional arguments for InspectImageGrep.
type InspectImageGrepOptions struct {
Path *[]string
Glob *[]string
MaxCount *int64
MaxTotal *int64
Case *string
Before *int64
After *int64
}
type InspectInstanceGrepOptions¶
InspectInstanceGrepOptions contains optional arguments for InspectInstanceGrep.
type InspectInstanceGrepOptions struct {
Path *[]string
Glob *[]string
MaxCount *int64
MaxTotal *int64
Case *string
Before *int64
After *int64
}
type InstanceNetworking¶
InstanceNetworking is generated from the InstanceNetworking schema.
type InstanceNetworking struct {
Enabled Optional[bool] `json:"enabled"`
Policy Optional[[]string] `json:"policy"`
}
InstanceNetworking.MarshalJSON¶
MarshalJSON encodes InstanceNetworking with exact wire names.
func (m InstanceNetworking) MarshalJSON() ([]byte, error)
InstanceNetworking.UnmarshalJSON¶
UnmarshalJSON decodes InstanceNetworking and checks required fields.
func (m *InstanceNetworking) UnmarshalJSON(data []byte) error
type InstanceNetworkingResponse¶
InstanceNetworkingResponse is generated from the InstanceNetworkingResponse schema.
type InstanceNetworkingResponse struct {
Enabled Optional[bool] `json:"enabled"`
Policy Optional[[]string] `json:"policy"`
EffectivePolicy Optional[NetworkPolicyCreateRequest] `json:"effective_policy"`
}
InstanceNetworkingResponse.MarshalJSON¶
MarshalJSON encodes InstanceNetworkingResponse with exact wire names.
func (m InstanceNetworkingResponse) MarshalJSON() ([]byte, error)
InstanceNetworkingResponse.UnmarshalJSON¶
UnmarshalJSON decodes InstanceNetworkingResponse and checks required fields.
func (m *InstanceNetworkingResponse) UnmarshalJSON(data []byte) error
type InstanceResourcesLimits¶
InstanceResourcesLimits is generated from the InstanceResourcesLimits schema.
type InstanceResourcesLimits struct {
CPU Optional[int64] `json:"cpu"`
MemoryMib Optional[int64] `json:"memory_mib"`
MaxLayerBytes Optional[int64] `json:"max_layer_bytes"`
}
InstanceResourcesLimits.MarshalJSON¶
MarshalJSON encodes InstanceResourcesLimits with exact wire names.
func (m InstanceResourcesLimits) MarshalJSON() ([]byte, error)
InstanceResourcesLimits.UnmarshalJSON¶
UnmarshalJSON decodes InstanceResourcesLimits and checks required fields.
func (m *InstanceResourcesLimits) UnmarshalJSON(data []byte) error
type InstanceResult¶
InstanceResult is generated from the InstanceResult schema.
type InstanceResult struct {
Resources Optional[InstanceResultResources] `json:"resources"`
State Optional[InstanceResultState] `json:"state"`
Stdout Optional[StreamRepr] `json:"stdout"`
Stderr Optional[StreamRepr] `json:"stderr"`
}
InstanceResult.MarshalJSON¶
MarshalJSON encodes InstanceResult with exact wire names.
func (m InstanceResult) MarshalJSON() ([]byte, error)
InstanceResult.UnmarshalJSON¶
UnmarshalJSON decodes InstanceResult and checks required fields.
func (m *InstanceResult) UnmarshalJSON(data []byte) error
type InstanceResultResources¶
InstanceResultResources is generated from the InstanceResultResources schema.
type InstanceResultResources struct {
BlockInput Optional[int64] `json:"block_input"`
BlockOutput Optional[int64] `json:"block_output"`
Cost Optional[float64] `json:"cost"`
ElapsedTime Optional[float64] `json:"elapsed_time"`
InvoluntarySwitches Optional[int64] `json:"involuntary_switches"`
MaxRss Optional[int64] `json:"max_rss"`
MonotonicTime Optional[float64] `json:"monotonic_time"`
PageFaults Optional[int64] `json:"page_faults"`
PageFaultsIo Optional[int64] `json:"page_faults_io"`
SharedMemory Optional[int64] `json:"shared_memory"`
Signals Optional[int64] `json:"signals"`
Swaps Optional[int64] `json:"swaps"`
SystemCPUTime Optional[float64] `json:"system_cpu_time"`
UnsharedMemory Optional[int64] `json:"unshared_memory"`
UserCPUTime Optional[float64] `json:"user_cpu_time"`
VoluntarySwitches Optional[int64] `json:"voluntary_switches"`
}
InstanceResultResources.MarshalJSON¶
MarshalJSON encodes InstanceResultResources with exact wire names.
func (m InstanceResultResources) MarshalJSON() ([]byte, error)
InstanceResultResources.UnmarshalJSON¶
UnmarshalJSON decodes InstanceResultResources and checks required fields.
func (m *InstanceResultResources) UnmarshalJSON(data []byte) error
type InstanceResultState¶
InstanceResultState is generated from the InstanceResultState schema.
type InstanceResultState struct {
Continued Optional[bool] `json:"continued"`
CoreDump Optional[bool] `json:"core_dump"`
ExitCode Optional[int64] `json:"exit_code"`
Pid Optional[int64] `json:"pid"`
Signal Optional[int64] `json:"signal"`
Stopped Optional[bool] `json:"stopped"`
TimedOut Optional[bool] `json:"timed_out"`
OomKilled Optional[bool] `json:"oom_killed"`
}
InstanceResultState.MarshalJSON¶
MarshalJSON encodes InstanceResultState with exact wire names.
func (m InstanceResultState) MarshalJSON() ([]byte, error)
InstanceResultState.UnmarshalJSON¶
UnmarshalJSON decodes InstanceResultState and checks required fields.
func (m *InstanceResultState) UnmarshalJSON(data []byte) error
type InstanceSpawnRequest¶
InstanceSpawnRequest is generated from the InstanceSpawnRequest schema.
type InstanceSpawnRequest struct {
Command string `json:"command"`
Disposable Optional[bool] `json:"disposable"`
Hostname Optional[string] `json:"hostname"`
Image string `json:"image"`
Args Optional[[]string] `json:"args"`
Shell Optional[bool] `json:"shell"`
Env Optional[map[string]string] `json:"env"`
PreserveEnv Optional[bool] `json:"preserve_env"`
PreserveCwd Optional[bool] `json:"preserve_cwd"`
Cwd Optional[string] `json:"cwd"`
UID Optional[int64] `json:"uid"`
GID Optional[int64] `json:"gid"`
ResourcesLimits Optional[InstanceResourcesLimits] `json:"resources_limits"`
Networking Optional[InstanceNetworking] `json:"networking"`
Stdin Optional[ClosableStreamRepr] `json:"stdin"`
Timeout Optional[int64] `json:"timeout"`
TruncateOutputAt Optional[int64] `json:"truncate_output_at"`
Files Optional[map[string]FileSpec] `json:"files"`
}
InstanceSpawnRequest.MarshalJSON¶
MarshalJSON encodes InstanceSpawnRequest with exact wire names.
func (m InstanceSpawnRequest) MarshalJSON() ([]byte, error)
InstanceSpawnRequest.UnmarshalJSON¶
UnmarshalJSON decodes InstanceSpawnRequest and checks required fields.
func (m *InstanceSpawnRequest) UnmarshalJSON(data []byte) error
type InstanceSpawnResponse¶
InstanceSpawnResponse is generated from the InstanceSpawnResponse schema.
type InstanceSpawnResponse struct {
UUID Optional[string] `json:"uuid"`
Command Optional[string] `json:"command"`
Image Optional[string] `json:"image"`
Hostname Optional[string] `json:"hostname"`
Args Optional[[]string] `json:"args"`
Shell Optional[bool] `json:"shell"`
Env Optional[map[string]string] `json:"env"`
PreserveEnv Optional[bool] `json:"preserve_env"`
Cwd Optional[string] `json:"cwd"`
UID Optional[int64] `json:"uid"`
GID Optional[int64] `json:"gid"`
ResourcesLimits Optional[InstanceResourcesLimits] `json:"resources_limits"`
Networking Optional[InstanceNetworkingResponse] `json:"networking"`
Stdin Optional[ClosableStreamRepr] `json:"stdin"`
Timeout Optional[int64] `json:"timeout"`
TruncateOutputAt Optional[int64] `json:"truncate_output_at"`
Disposable Optional[bool] `json:"disposable"`
Files Optional[map[string]FileSpec] `json:"files"`
Result Optional[InstanceResult] `json:"result"`
}
InstanceSpawnResponse.MarshalJSON¶
MarshalJSON encodes InstanceSpawnResponse with exact wire names.
func (m InstanceSpawnResponse) MarshalJSON() ([]byte, error)
InstanceSpawnResponse.UnmarshalJSON¶
UnmarshalJSON decodes InstanceSpawnResponse and checks required fields.
func (m *InstanceSpawnResponse) UnmarshalJSON(data []byte) error
type IterFilesOptions¶
IterFilesOptions configures IterFiles.
type IterFilesOptions struct {
// PageSize is the number of items requested per page. Zero uses 1000.
PageSize int64
// Limit bounds the total item count. Nil requests all items.
Limit *int64
Since *any
Until *any
}
type IterImagesOptions¶
IterImagesOptions configures IterImages.
type IterImagesOptions struct {
// PageSize is the number of items requested per page. Zero uses 1000.
PageSize int64
// Limit bounds the total item count. Nil requests all items.
Limit *int64
Tagged bool
Tag *string
UUID *string
Since *any
Until *any
}
type IterOperationEventsOptions¶
IterOperationEventsOptions contains optional arguments for IterOperationEvents.
type IterOperationEventsOptions struct {
Follow bool
Spid *int64
Since *int64
LastEventID *int64
}
type IterOperationsOptions¶
IterOperationsOptions configures IterOperations.
type IterOperationsOptions struct {
// PageSize is the number of items requested per page. Zero uses 1000.
PageSize int64
// Limit bounds the total item count. Nil requests all items.
Limit *int64
Status *OperationStatus
Kind *string
Since *any
Until *any
}
type ListFilesOptions¶
ListFilesOptions contains optional arguments for ListFiles.
type ListFilesOptions struct {
Limit *int64
Offset *int64
Since *any
Until *any
}
type ListImagesOptions¶
ListImagesOptions contains optional arguments for ListImages.
type ListImagesOptions struct {
Limit *int64
Offset *int64
Tagged bool
Tag *string
UUID *string
Since *any
Until *any
}
type ListNetworkPoliciesOptions¶
ListNetworkPoliciesOptions contains optional arguments for ListNetworkPolicies.
type ListNetworkPoliciesOptions struct {
Search *string
Limit *int64
Offset *int64
}
type ListOperationsOptions¶
ListOperationsOptions contains optional arguments for ListOperations.
type ListOperationsOptions struct {
Limit *int64
Offset *int64
Status *OperationStatus
Kind *string
Since *any
Until *any
}
type MockCall¶
MockCall records an HTTP attempt, including attempts made by helpers and retries. Operation is the canonical generated method name. PathParams uses the wire parameter names. Body contains the serialized request body.
type MockCall struct {
Operation string
Method string
URL string
Path string
PathParams map[string]string
Query url.Values
Header http.Header
Body []byte
}
type MockResponse¶
MockResponse supplies a wire response for MockHTTP. BodyError, when set, is returned after all Body bytes have been read. StatusCode must be explicit.
type MockResponse struct {
StatusCode int
Header http.Header
Body []byte
BodyError error
}
type MockTransport¶
MockTransport is an offline HTTP transport with outcome queues and a call log. Its zero value is ready to use. Configuration, requests, and log access are safe for concurrent use. Each queue repeats its last outcome.
Mock operation names, such as SpawnInstance or ListImages. Helpers such as SpawnInstance, EnsureFile, and IterImages execute normally through those mocks. Full-response and byte-stream aliases share the operation’s queue and call log.
type MockTransport struct {
// contains filtered or unexported fields
}
MockTransport.Calls¶
Calls returns an independent snapshot of all recorded HTTP attempts.
func (m *MockTransport) Calls() []MockCall
MockTransport.CallsFor¶
CallsFor returns a snapshot for one generated operation, in request order. Unknown names return an empty snapshot. Stream aliases use the canonical name.
func (m *MockTransport) CallsFor(operation string) []MockCall
MockTransport.Mock¶
Mock queues a typed result for a generated operation. Use an Op descriptor, model values for JSON, struct{}{} for empty responses, []byte for byte responses, and []OperationEvent for SSE responses. Results are serialized now and decoded by the real client when called.
func (m *MockTransport) Mock[T any](operation Operation[T], result T) error
MockTransport.MockError¶
MockError queues an error. APIStatusError and its typed wrappers become HTTP responses, so status handling and retries run normally. Other errors become transport failures wrapped in APIConnectionError and remain accessible through errors.Is and errors.As. Nil errors are rejected.
func (m *MockTransport) MockError(operation string, err error) error
MockTransport.MockHTTP¶
MockHTTP queues an exact HTTP response. Use it for malformed JSON, specific status codes or headers, and encoded bodies such as gzip. Input bytes and headers are copied, and each call receives a fresh response body.
func (m *MockTransport) MockHTTP(operation string, response MockResponse) error
MockTransport.MockStream¶
MockStream queues byte or SSE results followed by a read error. Result uses the same representation as Mock. A nil error produces normal end-of-stream.
func (m *MockTransport) MockStream[T any](operation Operation[T], result T, err error) error
MockTransport.RoundTrip¶
RoundTrip records the request and returns its next configured outcome. It never opens a connection. Unconfigured requests return NotMockedError.
func (m *MockTransport) RoundTrip(request *http.Request) (*http.Response, error)
type NetworkInterface¶
NetworkInterface is generated from the NetworkInterface schema.
type NetworkInterface struct {
Name string `json:"name"`
RxBytes int64 `json:"rx_bytes"`
RxPackets int64 `json:"rx_packets"`
RxErrs int64 `json:"rx_errs"`
RxDrop int64 `json:"rx_drop"`
TxBytes int64 `json:"tx_bytes"`
TxPackets int64 `json:"tx_packets"`
TxErrs int64 `json:"tx_errs"`
TxDrop int64 `json:"tx_drop"`
}
NetworkInterface.MarshalJSON¶
MarshalJSON encodes NetworkInterface with exact wire names.
func (m NetworkInterface) MarshalJSON() ([]byte, error)
NetworkInterface.UnmarshalJSON¶
UnmarshalJSON decodes NetworkInterface and checks required fields.
func (m *NetworkInterface) UnmarshalJSON(data []byte) error
type NetworkPolicy¶
NetworkPolicy is generated from the NetworkPolicy schema.
type NetworkPolicy struct {
UUID string `json:"uuid"`
Cidrs []NetworkPolicyCidrRule `json:"cidrs"`
}
NetworkPolicy.MarshalJSON¶
MarshalJSON encodes NetworkPolicy with exact wire names.
func (m NetworkPolicy) MarshalJSON() ([]byte, error)
NetworkPolicy.UnmarshalJSON¶
UnmarshalJSON decodes NetworkPolicy and checks required fields.
func (m *NetworkPolicy) UnmarshalJSON(data []byte) error
type NetworkPolicyCidrRule¶
NetworkPolicyCidrRule is generated from the NetworkPolicyCIDRRule schema.
type NetworkPolicyCidrRule struct {
Cidr string `json:"cidr"`
Proto string `json:"proto"`
Ports Optional[[]int64] `json:"ports"`
}
NetworkPolicyCidrRule.MarshalJSON¶
MarshalJSON encodes NetworkPolicyCidrRule with exact wire names.
func (m NetworkPolicyCidrRule) MarshalJSON() ([]byte, error)
NetworkPolicyCidrRule.UnmarshalJSON¶
UnmarshalJSON decodes NetworkPolicyCidrRule and checks required fields.
func (m *NetworkPolicyCidrRule) UnmarshalJSON(data []byte) error
type NetworkPolicyCreateRequest¶
NetworkPolicyCreateRequest is generated from the NetworkPolicyCreateRequest schema.
type NetworkPolicyCreateRequest struct {
Cidrs []NetworkPolicyCidrRule `json:"cidrs"`
}
NetworkPolicyCreateRequest.MarshalJSON¶
MarshalJSON encodes NetworkPolicyCreateRequest with exact wire names.
func (m NetworkPolicyCreateRequest) MarshalJSON() ([]byte, error)
NetworkPolicyCreateRequest.UnmarshalJSON¶
UnmarshalJSON decodes NetworkPolicyCreateRequest and checks required fields.
func (m *NetworkPolicyCreateRequest) UnmarshalJSON(data []byte) error
type NetworkPolicyListItem¶
NetworkPolicyListItem is generated from the NetworkPolicyListItem schema.
type NetworkPolicyListItem struct {
UUID string `json:"uuid"`
CreatedAt time.Time `json:"created_at"`
Tags []string `json:"tags"`
Summary NetworkPolicyListItemSummary `json:"summary"`
}
NetworkPolicyListItem.MarshalJSON¶
MarshalJSON encodes NetworkPolicyListItem with exact wire names.
func (m NetworkPolicyListItem) MarshalJSON() ([]byte, error)
NetworkPolicyListItem.UnmarshalJSON¶
UnmarshalJSON decodes NetworkPolicyListItem and checks required fields.
func (m *NetworkPolicyListItem) UnmarshalJSON(data []byte) error
type NetworkPolicyListItemSummary¶
NetworkPolicyListItemSummary is generated from the NetworkPolicyListItemSummary schema.
type NetworkPolicyListItemSummary struct {
Cidrs int64 `json:"cidrs"`
}
NetworkPolicyListItemSummary.MarshalJSON¶
MarshalJSON encodes NetworkPolicyListItemSummary with exact wire names.
func (m NetworkPolicyListItemSummary) MarshalJSON() ([]byte, error)
NetworkPolicyListItemSummary.UnmarshalJSON¶
UnmarshalJSON decodes NetworkPolicyListItemSummary and checks required fields.
func (m *NetworkPolicyListItemSummary) UnmarshalJSON(data []byte) error
type NetworkPolicyListResponse¶
NetworkPolicyListResponse is generated from the NetworkPolicyListResponse schema.
type NetworkPolicyListResponse struct {
Policies []NetworkPolicyListItem `json:"policies"`
}
NetworkPolicyListResponse.MarshalJSON¶
MarshalJSON encodes NetworkPolicyListResponse with exact wire names.
func (m NetworkPolicyListResponse) MarshalJSON() ([]byte, error)
NetworkPolicyListResponse.UnmarshalJSON¶
UnmarshalJSON decodes NetworkPolicyListResponse and checks required fields.
func (m *NetworkPolicyListResponse) UnmarshalJSON(data []byte) error
type NetworkPolicyTag¶
NetworkPolicyTag is generated from the NetworkPolicyTag schema.
type NetworkPolicyTag struct {
Tag string `json:"tag"`
UUID string `json:"uuid"`
}
NetworkPolicyTag.MarshalJSON¶
MarshalJSON encodes NetworkPolicyTag with exact wire names.
func (m NetworkPolicyTag) MarshalJSON() ([]byte, error)
NetworkPolicyTag.UnmarshalJSON¶
UnmarshalJSON decodes NetworkPolicyTag and checks required fields.
func (m *NetworkPolicyTag) UnmarshalJSON(data []byte) error
type NotFoundError¶
NotFoundError is returned for an unexpected HTTP 404 response.
type NotFoundError struct{ *APIStatusError }
NotFoundError.Error¶
func (e NotFoundError) Error() string
NotFoundError.Unwrap¶
func (e *NotFoundError) Unwrap() error
type NotMockedError¶
NotMockedError reports a request without a configured outcome. Client methods wrap it in APIConnectionError; errors.As can recover it.
type NotMockedError struct {
Operation string
Method string
Path string
}
NotMockedError.Error¶
func (e *NotMockedError) Error() string
type Operation¶
Operation links a generated endpoint to its mock result type. Use the generated Op values. The zero value is invalid.
type Operation[T any] struct {
// contains filtered or unexported fields
}
Operation.Name¶
Name returns the canonical name used by MockHTTP, MockError, and CallsFor.
func (op Operation[T]) Name() string
type OperationEvent¶
OperationEvent is generated from the OperationEvent schema.
type OperationEvent struct {
ID int64 `json:"id"`
Ts time.Time `json:"ts"`
Spid Optional[int64] `json:"spid"`
Type OperationEventType `json:"type"`
Data EventData `json:"data"`
}
OperationEvent.MarshalJSON¶
MarshalJSON encodes OperationEvent with exact wire names.
func (m OperationEvent) MarshalJSON() ([]byte, error)
OperationEvent.UnmarshalJSON¶
UnmarshalJSON decodes OperationEvent and checks required fields.
func (m *OperationEvent) UnmarshalJSON(data []byte) error
type OperationEventType¶
OperationEventType identifies an operation event payload.
type OperationEventType string
const OperationEventTypeInit (group)¶
const (
OperationEventTypeInit OperationEventType = "init"
OperationEventTypeSpawn OperationEventType = "spawn"
OperationEventTypeStdin OperationEventType = "stdin"
OperationEventTypeStdout OperationEventType = "stdout"
OperationEventTypeStderr OperationEventType = "stderr"
OperationEventTypeExit OperationEventType = "exit"
OperationEventTypeTruncated OperationEventType = "truncated"
OperationEventTypeSizeCap OperationEventType = "size_cap"
OperationEventTypeNetwork OperationEventType = "network"
OperationEventTypeShutdown OperationEventType = "shutdown"
OperationEventTypeInspect OperationEventType = "inspect"
OperationEventTypeFileUpload OperationEventType = "file_upload"
OperationEventTypeCompletion OperationEventType = "completion"
)
type OperationInstanceMetadata¶
OperationInstanceMetadata is generated from the OperationInstanceMetadata schema.
type OperationInstanceMetadata struct {
Command string `json:"command"`
Disposable Optional[bool] `json:"disposable"`
Hostname Optional[string] `json:"hostname"`
Image string `json:"image"`
Args Optional[[]string] `json:"args"`
Shell Optional[bool] `json:"shell"`
Env Optional[map[string]string] `json:"env"`
PreserveEnv Optional[bool] `json:"preserve_env"`
PreserveCwd Optional[bool] `json:"preserve_cwd"`
Cwd Optional[string] `json:"cwd"`
UID Optional[int64] `json:"uid"`
GID Optional[int64] `json:"gid"`
ResourcesLimits Optional[InstanceResourcesLimits] `json:"resources_limits"`
Networking Optional[InstanceNetworkingResponse] `json:"networking"`
Stdin Optional[ClosableStreamRepr] `json:"stdin"`
Timeout Optional[int64] `json:"timeout"`
TruncateOutputAt Optional[int64] `json:"truncate_output_at"`
Files Optional[map[string]FileSpec] `json:"files"`
Result Optional[InstanceResult] `json:"result"`
}
OperationInstanceMetadata.MarshalJSON¶
MarshalJSON encodes OperationInstanceMetadata with exact wire names.
func (m OperationInstanceMetadata) MarshalJSON() ([]byte, error)
OperationInstanceMetadata.UnmarshalJSON¶
UnmarshalJSON decodes OperationInstanceMetadata and checks required fields.
func (m *OperationInstanceMetadata) UnmarshalJSON(data []byte) error
type OperationResponse¶
OperationResponse is generated from the OperationResponse schema.
type OperationResponse struct {
UUID Optional[string] `json:"uuid"`
Kind Optional[string] `json:"kind"`
Status Optional[OperationStatus] `json:"status"`
Error Optional[string] `json:"error"`
CreatedAt Optional[string] `json:"created_at"`
Duration Optional[float64] `json:"duration"`
ImageSize Optional[int64] `json:"image_size"`
ConsumedCPU Optional[float64] `json:"consumed_cpu"`
ConsumedMemory Optional[int64] `json:"consumed_memory"`
ImageUUID Optional[string] `json:"image_uuid"`
ResultImageUUID Optional[string] `json:"result_image_uuid"`
Metadata Optional[any] `json:"metadata"`
Result Optional[OperationResult] `json:"result"`
}
OperationResponse.MarshalJSON¶
MarshalJSON encodes OperationResponse with exact wire names.
func (m OperationResponse) MarshalJSON() ([]byte, error)
OperationResponse.UnmarshalJSON¶
UnmarshalJSON decodes OperationResponse and checks required fields.
func (m *OperationResponse) UnmarshalJSON(data []byte) error
type OperationResult¶
OperationResult is generated from the OperationResult schema.
type OperationResult struct {
Image Optional[string] `json:"image"`
Tag Optional[string] `json:"tag"`
}
OperationResult.MarshalJSON¶
MarshalJSON encodes OperationResult with exact wire names.
func (m OperationResult) MarshalJSON() ([]byte, error)
OperationResult.UnmarshalJSON¶
UnmarshalJSON decodes OperationResult and checks required fields.
func (m *OperationResult) UnmarshalJSON(data []byte) error
type OperationStatus¶
OperationStatus is an operation lifecycle state.
type OperationStatus string
const OperationStatusPending (group)¶
const (
OperationStatusPending OperationStatus = "PENDING"
OperationStatusAssigned OperationStatus = "ASSIGNED"
OperationStatusExecuting OperationStatus = "EXECUTING"
OperationStatusSuccess OperationStatus = "SUCCESS"
OperationStatusFailed OperationStatus = "FAILED"
OperationStatusCancelled OperationStatus = "CANCELLED"
)
OperationStatus.IsTerminal¶
IsTerminal reports whether the operation state cannot change again.
func (s OperationStatus) IsTerminal() bool
type OperationSubprocessCreateOptions¶
OperationSubprocessCreateOptions contains optional arguments for OperationSubprocessCreate.
type OperationSubprocessCreateOptions struct {
ResourcesLimits Optional[ProcessResourcesLimits]
Args Optional[[]string]
Shell Optional[bool]
Env Optional[map[string]string]
Cwd Optional[string]
UID Optional[int64]
GID Optional[int64]
Stdin Optional[ClosableStreamRepr]
TruncateOutputAt Optional[int64]
}
type OperationSubprocessKillOptions¶
OperationSubprocessKillOptions contains optional arguments for OperationSubprocessKill.
type OperationSubprocessKillOptions struct {
Signal *string
}
type OperationSubprocessStdinOptions¶
OperationSubprocessStdinOptions contains optional arguments for OperationSubprocessStdin.
type OperationSubprocessStdinOptions struct {
Encoding Optional[string]
Close Optional[bool]
}
type OperationSummary¶
OperationSummary is generated from the OperationSummary schema.
type OperationSummary struct {
UUID Optional[string] `json:"uuid"`
Kind Optional[string] `json:"kind"`
Status Optional[OperationStatus] `json:"status"`
Error Optional[string] `json:"error"`
CreatedAt Optional[string] `json:"created_at"`
Duration Optional[float64] `json:"duration"`
ImageSize Optional[int64] `json:"image_size"`
ConsumedCPU Optional[float64] `json:"consumed_cpu"`
ConsumedMemory Optional[int64] `json:"consumed_memory"`
ImageUUID Optional[string] `json:"image_uuid"`
ResultImageUUID Optional[string] `json:"result_image_uuid"`
}
OperationSummary.MarshalJSON¶
MarshalJSON encodes OperationSummary with exact wire names.
func (m OperationSummary) MarshalJSON() ([]byte, error)
OperationSummary.UnmarshalJSON¶
UnmarshalJSON decodes OperationSummary and checks required fields.
func (m *OperationSummary) UnmarshalJSON(data []byte) error
type Optional¶
Optional preserves whether a JSON property was absent, null, or a value.
type Optional[T any] struct {
// contains filtered or unexported fields
}
Null¶
Null constructs an Optional that contains an explicit JSON null.
func Null[T any]() Optional[T]
Some¶
Some constructs an Optional that contains value.
func Some[T any](value T) Optional[T]
Optional.IsNull¶
IsNull reports whether the property was present as JSON null.
func (o Optional[T]) IsNull() bool
Optional.IsSet¶
IsSet reports whether the property was present.
func (o Optional[T]) IsSet() bool
Optional.MarshalJSON¶
MarshalJSON implements json.Marshaler. A standalone unset Optional marshals as null, while an enclosing generated model omits its unset fields.
func (o Optional[T]) MarshalJSON() ([]byte, error)
Optional.Set¶
Set replaces the state with a value.
func (o *Optional[T]) Set(value T)
Optional.SetNull¶
SetNull replaces the state with an explicit JSON null.
func (o *Optional[T]) SetNull()
Optional.UnmarshalJSON¶
UnmarshalJSON implements json.Unmarshaler.
func (o *Optional[T]) UnmarshalJSON(data []byte) error
Optional.Unset¶
Unset makes the property absent.
func (o *Optional[T]) Unset()
Optional.Value¶
Value returns the value and reports whether it is present and non-null.
func (o Optional[T]) Value() (T, bool)
type PermissionDeniedError¶
PermissionDeniedError is returned for an unexpected HTTP 403 response.
type PermissionDeniedError struct{ *APIStatusError }
PermissionDeniedError.Error¶
func (e PermissionDeniedError) Error() string
PermissionDeniedError.Unwrap¶
func (e *PermissionDeniedError) Unwrap() error
type ProcessResourcesLimits¶
ProcessResourcesLimits is generated from the ProcessResourcesLimits schema.
type ProcessResourcesLimits struct {
CPU Optional[int64] `json:"cpu"`
MemoryMib Optional[int64] `json:"memory_mib"`
}
ProcessResourcesLimits.MarshalJSON¶
MarshalJSON encodes ProcessResourcesLimits with exact wire names.
func (m ProcessResourcesLimits) MarshalJSON() ([]byte, error)
ProcessResourcesLimits.UnmarshalJSON¶
UnmarshalJSON decodes ProcessResourcesLimits and checks required fields.
func (m *ProcessResourcesLimits) UnmarshalJSON(data []byte) error
type Profile¶
Profile contains the settings for one Contree authentication profile.
type Profile struct {
Name string
URL string
Token string
AuthType string
Project string
}
ProfileFromEnvironment¶
ProfileFromEnvironment returns a profile when the environment contains a token and URL. CONTREE_* variables have priority over their NEBIUS_* aliases.
func ProfileFromEnvironment() (Profile, bool)
ResolveProfile¶
ResolveProfile selects a profile. An explicit name has priority over CONTREE_PROFILE and the active profile in the configuration. Pass one path to read a specific auth.ini file.
func ResolveProfile(name string, path ...string) (Profile, error)
Profile.GoString¶
GoString returns a Go-syntax profile description without its token.
func (p Profile) GoString() string
Profile.String¶
String returns a profile description without its token.
func (p Profile) String() string
type ProfileError¶
ProfileError reports a missing or incomplete profile.
type ProfileError struct {
Name string
Problem string
}
ProfileError.Error¶
func (e *ProfileError) Error() string
type RateLimitError¶
RateLimitError is returned for an unexpected HTTP 429 response.
type RateLimitError struct{ *APIStatusError }
RateLimitError.Error¶
func (e RateLimitError) Error() string
RateLimitError.Unwrap¶
func (e *RateLimitError) Unwrap() error
type RetryPolicy¶
RetryPolicy controls retries for idempotent buffered requests. MaxAttempts includes the initial request. One disables retries; zero retries until the context ends. The client timeout applies separately to each buffered attempt.
type RetryPolicy struct {
Statuses []int
ServerErrors bool
Delays []time.Duration
MaxAttempts int
RetryUnsafe bool
}
DefaultRetryPolicy¶
DefaultRetryPolicy returns a conservative exponential retry policy.
func DefaultRetryPolicy() RetryPolicy
type SSEError¶
SSEError reports an explicit sse_error frame from the server.
type SSEError struct {
Message string
LastEventID int64
HasEventID bool
}
SSEError.Error¶
func (e *SSEError) Error() string
type ServerError¶
ServerError is returned for an unexpected HTTP 5xx response.
type ServerError struct{ *APIStatusError }
ServerError.Error¶
func (e ServerError) Error() string
ServerError.Unwrap¶
func (e *ServerError) Unwrap() error
type SpawnInstanceOptions¶
SpawnInstanceOptions configures SpawnInstance. Zero scalar values and nil maps, slices, and pointers omit their fields so the server defaults apply. Non-nil empty maps and slices are sent as empty JSON objects and arrays.
Use SpawnInstanceWithResponseOptions with SpawnInstanceWithResponse to send explicit zero or null values for fields that SpawnInstanceOptions would omit.
type SpawnInstanceOptions struct {
Disposable bool
Hostname string
Args []string
Shell bool
Env map[string]string
PreserveEnv bool
PreserveCwd bool
Cwd string
UID int64
GID int64
ResourcesLimits *InstanceResourcesLimits
// Networking defaults to enabled. Set Enabled to Some(false) to disable it.
Networking *InstanceNetworking
Stdin *ClosableStreamRepr
// Timeout limits server execution, independently of the request context.
// Zero uses the server default. Positive durations round up to whole seconds.
// Negative durations return an error before sending a request.
Timeout time.Duration
// TruncateOutputAt limits captured bytes per stream. Nil uses the server
// default (1 MiB); a pointer to zero sends an explicit zero.
TruncateOutputAt *int64
Files map[string]FileSpec
}
type SpawnInstanceWithResponseOptions¶
SpawnInstanceWithResponseOptions contains optional arguments for SpawnInstanceWithResponse.
type SpawnInstanceWithResponseOptions struct {
Disposable Optional[bool]
Hostname Optional[string]
Args Optional[[]string]
Shell Optional[bool]
Env Optional[map[string]string]
PreserveEnv Optional[bool]
PreserveCwd Optional[bool]
Cwd Optional[string]
UID Optional[int64]
GID Optional[int64]
ResourcesLimits Optional[InstanceResourcesLimits]
Networking Optional[InstanceNetworking]
Stdin Optional[ClosableStreamRepr]
Timeout Optional[int64]
TruncateOutputAt Optional[int64]
Files Optional[map[string]FileSpec]
}
type StreamRepr¶
StreamRepr is generated from the StreamRepr schema.
type StreamRepr struct {
Value string `json:"value"`
Encoding string `json:"encoding"`
Truncated Optional[bool] `json:"truncated"`
}
NewStreamReprFromBytes¶
NewStreamReprFromBytes constructs a stream payload from bytes.
func NewStreamReprFromBytes(value []byte) StreamRepr
NewStreamReprFromText¶
NewStreamReprFromText constructs a stream payload from text.
func NewStreamReprFromText(value string) StreamRepr
StreamRepr.AsBytes¶
AsBytes decodes the stream payload to bytes.
func (m StreamRepr) AsBytes() []byte
StreamRepr.AsText¶
AsText decodes the stream payload to valid UTF-8 text.
func (m StreamRepr) AsText() string
StreamRepr.MarshalJSON¶
MarshalJSON encodes StreamRepr with exact wire names.
func (m StreamRepr) MarshalJSON() ([]byte, error)
StreamRepr.String¶
String returns the decoded payload text.
func (m StreamRepr) String() string
StreamRepr.UnmarshalJSON¶
UnmarshalJSON decodes StreamRepr and checks required fields.
func (m *StreamRepr) UnmarshalJSON(data []byte) error
type StringOrInt64¶
StringOrInt64 represents the string-or-integer union used by file modes.
type StringOrInt64 struct {
// contains filtered or unexported fields
}
StringOrInt64FromInt64¶
StringOrInt64FromInt64 constructs the integer variant.
func StringOrInt64FromInt64(value int64) StringOrInt64
StringOrInt64FromString¶
StringOrInt64FromString constructs the string variant.
func StringOrInt64FromString(value string) StringOrInt64
StringOrInt64.Int64Value¶
Int64Value returns the integer variant.
func (u StringOrInt64) Int64Value() (int64, bool)
StringOrInt64.MarshalJSON¶
MarshalJSON implements json.Marshaler.
func (u StringOrInt64) MarshalJSON() ([]byte, error)
StringOrInt64.StringValue¶
StringValue returns the string variant.
func (u StringOrInt64) StringValue() (string, bool)
StringOrInt64.UnmarshalJSON¶
UnmarshalJSON implements json.Unmarshaler.
func (u *StringOrInt64) UnmarshalJSON(data []byte) error
type TooEarlyError¶
TooEarlyError is returned for an unexpected HTTP 425 response.
type TooEarlyError struct{ *APIStatusError }
TooEarlyError.Error¶
func (e TooEarlyError) Error() string
TooEarlyError.Unwrap¶
func (e *TooEarlyError) Unwrap() error
type UnprocessableEntityError¶
UnprocessableEntityError is returned for an unexpected HTTP 422 response.
type UnprocessableEntityError struct{ *APIStatusError }
UnprocessableEntityError.Error¶
func (e UnprocessableEntityError) Error() string
UnprocessableEntityError.Unwrap¶
func (e *UnprocessableEntityError) Unwrap() error
type WaitOperationOptions¶
WaitOperationOptions selects how WaitOperation observes completion.
type WaitOperationOptions struct {
// IdleTimeout is the maximum gap between incoming SSE data in seconds.
// Nil uses 15 seconds. Zero disables the limit. Ping frames reset it.
IdleTimeout *float64
// FollowEvents defaults to nil: follow instance events and poll image imports.
// True forces events; false polls status without opening an event stream.
FollowEvents *bool
}
type WhoAmIResponse¶
WhoAmIResponse is generated from the WhoAmIResponse schema.
type WhoAmIResponse struct {
TokenUUID string `json:"token_uuid"`
TokenExpiration *int64 `json:"token_expiration"`
Permissions map[string]bool `json:"permissions"`
Limits Optional[map[string]int64] `json:"limits"`
OperationsStat map[string]int64 `json:"operations_stat"`
}
WhoAmIResponse.MarshalJSON¶
MarshalJSON encodes WhoAmIResponse with exact wire names.
func (m WhoAmIResponse) MarshalJSON() ([]byte, error)
WhoAmIResponse.UnmarshalJSON¶
UnmarshalJSON decodes WhoAmIResponse and checks required fields.
func (m *WhoAmIResponse) UnmarshalJSON(data []byte) error