Documentation
¶
Index ¶
- Constants
- Variables
- type AgentRunRequest
- type AgentRunResponse
- type CloseStdinRequest
- type ComposeFilesRequest
- type ConfigureRequest
- type ConnectFrame
- type ConnectRequest
- type ConnectStream
- type CreateWatcherRequest
- type CreateWatcherResponse
- type DownloadRequest
- type EntryInfo
- type EventType
- type FileRequest
- type FileType
- type FilesContentRequest
- type FilesContentResponse
- type FilesystemEvent
- type FilesystemWatchFrame
- type FilesystemWatchStream
- type FsEditRequest
- type FsEditResponse
- type GetResultRequest
- type GetResultResponse
- type GetWatcherEventsRequest
- type GetWatcherEventsResponse
- type ListDirRequest
- type ListDirResponse
- type MakeDirRequest
- type MakeDirResponse
- type MetricsResponse
- type MoveRequest
- type MoveResponse
- type MultipartFile
- type PortEntry
- type ProcessConfig
- type ProcessDataEvent
- type ProcessEndEvent
- type ProcessEvent
- type ProcessInfo
- type ProcessInput
- type ProcessListResponse
- type ProcessSelector
- type ProcessStartEvent
- type ProcessStartRequest
- type ProcessStream
- type ProcessStreamFrame
- type ProxyRequest
- type PtyConfig
- type PtySize
- type RemoveRequest
- type RemoveWatcherRequest
- type RequestOptions
- type RestEntryInfo
- type RestEntryType
- type SendInputRequest
- type SendSignalRequest
- type Service
- func (c *Service) BaseURL() string
- func (c *Service) CloseStdin(ctx context.Context, req *CloseStdinRequest, opts *RequestOptions) error
- func (c *Service) ComposeFiles(ctx context.Context, req *ComposeFilesRequest, opts *RequestOptions) (*RestEntryInfo, error)
- func (c *Service) Configure(ctx context.Context, req *ConfigureRequest) error
- func (c *Service) Connect(ctx context.Context, req *ConnectRequest, opts *RequestOptions) (*ProcessStream, error)
- func (c *Service) CreateWatcher(ctx context.Context, req *CreateWatcherRequest, opts *RequestOptions) (*CreateWatcherResponse, error)
- func (c *Service) Download(ctx context.Context, req *DownloadRequest, opts *RequestOptions) (*http.Response, error)
- func (c *Service) Edit(ctx context.Context, req *FsEditRequest, opts *RequestOptions) (*FsEditResponse, error)
- func (c *Service) Envs(ctx context.Context) (map[string]string, error)
- func (c *Service) FilesContent(ctx context.Context, req *FilesContentRequest, opts *RequestOptions) (*FilesContentResponse, error)
- func (c *Service) GetResult(ctx context.Context, req *GetResultRequest, opts *RequestOptions) (*GetResultResponse, error)
- func (c *Service) GetWatcherEvents(ctx context.Context, req *GetWatcherEventsRequest, opts *RequestOptions) (*GetWatcherEventsResponse, error)
- func (c *Service) ListDir(ctx context.Context, req *ListDirRequest, opts *RequestOptions) (*ListDirResponse, error)
- func (c *Service) ListProcesses(ctx context.Context, opts *RequestOptions) (*ProcessListResponse, error)
- func (c *Service) MakeDir(ctx context.Context, req *MakeDirRequest, opts *RequestOptions) (*MakeDirResponse, error)
- func (c *Service) Metrics(ctx context.Context) (*MetricsResponse, error)
- func (c *Service) Move(ctx context.Context, req *MoveRequest, opts *RequestOptions) (*MoveResponse, error)
- func (c *Service) Ports(ctx context.Context) ([]PortEntry, error)
- func (c *Service) Proxy(ctx context.Context, req *ProxyRequest) (*http.Response, error)
- func (c *Service) ReadFile(ctx context.Context, req *FileRequest, opts *RequestOptions) (*http.Response, error)
- func (c *Service) Remove(ctx context.Context, req *RemoveRequest, opts *RequestOptions) error
- func (c *Service) RemoveWatcher(ctx context.Context, req *RemoveWatcherRequest, opts *RequestOptions) error
- func (c *Service) Run(ctx context.Context, req *AgentRunRequest, opts *RequestOptions) (*AgentRunResponse, error)
- func (c *Service) SendInput(ctx context.Context, req *SendInputRequest, opts *RequestOptions) error
- func (c *Service) SendSignal(ctx context.Context, req *SendSignalRequest, opts *RequestOptions) error
- func (c *Service) Start(ctx context.Context, req *ProcessStartRequest, opts *RequestOptions) (*ProcessStream, error)
- func (c *Service) Stat(ctx context.Context, req *StatRequest, opts *RequestOptions) (*StatResponse, error)
- func (c *Service) StreamInput(ctx context.Context, frames []StreamInputFrame, opts *RequestOptions) (*ConnectFrame, error)
- func (c *Service) Update(ctx context.Context, req *UpdateRequest, opts *RequestOptions) error
- func (c *Service) UploadBytes(ctx context.Context, req *UploadBytesRequest, opts *RequestOptions) ([]RestEntryInfo, error)
- func (c *Service) UploadJSON(ctx context.Context, entry *WriteFileEntry, opts *RequestOptions) ([]RestEntryInfo, error)
- func (c *Service) UploadMultipart(ctx context.Context, req *UploadMultipartRequest, opts *RequestOptions) ([]RestEntryInfo, error)
- func (c *Service) WatchDir(ctx context.Context, req *WatchDirRequest, opts *RequestOptions) (*FilesystemWatchStream, error)
- func (c *Service) WriteBatch(ctx context.Context, req *WriteFilesRequest, opts *RequestOptions) (*WriteFilesBatchResponse, error)
- func (c *Service) WriteFile(ctx context.Context, req *UploadBytesRequest, opts *RequestOptions) error
- type Signal
- type StatRequest
- type StatResponse
- type StreamInputData
- type StreamInputFrame
- type StreamInputStart
- type UpdateRequest
- type UploadBytesRequest
- type UploadMultipartRequest
- type WatchDirRequest
- type WriteFileEntry
- type WriteFilesBatchResponse
- type WriteFilesBatchResult
- type WriteFilesRequest
Constants ¶
View Source
const (
ConnectProtocolVersion = "1"
)
Variables ¶
View Source
var ( ErrBaseURLEmpty = core.ErrBaseURLEmpty ErrInvalidBaseURL = core.ErrInvalidBaseURL ErrPathEmpty = errors.New("sandbox/cmd: path is required") ErrCommandEmpty = errors.New("sandbox/cmd: cmd is required") ErrProcessNil = errors.New("sandbox/cmd: process is required") ErrWatcherIDEmpty = errors.New("sandbox/cmd: watcherID is required") ErrCmdIDEmpty = errors.New("sandbox/cmd: cmdID is required") ErrPortInvalid = errors.New("sandbox/cmd: port must be greater than 0") ErrProcessSelectorEmpty = errors.New("sandbox/cmd: process selector requires pid or tag") ErrProcessSelectorAmbig = errors.New("sandbox/cmd: process selector requires exactly one of pid or tag") ErrProcessInputEmpty = errors.New("sandbox/cmd: process input requires stdin or pty") ErrPTYRequired = errors.New("sandbox/cmd: pty is required") ErrMultipartFilesEmpty = errors.New("sandbox/cmd: multipart upload requires at least one part") ErrStreamInputFramesZero = errors.New("sandbox/cmd: stream input requires at least one frame") )
Functions ¶
This section is empty.
Types ¶
type AgentRunRequest ¶
type AgentRunResponse ¶
type CloseStdinRequest ¶
type CloseStdinRequest struct {
Process ProcessSelector `json:"process"`
}
type ComposeFilesRequest ¶
type ConfigureRequest ¶
type ConnectFrame ¶
type ConnectFrame struct {
Flags byte
Payload json.RawMessage
}
func (*ConnectFrame) Decode ¶
func (f *ConnectFrame) Decode(out any) error
func (*ConnectFrame) IsEnd ¶
func (f *ConnectFrame) IsEnd() bool
type ConnectRequest ¶
type ConnectRequest struct {
Process ProcessSelector `json:"process"`
}
type ConnectStream ¶
type ConnectStream struct {
// contains filtered or unexported fields
}
func (*ConnectStream) Close ¶
func (s *ConnectStream) Close() error
func (*ConnectStream) NextFrame ¶
func (s *ConnectStream) NextFrame() (*ConnectFrame, error)
func (*ConnectStream) NextJSON ¶
func (s *ConnectStream) NextJSON(out any) (*ConnectFrame, error)
func (*ConnectStream) Response ¶
func (s *ConnectStream) Response() *http.Response
type CreateWatcherRequest ¶
type CreateWatcherResponse ¶
type CreateWatcherResponse struct {
WatcherID string `json:"watcherId"`
}
type DownloadRequest ¶
type DownloadRequest struct {
Path string
}
type EntryInfo ¶
type EntryInfo struct {
Name string `json:"name"`
Type FileType `json:"type"`
Path string `json:"path"`
Size int64 `json:"size"`
Mode int64 `json:"mode"`
Permissions string `json:"permissions"`
Owner string `json:"owner"`
Group string `json:"group"`
ModifiedTime string `json:"modifiedTime"`
SymlinkTarget *string `json:"symlinkTarget,omitempty"`
}
type EventType ¶
type EventType string
const ( EventTypeUnspecified EventType = "EVENT_TYPE_UNSPECIFIED" EventTypeCreate EventType = "EVENT_TYPE_CREATE" EventTypeWrite EventType = "EVENT_TYPE_WRITE" EventTypeRemove EventType = "EVENT_TYPE_REMOVE" EventTypeRename EventType = "EVENT_TYPE_RENAME" EventTypeChmod EventType = "EVENT_TYPE_CHMOD" )
type FileRequest ¶
type FileRequest struct {
Path string
}
type FilesContentRequest ¶
type FilesContentResponse ¶
type FilesystemEvent ¶
type FilesystemWatchFrame ¶
type FilesystemWatchFrame struct {
Start *struct{} `json:"start,omitempty"`
Keepalive *struct{} `json:"keepalive,omitempty"`
Filesystem *FilesystemEvent `json:"filesystem,omitempty"`
}
type FilesystemWatchStream ¶
type FilesystemWatchStream struct {
*ConnectStream
}
func (*FilesystemWatchStream) Next ¶
func (s *FilesystemWatchStream) Next() (*FilesystemWatchFrame, error)
type FsEditRequest ¶
type FsEditResponse ¶
type FsEditResponse struct {
Message string `json:"message"`
}
type GetResultRequest ¶
type GetResultRequest struct {
CmdID string `json:"cmdId"`
}
type GetResultResponse ¶
type GetWatcherEventsRequest ¶
type GetWatcherEventsResponse ¶
type GetWatcherEventsResponse struct {
Events []FilesystemEvent `json:"events"`
}
type ListDirRequest ¶
type ListDirResponse ¶
type ListDirResponse struct {
Entries []EntryInfo `json:"entries"`
}
type MakeDirRequest ¶
type MakeDirRequest struct {
Path string `json:"path"`
}
type MakeDirResponse ¶
type MakeDirResponse struct {
Entry EntryInfo `json:"entry"`
}
type MetricsResponse ¶
type MetricsResponse struct {
TS int64 `json:"ts"`
CPUCount int `json:"cpu_count"`
CPUUsedPct float64 `json:"cpu_used_pct"`
MemTotal int64 `json:"mem_total"`
MemUsed int64 `json:"mem_used"`
MemTotalMiB int64 `json:"mem_total_mib"`
MemUsedMiB int64 `json:"mem_used_mib"`
MemCache int64 `json:"mem_cache"`
DiskUsed int64 `json:"disk_used"`
DiskTotal int64 `json:"disk_total"`
}
type MoveRequest ¶
type MoveResponse ¶
type MoveResponse struct {
Entry EntryInfo `json:"entry"`
}
type MultipartFile ¶
type ProcessConfig ¶
type ProcessDataEvent ¶
type ProcessEndEvent ¶
type ProcessEvent ¶
type ProcessEvent struct {
Start *ProcessStartEvent `json:"start,omitempty"`
Data *ProcessDataEvent `json:"data,omitempty"`
End *ProcessEndEvent `json:"end,omitempty"`
Keepalive *struct{} `json:"keepalive,omitempty"`
}
type ProcessInfo ¶
type ProcessInfo struct {
PID int `json:"pid"`
Config ProcessConfig `json:"config"`
Tag string `json:"tag,omitempty"`
CmdID string `json:"cmdId,omitempty"`
}
type ProcessInput ¶
type ProcessInput struct {
Stdin string `json:"stdin,omitempty"`
PTY string `json:"pty,omitempty"`
}
func (ProcessInput) Validate ¶
func (i ProcessInput) Validate() error
type ProcessListResponse ¶
type ProcessListResponse struct {
Processes []ProcessInfo `json:"processes"`
}
type ProcessSelector ¶
func (ProcessSelector) Validate ¶
func (s ProcessSelector) Validate() error
type ProcessStartEvent ¶
type ProcessStartRequest ¶
type ProcessStartRequest struct {
Process *ProcessConfig `json:"process"`
TimeoutMS *int64 `json:"timeoutMs,omitempty"`
Tag string `json:"tag,omitempty"`
Stdin *bool `json:"stdin,omitempty"`
PTY *PtyConfig `json:"pty,omitempty"`
}
type ProcessStream ¶
type ProcessStream struct {
*ConnectStream
}
func (*ProcessStream) Next ¶
func (s *ProcessStream) Next() (*ProcessStreamFrame, error)
type ProcessStreamFrame ¶
type ProcessStreamFrame struct {
Event ProcessEvent `json:"event"`
}
type ProxyRequest ¶
type RemoveRequest ¶
type RemoveRequest struct {
Path string `json:"path"`
}
type RemoveWatcherRequest ¶
type RemoveWatcherRequest struct {
WatcherID string `json:"watcherId"`
}
type RequestOptions ¶
type RestEntryInfo ¶
type RestEntryInfo struct {
Path string `json:"path"`
Name string `json:"name"`
Type RestEntryType `json:"type"`
}
type RestEntryType ¶
type RestEntryType string
const ( RestEntryTypeFile RestEntryType = "file" RestEntryTypeDirectory RestEntryType = "directory" )
type SendInputRequest ¶
type SendInputRequest struct {
Process ProcessSelector `json:"process"`
Input ProcessInput `json:"input"`
}
type SendSignalRequest ¶
type SendSignalRequest struct {
Process ProcessSelector `json:"process"`
Signal string `json:"signal"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CloseStdin ¶
func (c *Service) CloseStdin(ctx context.Context, req *CloseStdinRequest, opts *RequestOptions) error
func (*Service) ComposeFiles ¶
func (c *Service) ComposeFiles(ctx context.Context, req *ComposeFilesRequest, opts *RequestOptions) (*RestEntryInfo, error)
func (*Service) Configure ¶
func (c *Service) Configure(ctx context.Context, req *ConfigureRequest) error
func (*Service) Connect ¶
func (c *Service) Connect(ctx context.Context, req *ConnectRequest, opts *RequestOptions) (*ProcessStream, error)
func (*Service) CreateWatcher ¶
func (c *Service) CreateWatcher(ctx context.Context, req *CreateWatcherRequest, opts *RequestOptions) (*CreateWatcherResponse, error)
func (*Service) Download ¶
func (c *Service) Download(ctx context.Context, req *DownloadRequest, opts *RequestOptions) (*http.Response, error)
func (*Service) Edit ¶
func (c *Service) Edit(ctx context.Context, req *FsEditRequest, opts *RequestOptions) (*FsEditResponse, error)
func (*Service) FilesContent ¶
func (c *Service) FilesContent(ctx context.Context, req *FilesContentRequest, opts *RequestOptions) (*FilesContentResponse, error)
func (*Service) GetResult ¶
func (c *Service) GetResult(ctx context.Context, req *GetResultRequest, opts *RequestOptions) (*GetResultResponse, error)
func (*Service) GetWatcherEvents ¶
func (c *Service) GetWatcherEvents(ctx context.Context, req *GetWatcherEventsRequest, opts *RequestOptions) (*GetWatcherEventsResponse, error)
func (*Service) ListDir ¶
func (c *Service) ListDir(ctx context.Context, req *ListDirRequest, opts *RequestOptions) (*ListDirResponse, error)
func (*Service) ListProcesses ¶
func (c *Service) ListProcesses(ctx context.Context, opts *RequestOptions) (*ProcessListResponse, error)
func (*Service) MakeDir ¶
func (c *Service) MakeDir(ctx context.Context, req *MakeDirRequest, opts *RequestOptions) (*MakeDirResponse, error)
func (*Service) Move ¶
func (c *Service) Move(ctx context.Context, req *MoveRequest, opts *RequestOptions) (*MoveResponse, error)
func (*Service) ReadFile ¶
func (c *Service) ReadFile(ctx context.Context, req *FileRequest, opts *RequestOptions) (*http.Response, error)
func (*Service) Remove ¶
func (c *Service) Remove(ctx context.Context, req *RemoveRequest, opts *RequestOptions) error
func (*Service) RemoveWatcher ¶
func (c *Service) RemoveWatcher(ctx context.Context, req *RemoveWatcherRequest, opts *RequestOptions) error
func (*Service) Run ¶
func (c *Service) Run(ctx context.Context, req *AgentRunRequest, opts *RequestOptions) (*AgentRunResponse, error)
func (*Service) SendInput ¶
func (c *Service) SendInput(ctx context.Context, req *SendInputRequest, opts *RequestOptions) error
func (*Service) SendSignal ¶
func (c *Service) SendSignal(ctx context.Context, req *SendSignalRequest, opts *RequestOptions) error
func (*Service) Start ¶
func (c *Service) Start(ctx context.Context, req *ProcessStartRequest, opts *RequestOptions) (*ProcessStream, error)
func (*Service) Stat ¶
func (c *Service) Stat(ctx context.Context, req *StatRequest, opts *RequestOptions) (*StatResponse, error)
func (*Service) StreamInput ¶
func (c *Service) StreamInput(ctx context.Context, frames []StreamInputFrame, opts *RequestOptions) (*ConnectFrame, error)
func (*Service) Update ¶
func (c *Service) Update(ctx context.Context, req *UpdateRequest, opts *RequestOptions) error
func (*Service) UploadBytes ¶
func (c *Service) UploadBytes(ctx context.Context, req *UploadBytesRequest, opts *RequestOptions) ([]RestEntryInfo, error)
func (*Service) UploadJSON ¶
func (c *Service) UploadJSON(ctx context.Context, entry *WriteFileEntry, opts *RequestOptions) ([]RestEntryInfo, error)
func (*Service) UploadMultipart ¶
func (c *Service) UploadMultipart(ctx context.Context, req *UploadMultipartRequest, opts *RequestOptions) ([]RestEntryInfo, error)
func (*Service) WatchDir ¶
func (c *Service) WatchDir(ctx context.Context, req *WatchDirRequest, opts *RequestOptions) (*FilesystemWatchStream, error)
func (*Service) WriteBatch ¶
func (c *Service) WriteBatch(ctx context.Context, req *WriteFilesRequest, opts *RequestOptions) (*WriteFilesBatchResponse, error)
func (*Service) WriteFile ¶
func (c *Service) WriteFile(ctx context.Context, req *UploadBytesRequest, opts *RequestOptions) error
type StatRequest ¶
type StatRequest struct {
Path string `json:"path"`
}
type StatResponse ¶
type StatResponse struct {
Entry EntryInfo `json:"entry"`
}
type StreamInputData ¶
type StreamInputData struct {
Input ProcessInput `json:"input"`
}
type StreamInputFrame ¶
type StreamInputFrame struct {
Start *StreamInputStart `json:"start,omitempty"`
Data *StreamInputData `json:"data,omitempty"`
Keepalive *struct{} `json:"keepalive,omitempty"`
}
type StreamInputStart ¶
type StreamInputStart struct {
Process ProcessSelector `json:"process"`
}
type UpdateRequest ¶
type UpdateRequest struct {
Process ProcessSelector `json:"process"`
PTY *PtyConfig `json:"pty"`
}
type UploadBytesRequest ¶
type UploadMultipartRequest ¶
type UploadMultipartRequest struct {
Path string
Parts []MultipartFile
}
type WatchDirRequest ¶
type WriteFileEntry ¶
type WriteFilesBatchResponse ¶
type WriteFilesBatchResponse struct {
Files []WriteFilesBatchResult `json:"files"`
}
type WriteFilesBatchResult ¶
type WriteFilesRequest ¶
type WriteFilesRequest struct {
Files []WriteFileEntry `json:"files"`
}
Click to show internal directories.
Click to hide internal directories.