Documentation
¶
Index ¶
- Variables
- type Catalog
- type CatalogSandbox
- type CatalogTemplate
- type DefaultTemplateCatalog
- type E2BService
- func (s *E2BService) ListDefaultTemplates(ctx context.Context) ([]CatalogTemplate, error)
- func (s *E2BService) ListRunnerSandboxes(ctx context.Context) ([]CatalogSandbox, error)
- func (s *E2BService) ListTemplates(ctx context.Context) ([]CatalogTemplate, error)
- func (s *E2BService) RecoverRunner(ctx context.Context, input RecoverInput) (StartResult, error)
- func (s *E2BService) StartRunner(ctx context.Context, input StartInput) (StartResult, error)
- func (s *E2BService) StartTerminal(ctx context.Context, sandboxID string, size PtySize, onData func([]byte)) (TerminalSession, error)
- func (s *E2BService) StopRunner(ctx context.Context, sandboxID string, pid uint32) error
- func (s *E2BService) ValidateTemplate(ctx context.Context, templateID string) error
- type ExitResult
- type PtySize
- type RecoverInput
- type Service
- type StartInput
- type StartResult
- type TerminalSession
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTemplateRequired = errors.New("template_id is required") ErrTemplateNotFound = errors.New("template not found") ErrTemplateNotReady = errors.New("template is not ready") ErrSandboxNotFound = errors.New("sandbox not found") ErrRunnerNotFound = errors.New("runner process not found") )
Functions ¶
This section is empty.
Types ¶
type Catalog ¶
type Catalog interface {
ListTemplates(ctx context.Context) ([]CatalogTemplate, error)
ListRunnerSandboxes(ctx context.Context) ([]CatalogSandbox, error)
}
type CatalogSandbox ¶
type CatalogSandbox struct {
SandboxID string `json:"sandbox_id"`
TemplateID string `json:"template_id"`
Alias string `json:"alias,omitempty"`
State string `json:"state"`
CPUCount int32 `json:"cpu_count"`
MemoryMB int32 `json:"memory_mb"`
DiskSizeMB int32 `json:"disk_size_mb"`
StartedAt time.Time `json:"started_at"`
ExpiresAt time.Time `json:"expires_at"`
}
type CatalogTemplate ¶
type CatalogTemplate struct {
TemplateID string `json:"template_id"`
Aliases []string `json:"aliases"`
Names []string `json:"names"`
BuildStatus string `json:"build_status"`
CPUCount int32 `json:"cpu_count"`
MemoryMB int32 `json:"memory_mb"`
DiskSizeMB int32 `json:"disk_size_mb"`
Public bool `json:"public"`
SpawnCount int64 `json:"spawn_count"`
UpdatedAt time.Time `json:"updated_at"`
}
type DefaultTemplateCatalog ¶ added in v0.2.7
type DefaultTemplateCatalog interface {
ListDefaultTemplates(ctx context.Context) ([]CatalogTemplate, error)
}
DefaultTemplateCatalog lists public templates available on the scoped Sandbox endpoint.
type E2BService ¶
type E2BService struct {
// contains filtered or unexported fields
}
func NewE2BService ¶
func NewE2BService(apiKey, endpoint string, httpClient *http.Client) (*E2BService, error)
func (*E2BService) ListDefaultTemplates ¶ added in v0.2.7
func (s *E2BService) ListDefaultTemplates(ctx context.Context) ([]CatalogTemplate, error)
ListDefaultTemplates lists the public template catalog from the scoped Sandbox endpoint.
func (*E2BService) ListRunnerSandboxes ¶
func (s *E2BService) ListRunnerSandboxes(ctx context.Context) ([]CatalogSandbox, error)
func (*E2BService) ListTemplates ¶
func (s *E2BService) ListTemplates(ctx context.Context) ([]CatalogTemplate, error)
func (*E2BService) RecoverRunner ¶ added in v0.2.6
func (s *E2BService) RecoverRunner(ctx context.Context, input RecoverInput) (StartResult, error)
func (*E2BService) StartRunner ¶
func (s *E2BService) StartRunner(ctx context.Context, input StartInput) (StartResult, error)
func (*E2BService) StartTerminal ¶
func (s *E2BService) StartTerminal(ctx context.Context, sandboxID string, size PtySize, onData func([]byte)) (TerminalSession, error)
func (*E2BService) StopRunner ¶
func (*E2BService) ValidateTemplate ¶
func (s *E2BService) ValidateTemplate(ctx context.Context, templateID string) error
type RecoverInput ¶ added in v0.2.6
type Service ¶
type Service interface {
ValidateTemplate(ctx context.Context, templateID string) error
StartRunner(ctx context.Context, input StartInput) (StartResult, error)
RecoverRunner(ctx context.Context, input RecoverInput) (StartResult, error)
StopRunner(ctx context.Context, sandboxID string, pid uint32) error
StartTerminal(ctx context.Context, sandboxID string, size PtySize, onData func([]byte)) (TerminalSession, error)
}
type StartInput ¶
type StartInput struct {
RequestID string
RunnerName string
RepositoryURL string
RegistrationToken string
Labels []string
RunnerGroup string
TemplateID string
RequireDocker bool
Timeout time.Duration
CommandContext context.Context
OnStdout func([]byte)
OnStderr func([]byte)
OnExit func(ExitResult, error)
}
type StartResult ¶
Click to show internal directories.
Click to hide internal directories.