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