123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- package types
- import (
- "os"
- "time"
- "github.com/docker/docker/api/types/network"
- "github.com/docker/docker/api/types/registry"
- "github.com/docker/docker/pkg/version"
- "github.com/docker/docker/runconfig"
- "github.com/docker/go-connections/nat"
- )
- // ContainerCreateResponse contains the information returned to a client on the
- // creation of a new container.
- type ContainerCreateResponse struct {
- // ID is the ID of the created container.
- ID string `json:"Id"`
- // Warnings are any warnings encountered during the creation of the container.
- Warnings []string `json:"Warnings"`
- }
- // ContainerExecCreateResponse contains response of Remote API:
- // POST "/containers/{name:.*}/exec"
- type ContainerExecCreateResponse struct {
- // ID is the exec ID.
- ID string `json:"Id"`
- }
- // AuthResponse contains response of Remote API:
- // POST "/auth"
- type AuthResponse struct {
- // Status is the authentication status
- Status string `json:"Status"`
- }
- // ContainerWaitResponse contains response of Remote API:
- // POST "/containers/"+containerID+"/wait"
- type ContainerWaitResponse struct {
- // StatusCode is the status code of the wait job
- StatusCode int `json:"StatusCode"`
- }
- // ContainerCommitResponse contains response of Remote API:
- // POST "/commit?container="+containerID
- type ContainerCommitResponse struct {
- ID string `json:"Id"`
- }
- // ContainerChange contains response of Remote API:
- // GET "/containers/{name:.*}/changes"
- type ContainerChange struct {
- Kind int
- Path string
- }
- // ImageHistory contains response of Remote API:
- // GET "/images/{name:.*}/history"
- type ImageHistory struct {
- ID string `json:"Id"`
- Created int64
- CreatedBy string
- Tags []string
- Size int64
- Comment string
- }
- // ImageDelete contains response of Remote API:
- // DELETE "/images/{name:.*}"
- type ImageDelete struct {
- Untagged string `json:",omitempty"`
- Deleted string `json:",omitempty"`
- }
- // Image contains response of Remote API:
- // GET "/images/json"
- type Image struct {
- ID string `json:"Id"`
- ParentID string `json:"ParentId"`
- RepoTags []string
- RepoDigests []string
- Created int64
- Size int64
- VirtualSize int64
- Labels map[string]string
- }
- // GraphDriverData returns Image's graph driver config info
- // when calling inspect command
- type GraphDriverData struct {
- Name string
- Data map[string]string
- }
- // ImageInspect contains response of Remote API:
- // GET "/images/{name:.*}/json"
- type ImageInspect struct {
- ID string `json:"Id"`
- RepoTags []string
- RepoDigests []string
- Parent string
- Comment string
- Created string
- Container string
- ContainerConfig *runconfig.Config
- DockerVersion string
- Author string
- Config *runconfig.Config
- Architecture string
- Os string
- Size int64
- VirtualSize int64
- GraphDriver GraphDriverData
- }
- // Port stores open ports info of container
- // e.g. {"PrivatePort": 8080, "PublicPort": 80, "Type": "tcp"}
- type Port struct {
- IP string `json:",omitempty"`
- PrivatePort int
- PublicPort int `json:",omitempty"`
- Type string
- }
- // Container contains response of Remote API:
- // GET "/containers/json"
- type Container struct {
- ID string `json:"Id"`
- Names []string
- Image string
- ImageID string
- Command string
- Created int64
- Ports []Port
- SizeRw int64 `json:",omitempty"`
- SizeRootFs int64 `json:",omitempty"`
- Labels map[string]string
- Status string
- HostConfig struct {
- NetworkMode string `json:",omitempty"`
- }
- NetworkSettings *SummaryNetworkSettings
- }
- // CopyConfig contains request body of Remote API:
- // POST "/containers/"+containerID+"/copy"
- type CopyConfig struct {
- Resource string
- }
- // ContainerPathStat is used to encode the header from
- // GET "/containers/{name:.*}/archive"
- // "Name" is the file or directory name.
- type ContainerPathStat struct {
- Name string `json:"name"`
- Size int64 `json:"size"`
- Mode os.FileMode `json:"mode"`
- Mtime time.Time `json:"mtime"`
- LinkTarget string `json:"linkTarget"`
- }
- // ContainerProcessList contains response of Remote API:
- // GET "/containers/{name:.*}/top"
- type ContainerProcessList struct {
- Processes [][]string
- Titles []string
- }
- // Version contains response of Remote API:
- // GET "/version"
- type Version struct {
- Version string
- APIVersion version.Version `json:"ApiVersion"`
- GitCommit string
- GoVersion string
- Os string
- Arch string
- KernelVersion string `json:",omitempty"`
- Experimental bool `json:",omitempty"`
- BuildTime string `json:",omitempty"`
- }
- // Info contains response of Remote API:
- // GET "/info"
- type Info struct {
- ID string
- Containers int
- Images int
- Driver string
- DriverStatus [][2]string
- Plugins PluginsInfo
- MemoryLimit bool
- SwapLimit bool
- CPUCfsPeriod bool `json:"CpuCfsPeriod"`
- CPUCfsQuota bool `json:"CpuCfsQuota"`
- CPUShares bool
- CPUSet bool
- IPv4Forwarding bool
- BridgeNfIptables bool
- BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
- Debug bool
- NFd int
- OomKillDisable bool
- NGoroutines int
- SystemTime string
- ExecutionDriver string
- LoggingDriver string
- NEventsListener int
- KernelVersion string
- OperatingSystem string
- OSType string
- Architecture string
- IndexServerAddress string
- RegistryConfig *registry.ServiceConfig
- InitSha1 string
- InitPath string
- NCPU int
- MemTotal int64
- DockerRootDir string
- HTTPProxy string `json:"HttpProxy"`
- HTTPSProxy string `json:"HttpsProxy"`
- NoProxy string
- Name string
- Labels []string
- ExperimentalBuild bool
- ServerVersion string
- ClusterStore string
- ClusterAdvertise string
- }
- // PluginsInfo is temp struct holds Plugins name
- // registered with docker daemon. It used by Info struct
- type PluginsInfo struct {
- // List of Volume plugins registered
- Volume []string
- // List of Network plugins registered
- Network []string
- }
- // ExecStartCheck is a temp struct used by execStart
- // Config fields is part of ExecConfig in runconfig package
- type ExecStartCheck struct {
- // ExecStart will first check if it's detached
- Detach bool
- // Check if there's a tty
- Tty bool
- }
- // ContainerState stores container's running state
- // it's part of ContainerJSONBase and will return by "inspect" command
- type ContainerState struct {
- Status string
- Running bool
- Paused bool
- Restarting bool
- OOMKilled bool
- Dead bool
- Pid int
- ExitCode int
- Error string
- StartedAt string
- FinishedAt string
- }
- // ContainerJSONBase contains response of Remote API:
- // GET "/containers/{name:.*}/json"
- type ContainerJSONBase struct {
- ID string `json:"Id"`
- Created string
- Path string
- Args []string
- State *ContainerState
- Image string
- ResolvConfPath string
- HostnamePath string
- HostsPath string
- LogPath string
- Name string
- RestartCount int
- Driver string
- MountLabel string
- ProcessLabel string
- AppArmorProfile string
- ExecIDs []string
- HostConfig *runconfig.HostConfig
- GraphDriver GraphDriverData
- SizeRw *int64 `json:",omitempty"`
- SizeRootFs *int64 `json:",omitempty"`
- }
- // ContainerJSON is newly used struct along with MountPoint
- type ContainerJSON struct {
- *ContainerJSONBase
- Mounts []MountPoint
- Config *runconfig.Config
- NetworkSettings *NetworkSettings
- }
- // NetworkSettings exposes the network settings in the api
- type NetworkSettings struct {
- NetworkSettingsBase
- DefaultNetworkSettings
- Networks map[string]*network.EndpointSettings
- }
- // SummaryNetworkSettings provides a summary of container's networks
- // in /containers/json
- type SummaryNetworkSettings struct {
- Networks map[string]*network.EndpointSettings
- }
- // NetworkSettingsBase holds basic information about networks
- type NetworkSettingsBase struct {
- Bridge string
- SandboxID string
- HairpinMode bool
- LinkLocalIPv6Address string
- LinkLocalIPv6PrefixLen int
- Ports nat.PortMap
- SandboxKey string
- SecondaryIPAddresses []network.Address
- SecondaryIPv6Addresses []network.Address
- }
- // DefaultNetworkSettings holds network information
- // during the 2 release deprecation period.
- // It will be removed in Docker 1.11.
- type DefaultNetworkSettings struct {
- EndpointID string
- Gateway string
- GlobalIPv6Address string
- GlobalIPv6PrefixLen int
- IPAddress string
- IPPrefixLen int
- IPv6Gateway string
- MacAddress string
- }
- // MountPoint represents a mount point configuration inside the container.
- type MountPoint struct {
- Name string `json:",omitempty"`
- Source string
- Destination string
- Driver string `json:",omitempty"`
- Mode string
- RW bool
- Propagation string
- }
- // Volume represents the configuration of a volume for the remote API
- type Volume struct {
- Name string // Name is the name of the volume
- Driver string // Driver is the Driver name used to create the volume
- Mountpoint string // Mountpoint is the location on disk of the volume
- }
- // VolumesListResponse contains the response for the remote API:
- // GET "/volumes"
- type VolumesListResponse struct {
- Volumes []*Volume // Volumes is the list of volumes being returned
- }
- // VolumeCreateRequest contains the response for the remote API:
- // POST "/volumes/create"
- type VolumeCreateRequest struct {
- Name string // Name is the requested name of the volume
- Driver string // Driver is the name of the driver that should be used to create the volume
- DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume.
- }
- // NetworkResource is the body of the "get network" http response message
- type NetworkResource struct {
- Name string
- ID string `json:"Id"`
- Scope string
- Driver string
- IPAM network.IPAM
- Containers map[string]EndpointResource
- Options map[string]string
- }
- // EndpointResource contains network resources allocated and used for a container in a network
- type EndpointResource struct {
- Name string
- EndpointID string
- MacAddress string
- IPv4Address string
- IPv6Address string
- }
- // NetworkCreate is the expected body of the "create network" http request message
- type NetworkCreate struct {
- Name string
- CheckDuplicate bool
- Driver string
- IPAM network.IPAM
- Options map[string]string
- }
- // NetworkCreateResponse is the response message sent by the server for network create call
- type NetworkCreateResponse struct {
- ID string `json:"Id"`
- Warning string
- }
- // NetworkConnect represents the data to be used to connect a container to the network
- type NetworkConnect struct {
- Container string
- }
- // NetworkDisconnect represents the data to be used to disconnect a container from the network
- type NetworkDisconnect struct {
- Container string
- }
|