github.com/rawahars/moby@v24.0.4+incompatible/api/types/types.go (about)

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