github.com/endophage/docker@v1.4.2-0.20161027011718-242853499895/api/types/types.go (about) 1 package types 2 3 import ( 4 "io" 5 "os" 6 "time" 7 8 "github.com/docker/docker/api/types/container" 9 "github.com/docker/docker/api/types/mount" 10 "github.com/docker/docker/api/types/network" 11 "github.com/docker/docker/api/types/registry" 12 "github.com/docker/docker/api/types/swarm" 13 "github.com/docker/go-connections/nat" 14 ) 15 16 // ContainerCreateResponse contains the information returned to a client on the 17 // creation of a new container. 18 type ContainerCreateResponse struct { 19 // ID is the ID of the created container. 20 ID string `json:"Id"` 21 22 // Warnings are any warnings encountered during the creation of the container. 23 Warnings []string `json:"Warnings"` 24 } 25 26 // ContainerExecCreateResponse contains response of Remote API: 27 // POST "/containers/{name:.*}/exec" 28 type ContainerExecCreateResponse struct { 29 // ID is the exec ID. 30 ID string `json:"Id"` 31 } 32 33 // ContainerUpdateResponse contains response of Remote API: 34 // POST "/containers/{name:.*}/update" 35 type ContainerUpdateResponse struct { 36 // Warnings are any warnings encountered during the updating of the container. 37 Warnings []string `json:"Warnings"` 38 } 39 40 // AuthResponse contains response of Remote API: 41 // POST "/auth" 42 type AuthResponse struct { 43 // Status is the authentication status 44 Status string `json:"Status"` 45 46 // IdentityToken is an opaque token used for authenticating 47 // a user after a successful login. 48 IdentityToken string `json:"IdentityToken,omitempty"` 49 } 50 51 // ContainerWaitResponse contains response of Remote API: 52 // POST "/containers/"+containerID+"/wait" 53 type ContainerWaitResponse struct { 54 // StatusCode is the status code of the wait job 55 StatusCode int `json:"StatusCode"` 56 } 57 58 // ContainerCommitResponse contains response of Remote API: 59 // POST "/commit?container="+containerID 60 type ContainerCommitResponse struct { 61 ID string `json:"Id"` 62 } 63 64 // ContainerChange contains response of Remote API: 65 // GET "/containers/{name:.*}/changes" 66 type ContainerChange struct { 67 Kind int 68 Path string 69 } 70 71 // ImageHistory contains response of Remote API: 72 // GET "/images/{name:.*}/history" 73 type ImageHistory struct { 74 ID string `json:"Id"` 75 Created int64 76 CreatedBy string 77 Tags []string 78 Size int64 79 Comment string 80 } 81 82 // ImageDelete contains response of Remote API: 83 // DELETE "/images/{name:.*}" 84 type ImageDelete struct { 85 Untagged string `json:",omitempty"` 86 Deleted string `json:",omitempty"` 87 } 88 89 // GraphDriverData returns Image's graph driver config info 90 // when calling inspect command 91 type GraphDriverData struct { 92 Name string 93 Data map[string]string 94 } 95 96 // RootFS returns Image's RootFS description including the layer IDs. 97 type RootFS struct { 98 Type string 99 Layers []string `json:",omitempty"` 100 BaseLayer string `json:",omitempty"` 101 } 102 103 // ImageInspect contains response of Remote API: 104 // GET "/images/{name:.*}/json" 105 type ImageInspect struct { 106 ID string `json:"Id"` 107 RepoTags []string 108 RepoDigests []string 109 Parent string 110 Comment string 111 Created string 112 Container string 113 ContainerConfig *container.Config 114 DockerVersion string 115 Author string 116 Config *container.Config 117 Architecture string 118 Os string 119 OsVersion string `json:",omitempty"` 120 Size int64 121 VirtualSize int64 122 GraphDriver GraphDriverData 123 RootFS RootFS 124 } 125 126 // Container contains response of Remote API: 127 // GET "/containers/json" 128 type Container struct { 129 ID string `json:"Id"` 130 Names []string 131 Image string 132 ImageID string 133 Command string 134 Created int64 135 Ports []Port 136 SizeRw int64 `json:",omitempty"` 137 SizeRootFs int64 `json:",omitempty"` 138 Labels map[string]string 139 State string 140 Status string 141 HostConfig struct { 142 NetworkMode string `json:",omitempty"` 143 } 144 NetworkSettings *SummaryNetworkSettings 145 Mounts []MountPoint 146 } 147 148 // CopyConfig contains request body of Remote API: 149 // POST "/containers/"+containerID+"/copy" 150 type CopyConfig struct { 151 Resource string 152 } 153 154 // ContainerPathStat is used to encode the header from 155 // GET "/containers/{name:.*}/archive" 156 // "Name" is the file or directory name. 157 type ContainerPathStat struct { 158 Name string `json:"name"` 159 Size int64 `json:"size"` 160 Mode os.FileMode `json:"mode"` 161 Mtime time.Time `json:"mtime"` 162 LinkTarget string `json:"linkTarget"` 163 } 164 165 // ContainerStats contains response of Remote API: 166 // GET "/stats" 167 type ContainerStats struct { 168 Body io.ReadCloser `json:"body"` 169 OSType string `json:"ostype"` 170 } 171 172 // ContainerProcessList contains response of Remote API: 173 // GET "/containers/{name:.*}/top" 174 type ContainerProcessList struct { 175 Processes [][]string 176 Titles []string 177 } 178 179 // Version contains response of Remote API: 180 // GET "/version" 181 type Version struct { 182 Version string 183 APIVersion string `json:"ApiVersion"` 184 GitCommit string 185 GoVersion string 186 Os string 187 Arch string 188 KernelVersion string `json:",omitempty"` 189 Experimental bool `json:",omitempty"` 190 BuildTime string `json:",omitempty"` 191 } 192 193 // Info contains response of Remote API: 194 // GET "/info" 195 type Info struct { 196 ID string 197 Containers int 198 ContainersRunning int 199 ContainersPaused int 200 ContainersStopped int 201 Images int 202 Driver string 203 DriverStatus [][2]string 204 SystemStatus [][2]string 205 Plugins PluginsInfo 206 MemoryLimit bool 207 SwapLimit bool 208 KernelMemory bool 209 CPUCfsPeriod bool `json:"CpuCfsPeriod"` 210 CPUCfsQuota bool `json:"CpuCfsQuota"` 211 CPUShares bool 212 CPUSet bool 213 IPv4Forwarding bool 214 BridgeNfIptables bool 215 BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` 216 Debug bool 217 NFd int 218 OomKillDisable bool 219 NGoroutines int 220 SystemTime string 221 LoggingDriver string 222 CgroupDriver string 223 NEventsListener int 224 KernelVersion string 225 OperatingSystem string 226 OSType string 227 Architecture string 228 IndexServerAddress string 229 RegistryConfig *registry.ServiceConfig 230 NCPU int 231 MemTotal int64 232 DockerRootDir string 233 HTTPProxy string `json:"HttpProxy"` 234 HTTPSProxy string `json:"HttpsProxy"` 235 NoProxy string 236 Name string 237 Labels []string 238 ExperimentalBuild bool 239 ServerVersion string 240 ClusterStore string 241 ClusterAdvertise string 242 SecurityOptions []string 243 Runtimes map[string]Runtime 244 DefaultRuntime string 245 Swarm swarm.Info 246 // LiveRestoreEnabled determines whether containers should be kept 247 // running when the daemon is shutdown or upon daemon start if 248 // running containers are detected 249 LiveRestoreEnabled bool 250 Isolation container.Isolation 251 } 252 253 // PluginsInfo is a temp struct holding Plugins name 254 // registered with docker daemon. It is used by Info struct 255 type PluginsInfo struct { 256 // List of Volume plugins registered 257 Volume []string 258 // List of Network plugins registered 259 Network []string 260 // List of Authorization plugins registered 261 Authorization []string 262 } 263 264 // ExecStartCheck is a temp struct used by execStart 265 // Config fields is part of ExecConfig in runconfig package 266 type ExecStartCheck struct { 267 // ExecStart will first check if it's detached 268 Detach bool 269 // Check if there's a tty 270 Tty bool 271 } 272 273 // HealthcheckResult stores information about a single run of a healthcheck probe 274 type HealthcheckResult struct { 275 Start time.Time // Start is the time this check started 276 End time.Time // End is the time this check ended 277 ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe 278 Output string // Output from last check 279 } 280 281 // Health states 282 const ( 283 Starting = "starting" // Starting indicates that the container is not yet ready 284 Healthy = "healthy" // Healthy indicates that the container is running correctly 285 Unhealthy = "unhealthy" // Unhealthy indicates that the container has a problem 286 ) 287 288 // Health stores information about the container's healthcheck results 289 type Health struct { 290 Status string // Status is one of Starting, Healthy or Unhealthy 291 FailingStreak int // FailingStreak is the number of consecutive failures 292 Log []*HealthcheckResult // Log contains the last few results (oldest first) 293 } 294 295 // ContainerState stores container's running state 296 // it's part of ContainerJSONBase and will return by "inspect" command 297 type ContainerState struct { 298 Status string 299 Running bool 300 Paused bool 301 Restarting bool 302 OOMKilled bool 303 Dead bool 304 Pid int 305 ExitCode int 306 Error string 307 StartedAt string 308 FinishedAt string 309 Health *Health `json:",omitempty"` 310 } 311 312 // ContainerNode stores information about the node that a container 313 // is running on. It's only available in Docker Swarm 314 type ContainerNode struct { 315 ID string 316 IPAddress string `json:"IP"` 317 Addr string 318 Name string 319 Cpus int 320 Memory int64 321 Labels map[string]string 322 } 323 324 // ContainerJSONBase contains response of Remote API: 325 // GET "/containers/{name:.*}/json" 326 type ContainerJSONBase struct { 327 ID string `json:"Id"` 328 Created string 329 Path string 330 Args []string 331 State *ContainerState 332 Image string 333 ResolvConfPath string 334 HostnamePath string 335 HostsPath string 336 LogPath string 337 Node *ContainerNode `json:",omitempty"` 338 Name string 339 RestartCount int 340 Driver string 341 MountLabel string 342 ProcessLabel string 343 AppArmorProfile string 344 ExecIDs []string 345 HostConfig *container.HostConfig 346 GraphDriver GraphDriverData 347 SizeRw *int64 `json:",omitempty"` 348 SizeRootFs *int64 `json:",omitempty"` 349 } 350 351 // ContainerJSON is newly used struct along with MountPoint 352 type ContainerJSON struct { 353 *ContainerJSONBase 354 Mounts []MountPoint 355 Config *container.Config 356 NetworkSettings *NetworkSettings 357 } 358 359 // NetworkSettings exposes the network settings in the api 360 type NetworkSettings struct { 361 NetworkSettingsBase 362 DefaultNetworkSettings 363 Networks map[string]*network.EndpointSettings 364 } 365 366 // SummaryNetworkSettings provides a summary of container's networks 367 // in /containers/json 368 type SummaryNetworkSettings struct { 369 Networks map[string]*network.EndpointSettings 370 } 371 372 // NetworkSettingsBase holds basic information about networks 373 type NetworkSettingsBase struct { 374 Bridge string // Bridge is the Bridge name the network uses(e.g. `docker0`) 375 SandboxID string // SandboxID uniquely represents a container's network stack 376 HairpinMode bool // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface 377 LinkLocalIPv6Address string // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix 378 LinkLocalIPv6PrefixLen int // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address 379 Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port 380 SandboxKey string // SandboxKey identifies the sandbox 381 SecondaryIPAddresses []network.Address 382 SecondaryIPv6Addresses []network.Address 383 } 384 385 // DefaultNetworkSettings holds network information 386 // during the 2 release deprecation period. 387 // It will be removed in Docker 1.11. 388 type DefaultNetworkSettings struct { 389 EndpointID string // EndpointID uniquely represents a service endpoint in a Sandbox 390 Gateway string // Gateway holds the gateway address for the network 391 GlobalIPv6Address string // GlobalIPv6Address holds network's global IPv6 address 392 GlobalIPv6PrefixLen int // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address 393 IPAddress string // IPAddress holds the IPv4 address for the network 394 IPPrefixLen int // IPPrefixLen represents mask length of network's IPv4 address 395 IPv6Gateway string // IPv6Gateway holds gateway address specific for IPv6 396 MacAddress string // MacAddress holds the MAC address for the network 397 } 398 399 // MountPoint represents a mount point configuration inside the container. 400 // This is used for reporting the mountpoints in use by a container. 401 type MountPoint struct { 402 Type mount.Type `json:",omitempty"` 403 Name string `json:",omitempty"` 404 Source string 405 Destination string 406 Driver string `json:",omitempty"` 407 Mode string 408 RW bool 409 Propagation mount.Propagation 410 } 411 412 // VolumesListResponse contains the response for the remote API: 413 // GET "/volumes" 414 type VolumesListResponse struct { 415 Volumes []*Volume // Volumes is the list of volumes being returned 416 Warnings []string // Warnings is a list of warnings that occurred when getting the list from the volume drivers 417 } 418 419 // VolumeCreateRequest contains the request for the remote API: 420 // POST "/volumes/create" 421 type VolumeCreateRequest struct { 422 Name string // Name is the requested name of the volume 423 Driver string // Driver is the name of the driver that should be used to create the volume 424 DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume. 425 Labels map[string]string // Labels holds metadata specific to the volume being created. 426 } 427 428 // NetworkResource is the body of the "get network" http response message 429 type NetworkResource struct { 430 Name string // Name is the requested name of the network 431 ID string `json:"Id"` // ID uniquely identifies a network on a single machine 432 Created time.Time // Created is the time the network created 433 Scope string // Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level) 434 Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`) 435 EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6 436 IPAM network.IPAM // IPAM is the network's IP Address Management 437 Internal bool // Internal represents if the network is used internal only 438 Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. 439 Containers map[string]EndpointResource // Containers contains endpoints belonging to the network 440 Options map[string]string // Options holds the network specific options to use for when creating the network 441 Labels map[string]string // Labels holds metadata specific to the network being created 442 } 443 444 // EndpointResource contains network resources allocated and used for a container in a network 445 type EndpointResource struct { 446 Name string 447 EndpointID string 448 MacAddress string 449 IPv4Address string 450 IPv6Address string 451 } 452 453 // NetworkCreate is the expected body of the "create network" http request message 454 type NetworkCreate struct { 455 CheckDuplicate bool 456 Driver string 457 EnableIPv6 bool 458 IPAM *network.IPAM 459 Internal bool 460 Attachable bool 461 Options map[string]string 462 Labels map[string]string 463 } 464 465 // NetworkCreateRequest is the request message sent to the server for network create call. 466 type NetworkCreateRequest struct { 467 NetworkCreate 468 Name string 469 } 470 471 // NetworkCreateResponse is the response message sent by the server for network create call 472 type NetworkCreateResponse struct { 473 ID string `json:"Id"` 474 Warning string 475 } 476 477 // NetworkConnect represents the data to be used to connect a container to the network 478 type NetworkConnect struct { 479 Container string 480 EndpointConfig *network.EndpointSettings `json:",omitempty"` 481 } 482 483 // NetworkDisconnect represents the data to be used to disconnect a container from the network 484 type NetworkDisconnect struct { 485 Container string 486 Force bool 487 } 488 489 // Checkpoint represents the details of a checkpoint 490 type Checkpoint struct { 491 Name string // Name is the name of the checkpoint 492 } 493 494 // Runtime describes an OCI runtime 495 type Runtime struct { 496 Path string `json:"path"` 497 Args []string `json:"runtimeArgs,omitempty"` 498 } 499 500 // DiskUsage contains response of Remote API: 501 // GET "/system/df" 502 type DiskUsage struct { 503 LayersSize int64 504 Images []*ImageSummary 505 Containers []*Container 506 Volumes []*Volume 507 } 508 509 // ImagesPruneConfig contains the configuration for Remote API: 510 // POST "/images/prune" 511 type ImagesPruneConfig struct { 512 DanglingOnly bool 513 } 514 515 // ContainersPruneConfig contains the configuration for Remote API: 516 // POST "/images/prune" 517 type ContainersPruneConfig struct { 518 } 519 520 // VolumesPruneConfig contains the configuration for Remote API: 521 // POST "/images/prune" 522 type VolumesPruneConfig struct { 523 } 524 525 // NetworksPruneConfig contains the configuration for Remote API: 526 // POST "/networks/prune" 527 type NetworksPruneConfig struct { 528 } 529 530 // ContainersPruneReport contains the response for Remote API: 531 // POST "/containers/prune" 532 type ContainersPruneReport struct { 533 ContainersDeleted []string 534 SpaceReclaimed uint64 535 } 536 537 // VolumesPruneReport contains the response for Remote API: 538 // POST "/volumes/prune" 539 type VolumesPruneReport struct { 540 VolumesDeleted []string 541 SpaceReclaimed uint64 542 } 543 544 // ImagesPruneReport contains the response for Remote API: 545 // POST "/images/prune" 546 type ImagesPruneReport struct { 547 ImagesDeleted []ImageDelete 548 SpaceReclaimed uint64 549 } 550 551 // NetworksPruneReport contains the response for Remote API: 552 // POST "/networks/prune" 553 type NetworksPruneReport struct { 554 NetworksDeleted []string 555 }