types.go 25 KB

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