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