types.go 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. package types // import "github.com/docker/docker/api/types"
  2. import (
  3. "errors"
  4. "fmt"
  5. "io"
  6. "os"
  7. "strings"
  8. "time"
  9. "github.com/docker/docker/api/types/container"
  10. "github.com/docker/docker/api/types/filters"
  11. "github.com/docker/docker/api/types/mount"
  12. "github.com/docker/docker/api/types/network"
  13. "github.com/docker/docker/api/types/registry"
  14. "github.com/docker/docker/api/types/swarm"
  15. "github.com/docker/go-connections/nat"
  16. )
  17. // RootFS returns Image's RootFS description including the layer IDs.
  18. type RootFS struct {
  19. Type string `json:",omitempty"`
  20. Layers []string `json:",omitempty"`
  21. }
  22. // ImageInspect contains response of Engine API:
  23. // GET "/images/{name:.*}/json"
  24. type ImageInspect struct {
  25. // ID is the content-addressable ID of an image.
  26. //
  27. // This identified is a content-addressable digest calculated from the
  28. // image's configuration (which includes the digests of layers used by
  29. // the image).
  30. //
  31. // Note that this digest differs from the `RepoDigests` below, which
  32. // holds digests of image manifests that reference the image.
  33. ID string `json:"Id"`
  34. // RepoTags is a list of image names/tags in the local image cache that
  35. // reference this image.
  36. //
  37. // Multiple image tags can refer to the same imagem and this list may be
  38. // empty if no tags reference the image, in which case the image is
  39. // "untagged", in which case it can still be referenced by its ID.
  40. RepoTags []string
  41. // RepoDigests is a list of content-addressable digests of locally available
  42. // image manifests that the image is referenced from. Multiple manifests can
  43. // refer to the same image.
  44. //
  45. // These digests are usually only available if the image was either pulled
  46. // from a registry, or if the image was pushed to a registry, which is when
  47. // the manifest is generated and its digest calculated.
  48. RepoDigests []string
  49. // Parent is the ID of the parent image.
  50. //
  51. // Depending on how the image was created, this field may be empty and
  52. // is only set for images that were built/created locally. This field
  53. // is empty if the image was pulled from an image registry.
  54. Parent string
  55. // Comment is an optional message that can be set when committing or
  56. // importing the image.
  57. Comment string
  58. // Created is the date and time at which the image was created, formatted in
  59. // RFC 3339 nano-seconds (time.RFC3339Nano).
  60. Created string
  61. // Container is the ID of the container that was used to create the image.
  62. //
  63. // Depending on how the image was created, this field may be empty.
  64. Container string
  65. // ContainerConfig is the configuration of the container that was committed
  66. // into the image.
  67. ContainerConfig *container.Config
  68. // DockerVersion is the version of Docker that was used to build the image.
  69. //
  70. // Depending on how the image was created, this field may be empty.
  71. DockerVersion string
  72. // Author is the name of the author that was specified when committing the
  73. // image, or as specified through MAINTAINER (deprecated) in the Dockerfile.
  74. Author string
  75. Config *container.Config
  76. // Architecture is the hardware CPU architecture that the image runs on.
  77. Architecture string
  78. // Variant is the CPU architecture variant (presently ARM-only).
  79. Variant string `json:",omitempty"`
  80. // OS is the Operating System the image is built to run on.
  81. Os string
  82. // OsVersion is the version of the Operating System the image is built to
  83. // run on (especially for Windows).
  84. OsVersion string `json:",omitempty"`
  85. // Size is the total size of the image including all layers it is composed of.
  86. Size int64
  87. // VirtualSize is the total size of the image including all layers it is
  88. // composed of.
  89. //
  90. // In versions of Docker before v1.10, this field was calculated from
  91. // the image itself and all of its parent images. Docker v1.10 and up
  92. // store images self-contained, and no longer use a parent-chain, making
  93. // this field an equivalent of the Size field.
  94. //
  95. // This field is kept for backward compatibility, but may be removed in
  96. // a future version of the API.
  97. VirtualSize int64 // TODO(thaJeztah): deprecate this field
  98. // GraphDriver holds information about the storage driver used to store the
  99. // container's and image's filesystem.
  100. GraphDriver GraphDriverData
  101. // RootFS contains information about the image's RootFS, including the
  102. // layer IDs.
  103. RootFS RootFS
  104. // Metadata of the image in the local cache.
  105. //
  106. // This information is local to the daemon, and not part of the image itself.
  107. Metadata ImageMetadata
  108. }
  109. // ImageMetadata contains engine-local data about the image
  110. type ImageMetadata struct {
  111. // LastTagTime is the date and time at which the image was last tagged.
  112. LastTagTime time.Time `json:",omitempty"`
  113. }
  114. // Container contains response of Engine API:
  115. // GET "/containers/json"
  116. type Container struct {
  117. ID string `json:"Id"`
  118. Names []string
  119. Image string
  120. ImageID string
  121. Command string
  122. Created int64
  123. Ports []Port
  124. SizeRw int64 `json:",omitempty"`
  125. SizeRootFs int64 `json:",omitempty"`
  126. Labels map[string]string
  127. State string
  128. Status string
  129. HostConfig struct {
  130. NetworkMode string `json:",omitempty"`
  131. }
  132. NetworkSettings *SummaryNetworkSettings
  133. Mounts []MountPoint
  134. }
  135. // CopyConfig contains request body of Engine API:
  136. // POST "/containers/"+containerID+"/copy"
  137. type CopyConfig struct {
  138. Resource string
  139. }
  140. // ContainerPathStat is used to encode the header from
  141. // GET "/containers/{name:.*}/archive"
  142. // "Name" is the file or directory name.
  143. type ContainerPathStat struct {
  144. Name string `json:"name"`
  145. Size int64 `json:"size"`
  146. Mode os.FileMode `json:"mode"`
  147. Mtime time.Time `json:"mtime"`
  148. LinkTarget string `json:"linkTarget"`
  149. }
  150. // ContainerStats contains response of Engine API:
  151. // GET "/stats"
  152. type ContainerStats struct {
  153. Body io.ReadCloser `json:"body"`
  154. OSType string `json:"ostype"`
  155. }
  156. // Ping contains response of Engine API:
  157. // GET "/_ping"
  158. type Ping struct {
  159. APIVersion string
  160. OSType string
  161. Experimental bool
  162. BuilderVersion BuilderVersion
  163. }
  164. // ComponentVersion describes the version information for a specific component.
  165. type ComponentVersion struct {
  166. Name string
  167. Version string
  168. Details map[string]string `json:",omitempty"`
  169. }
  170. // Version contains response of Engine API:
  171. // GET "/version"
  172. type Version struct {
  173. Platform struct{ Name string } `json:",omitempty"`
  174. Components []ComponentVersion `json:",omitempty"`
  175. // The following fields are deprecated, they relate to the Engine component and are kept for backwards compatibility
  176. Version string
  177. APIVersion string `json:"ApiVersion"`
  178. MinAPIVersion string `json:"MinAPIVersion,omitempty"`
  179. GitCommit string
  180. GoVersion string
  181. Os string
  182. Arch string
  183. KernelVersion string `json:",omitempty"`
  184. Experimental bool `json:",omitempty"`
  185. BuildTime string `json:",omitempty"`
  186. }
  187. // Commit holds the Git-commit (SHA1) that a binary was built from, as reported
  188. // in the version-string of external tools, such as containerd, or runC.
  189. type Commit struct {
  190. ID string // ID is the actual commit ID of external tool.
  191. Expected string // Expected is the commit ID of external tool expected by dockerd as set at build time.
  192. }
  193. // Info contains response of Engine 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 `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API
  205. Plugins PluginsInfo
  206. MemoryLimit bool
  207. SwapLimit bool
  208. KernelMemory bool // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
  209. KernelMemoryTCP bool
  210. CPUCfsPeriod bool `json:"CpuCfsPeriod"`
  211. CPUCfsQuota bool `json:"CpuCfsQuota"`
  212. CPUShares bool
  213. CPUSet bool
  214. PidsLimit bool
  215. IPv4Forwarding bool
  216. BridgeNfIptables bool
  217. BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
  218. Debug bool
  219. NFd int
  220. OomKillDisable bool
  221. NGoroutines int
  222. SystemTime string
  223. LoggingDriver string
  224. CgroupDriver string
  225. CgroupVersion string `json:",omitempty"`
  226. NEventsListener int
  227. KernelVersion string
  228. OperatingSystem string
  229. OSVersion string
  230. OSType string
  231. Architecture string
  232. IndexServerAddress string
  233. RegistryConfig *registry.ServiceConfig
  234. NCPU int
  235. MemTotal int64
  236. GenericResources []swarm.GenericResource
  237. DockerRootDir string
  238. HTTPProxy string `json:"HttpProxy"`
  239. HTTPSProxy string `json:"HttpsProxy"`
  240. NoProxy string
  241. Name string
  242. Labels []string
  243. ExperimentalBuild bool
  244. ServerVersion string
  245. ClusterStore string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
  246. ClusterAdvertise string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
  247. Runtimes map[string]Runtime
  248. DefaultRuntime string
  249. Swarm swarm.Info
  250. // LiveRestoreEnabled determines whether containers should be kept
  251. // running when the daemon is shutdown or upon daemon start if
  252. // running containers are detected
  253. LiveRestoreEnabled bool
  254. Isolation container.Isolation
  255. InitBinary string
  256. ContainerdCommit Commit
  257. RuncCommit Commit
  258. InitCommit Commit
  259. SecurityOptions []string
  260. ProductLicense string `json:",omitempty"`
  261. DefaultAddressPools []NetworkAddressPool `json:",omitempty"`
  262. // Warnings contains a slice of warnings that occurred while collecting
  263. // system information. These warnings are intended to be informational
  264. // messages for the user, and are not intended to be parsed / used for
  265. // other purposes, as they do not have a fixed format.
  266. Warnings []string
  267. }
  268. // KeyValue holds a key/value pair
  269. type KeyValue struct {
  270. Key, Value string
  271. }
  272. // NetworkAddressPool is a temp struct used by Info struct
  273. type NetworkAddressPool struct {
  274. Base string
  275. Size int
  276. }
  277. // SecurityOpt contains the name and options of a security option
  278. type SecurityOpt struct {
  279. Name string
  280. Options []KeyValue
  281. }
  282. // DecodeSecurityOptions decodes a security options string slice to a type safe
  283. // SecurityOpt
  284. func DecodeSecurityOptions(opts []string) ([]SecurityOpt, error) {
  285. so := []SecurityOpt{}
  286. for _, opt := range opts {
  287. // support output from a < 1.13 docker daemon
  288. if !strings.Contains(opt, "=") {
  289. so = append(so, SecurityOpt{Name: opt})
  290. continue
  291. }
  292. secopt := SecurityOpt{}
  293. split := strings.Split(opt, ",")
  294. for _, s := range split {
  295. kv := strings.SplitN(s, "=", 2)
  296. if len(kv) != 2 {
  297. return nil, fmt.Errorf("invalid security option %q", s)
  298. }
  299. if kv[0] == "" || kv[1] == "" {
  300. return nil, errors.New("invalid empty security option")
  301. }
  302. if kv[0] == "name" {
  303. secopt.Name = kv[1]
  304. continue
  305. }
  306. secopt.Options = append(secopt.Options, KeyValue{Key: kv[0], Value: kv[1]})
  307. }
  308. so = append(so, secopt)
  309. }
  310. return so, nil
  311. }
  312. // PluginsInfo is a temp struct holding Plugins name
  313. // registered with docker daemon. It is used by Info struct
  314. type PluginsInfo struct {
  315. // List of Volume plugins registered
  316. Volume []string
  317. // List of Network plugins registered
  318. Network []string
  319. // List of Authorization plugins registered
  320. Authorization []string
  321. // List of Log plugins registered
  322. Log []string
  323. }
  324. // ExecStartCheck is a temp struct used by execStart
  325. // Config fields is part of ExecConfig in runconfig package
  326. type ExecStartCheck struct {
  327. // ExecStart will first check if it's detached
  328. Detach bool
  329. // Check if there's a tty
  330. Tty bool
  331. }
  332. // HealthcheckResult stores information about a single run of a healthcheck probe
  333. type HealthcheckResult struct {
  334. Start time.Time // Start is the time this check started
  335. End time.Time // End is the time this check ended
  336. ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe
  337. Output string // Output from last check
  338. }
  339. // Health states
  340. const (
  341. NoHealthcheck = "none" // Indicates there is no healthcheck
  342. Starting = "starting" // Starting indicates that the container is not yet ready
  343. Healthy = "healthy" // Healthy indicates that the container is running correctly
  344. Unhealthy = "unhealthy" // Unhealthy indicates that the container has a problem
  345. )
  346. // Health stores information about the container's healthcheck results
  347. type Health struct {
  348. Status string // Status is one of Starting, Healthy or Unhealthy
  349. FailingStreak int // FailingStreak is the number of consecutive failures
  350. Log []*HealthcheckResult // Log contains the last few results (oldest first)
  351. }
  352. // ContainerState stores container's running state
  353. // it's part of ContainerJSONBase and will return by "inspect" command
  354. type ContainerState struct {
  355. Status string // String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead"
  356. Running bool
  357. Paused bool
  358. Restarting bool
  359. OOMKilled bool
  360. Dead bool
  361. Pid int
  362. ExitCode int
  363. Error string
  364. StartedAt string
  365. FinishedAt string
  366. Health *Health `json:",omitempty"`
  367. }
  368. // ContainerNode stores information about the node that a container
  369. // is running on. It's only used by the Docker Swarm standalone API
  370. type ContainerNode struct {
  371. ID string
  372. IPAddress string `json:"IP"`
  373. Addr string
  374. Name string
  375. Cpus int
  376. Memory int64
  377. Labels map[string]string
  378. }
  379. // ContainerJSONBase contains response of Engine API:
  380. // GET "/containers/{name:.*}/json"
  381. type ContainerJSONBase struct {
  382. ID string `json:"Id"`
  383. Created string
  384. Path string
  385. Args []string
  386. State *ContainerState
  387. Image string
  388. ResolvConfPath string
  389. HostnamePath string
  390. HostsPath string
  391. LogPath string
  392. Node *ContainerNode `json:",omitempty"` // Node is only propagated by Docker Swarm standalone API
  393. Name string
  394. RestartCount int
  395. Driver string
  396. Platform string
  397. MountLabel string
  398. ProcessLabel string
  399. AppArmorProfile string
  400. ExecIDs []string
  401. HostConfig *container.HostConfig
  402. GraphDriver GraphDriverData
  403. SizeRw *int64 `json:",omitempty"`
  404. SizeRootFs *int64 `json:",omitempty"`
  405. }
  406. // ContainerJSON is newly used struct along with MountPoint
  407. type ContainerJSON struct {
  408. *ContainerJSONBase
  409. Mounts []MountPoint
  410. Config *container.Config
  411. NetworkSettings *NetworkSettings
  412. }
  413. // NetworkSettings exposes the network settings in the api
  414. type NetworkSettings struct {
  415. NetworkSettingsBase
  416. DefaultNetworkSettings
  417. Networks map[string]*network.EndpointSettings
  418. }
  419. // SummaryNetworkSettings provides a summary of container's networks
  420. // in /containers/json
  421. type SummaryNetworkSettings struct {
  422. Networks map[string]*network.EndpointSettings
  423. }
  424. // NetworkSettingsBase holds basic information about networks
  425. type NetworkSettingsBase struct {
  426. Bridge string // Bridge is the Bridge name the network uses(e.g. `docker0`)
  427. SandboxID string // SandboxID uniquely represents a container's network stack
  428. HairpinMode bool // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface
  429. LinkLocalIPv6Address string // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix
  430. LinkLocalIPv6PrefixLen int // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address
  431. Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port
  432. SandboxKey string // SandboxKey identifies the sandbox
  433. SecondaryIPAddresses []network.Address
  434. SecondaryIPv6Addresses []network.Address
  435. }
  436. // DefaultNetworkSettings holds network information
  437. // during the 2 release deprecation period.
  438. // It will be removed in Docker 1.11.
  439. type DefaultNetworkSettings struct {
  440. EndpointID string // EndpointID uniquely represents a service endpoint in a Sandbox
  441. Gateway string // Gateway holds the gateway address for the network
  442. GlobalIPv6Address string // GlobalIPv6Address holds network's global IPv6 address
  443. GlobalIPv6PrefixLen int // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address
  444. IPAddress string // IPAddress holds the IPv4 address for the network
  445. IPPrefixLen int // IPPrefixLen represents mask length of network's IPv4 address
  446. IPv6Gateway string // IPv6Gateway holds gateway address specific for IPv6
  447. MacAddress string // MacAddress holds the MAC address for the network
  448. }
  449. // MountPoint represents a mount point configuration inside the container.
  450. // This is used for reporting the mountpoints in use by a container.
  451. type MountPoint struct {
  452. Type mount.Type `json:",omitempty"`
  453. Name string `json:",omitempty"`
  454. Source string
  455. Destination string
  456. Driver string `json:",omitempty"`
  457. Mode string
  458. RW bool
  459. Propagation mount.Propagation
  460. }
  461. // NetworkResource is the body of the "get network" http response message
  462. type NetworkResource struct {
  463. Name string // Name is the requested name of the network
  464. ID string `json:"Id"` // ID uniquely identifies a network on a single machine
  465. Created time.Time // Created is the time the network created
  466. Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level)
  467. Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
  468. EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6
  469. IPAM network.IPAM // IPAM is the network's IP Address Management
  470. Internal bool // Internal represents if the network is used internal only
  471. Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.
  472. Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster.
  473. ConfigFrom network.ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network.
  474. ConfigOnly bool // ConfigOnly networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services.
  475. Containers map[string]EndpointResource // Containers contains endpoints belonging to the network
  476. Options map[string]string // Options holds the network specific options to use for when creating the network
  477. Labels map[string]string // Labels holds metadata specific to the network being created
  478. Peers []network.PeerInfo `json:",omitempty"` // List of peer nodes for an overlay network
  479. Services map[string]network.ServiceInfo `json:",omitempty"`
  480. }
  481. // EndpointResource contains network resources allocated and used for a container in a network
  482. type EndpointResource struct {
  483. Name string
  484. EndpointID string
  485. MacAddress string
  486. IPv4Address string
  487. IPv6Address string
  488. }
  489. // NetworkCreate is the expected body of the "create network" http request message
  490. type NetworkCreate struct {
  491. // Check for networks with duplicate names.
  492. // Network is primarily keyed based on a random ID and not on the name.
  493. // Network name is strictly a user-friendly alias to the network
  494. // which is uniquely identified using ID.
  495. // And there is no guaranteed way to check for duplicates.
  496. // Option CheckDuplicate is there to provide a best effort checking of any networks
  497. // which has the same name but it is not guaranteed to catch all name collisions.
  498. CheckDuplicate bool
  499. Driver string
  500. Scope string
  501. EnableIPv6 bool
  502. IPAM *network.IPAM
  503. Internal bool
  504. Attachable bool
  505. Ingress bool
  506. ConfigOnly bool
  507. ConfigFrom *network.ConfigReference
  508. Options map[string]string
  509. Labels map[string]string
  510. }
  511. // NetworkCreateRequest is the request message sent to the server for network create call.
  512. type NetworkCreateRequest struct {
  513. NetworkCreate
  514. Name string
  515. }
  516. // NetworkCreateResponse is the response message sent by the server for network create call
  517. type NetworkCreateResponse struct {
  518. ID string `json:"Id"`
  519. Warning string
  520. }
  521. // NetworkConnect represents the data to be used to connect a container to the network
  522. type NetworkConnect struct {
  523. Container string
  524. EndpointConfig *network.EndpointSettings `json:",omitempty"`
  525. }
  526. // NetworkDisconnect represents the data to be used to disconnect a container from the network
  527. type NetworkDisconnect struct {
  528. Container string
  529. Force bool
  530. }
  531. // NetworkInspectOptions holds parameters to inspect network
  532. type NetworkInspectOptions struct {
  533. Scope string
  534. Verbose bool
  535. }
  536. // Checkpoint represents the details of a checkpoint
  537. type Checkpoint struct {
  538. Name string // Name is the name of the checkpoint
  539. }
  540. // Runtime describes an OCI runtime
  541. type Runtime struct {
  542. Path string `json:"path"`
  543. Args []string `json:"runtimeArgs,omitempty"`
  544. // This is exposed here only for internal use
  545. // It is not currently supported to specify custom shim configs
  546. Shim *ShimConfig `json:"-"`
  547. }
  548. // ShimConfig is used by runtime to configure containerd shims
  549. type ShimConfig struct {
  550. Binary string
  551. Opts interface{}
  552. }
  553. // DiskUsageObject represents an object type used for disk usage query filtering.
  554. type DiskUsageObject string
  555. const (
  556. // ContainerObject represents a container DiskUsageObject.
  557. ContainerObject DiskUsageObject = "container"
  558. // ImageObject represents an image DiskUsageObject.
  559. ImageObject DiskUsageObject = "image"
  560. // VolumeObject represents a volume DiskUsageObject.
  561. VolumeObject DiskUsageObject = "volume"
  562. // BuildCacheObject represents a build-cache DiskUsageObject.
  563. BuildCacheObject DiskUsageObject = "build-cache"
  564. )
  565. // DiskUsageOptions holds parameters for system disk usage query.
  566. type DiskUsageOptions struct {
  567. // Types specifies what object types to include in the response. If empty,
  568. // all object types are returned.
  569. Types []DiskUsageObject
  570. }
  571. // DiskUsage contains response of Engine API:
  572. // GET "/system/df"
  573. type DiskUsage struct {
  574. LayersSize int64
  575. Images []*ImageSummary
  576. Containers []*Container
  577. Volumes []*Volume
  578. BuildCache []*BuildCache
  579. BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
  580. }
  581. // ContainersPruneReport contains the response for Engine API:
  582. // POST "/containers/prune"
  583. type ContainersPruneReport struct {
  584. ContainersDeleted []string
  585. SpaceReclaimed uint64
  586. }
  587. // VolumesPruneReport contains the response for Engine API:
  588. // POST "/volumes/prune"
  589. type VolumesPruneReport struct {
  590. VolumesDeleted []string
  591. SpaceReclaimed uint64
  592. }
  593. // ImagesPruneReport contains the response for Engine API:
  594. // POST "/images/prune"
  595. type ImagesPruneReport struct {
  596. ImagesDeleted []ImageDeleteResponseItem
  597. SpaceReclaimed uint64
  598. }
  599. // BuildCachePruneReport contains the response for Engine API:
  600. // POST "/build/prune"
  601. type BuildCachePruneReport struct {
  602. CachesDeleted []string
  603. SpaceReclaimed uint64
  604. }
  605. // NetworksPruneReport contains the response for Engine API:
  606. // POST "/networks/prune"
  607. type NetworksPruneReport struct {
  608. NetworksDeleted []string
  609. }
  610. // SecretCreateResponse contains the information returned to a client
  611. // on the creation of a new secret.
  612. type SecretCreateResponse struct {
  613. // ID is the id of the created secret.
  614. ID string
  615. }
  616. // SecretListOptions holds parameters to list secrets
  617. type SecretListOptions struct {
  618. Filters filters.Args
  619. }
  620. // ConfigCreateResponse contains the information returned to a client
  621. // on the creation of a new config.
  622. type ConfigCreateResponse struct {
  623. // ID is the id of the created config.
  624. ID string
  625. }
  626. // ConfigListOptions holds parameters to list configs
  627. type ConfigListOptions struct {
  628. Filters filters.Args
  629. }
  630. // PushResult contains the tag, manifest digest, and manifest size from the
  631. // push. It's used to signal this information to the trust code in the client
  632. // so it can sign the manifest if necessary.
  633. type PushResult struct {
  634. Tag string
  635. Digest string
  636. Size int
  637. }
  638. // BuildResult contains the image id of a successful build
  639. type BuildResult struct {
  640. ID string
  641. }
  642. // BuildCache contains information about a build cache record
  643. type BuildCache struct {
  644. ID string
  645. Parent string
  646. Type string
  647. Description string
  648. InUse bool
  649. Shared bool
  650. Size int64
  651. CreatedAt time.Time
  652. LastUsedAt *time.Time
  653. UsageCount int
  654. }
  655. // BuildCachePruneOptions hold parameters to prune the build cache
  656. type BuildCachePruneOptions struct {
  657. All bool
  658. KeepStorage int64
  659. Filters filters.Args
  660. }