Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cell
- import "io"
- type Client interface {
- Query(QueryRequest) (QueryResponse, error)
- Allocate(AllocationRequest) (AllocationResponse, error)
- Run(RunRequest) (RunResponse, error)
- Stop(StopRequest) (StopResponse, error)
- Delete(DeleteRequest) (DeleteResponse, error)
- Events(EventRequest) (EventStream, error)
- File(FileRequest) (io.ReadCloser, error)
- }
- type EventStream interface {
- Next() (Event, error)
- Close() error
- }
- type AllocationCommand struct {
- Guid string
- Resources ContainerResources
- Tags Tags
- }
- type AllocationRequest struct {
- Allocate []AllocationCommand
- }
- type AllocationResponse struct {
- AllocationFailures []CommandFailure
- }
- type CellInfo struct {
- Guid string
- Zone string
- State CellState
- Resources CellResources
- }
- type CellResources struct {
- AvailableMemoryMB int
- MaxMemoryMB int
- AvailableDiskMB int
- MaxDiskMB int
- AvailableContainers int
- MaxContainers int
- VolumeDrivers []string
- RootFS []string
- }
- type CellState string
- const (
- CellStateStarting CellState = "starting"
- CellStateRunning CellState = "running"
- CellStateEvacuating CellState = "evacuating"
- )
- type CommandFailure struct {
- ContainerGuid string
- Error string
- }
- type ContainerInfo struct {
- Guid string
- State ContainerState
- Resources ContainerResources
- ExternalIP string
- Stopped bool
- Failed bool
- FailureReason string
- Tags Tags
- }
- type ContainerResources struct {
- MemoryLimitMB int
- DiskLimitMB int
- RootFS string
- VolumeDrivers []string
- }
- type ContainerState string
- const (
- ContainerStateReserved ContainerState = "reserved"
- ContainerStateInitializing ContainerState = "initializing"
- ContainerStateCreated ContainerState = "created"
- ContainerStateRunning ContainerState = "running"
- ContainerStateCompleted ContainerState = "completed"
- )
- type DeleteRequest struct {
- Delete []DeleteCommand
- }
- type DeleteCommand struct {
- Guid string
- }
- type DeleteResponse struct {
- DeletionFailures []CommandFailure
- }
- type EventRequest struct {
- ContainerInfo bool
- ContainerTags []string
- }
- type Event struct {
- Guid string
- State ContainerState
- }
- type FileRequest struct {
- Guid string
- Path string
- }
- type QueryRequest struct {
- CellInfo bool
- Containers bool
- ContainerGuids []string
- ContainerTags []string
- }
- type QueryResponse struct {
- CellInfo CellInfo
- Containers []ContainerInfo
- }
- type RunRequest struct {
- Run []RunCommand
- }
- type RunResponse struct {
- RunFailures []CommandFailure
- }
- type StopRequest struct {
- Stop []StopCommand
- }
- type StopCommand struct {
- Guid string
- }
- type StopResponse struct {
- StopFailures []CommandFailure
- }
- type Tags map[string]string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement