model

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

View Source
const (
	HeaderRequestID = "X-Request-ID"
	HeaderApiVer    = "X-Api-Version"
	HeaderSrvName   = "X-Service"
)
View Source
const (
	ContainersPath       = "containers"
	ContainerStartPath   = "start"
	ContainerStopPath    = "stop"
	ContainerRestartPath = "restart"
	ContainerLogsPath    = "logs"
	ContainerExecPath    = "exec"
	ImagesPath           = "images"
	NetworksPath         = "networks"
	VolumesPath          = "volumes"
	JobsPath             = "jobs"
	JobsCancelPath       = "cancel"
	SrvInfoPath          = "info"
	RestrictedPath       = "restricted"
)

Variables

View Source
var ContainerStateMap = map[ContainerState]struct{}{
	InitState:       {},
	RunningState:    {},
	PausedState:     {},
	RestartingState: {},
	RemovingState:   {},
	StoppedState:    {},
	DeadState:       {},
}
View Source
var MountTypeMap = map[MountType]struct{}{
	BindMount:   {},
	VolumeMount: {},
	TmpfsMount:  {},
}
View Source
var NetworkTypeMap = map[NetworkType]struct{}{
	BridgeNet:  {},
	MACVlanNet: {},
	HostNet:    {},
}
View Source
var PortTypeMap = map[PortType]struct{}{
	TcpPort:  {},
	UdpPort:  {},
	SctpPort: {},
}
View Source
var RestartStrategyMap = map[RestartStrategy]struct{}{
	RestartNever:      {},
	RestartAlways:     {},
	RestartNotStopped: {},
	RestartOnFail:     {},
}

Functions

func NewInternalError added in v0.5.0

func NewInternalError(err error) error

func NewInvalidInputError added in v0.5.0

func NewInvalidInputError(err error) error

func NewNotFoundError added in v0.5.0

func NewNotFoundError(err error) error

Types

type Container

type Container struct {
	ID        string            `json:"id"`
	Name      string            `json:"name"`
	State     ContainerState    `json:"state"`
	Health    *ContainerHealth  `json:"health"`
	Created   time.Time         `json:"created"`
	Started   *time.Time        `json:"started"`
	Image     string            `json:"image"`
	ImageID   string            `json:"image_id"`
	EnvVars   map[string]string `json:"env_vars"`
	Labels    map[string]string `json:"labels"`
	Mounts    []Mount           `json:"mounts"`
	Devices   []Device          `json:"devices"`
	Ports     []Port            `json:"ports"`
	Networks  []ContainerNet    `json:"networks"`
	RunConfig RunConfig         `json:"run_config"`
}

type ContainerFilter

type ContainerFilter struct {
	Name   string
	State  ContainerState
	Labels map[string]string
}

type ContainerHealth added in v0.8.0

type ContainerHealth = string
const (
	HealthyState    ContainerHealth = "healthy"
	UnhealthyState  ContainerHealth = "unhealthy"
	TransitionState ContainerHealth = "transitioning"
)

type ContainerNet

type ContainerNet struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	DomainNames []string `json:"domain_names"`
	Gateway     IPAddr   `json:"gateway"`
	IPAddress   IPAddr   `json:"ip_address"`
	MacAddress  string   `json:"mac_address"`
}

type ContainerState

type ContainerState = string
const (
	InitState       ContainerState = "initialized"
	RunningState    ContainerState = "running"
	PausedState     ContainerState = "paused"
	RestartingState ContainerState = "restarting"
	RemovingState   ContainerState = "removing"
	StoppedState    ContainerState = "stopped"
	DeadState       ContainerState = "dead"
)

type Device added in v0.7.0

type Device struct {
	Source   string `json:"source"`
	Target   string `json:"target"`
	ReadOnly bool   `json:"read_only"`
}

func (*Device) KeyStr added in v0.7.0

func (d *Device) KeyStr() string

type ExecConfig added in v0.13.0

type ExecConfig struct {
	Tty     bool
	EnvVars map[string]string
	WorkDir string
	Cmd     []string
}

type IPAddr

type IPAddr net.IP

func (IPAddr) MarshalJSON

func (i IPAddr) MarshalJSON() ([]byte, error)

func (*IPAddr) UnmarshalJSON

func (i *IPAddr) UnmarshalJSON(b []byte) (err error)

type Image

type Image struct {
	ID      string            `json:"id"`
	Created time.Time         `json:"created"`
	Size    int64             `json:"size"`
	Arch    string            `json:"arch"`
	Tags    []string          `json:"tags"`
	Digests []string          `json:"digests"`
	Labels  map[string]string `json:"labels"`
}

type ImageFilter

type ImageFilter struct {
	Name   string
	Tag    string
	Labels map[string]string
}

type ImageRequest

type ImageRequest struct {
	Image string `json:"image"`
}

type InternalError added in v0.5.0

type InternalError struct {
	// contains filtered or unexported fields
}

func (*InternalError) Error added in v0.5.0

func (e *InternalError) Error() string

func (*InternalError) Unwrap added in v0.5.0

func (e *InternalError) Unwrap() error

type InvalidInputError added in v0.5.0

type InvalidInputError struct {
	// contains filtered or unexported fields
}

func (*InvalidInputError) Error added in v0.5.0

func (e *InvalidInputError) Error() string

func (*InvalidInputError) Unwrap added in v0.5.0

func (e *InvalidInputError) Unwrap() error

type LogFilter

type LogFilter struct {
	MaxLines int
	Since    time.Time
	Until    time.Time
}

type Mount

type Mount struct {
	Type     MountType         `json:"type"`
	Source   string            `json:"source"`
	Target   string            `json:"target"`
	ReadOnly bool              `json:"read_only"`
	Labels   map[string]string `json:"labels,omitempty"`
	Size     int64             `json:"size,omitempty"`
	Mode     fs.FileMode       `json:"mode,omitempty"`
}

func (*Mount) KeyStr

func (m *Mount) KeyStr() string

type MountType

type MountType = string
const (
	BindMount   MountType = "bind"
	VolumeMount MountType = "volume"
	TmpfsMount  MountType = "tmpfs"
)

type Network

type Network struct {
	ID      string      `json:"id"`
	Name    string      `json:"name"`
	Type    NetworkType `json:"type"`
	Subnet  Subnet      `json:"subnet"`
	Gateway IPAddr      `json:"gateway"`
}

type NetworkType

type NetworkType = string
const (
	BridgeNet  NetworkType = "bridge"
	MACVlanNet NetworkType = "macvlan"
	HostNet    NetworkType = "host"
)

type NotFoundError added in v0.5.0

type NotFoundError struct {
	// contains filtered or unexported fields
}

func (*NotFoundError) Error added in v0.5.0

func (e *NotFoundError) Error() string

func (*NotFoundError) Unwrap added in v0.5.0

func (e *NotFoundError) Unwrap() error

type Port

type Port struct {
	Number   int           `json:"number"`
	Protocol PortType      `json:"protocol"`
	Bindings []PortBinding `json:"bindings"`
}

func (*Port) KeyStr

func (p *Port) KeyStr() string

type PortBinding

type PortBinding struct {
	Number    int    `json:"number"`
	Interface IPAddr `json:"interface"`
}

type PortType

type PortType = string
const (
	TcpPort  PortType = "tcp"
	UdpPort  PortType = "udp"
	SctpPort PortType = "sctp"
)

type RestartStrategy

type RestartStrategy = string
const (
	RestartNever      RestartStrategy = "never"
	RestartAlways     RestartStrategy = "always"
	RestartNotStopped RestartStrategy = "not-stopped"
	RestartOnFail     RestartStrategy = "on-fail"
)

type RunConfig

type RunConfig struct {
	RestartStrategy RestartStrategy `json:"restart_strategy"`
	Retries         *int            `json:"retries"`
	RemoveAfterRun  bool            `json:"remove_after_run"`
	StopTimeout     *time.Duration  `json:"stop_timeout"`
	StopSignal      *string         `json:"stop_signal"`
	PseudoTTY       bool            `json:"pseudo_tty"`
	Command         []string        `json:"command"`
}

type Subnet

type Subnet struct {
	Prefix IPAddr `json:"prefix"`
	Bits   int    `json:"bits"`
}

func (*Subnet) KeyStr

func (s *Subnet) KeyStr() string

type Volume

type Volume struct {
	Name    string            `json:"name"`
	Created time.Time         `json:"created"`
	Labels  map[string]string `json:"labels"`
}

type VolumeFilter

type VolumeFilter struct {
	Labels map[string]string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL