Documentation ¶
Index ¶
- Variables
- func ContainerStateString(state *types.ContainerState) string
- type ComposeStorage
- func (storage *ComposeStorage) CreateProjectSpec(createProject CreateProject) (*ProjectData, error)
- func (storage *ComposeStorage) ProjectJSON(projectName string) (*ProjectJSON, error)
- func (storage *ComposeStorage) ProjectSpec(projectName string) (*ProjectData, error)
- func (storage *ComposeStorage) ProjectSpecs() ([]*ProjectData, error)
- func (storage *ComposeStorage) RemoveProjectSpec(projectName string) error
- func (storage *ComposeStorage) SaveProjectPackageFile(projectName string, packageFile string, packageFileBytes []byte) (string, error)
- func (storage *ComposeStorage) SetProjectJSON(projectJSON *ProjectJSON) error
- type Config
- type Container
- type ContainerLog
- type ContainerOperate
- type ContainerStats
- type ContainerStatsFromDocker
- type ContainerStatsWithError
- type CreateProject
- type IORecursive
- type Image
- type ImageTags
- type OperateProject
- type PortBinding
- type ProjectBase
- type ProjectData
- type ProjectInfo
- type ProjectJSON
- type ProjectStatus
- type ProjectUploadStatus
- type ServiceState
- type VolumesBinding
Constants ¶
This section is empty.
Variables ¶
var ( //ErrProjectNameInvalid is exported ErrProjectNameInvalid = errors.New("project name invalid") //ErrProjectPackageFileInvalid is exported ErrProjectPackageFileInvalid = errors.New("project package file invalid") )
var ( RestartPolicyType = map[string]interface{}{ "no": true, "always": true, "on-failure": true, } ActionType = map[string]interface{}{ "start": true, "stop": true, "restart": true, "kill": true, "pause": true, "unpause": true, "rename": true, "upgrade": true, } )
var ErrorMap = map[int]string{
20001: "Container already created, but cannot start",
20002: "Get container info failed when upgrade container",
20003: "Rename container failed when upgrade or update container",
20004: "Try pull image failed when upgrade container",
20005: "Stop container failed when upgrade or update container",
20006: "Cannot create new container when upgrade container",
20007: "Cannot start new container when upgrade container",
20008: "Cannot delete old container when upgrade container, but image is upgrade succeed",
21001: "Try pull image failed when create or update container",
}
ErrorMap - error map msg
Functions ¶
func ContainerStateString ¶
func ContainerStateString(state *types.ContainerState) string
ContainerStateString - convert container state to short string format
Types ¶
type ComposeStorage ¶
ComposeStorage is exported compose project local storage.
func NewComposeStorage ¶
func NewComposeStorage(rootPath string) (*ComposeStorage, error)
NewComposeStorage is exported
func (*ComposeStorage) CreateProjectSpec ¶
func (storage *ComposeStorage) CreateProjectSpec(createProject CreateProject) (*ProjectData, error)
CreateProjectSpec is exported
func (*ComposeStorage) ProjectJSON ¶
func (storage *ComposeStorage) ProjectJSON(projectName string) (*ProjectJSON, error)
ProjectJSON is exported
func (*ComposeStorage) ProjectSpec ¶
func (storage *ComposeStorage) ProjectSpec(projectName string) (*ProjectData, error)
ProjectSpec is exported
func (*ComposeStorage) ProjectSpecs ¶
func (storage *ComposeStorage) ProjectSpecs() ([]*ProjectData, error)
ProjectSpecs is exported
func (*ComposeStorage) RemoveProjectSpec ¶
func (storage *ComposeStorage) RemoveProjectSpec(projectName string) error
RemoveProjectSpec is exported
func (*ComposeStorage) SaveProjectPackageFile ¶
func (storage *ComposeStorage) SaveProjectPackageFile(projectName string, packageFile string, packageFileBytes []byte) (string, error)
SaveProjectPackageFile is exported
func (*ComposeStorage) SetProjectJSON ¶
func (storage *ComposeStorage) SetProjectJSON(projectJSON *ProjectJSON) error
SetProjectJSON is exported
type Config ¶
type Config struct { AppVersion string `json:"AppVersion"` DockerEndPoint string `json:"DockerEndPoint"` DockerAPIVersion string `json:"DockerAPIVersion"` DockerRegistryAddress string `json:"-"` EnableBuildImage bool `json:"-"` DockerComposePath string `json:"DockerComposePath"` DockerComposePackageMaxSize int64 `json:"DockerComposePackageMaxSize"` DockerNodeHTTPAddr string `json:"DockerNodeHTTPAddr"` DockerContainerPortsRange string `json:"DockerContainerPortsRange"` DockerClusterEnabled bool `json:"DockerClusterEnabled"` DockerClusterURIs string `json:"DockerClusterURIs"` DockerClusterName string `json:"DockerClusterName"` DockerClusterHeartBeat string `json:"DockerClusterHeartBeat"` DockerClusterTTL string `json:"DockerClusterTTL"` LogLevel int `json:"LogLevel"` }
Config - config info
type Container ¶
type Container struct { ID string `json:"Id"` Image string `json:"Image"` Command string `json:"Command"` CommandWithoutEntryPoint string `json:"CommandWithoutEntryPoint"` Name string `json:"Name"` Ports []PortBinding `json:"Ports"` Volumes []VolumesBinding `json:"Volumes"` DNS []string `json:"Dns"` Env []string `json:"Env"` HostName string `json:"HostName"` NetworkMode string `json:"NetworkMode"` Status interface{} `json:"Status,omitempty"` RestartPolicy string `json:"RestartPolicy,omitempty"` RestartRetryCount int `json:"RestartRetryCount,omitempty"` ExtraHosts []string `json:"Extrahosts"` Memory int64 `json:"Memory,omitempty"` SHMSize int64 `json:"SHMSize,omitempty"` Links []string `json:"Links"` Ulimits []*units.Ulimit `json:"Ulimits"` Labels map[string]string `json:"Labels"` LogConfig container.LogConfig `json:"LogConfig"` }
Container - define container info struct
func (*Container) Parse ¶
func (container *Container) Parse(origContainer *types.ContainerJSON)
Parse - parse container from original container info
type ContainerLog ¶
ContainerLog - define container logs info struct
type ContainerOperate ¶
type ContainerOperate struct { Action string `json:"Action"` Container string `json:"Container"` ImageTag string `json:"ImageTag"` NewName string `json:"NewName"` }
ContainerOperate - define container http request struct
type ContainerStats ¶
type ContainerStats struct { ContainerName string `json:"ContainerName"` ContainerID string `json:"ContainerID"` CPUUsage string `json:"CPUUsage"` MemoryUsage int64 `json:"MemoryUsage"` MemoryLimit int64 `json:"MemoryLimit"` MemoryPercent float64 `json:"MemoryPercent"` NetworkIn int64 `json:"NetworkIn"` NetworkOut int64 `json:"NetowrkOut"` IOBytesRead int64 `json:"IOBytesRead"` IOBytesWrite int64 `json:"IOBytesWrite"` }
ContainerStats - define container stats info struct
type ContainerStatsFromDocker ¶
type ContainerStatsFromDocker struct { Network struct { RxBytes float64 `json:"rx_bytes"` TxBytes float64 `json:"tx_bytes"` } `json:"network"` PreCPUStats struct { CPUUsage struct { TotalUsage float64 `json:"total_usage"` } `json:"cpu_usage"` SystemCPUUsage float64 `json:"system_cpu_usage"` } `json:"precpu_stats"` CPUStats struct { CPUUsage struct { TotalUsage float64 `json:"total_usage"` } `json:"cpu_usage"` SystemCPUUsage float64 `json:"system_cpu_usage"` } `json:"cpu_stats"` MemoryStats struct { Usage float64 `json:"usage"` Limit float64 `json:"limit"` } `json:"memory_stats"` BlkioStats struct { IOServiceBytesRecursive []IORecursive `json:"io_service_bytes_recursive"` } `json:"blkio_stats"` }
ContainerStatsFromDocker - define container stats info from dockerapi
type ContainerStatsWithError ¶
type ContainerStatsWithError struct { Stats ContainerStats `json:"ContainerStats"` Error interface{} `json:"Error"` }
ContainerStatsWithError - define container stats info struct
type CreateProject ¶
type CreateProject struct { Name string `json:"Name"` ComposeData string `json:"ComposeData"` PackageFile string `json:"PackageFile"` }
CreateProject - define compose create project struct
type IORecursive ¶
type IORecursive struct { Major int64 `json:"major"` Minor int64 `json:"minor"` Op string `json:"op"` Value int64 `json:"value"` }
IORecursive - define container stats's IORecursive
type OperateProject ¶
OperateProject - define compose operate project struct
type PortBinding ¶
type PortBinding struct { PrivatePort int `json:"PrivatePort"` PublicPort int `json:"PublicPort"` Type string `json:"Type"` IP string `json:"Ip"` }
PortBinding - define container port binding info struct
type ProjectBase ¶
type ProjectBase struct { Name string `json:"Name"` HashCode string `json:"HashCode"` Timestamp int64 `json:"Timestamp"` Containers project.InfoSet `json:"Containers"` }
ProjectBase - define project base info struct
type ProjectData ¶
type ProjectData struct { *ProjectJSON ComposeFile string `json:"ComposeFile"` ComposeBytes []byte `json:"ComposeBytes"` }
ProjectData is exported
type ProjectInfo ¶
type ProjectInfo struct { ProjectBase ComposeData string `json:"ComposeData"` PackageFile string `json:"PackageFile"` }
ProjectInfo - define compose project info struct
type ProjectJSON ¶
type ProjectJSON struct { Name string `json:"Name"` HashCode string `json:"HashCode"` PackageFile string `json:"PackageFile"` Timestamp int64 `json:"Timestamp"` }
ProjectJSON is exported
type ProjectStatus ¶
type ProjectStatus struct { Name string `json:"Name"` Status interface{} `json:"Status"` }
ProjectStatus - define compose project status struct
type ProjectUploadStatus ¶
type ProjectUploadStatus struct { Name string `json:"Name"` PackageFile string `json:"PackageFile"` Status interface{} `json:"Status"` }
ProjectUploadStatus - define compose project package file upload struct
type ServiceState ¶
type ServiceState struct { Name string `json:"Name"` *types.ContainerState }
ServiceState - define compose service state struct
type VolumesBinding ¶
type VolumesBinding struct { ContainerVolume string `json:"ContainerVolume"` HostVolume string `json:"HostVolume"` BindMount string `json:"BindMount,omitempty"` }
VolumesBinding - define container volumes binding info struct