Documentation
¶
Overview ¶
Package template provides a fluent builder and a Client for building E2B sandbox templates. It mirrors the public surface of the Python Template and JS TemplateBase classes.
A Builder accumulates instructions and can be serialized with ToDockerfile or ToJSON. To register a template with the E2B backend, construct a Client via NewClient and call Build / BuildStream / BuildInBackground. Client methods honor context cancellation and are safe for concurrent use; a *Builder is not — construct one per goroutine.
Index ¶
- func DefaultLogger(w io.Writer) func(LogEntry)
- type AptOption
- type BuildError
- type BuildEvent
- type BuildInfo
- type BuildLogsOptions
- type BuildOptions
- type BuildReason
- type BuildStatus
- type BuildStatusValue
- type Builder
- func (b *Builder) AddMCPServer(servers []string) *Builder
- func (b *Builder) AptInstall(packages []string, opts ...AptOption) *Builder
- func (b *Builder) BaseImage() string
- func (b *Builder) BaseTemplate() string
- func (b *Builder) BetaDevContainerPrebuild(dir string) *Builder
- func (b *Builder) BetaSetDevContainerStart(dir string) *FinalBuilder
- func (b *Builder) BunInstall(packages []string, opts ...BunOption) *Builder
- func (b *Builder) Copy(src, dst string, opts ...CopyOption) *Builder
- func (b *Builder) CopyItems(items []CopyItem) *Builder
- func (b *Builder) Entrypoint(cmd string) *Builder
- func (b *Builder) Env(key, value string) *Builder
- func (b *Builder) Expose(port int) *Builder
- func (b *Builder) FromAWSRegistry(image, accessKeyID, secretAccessKey, region string) *Builder
- func (b *Builder) FromBaseImage() *Builder
- func (b *Builder) FromBunImage(variant string) *Builder
- func (b *Builder) FromDebianImage(variant string) *Builder
- func (b *Builder) FromDockerfile(contents string) *Builder
- func (b *Builder) FromDockerfileContent(content string) *Builder
- func (b *Builder) FromDockerfileFile(path string) *Builder
- func (b *Builder) FromGCPRegistry(image, serviceAccountJSON string) *Builder
- func (b *Builder) FromGoImage(tag string) *Builder
- func (b *Builder) FromImage(image string, creds ...RegistryCredentials) *Builder
- func (b *Builder) FromNodeImage(tag string) *Builder
- func (b *Builder) FromPythonImage(tag string) *Builder
- func (b *Builder) FromTemplate(templateID string) *Builder
- func (b *Builder) FromUbuntuImage(variant string) *Builder
- func (b *Builder) GitClone(url string, opts ...GitCloneOption) *Builder
- func (b *Builder) MakeDir(paths []string, opts ...MkdirOption) *Builder
- func (b *Builder) MakeSymlink(src, dest string, opts ...SymlinkOption) *Builder
- func (b *Builder) NpmInstall(packages []string, opts ...NpmOption) *Builder
- func (b *Builder) PipInstall(packages []string, opts ...PipOption) *Builder
- func (b *Builder) ReadyCmdString() string
- func (b *Builder) Remove(paths []string, opts ...RemoveOption) *Builder
- func (b *Builder) Rename(src, dest string, opts ...RenameOption) *Builder
- func (b *Builder) Run(cmd string) *Builder
- func (b *Builder) RunCmd(cmd string, opts ...RunOption) *Builder
- func (b *Builder) RunCmds(cmds []string, opts ...RunOption) *Builder
- func (b *Builder) SetEnvs(envs map[string]string) *Builder
- func (b *Builder) SetReadyCmd(ready ReadyCmd) *FinalBuilder
- func (b *Builder) SetStartCmd(cmd string, ready ReadyCmd) *FinalBuilder
- func (b *Builder) SetTag(tag string) *Builder
- func (b *Builder) SetUser(user string) *Builder
- func (b *Builder) SetWorkdir(path string) *Builder
- func (b *Builder) SkipCache() *Builder
- func (b *Builder) StartCmd() string
- func (b *Builder) Tag() string
- func (b *Builder) ToDockerfile() (string, error)
- func (b *Builder) ToJSON() (string, error)
- func (b *Builder) WithContext(dir string) *Builder
- func (b *Builder) WithIgnore(patterns ...string) *Builder
- func (b *Builder) Workdir(path string) *Builder
- type BunOption
- type Client
- func (c *Client) AssignTags(ctx context.Context, target string, tags []string) (*TagInfo, error)
- func (c *Client) Build(ctx context.Context, b *Builder, opts BuildOptions) (*BuildInfo, error)
- func (c *Client) BuildInBackground(ctx context.Context, b *Builder, opts BuildOptions) (*BuildInfo, error)
- func (c *Client) BuildInBackgroundV2(ctx context.Context, b *Builder, opts BuildOptions) (*BuildInfo, error)
- func (c *Client) BuildStream(ctx context.Context, b *Builder, opts BuildOptions) (<-chan BuildEvent, error)
- func (c *Client) BuildStreamV2(ctx context.Context, b *Builder, opts BuildOptions) (<-chan BuildEvent, error)
- func (c *Client) BuildV2(ctx context.Context, b *Builder, opts BuildOptions) (*BuildInfo, error)
- func (c *Client) Delete(ctx context.Context, templateID string) error
- func (c *Client) Exists(ctx context.Context, alias string) (bool, error)
- func (c *Client) Get(ctx context.Context, templateID string, opts GetOptions) (*TemplateDetail, error)
- func (c *Client) GetBuildLogs(ctx context.Context, templateID, buildID string, opts BuildLogsOptions) ([]LogEntry, error)
- func (c *Client) GetBuildStatus(ctx context.Context, info BuildInfo, logsOffset int) (*BuildStatus, error)
- func (c *Client) GetTags(ctx context.Context, templateID string) ([]TemplateTag, error)
- func (c *Client) List(ctx context.Context, opts ListOptions) ([]Template, error)
- func (c *Client) RemoveTags(ctx context.Context, name string, tags []string) error
- func (c *Client) SetPublic(ctx context.Context, templateID string, public bool) ([]string, error)
- func (c *Client) SetPublicV1(ctx context.Context, templateID string, public bool) error
- type CopyItem
- type CopyOption
- type FinalBuilder
- type GetOptions
- type GitCloneOption
- type ListOptions
- type LogEntry
- type LogEntryEnd
- type LogEntryStart
- type LogLevel
- type MkdirOption
- type NpmOption
- type PipOption
- type ReadyCmd
- type RegistryCredentials
- type RemoveOption
- type RenameOption
- type RunOption
- type SymlinkOption
- type TagInfo
- type Template
- type TemplateBuild
- type TemplateDetail
- type TemplateTag
- type TemplateUser
- type UploadError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLogger ¶
DefaultLogger returns a function that prints log entries to stderr.
Types ¶
type AptOption ¶
type AptOption func(*aptOpts)
AptOption configures Builder.AptInstall.
func WithAptFixMissing ¶
func WithAptFixMissing() AptOption
WithAptFixMissing passes --fix-missing to apt-get install.
func WithAptNoInstallRecommends ¶
func WithAptNoInstallRecommends() AptOption
WithAptNoInstallRecommends passes --no-install-recommends to apt-get install.
type BuildError ¶
type BuildError struct {
Op string
TemplateID string
BuildID string
Step string
Message string
LogTail []LogEntry
Err error
}
BuildError describes a failure during a server-side template build. Unwrap() returns e2b.ErrTemplateBuild so callers can use errors.Is.
func (*BuildError) Error ¶
func (e *BuildError) Error() string
func (*BuildError) Unwrap ¶
func (e *BuildError) Unwrap() error
type BuildEvent ¶
BuildEvent is one emission from Client.BuildStream. Exactly one of Log, Done, or Err is non-nil at a time. The channel closes after emitting a terminal Done or Err.
type BuildInfo ¶
BuildInfo identifies a completed or in-flight template build. Returned from Client.Build and Client.BuildInBackground.
type BuildLogsOptions ¶
type BuildLogsOptions struct {
// CursorMs is the starting timestamp in milliseconds. 0 means server default.
CursorMs int64
// Limit caps the number of log entries returned (0–1000). 0 means server default.
Limit int32
// Direction is "asc" or "desc". Empty means server default.
Direction string
// Level filters out entries below this level. Empty means no filter.
Level LogLevel
}
BuildLogsOptions filters Client.GetBuildLogs.
type BuildOptions ¶
type BuildOptions struct {
Name string
Tags []string
CPUCount int32
MemoryMB int32
SkipCache bool
PollInterval time.Duration
}
BuildOptions captures every caller-tunable parameter of a template build.
type BuildReason ¶
BuildReason describes why a build ended in the error state.
type BuildStatus ¶
type BuildStatus struct {
TemplateID string
BuildID string
Status BuildStatusValue
Logs []LogEntry
Reason *BuildReason
}
BuildStatus is the server-reported state of a template build.
type BuildStatusValue ¶
type BuildStatusValue string
BuildStatusValue enumerates the possible states of a running template build, mirroring the upstream API enum.
const ( BuildStatusBuilding BuildStatusValue = "building" BuildStatusWaiting BuildStatusValue = "waiting" BuildStatusReady BuildStatusValue = "ready" BuildStatusError BuildStatusValue = "error" )
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs a template. A *Builder is not safe for concurrent use — construct one per goroutine, or fully finalize it with SetStartCmd / SetReadyCmd (which return a *FinalBuilder) before handing the result off.
func New ¶
func New() *Builder
New returns an empty builder. Use FromImage / FromDockerfile to specify a base.
func (*Builder) AddMCPServer ¶
AddMCPServer adds one or more MCP servers using mcp-gateway. Only valid when the builder was initialized with FromTemplate("mcp-gateway"); the error is captured on the builder and surfaced at serialize().
func (*Builder) AptInstall ¶
AptInstall emits the Python SDK's canonical "apt-get update && apt-get install -y ..." one-liner so the update and install share a single cache layer and partial updates never go stale. Each flag literal carries its own trailing space; that space is consumed by the space before the packages join, which is why no explicit TrimRight is needed. Callers are expected to pass at least one package.
func (*Builder) BaseImage ¶
BaseImage returns the base image (empty when building on an E2B template).
func (*Builder) BaseTemplate ¶
BaseTemplate returns the base template ID (empty when building on an image).
func (*Builder) BetaDevContainerPrebuild ¶
BetaDevContainerPrebuild runs a devcontainer build during the template build. Only valid when the builder was initialized with FromTemplate("devcontainer").
func (*Builder) BetaSetDevContainerStart ¶
func (b *Builder) BetaSetDevContainerStart(dir string) *FinalBuilder
BetaSetDevContainerStart wires the devcontainer-specific start+ready commands to a workspace directory. Requires FromTemplate("devcontainer").
func (*Builder) BunInstall ¶
BunInstall emits a RUN that installs JS/TS packages via bun. Nil/empty packages produce a bare "bun install".
func (*Builder) Copy ¶
func (b *Builder) Copy(src, dst string, opts ...CopyOption) *Builder
Copy adds a COPY instruction from the template build context. The Args slice carries four positional slots — src, dst, user, mode. When mode is unset the slot stays "", otherwise it is formatted as a zero-padded 4-digit octal string.
func (*Builder) CopyItems ¶
CopyItems adds a COPY instruction for each item, translating struct fields to CopyOptions so validation and defaults match single Copy calls.
func (*Builder) Entrypoint ¶
Entrypoint sets the container entrypoint. Retained for Dockerfile-level parity; the server build API has no direct ENTRYPOINT step, so serialize() does not emit one.
func (*Builder) FromAWSRegistry ¶
FromAWSRegistry sets the base image and configures AWS ECR authentication.
func (*Builder) FromBaseImage ¶
FromBaseImage resets to the default e2bdev/base image.
func (*Builder) FromBunImage ¶
FromBunImage starts a template from an official Bun image. The default variant is "latest".
func (*Builder) FromDebianImage ¶
FromDebianImage starts a template from an official Debian image. The default variant is "stable".
func (*Builder) FromDockerfile ¶
FromDockerfile parses inline Dockerfile content. Deprecated: prefer FromDockerfileContent (clearer name) or FromDockerfileFile.
func (*Builder) FromDockerfileContent ¶
FromDockerfileContent parses inline Dockerfile text and applies the instructions to this builder. Supported instructions: FROM, RUN, COPY (two-token form), WORKDIR, USER, ENV. Others are silently ignored.
func (*Builder) FromDockerfileFile ¶
FromDockerfileFile reads a file from disk and parses it with FromDockerfileContent.
func (*Builder) FromGCPRegistry ¶
FromGCPRegistry sets the base image and configures GCP Artifact/Container Registry authentication via a service-account JSON blob.
func (*Builder) FromGoImage ¶
FromGoImage uses the official golang image.
func (*Builder) FromImage ¶
func (b *Builder) FromImage(image string, creds ...RegistryCredentials) *Builder
FromImage sets the base Docker image. An optional RegistryCredentials argument supplies basic-auth credentials for a private registry; only the first value is consulted. When both Username and Password are empty the registry config is left nil.
func (*Builder) FromNodeImage ¶
FromNodeImage uses the official node image.
func (*Builder) FromPythonImage ¶
FromPythonImage uses the official python image with the given tag (default "3").
func (*Builder) FromTemplate ¶
FromTemplate bases this template on another E2B template.
func (*Builder) FromUbuntuImage ¶
FromUbuntuImage starts a template from an official Ubuntu image. The default variant is "latest".
func (*Builder) GitClone ¶
func (b *Builder) GitClone(url string, opts ...GitCloneOption) *Builder
GitClone emits a RUN that clones the given URL. Branch, depth, and path options append their tokens in the order git expects (branch adds three tokens, depth adds two, path adds one).
func (*Builder) MakeDir ¶
func (b *Builder) MakeDir(paths []string, opts ...MkdirOption) *Builder
MakeDir creates one or more directories inside the template during build.
func (*Builder) MakeSymlink ¶
func (b *Builder) MakeSymlink(src, dest string, opts ...SymlinkOption) *Builder
MakeSymlink creates a symbolic link at dest pointing to src inside the template during build.
func (*Builder) NpmInstall ¶
NpmInstall emits a RUN that installs Node packages via npm. Nil/empty packages produce a bare "npm install" (install dependencies from package.json).
func (*Builder) PipInstall ¶
PipInstall emits a RUN that installs Python packages via pip. With a nil or empty packages slice it falls back to "pip install ." (install current directory). The default user is root; WithPipUserInstall clears that and appends --user.
func (*Builder) ReadyCmdString ¶
ReadyCmdString returns the configured readiness command.
func (*Builder) Remove ¶
func (b *Builder) Remove(paths []string, opts ...RemoveOption) *Builder
Remove deletes files or directories inside the template during build.
func (*Builder) Rename ¶
func (b *Builder) Rename(src, dest string, opts ...RenameOption) *Builder
Rename moves src to dest inside the template during build.
func (*Builder) RunCmd ¶
RunCmd appends a RUN instruction for a single shell command, with an optional user selection via WithRunUser.
func (*Builder) RunCmds ¶
RunCmds joins the commands with " && " and delegates to RunCmd so the server sees a single RUN step.
func (*Builder) SetEnvs ¶
SetEnvs emits a single ENV instruction whose Args interleave keys and values (k1, v1, k2, v2, ...). An empty or nil map is a no-op.
func (*Builder) SetReadyCmd ¶
func (b *Builder) SetReadyCmd(ready ReadyCmd) *FinalBuilder
SetReadyCmd sets only the readiness check and finalizes the builder.
func (*Builder) SetStartCmd ¶
func (b *Builder) SetStartCmd(cmd string, ready ReadyCmd) *FinalBuilder
SetStartCmd records the command run when a sandbox boots, plus the readiness check to wait on. Pass ReadyCmd{} to opt out of a readiness check.
func (*Builder) SetWorkdir ¶
SetWorkdir emits a WORKDIR instruction with the given path.
func (*Builder) SkipCache ¶
SkipCache marks the next instruction as force-rebuilt, ignoring the upstream cache. Chain before any instruction to invalidate just that layer; the flag resets after the next instruction is added.
func (*Builder) ToDockerfile ¶
ToDockerfile serializes the builder to a Dockerfile. Templates based on another E2B template cannot be serialized and return an error.
func (*Builder) ToJSON ¶
ToJSON returns the JSON payload that Client.Build would send to the server, pretty-printed. Useful for inspection and debugging.
func (*Builder) WithContext ¶
WithContext sets the local directory used as the build context for COPY instructions. Subsequent COPY hashing and tar packaging reads files under this path.
func (*Builder) WithIgnore ¶
WithIgnore appends patterns (in .dockerignore syntax) that filter files during COPY hashing and tar packaging.
type BunOption ¶
type BunOption func(*bunOpts)
BunOption configures Builder.BunInstall.
func WithBunDev ¶
func WithBunDev() BunOption
WithBunDev appends --dev to the bun invocation (bun's equivalent of npm's --save-dev).
func WithBunGlobal ¶
func WithBunGlobal() BunOption
WithBunGlobal appends -g to the bun invocation and sets the user to root.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a server-side template builder/inspector. Methods on Client dispatch to the E2B template HTTP API. Safe for concurrent use.
func NewClient ¶
NewClient constructs a Client from a Config, applying environment-variable fallbacks. Fails only when the API URL is malformed.
func (*Client) AssignTags ¶
AssignTags assigns one or more tags to an existing template build.
func (*Client) Build ¶
Build runs a server-side template build to completion. Logs are discarded; for streaming use BuildStream. Returns the completed BuildInfo or the first error that terminates the build.
func (*Client) BuildInBackground ¶
func (c *Client) BuildInBackground(ctx context.Context, b *Builder, opts BuildOptions) (*BuildInfo, error)
BuildInBackground kicks off a build without polling for completion. The caller can poll via GetBuildStatus using the returned BuildInfo.
func (*Client) BuildInBackgroundV2 ¶
func (c *Client) BuildInBackgroundV2(ctx context.Context, b *Builder, opts BuildOptions) (*BuildInfo, error)
BuildInBackgroundV2 is the POST /v2/templates counterpart of BuildInBackground.
func (*Client) BuildStream ¶
func (c *Client) BuildStream(ctx context.Context, b *Builder, opts BuildOptions) (<-chan BuildEvent, error)
BuildStream kicks off a build and returns a channel of BuildEvents. The channel closes after emitting a terminal Done or Err event.
func (*Client) BuildStreamV2 ¶
func (c *Client) BuildStreamV2(ctx context.Context, b *Builder, opts BuildOptions) (<-chan BuildEvent, error)
BuildStreamV2 is the POST /v2/templates counterpart of BuildStream.
func (*Client) BuildV2 ¶
BuildV2 is the POST /v2/templates counterpart of Build, intended for self-hosted E2B deployments that predate /v3/templates (≤ 2.1.x). The v2 request body has no tags field; BuildOptions.Tags must be empty.
func (*Client) Exists ¶
Exists returns true if a template with the given alias exists and the caller can see it (200 or 403). 404 means it does not exist; other non-2xx status codes are returned as errors.
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, templateID string, opts GetOptions) (*TemplateDetail, error)
Get returns metadata and one page of build history for a single template.
func (*Client) GetBuildLogs ¶
func (c *Client) GetBuildLogs(ctx context.Context, templateID, buildID string, opts BuildLogsOptions) ([]LogEntry, error)
GetBuildLogs fetches structured build logs for a specific build.
func (*Client) GetBuildStatus ¶
func (c *Client) GetBuildStatus(ctx context.Context, info BuildInfo, logsOffset int) (*BuildStatus, error)
GetBuildStatus fetches the current status of an in-flight build.
func (*Client) List ¶
List returns every template visible to the caller. Pass opts.TeamID to restrict the result to a specific team.
func (*Client) RemoveTags ¶
RemoveTags removes one or more tags from a template.
func (*Client) SetPublic ¶
SetPublic toggles the template's public visibility flag via PATCH /v2/templates/{id}. Returns the current names (namespace/alias format when namespaced).
func (*Client) SetPublicV1 ¶
SetPublicV1 is the PATCH /templates/{id} counterpart of SetPublic for self-hosted E2B deployments that predate /v2/templates/{id} (≤ 2.1.x). The legacy endpoint has no response body, so no names are returned.
type CopyItem ¶
type CopyItem struct {
Src string
Dest string
User string
Mode os.FileMode
ForceUpload bool
ResolveSymlinks *bool
}
CopyItem mirrors the Python SDK's CopyItem dict. All fields except Src and Dest are optional.
type CopyOption ¶
type CopyOption func(*copyOpts)
CopyOption is a functional option for Copy.
func WithCopyForceUpload ¶
func WithCopyForceUpload() CopyOption
WithCopyForceUpload forces re-upload of the COPY layer even when a matching hash already exists on the server.
func WithCopyMode ¶
func WithCopyMode(m os.FileMode) CopyOption
WithCopyMode sets the file mode applied to the copied files.
func WithCopyResolveSymlinks ¶
func WithCopyResolveSymlinks(b bool) CopyOption
WithCopyResolveSymlinks overrides the default symlink resolution behavior for this COPY. Pass true to follow symlinks, false to preserve them.
func WithCopyUser ¶
func WithCopyUser(u string) CopyOption
WithCopyUser sets the owning user for the copied files (USER arg of COPY).
type FinalBuilder ¶
type FinalBuilder struct {
// contains filtered or unexported fields
}
FinalBuilder is the terminal state of the fluent API. After setting the start/ready commands, callers may only serialize or hand off to the Client.
func (*FinalBuilder) Builder ¶
func (f *FinalBuilder) Builder() *Builder
Builder returns the underlying *Builder. Use sparingly; the point of FinalBuilder is to discourage adding more instructions. Required by the Client so it can call serialize/instructionsWithHashes.
func (*FinalBuilder) ToDockerfile ¶
func (f *FinalBuilder) ToDockerfile() (string, error)
ToDockerfile delegates to the underlying Builder.
func (*FinalBuilder) ToJSON ¶
func (f *FinalBuilder) ToJSON() (string, error)
ToJSON delegates to the underlying Builder.
type GetOptions ¶
GetOptions paginates the build history returned by Client.Get. Zero value uses server defaults.
type GitCloneOption ¶
type GitCloneOption func(*gitOpts)
GitCloneOption configures Builder.GitClone.
func WithGitBranch ¶
func WithGitBranch(branch string) GitCloneOption
WithGitBranch checks out the given branch via --branch + --single-branch.
func WithGitDepth ¶
func WithGitDepth(depth int) GitCloneOption
WithGitDepth sets the clone depth (shallow clone when > 0).
func WithGitPath ¶
func WithGitPath(path string) GitCloneOption
WithGitPath clones into the given local path.
func WithGitUser ¶
func WithGitUser(user string) GitCloneOption
WithGitUser runs the git clone command as the given user.
type ListOptions ¶
type ListOptions struct {
// TeamID restricts results to a specific team. Empty means no filter.
TeamID string
}
ListOptions filters Client.List results. Zero value lists every template visible to the caller.
type LogEntryEnd ¶
LogEntryEnd marks the end of a build phase.
type LogEntryStart ¶
type LogEntryStart struct {
Phase string
}
LogEntryStart marks the beginning of a build phase.
type MkdirOption ¶
type MkdirOption func(*mkdirOpts)
MkdirOption configures Builder.MakeDir.
func WithMkdirMode ¶
func WithMkdirMode(m os.FileMode) MkdirOption
WithMkdirMode sets the mode bits passed to mkdir via -m.
func WithMkdirUser ¶
func WithMkdirUser(u string) MkdirOption
WithMkdirUser runs the mkdir command as the given user.
type NpmOption ¶
type NpmOption func(*npmOpts)
NpmOption configures Builder.NpmInstall.
func WithNpmGlobal ¶
func WithNpmGlobal() NpmOption
WithNpmGlobal appends -g to the npm invocation and sets the user to root.
type PipOption ¶
type PipOption func(*pipOpts)
PipOption configures Builder.PipInstall.
func WithPipUserInstall ¶
func WithPipUserInstall() PipOption
WithPipUserInstall appends --user to the pip invocation and clears the default user (so the command does not force root).
type ReadyCmd ¶
type ReadyCmd struct {
// contains filtered or unexported fields
}
ReadyCmd wraps a shell command evaluated by envd to decide when the sandbox has finished starting.
func WaitForFile ¶
WaitForFile checks for the existence of a file.
func WaitForPort ¶
WaitForPort checks whether the given TCP port is listening.
func WaitForProcess ¶
WaitForProcess checks whether a process with the given name is running.
func WaitForTimeoutMs ¶
WaitForTimeoutMs sleeps for the given number of milliseconds (rounded up to at least 1 second).
func WaitForURL ¶
WaitForURL polls an HTTP endpoint until it returns the expected status code.
type RegistryCredentials ¶
RegistryCredentials carries basic-auth credentials for a private registry.
type RemoveOption ¶
type RemoveOption func(*removeOpts)
RemoveOption configures Builder.Remove.
func WithRemoveForce ¶
func WithRemoveForce() RemoveOption
WithRemoveForce adds -f to the emitted rm command.
func WithRemoveRecursive ¶
func WithRemoveRecursive() RemoveOption
WithRemoveRecursive adds -r to the emitted rm command.
func WithRemoveUser ¶
func WithRemoveUser(u string) RemoveOption
WithRemoveUser runs the rm command as the given user.
type RenameOption ¶
type RenameOption func(*renameOpts)
RenameOption configures Builder.Rename.
func WithRenameForce ¶
func WithRenameForce() RenameOption
WithRenameForce adds -f to the emitted mv command.
func WithRenameUser ¶
func WithRenameUser(u string) RenameOption
WithRenameUser runs the mv command as the given user.
type RunOption ¶
type RunOption func(*runOpts)
RunOption configures Builder.RunCmd and Builder.RunCmds.
func WithRunUser ¶
WithRunUser runs the command as the given user.
type SymlinkOption ¶
type SymlinkOption func(*symOpts)
SymlinkOption configures Builder.MakeSymlink.
func WithSymlinkForce ¶
func WithSymlinkForce() SymlinkOption
WithSymlinkForce adds -f to the emitted ln command.
func WithSymlinkUser ¶
func WithSymlinkUser(u string) SymlinkOption
WithSymlinkUser runs the ln command as the given user.
type Template ¶
type Template struct {
TemplateID string
BuildID string
Names []string
Public bool
CPUCount int32
MemoryMB int32
DiskSizeMB int32
EnvdVersion string
BuildStatus BuildStatusValue
BuildCount int32
SpawnCount int64
CreatedAt time.Time
UpdatedAt time.Time
LastSpawnedAt *time.Time
CreatedBy *TemplateUser
}
Template is a single row returned from Client.List and the summary portion of Client.Get. Mirrors the upstream Template schema but keeps internal API types private.
type TemplateBuild ¶
type TemplateBuild struct {
BuildID string
Status BuildStatusValue
CPUCount int32
MemoryMB int32
DiskSizeMB *int32
EnvdVersion string
CreatedAt time.Time
UpdatedAt time.Time
FinishedAt *time.Time
}
TemplateBuild is one historical build entry returned inside TemplateDetail.
type TemplateDetail ¶
type TemplateDetail struct {
TemplateID string
Names []string
Public bool
SpawnCount int64
CreatedAt time.Time
UpdatedAt time.Time
LastSpawnedAt *time.Time
Builds []TemplateBuild
}
TemplateDetail is the response from Client.Get: template identity plus one page of its build history. Per-build resource settings live on each TemplateBuild entry because they can differ across builds.
type TemplateTag ¶
TemplateTag is one row returned from Client.GetTags.
type TemplateUser ¶
TemplateUser identifies the creator of a template.
type UploadError ¶
UploadError describes a failure while uploading a template COPY layer.
func (*UploadError) Error ¶
func (e *UploadError) Error() string
func (*UploadError) Unwrap ¶
func (e *UploadError) Unwrap() error