github.com/goern/docker@v1.9.0-rc1/api/types/types.go (about) 1 package types 2 3 import ( 4 "os" 5 "time" 6 7 "github.com/docker/docker/daemon/network" 8 "github.com/docker/docker/pkg/version" 9 "github.com/docker/docker/registry" 10 "github.com/docker/docker/runconfig" 11 ) 12 13 // ContainerCreateResponse contains the information returned to a client on the 14 // creation of a new container. 15 type ContainerCreateResponse struct { 16 // ID is the ID of the created container. 17 ID string `json:"Id"` 18 19 // Warnings are any warnings encountered during the creation of the container. 20 Warnings []string `json:"Warnings"` 21 } 22 23 // ContainerExecCreateResponse contains response of Remote API: 24 // POST "/containers/{name:.*}/exec" 25 type ContainerExecCreateResponse struct { 26 // ID is the exec ID. 27 ID string `json:"Id"` 28 } 29 30 // AuthResponse contains response of Remote API: 31 // POST "/auth" 32 type AuthResponse struct { 33 // Status is the authentication status 34 Status string `json:"Status"` 35 } 36 37 // ContainerWaitResponse contains response of Remote API: 38 // POST "/containers/"+containerID+"/wait" 39 type ContainerWaitResponse struct { 40 // StatusCode is the status code of the wait job 41 StatusCode int `json:"StatusCode"` 42 } 43 44 // ContainerCommitResponse contains response of Remote API: 45 // POST "/commit?container="+containerID 46 type ContainerCommitResponse struct { 47 ID string `json:"Id"` 48 } 49 50 // ContainerChange contains response of Remote API: 51 // GET "/containers/{name:.*}/changes" 52 type ContainerChange struct { 53 Kind int 54 Path string 55 } 56 57 // ImageHistory contains response of Remote API: 58 // GET "/images/{name:.*}/history" 59 type ImageHistory struct { 60 ID string `json:"Id"` 61 Created int64 62 CreatedBy string 63 Tags []string 64 Size int64 65 Comment string 66 } 67 68 // ImageDelete contains response of Remote API: 69 // DELETE "/images/{name:.*}" 70 type ImageDelete struct { 71 Untagged string `json:",omitempty"` 72 Deleted string `json:",omitempty"` 73 } 74 75 // Image contains response of Remote API: 76 // GET "/images/json" 77 type Image struct { 78 ID string `json:"Id"` 79 ParentID string `json:"ParentId"` 80 RepoTags []string 81 RepoDigests []string 82 Created int64 83 Size int64 84 VirtualSize int64 85 Labels map[string]string 86 } 87 88 // GraphDriverData returns Image's graph driver config info 89 // when calling inspect command 90 type GraphDriverData struct { 91 Name string 92 Data map[string]string 93 } 94 95 // ImageInspect contains response of Remote API: 96 // GET "/images/{name:.*}/json" 97 type ImageInspect struct { 98 ID string `json:"Id"` 99 Tags []string 100 Parent string 101 Comment string 102 Created string 103 Container string 104 ContainerConfig *runconfig.Config 105 DockerVersion string 106 Author string 107 Config *runconfig.Config 108 Architecture string 109 Os string 110 Size int64 111 VirtualSize int64 112 GraphDriver GraphDriverData 113 } 114 115 // Port stores open ports info of container 116 // e.g. {"PrivatePort": 8080, "PublicPort": 80, "Type": "tcp"} 117 type Port struct { 118 IP string `json:",omitempty"` 119 PrivatePort int 120 PublicPort int `json:",omitempty"` 121 Type string 122 } 123 124 // Container contains response of Remote API: 125 // GET "/containers/json" 126 type Container struct { 127 ID string `json:"Id"` 128 Names []string 129 Image string 130 ImageID string 131 Command string 132 Created int64 133 Ports []Port 134 SizeRw int64 `json:",omitempty"` 135 SizeRootFs int64 `json:",omitempty"` 136 Labels map[string]string 137 Status string 138 HostConfig struct { 139 NetworkMode string `json:",omitempty"` 140 } 141 } 142 143 // CopyConfig contains request body of Remote API: 144 // POST "/containers/"+containerID+"/copy" 145 type CopyConfig struct { 146 Resource string 147 } 148 149 // ContainerPathStat is used to encode the header from 150 // GET "/containers/{name:.*}/archive" 151 // "Name" is the file or directory name. 152 type ContainerPathStat struct { 153 Name string `json:"name"` 154 Size int64 `json:"size"` 155 Mode os.FileMode `json:"mode"` 156 Mtime time.Time `json:"mtime"` 157 LinkTarget string `json:"linkTarget"` 158 } 159 160 // ContainerProcessList contains response of Remote API: 161 // GET "/containers/{name:.*}/top" 162 type ContainerProcessList struct { 163 Processes [][]string 164 Titles []string 165 } 166 167 // Version contains response of Remote API: 168 // GET "/version" 169 type Version struct { 170 Version string 171 APIVersion version.Version `json:"ApiVersion"` 172 GitCommit string 173 GoVersion string 174 Os string 175 Arch string 176 KernelVersion string `json:",omitempty"` 177 Experimental bool `json:",omitempty"` 178 BuildTime string `json:",omitempty"` 179 } 180 181 // Info contains response of Remote API: 182 // GET "/info" 183 type Info struct { 184 ID string 185 Containers int 186 Images int 187 Driver string 188 DriverStatus [][2]string 189 MemoryLimit bool 190 SwapLimit bool 191 CPUCfsPeriod bool `json:"CpuCfsPeriod"` 192 CPUCfsQuota bool `json:"CpuCfsQuota"` 193 IPv4Forwarding bool 194 BridgeNfIptables bool 195 BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` 196 Debug bool 197 NFd int 198 OomKillDisable bool 199 NGoroutines int 200 SystemTime string 201 ExecutionDriver string 202 LoggingDriver string 203 NEventsListener int 204 KernelVersion string 205 OperatingSystem string 206 IndexServerAddress string 207 RegistryConfig *registry.ServiceConfig 208 InitSha1 string 209 InitPath string 210 NCPU int 211 MemTotal int64 212 DockerRootDir string 213 HTTPProxy string `json:"HttpProxy"` 214 HTTPSProxy string `json:"HttpsProxy"` 215 NoProxy string 216 Name string 217 Labels []string 218 ExperimentalBuild bool 219 ServerVersion string 220 ClusterStore string 221 } 222 223 // ExecStartCheck is a temp struct used by execStart 224 // Config fields is part of ExecConfig in runconfig package 225 type ExecStartCheck struct { 226 // ExecStart will first check if it's detached 227 Detach bool 228 // Check if there's a tty 229 Tty bool 230 } 231 232 // ContainerState stores container's running state 233 // it's part of ContainerJSONBase and will return by "inspect" command 234 type ContainerState struct { 235 Status string 236 Running bool 237 Paused bool 238 Restarting bool 239 OOMKilled bool 240 Dead bool 241 Pid int 242 ExitCode int 243 Error string 244 StartedAt string 245 FinishedAt string 246 } 247 248 // ContainerJSONBase contains response of Remote API: 249 // GET "/containers/{name:.*}/json" 250 type ContainerJSONBase struct { 251 ID string `json:"Id"` 252 Created string 253 Path string 254 Args []string 255 State *ContainerState 256 Image string 257 NetworkSettings *network.Settings 258 ResolvConfPath string 259 HostnamePath string 260 HostsPath string 261 LogPath string 262 Name string 263 RestartCount int 264 Driver string 265 ExecDriver string 266 MountLabel string 267 ProcessLabel string 268 AppArmorProfile string 269 ExecIDs []string 270 HostConfig *runconfig.HostConfig 271 GraphDriver GraphDriverData 272 SizeRw *int64 `json:",omitempty"` 273 SizeRootFs *int64 `json:",omitempty"` 274 } 275 276 // ContainerJSON is newly used struct along with MountPoint 277 type ContainerJSON struct { 278 *ContainerJSONBase 279 Mounts []MountPoint 280 Config *runconfig.Config 281 } 282 283 // MountPoint represents a mount point configuration inside the container. 284 type MountPoint struct { 285 Name string `json:",omitempty"` 286 Source string 287 Destination string 288 Driver string `json:",omitempty"` 289 Mode string 290 RW bool 291 } 292 293 // Volume represents the configuration of a volume for the remote API 294 type Volume struct { 295 Name string // Name is the name of the volume 296 Driver string // Driver is the Driver name used to create the volume 297 Mountpoint string // Mountpoint is the location on disk of the volume 298 } 299 300 // VolumesListResponse contains the response for the remote API: 301 // GET "/volumes" 302 type VolumesListResponse struct { 303 Volumes []*Volume // Volumes is the list of volumes being returned 304 } 305 306 // VolumeCreateRequest contains the response for the remote API: 307 // POST "/volumes" 308 type VolumeCreateRequest struct { 309 Name string // Name is the requested name of the volume 310 Driver string // Driver is the name of the driver that should be used to create the volume 311 DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume. 312 } 313 314 // NetworkResource is the body of the "get network" http response message 315 type NetworkResource struct { 316 Name string `json:"name"` 317 ID string `json:"id"` 318 Scope string `json:"scope"` 319 Driver string `json:"driver"` 320 IPAM network.IPAM `json:"ipam"` 321 Containers map[string]EndpointResource `json:"containers"` 322 } 323 324 //EndpointResource contains network resources allocated and usd for a container in a network 325 type EndpointResource struct { 326 EndpointID string `json:"endpoint"` 327 MacAddress string `json:"mac_address"` 328 IPv4Address string `json:"ipv4_address"` 329 IPv6Address string `json:"ipv6_address"` 330 } 331 332 // NetworkCreate is the expected body of the "create network" http request message 333 type NetworkCreate struct { 334 Name string `json:"name"` 335 CheckDuplicate bool `json:"check_duplicate"` 336 Driver string `json:"driver"` 337 IPAM network.IPAM `json:"ipam"` 338 } 339 340 // NetworkCreateResponse is the response message sent by the server for network create call 341 type NetworkCreateResponse struct { 342 ID string `json:"id"` 343 Warning string `json:"warning"` 344 } 345 346 // NetworkConnect represents the data to be used to connect a container to the network 347 type NetworkConnect struct { 348 Container string `json:"container"` 349 } 350 351 // NetworkDisconnect represents the data to be used to disconnect a container from the network 352 type NetworkDisconnect struct { 353 Container string `json:"container"` 354 }