github.com/mheon/docker@v0.11.2-0.20150922122814-44f47903a831/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 Command string 131 Created int64 132 Ports []Port 133 SizeRw int64 `json:",omitempty"` 134 SizeRootFs int64 `json:",omitempty"` 135 Labels map[string]string 136 Status string 137 HostConfig struct { 138 NetworkMode string `json:",omitempty"` 139 } 140 } 141 142 // CopyConfig contains request body of Remote API: 143 // POST "/containers/"+containerID+"/copy" 144 type CopyConfig struct { 145 Resource string 146 } 147 148 // ContainerPathStat is used to encode the header from 149 // GET "/containers/{name:.*}/archive" 150 // "Name" is the file or directory name. 151 type ContainerPathStat struct { 152 Name string `json:"name"` 153 Size int64 `json:"size"` 154 Mode os.FileMode `json:"mode"` 155 Mtime time.Time `json:"mtime"` 156 LinkTarget string `json:"linkTarget"` 157 } 158 159 // ContainerProcessList contains response of Remote API: 160 // GET "/containers/{name:.*}/top" 161 type ContainerProcessList struct { 162 Processes [][]string 163 Titles []string 164 } 165 166 // Version contains response of Remote API: 167 // GET "/version" 168 type Version struct { 169 Version string 170 APIVersion version.Version `json:"ApiVersion"` 171 GitCommit string 172 GoVersion string 173 Os string 174 Arch string 175 KernelVersion string `json:",omitempty"` 176 Experimental bool `json:",omitempty"` 177 BuildTime string `json:",omitempty"` 178 } 179 180 // Info contains response of Remote API: 181 // GET "/info" 182 type Info struct { 183 ID string 184 Containers int 185 Images int 186 Driver string 187 DriverStatus [][2]string 188 MemoryLimit bool 189 SwapLimit bool 190 CPUCfsPeriod bool `json:"CpuCfsPeriod"` 191 CPUCfsQuota bool `json:"CpuCfsQuota"` 192 IPv4Forwarding bool 193 BridgeNfIptables bool 194 BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` 195 Debug bool 196 NFd int 197 OomKillDisable bool 198 NGoroutines int 199 SystemTime string 200 ExecutionDriver string 201 LoggingDriver string 202 NEventsListener int 203 KernelVersion string 204 OperatingSystem string 205 IndexServerAddress string 206 RegistryConfig *registry.ServiceConfig 207 InitSha1 string 208 InitPath string 209 NCPU int 210 MemTotal int64 211 DockerRootDir string 212 HTTPProxy string `json:"HttpProxy"` 213 HTTPSProxy string `json:"HttpsProxy"` 214 NoProxy string 215 Name string 216 Labels []string 217 ExperimentalBuild bool 218 ServerVersion string 219 } 220 221 // ExecStartCheck is a temp struct used by execStart 222 // Config fields is part of ExecConfig in runconfig package 223 type ExecStartCheck struct { 224 // ExecStart will first check if it's detached 225 Detach bool 226 // Check if there's a tty 227 Tty bool 228 } 229 230 // ContainerState stores container's running state 231 // it's part of ContainerJSONBase and will return by "inspect" command 232 type ContainerState struct { 233 Status string 234 Running bool 235 Paused bool 236 Restarting bool 237 OOMKilled bool 238 Dead bool 239 Pid int 240 ExitCode int 241 Error string 242 StartedAt string 243 FinishedAt string 244 } 245 246 // ContainerJSONBase contains response of Remote API: 247 // GET "/containers/{name:.*}/json" 248 type ContainerJSONBase struct { 249 ID string `json:"Id"` 250 Created string 251 Path string 252 Args []string 253 State *ContainerState 254 Image string 255 NetworkSettings *network.Settings 256 ResolvConfPath string 257 HostnamePath string 258 HostsPath string 259 LogPath string 260 Name string 261 RestartCount int 262 Driver string 263 ExecDriver string 264 MountLabel string 265 ProcessLabel string 266 AppArmorProfile string 267 ExecIDs []string 268 HostConfig *runconfig.HostConfig 269 GraphDriver GraphDriverData 270 } 271 272 // ContainerJSON is newly used struct along with MountPoint 273 type ContainerJSON struct { 274 *ContainerJSONBase 275 Mounts []MountPoint 276 Config *runconfig.Config 277 } 278 279 // ContainerJSON120 is a backcompatibility struct along with ContainerConfig120. 280 type ContainerJSON120 struct { 281 *ContainerJSONBase 282 Mounts []MountPoint 283 Config *ContainerConfig120 284 } 285 286 // ContainerJSONPre120 is a backcompatibility struct along with ContainerConfigPre120. 287 // Note this is not used by the Windows daemon. 288 type ContainerJSONPre120 struct { 289 *ContainerJSONBase 290 Volumes map[string]string 291 VolumesRW map[string]bool 292 Config *ContainerConfigPre120 293 } 294 295 // ContainerConfigPre120 is a backcompatibility struct used in ContainerJSONPre120 296 type ContainerConfigPre120 struct { 297 *runconfig.Config 298 299 // backward compatibility, they now live in HostConfig 300 VolumeDriver string 301 Memory int64 302 MemorySwap int64 303 CPUShares int64 `json:"CpuShares"` 304 CPUSet string `json:"CpuSet"` 305 } 306 307 // ContainerConfig120 is a backcompatibility struct used in ContainerJSON120 308 type ContainerConfig120 struct { 309 *runconfig.Config 310 // backward compatibility, it lives now in HostConfig 311 VolumeDriver string 312 } 313 314 // MountPoint represents a mount point configuration inside the container. 315 type MountPoint struct { 316 Name string `json:",omitempty"` 317 Source string 318 Destination string 319 Driver string `json:",omitempty"` 320 Mode string 321 RW bool 322 } 323 324 // Volume represents the configuration of a volume for the remote API 325 type Volume struct { 326 Name string // Name is the name of the volume 327 Driver string // Driver is the Driver name used to create the volume 328 Mountpoint string // Mountpoint is the location on disk of the volume 329 } 330 331 // VolumesListResponse contains the response for the remote API: 332 // GET "/volumes" 333 type VolumesListResponse struct { 334 Volumes []*Volume // Volumes is the list of volumes being returned 335 } 336 337 // VolumeCreateRequest contains the response for the remote API: 338 // POST "/volumes" 339 type VolumeCreateRequest struct { 340 Name string // Name is the requested name of the volume 341 Driver string // Driver is the name of the driver that should be used to create the volume 342 DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume. 343 }