mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Bump docker/docker v23.0.10
This commit is contained in:
parent
80af149b02
commit
2fd3dabf69
107 changed files with 4189 additions and 2048 deletions
2006
coverage.txt
2006
coverage.txt
File diff suppressed because it is too large
Load diff
2
go.mod
2
go.mod
|
|
@ -7,7 +7,7 @@ require (
|
||||||
github.com/boz/go-throttle v0.0.0-20160922054636-fdc4eab740c1
|
github.com/boz/go-throttle v0.0.0-20160922054636-fdc4eab740c1
|
||||||
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
|
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
|
||||||
github.com/docker/cli v20.10.15+incompatible
|
github.com/docker/cli v20.10.15+incompatible
|
||||||
github.com/docker/docker v20.10.27-0.20230918140811-29a0e76e6495+incompatible
|
github.com/docker/docker v23.0.10-0.20240216160024-548f37a132d9+incompatible
|
||||||
github.com/fatih/color v1.10.0
|
github.com/fatih/color v1.10.0
|
||||||
github.com/go-errors/errors v1.4.2
|
github.com/go-errors/errors v1.4.2
|
||||||
github.com/gookit/color v1.5.0
|
github.com/gookit/color v1.5.0
|
||||||
|
|
|
||||||
4
go.sum
4
go.sum
|
|
@ -16,8 +16,8 @@ github.com/docker/cli v20.10.15+incompatible h1:HGO75iIgpyuG1m0hw0Kp7hY5o7XELmY1
|
||||||
github.com/docker/cli v20.10.15+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
github.com/docker/cli v20.10.15+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||||
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
|
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
|
||||||
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/docker v20.10.27-0.20230918140811-29a0e76e6495+incompatible h1:pgbpJ4kql71BzDNYSe18E489Ni4vn4yQ+0Xj8567Lvc=
|
github.com/docker/docker v23.0.10-0.20240216160024-548f37a132d9+incompatible h1:C4b6PgP3QHSikEWaQ2Q8LFBfMHCEC9QiQ2hZ/If/Vrk=
|
||||||
github.com/docker/docker v20.10.27-0.20230918140811-29a0e76e6495+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v23.0.10-0.20240216160024-548f37a132d9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8=
|
github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8=
|
||||||
github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40=
|
github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40=
|
||||||
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ func (c *Container) Remove(options dockerTypes.ContainerRemoveOptions) error {
|
||||||
// Stop stops the container
|
// Stop stops the container
|
||||||
func (c *Container) Stop() error {
|
func (c *Container) Stop() error {
|
||||||
c.Log.Warn(fmt.Sprintf("stopping container %s", c.Name))
|
c.Log.Warn(fmt.Sprintf("stopping container %s", c.Name))
|
||||||
return c.Client.ContainerStop(context.Background(), c.ID, nil)
|
return c.Client.ContainerStop(context.Background(), c.ID, container.StopOptions{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pause pauses the container
|
// Pause pauses the container
|
||||||
|
|
@ -80,7 +80,7 @@ func (c *Container) Unpause() error {
|
||||||
// Restart restarts the container
|
// Restart restarts the container
|
||||||
func (c *Container) Restart() error {
|
func (c *Container) Restart() error {
|
||||||
c.Log.Warn(fmt.Sprintf("restarting container %s", c.Name))
|
c.Log.Warn(fmt.Sprintf("restarting container %s", c.Name))
|
||||||
return c.Client.ContainerRestart(context.Background(), c.ID, nil)
|
return c.Client.ContainerRestart(context.Background(), c.ID, container.StopOptions{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach attaches the container
|
// Attach attaches the container
|
||||||
|
|
|
||||||
283
vendor/github.com/docker/docker/AUTHORS
generated
vendored
283
vendor/github.com/docker/docker/AUTHORS
generated
vendored
File diff suppressed because it is too large
Load diff
2
vendor/github.com/docker/docker/api/common.go
generated
vendored
2
vendor/github.com/docker/docker/api/common.go
generated
vendored
|
|
@ -3,7 +3,7 @@ package api // import "github.com/docker/docker/api"
|
||||||
// Common constants for daemon and client.
|
// Common constants for daemon and client.
|
||||||
const (
|
const (
|
||||||
// DefaultVersion of Current REST API
|
// DefaultVersion of Current REST API
|
||||||
DefaultVersion = "1.41"
|
DefaultVersion = "1.42"
|
||||||
|
|
||||||
// NoBaseImageSpecifier is the symbol used by the FROM
|
// NoBaseImageSpecifier is the symbol used by the FROM
|
||||||
// command to specify that no base image is to be used.
|
// command to specify that no base image is to be used.
|
||||||
|
|
|
||||||
1610
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
1610
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
File diff suppressed because it is too large
Load diff
28
vendor/github.com/docker/docker/api/types/client.go
generated
vendored
28
vendor/github.com/docker/docker/api/types/client.go
generated
vendored
|
|
@ -59,7 +59,6 @@ type ContainerExecInspect struct {
|
||||||
|
|
||||||
// ContainerListOptions holds parameters to list containers with.
|
// ContainerListOptions holds parameters to list containers with.
|
||||||
type ContainerListOptions struct {
|
type ContainerListOptions struct {
|
||||||
Quiet bool
|
|
||||||
Size bool
|
Size bool
|
||||||
All bool
|
All bool
|
||||||
Latest bool
|
Latest bool
|
||||||
|
|
@ -113,8 +112,14 @@ type NetworkListOptions struct {
|
||||||
Filters filters.Args
|
Filters filters.Args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewHijackedResponse intializes a HijackedResponse type
|
||||||
|
func NewHijackedResponse(conn net.Conn, mediaType string) HijackedResponse {
|
||||||
|
return HijackedResponse{Conn: conn, Reader: bufio.NewReader(conn), mediaType: mediaType}
|
||||||
|
}
|
||||||
|
|
||||||
// HijackedResponse holds connection information for a hijacked request.
|
// HijackedResponse holds connection information for a hijacked request.
|
||||||
type HijackedResponse struct {
|
type HijackedResponse struct {
|
||||||
|
mediaType string
|
||||||
Conn net.Conn
|
Conn net.Conn
|
||||||
Reader *bufio.Reader
|
Reader *bufio.Reader
|
||||||
}
|
}
|
||||||
|
|
@ -124,6 +129,15 @@ func (h *HijackedResponse) Close() {
|
||||||
h.Conn.Close()
|
h.Conn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MediaType let client know if HijackedResponse hold a raw or multiplexed stream.
|
||||||
|
// returns false if HTTP Content-Type is not relevant, and container must be inspected
|
||||||
|
func (h *HijackedResponse) MediaType() (string, bool) {
|
||||||
|
if h.mediaType == "" {
|
||||||
|
return "", false
|
||||||
|
}
|
||||||
|
return h.mediaType, true
|
||||||
|
}
|
||||||
|
|
||||||
// CloseWriter is an interface that implements structs
|
// CloseWriter is an interface that implements structs
|
||||||
// that close input streams to prevent from writing.
|
// that close input streams to prevent from writing.
|
||||||
type CloseWriter interface {
|
type CloseWriter interface {
|
||||||
|
|
@ -236,10 +250,20 @@ type ImageImportOptions struct {
|
||||||
Platform string // Platform is the target platform of the image
|
Platform string // Platform is the target platform of the image
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageListOptions holds parameters to filter the list of images with.
|
// ImageListOptions holds parameters to list images with.
|
||||||
type ImageListOptions struct {
|
type ImageListOptions struct {
|
||||||
|
// All controls whether all images in the graph are filtered, or just
|
||||||
|
// the heads.
|
||||||
All bool
|
All bool
|
||||||
|
|
||||||
|
// Filters is a JSON-encoded set of filter arguments.
|
||||||
Filters filters.Args
|
Filters filters.Args
|
||||||
|
|
||||||
|
// SharedSize indicates whether the shared size of images should be computed.
|
||||||
|
SharedSize bool
|
||||||
|
|
||||||
|
// ContainerCount indicates whether container count should be computed.
|
||||||
|
ContainerCount bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageLoadResponse returns information to the client about a load process.
|
// ImageLoadResponse returns information to the client about a load process.
|
||||||
|
|
|
||||||
1
vendor/github.com/docker/docker/api/types/configs.go
generated
vendored
1
vendor/github.com/docker/docker/api/types/configs.go
generated
vendored
|
|
@ -33,6 +33,7 @@ type ExecConfig struct {
|
||||||
User string // User that will run the command
|
User string // User that will run the command
|
||||||
Privileged bool // Is the container in privileged mode
|
Privileged bool // Is the container in privileged mode
|
||||||
Tty bool // Attach standard streams to a tty.
|
Tty bool // Attach standard streams to a tty.
|
||||||
|
ConsoleSize *[2]uint `json:",omitempty"` // Initial console size [height, width]
|
||||||
AttachStdin bool // Attach the standard input, makes possible user interaction
|
AttachStdin bool // Attach the standard input, makes possible user interaction
|
||||||
AttachStderr bool // Attach the standard error
|
AttachStderr bool // Attach the standard error
|
||||||
AttachStdout bool // Attach the standard output
|
AttachStdout bool // Attach the standard output
|
||||||
|
|
|
||||||
27
vendor/github.com/docker/docker/api/types/container/config.go
generated
vendored
27
vendor/github.com/docker/docker/api/types/container/config.go
generated
vendored
|
|
@ -1,6 +1,7 @@
|
||||||
package container // import "github.com/docker/docker/api/types/container"
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/strslice"
|
"github.com/docker/docker/api/types/strslice"
|
||||||
|
|
@ -13,6 +14,24 @@ import (
|
||||||
// Docker interprets it as 3 nanoseconds.
|
// Docker interprets it as 3 nanoseconds.
|
||||||
const MinimumDuration = 1 * time.Millisecond
|
const MinimumDuration = 1 * time.Millisecond
|
||||||
|
|
||||||
|
// StopOptions holds the options to stop or restart a container.
|
||||||
|
type StopOptions struct {
|
||||||
|
// Signal (optional) is the signal to send to the container to (gracefully)
|
||||||
|
// stop it before forcibly terminating the container with SIGKILL after the
|
||||||
|
// timeout expires. If not value is set, the default (SIGTERM) is used.
|
||||||
|
Signal string `json:",omitempty"`
|
||||||
|
|
||||||
|
// Timeout (optional) is the timeout (in seconds) to wait for the container
|
||||||
|
// to stop gracefully before forcibly terminating it with SIGKILL.
|
||||||
|
//
|
||||||
|
// - Use nil to use the default timeout (10 seconds).
|
||||||
|
// - Use '-1' to wait indefinitely.
|
||||||
|
// - Use '0' to not wait for the container to exit gracefully, and
|
||||||
|
// immediately proceeds to forcibly terminating the container.
|
||||||
|
// - Other positive values are used as timeout (in seconds).
|
||||||
|
Timeout *int `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// HealthConfig holds configuration settings for the HEALTHCHECK feature.
|
// HealthConfig holds configuration settings for the HEALTHCHECK feature.
|
||||||
type HealthConfig struct {
|
type HealthConfig struct {
|
||||||
// Test is the test to perform to check that the container is healthy.
|
// Test is the test to perform to check that the container is healthy.
|
||||||
|
|
@ -34,6 +53,14 @@ type HealthConfig struct {
|
||||||
Retries int `json:",omitempty"`
|
Retries int `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExecStartOptions holds the options to start container's exec.
|
||||||
|
type ExecStartOptions struct {
|
||||||
|
Stdin io.Reader
|
||||||
|
Stdout io.Writer
|
||||||
|
Stderr io.Writer
|
||||||
|
ConsoleSize *[2]uint `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// Config contains the configuration data about a container.
|
// Config contains the configuration data about a container.
|
||||||
// It should hold only portable information about the container.
|
// It should hold only portable information about the container.
|
||||||
// Here, "portable" means "independent from the host we are running on".
|
// Here, "portable" means "independent from the host we are running on".
|
||||||
|
|
|
||||||
20
vendor/github.com/docker/docker/api/types/container/container_create.go
generated
vendored
20
vendor/github.com/docker/docker/api/types/container/container_create.go
generated
vendored
|
|
@ -1,20 +0,0 @@
|
||||||
package container // import "github.com/docker/docker/api/types/container"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Code generated by `swagger generate operation`. DO NOT EDIT.
|
|
||||||
//
|
|
||||||
// See hack/generate-swagger-api.sh
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ContainerCreateCreatedBody OK response to ContainerCreate operation
|
|
||||||
// swagger:model ContainerCreateCreatedBody
|
|
||||||
type ContainerCreateCreatedBody struct {
|
|
||||||
|
|
||||||
// The ID of the created container
|
|
||||||
// Required: true
|
|
||||||
ID string `json:"Id"`
|
|
||||||
|
|
||||||
// Warnings encountered when creating the container
|
|
||||||
// Required: true
|
|
||||||
Warnings []string `json:"Warnings"`
|
|
||||||
}
|
|
||||||
28
vendor/github.com/docker/docker/api/types/container/container_wait.go
generated
vendored
28
vendor/github.com/docker/docker/api/types/container/container_wait.go
generated
vendored
|
|
@ -1,28 +0,0 @@
|
||||||
package container // import "github.com/docker/docker/api/types/container"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Code generated by `swagger generate operation`. DO NOT EDIT.
|
|
||||||
//
|
|
||||||
// See hack/generate-swagger-api.sh
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ContainerWaitOKBodyError container waiting error, if any
|
|
||||||
// swagger:model ContainerWaitOKBodyError
|
|
||||||
type ContainerWaitOKBodyError struct {
|
|
||||||
|
|
||||||
// Details of an error
|
|
||||||
Message string `json:"Message,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContainerWaitOKBody OK response to ContainerWait operation
|
|
||||||
// swagger:model ContainerWaitOKBody
|
|
||||||
type ContainerWaitOKBody struct {
|
|
||||||
|
|
||||||
// error
|
|
||||||
// Required: true
|
|
||||||
Error *ContainerWaitOKBodyError `json:"Error"`
|
|
||||||
|
|
||||||
// Exit code of the container
|
|
||||||
// Required: true
|
|
||||||
StatusCode int64 `json:"StatusCode"`
|
|
||||||
}
|
|
||||||
19
vendor/github.com/docker/docker/api/types/container/create_response.go
generated
vendored
Normal file
19
vendor/github.com/docker/docker/api/types/container/create_response.go
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
package container
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// CreateResponse ContainerCreateResponse
|
||||||
|
//
|
||||||
|
// OK response to ContainerCreate operation
|
||||||
|
// swagger:model CreateResponse
|
||||||
|
type CreateResponse struct {
|
||||||
|
|
||||||
|
// The ID of the created container
|
||||||
|
// Required: true
|
||||||
|
ID string `json:"Id"`
|
||||||
|
|
||||||
|
// Warnings encountered when creating the container
|
||||||
|
// Required: true
|
||||||
|
Warnings []string `json:"Warnings"`
|
||||||
|
}
|
||||||
16
vendor/github.com/docker/docker/api/types/container/deprecated.go
generated
vendored
Normal file
16
vendor/github.com/docker/docker/api/types/container/deprecated.go
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
|
// ContainerCreateCreatedBody OK response to ContainerCreate operation
|
||||||
|
//
|
||||||
|
// Deprecated: use CreateResponse
|
||||||
|
type ContainerCreateCreatedBody = CreateResponse
|
||||||
|
|
||||||
|
// ContainerWaitOKBody OK response to ContainerWait operation
|
||||||
|
//
|
||||||
|
// Deprecated: use WaitResponse
|
||||||
|
type ContainerWaitOKBody = WaitResponse
|
||||||
|
|
||||||
|
// ContainerWaitOKBodyError container waiting error, if any
|
||||||
|
//
|
||||||
|
// Deprecated: use WaitExitError
|
||||||
|
type ContainerWaitOKBodyError = WaitExitError
|
||||||
78
vendor/github.com/docker/docker/api/types/container/host_config.go
generated
vendored
78
vendor/github.com/docker/docker/api/types/container/host_config.go
generated
vendored
|
|
@ -13,19 +13,26 @@ import (
|
||||||
// CgroupnsMode represents the cgroup namespace mode of the container
|
// CgroupnsMode represents the cgroup namespace mode of the container
|
||||||
type CgroupnsMode string
|
type CgroupnsMode string
|
||||||
|
|
||||||
|
// cgroup namespace modes for containers
|
||||||
|
const (
|
||||||
|
CgroupnsModeEmpty CgroupnsMode = ""
|
||||||
|
CgroupnsModePrivate CgroupnsMode = "private"
|
||||||
|
CgroupnsModeHost CgroupnsMode = "host"
|
||||||
|
)
|
||||||
|
|
||||||
// IsPrivate indicates whether the container uses its own private cgroup namespace
|
// IsPrivate indicates whether the container uses its own private cgroup namespace
|
||||||
func (c CgroupnsMode) IsPrivate() bool {
|
func (c CgroupnsMode) IsPrivate() bool {
|
||||||
return c == "private"
|
return c == CgroupnsModePrivate
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsHost indicates whether the container shares the host's cgroup namespace
|
// IsHost indicates whether the container shares the host's cgroup namespace
|
||||||
func (c CgroupnsMode) IsHost() bool {
|
func (c CgroupnsMode) IsHost() bool {
|
||||||
return c == "host"
|
return c == CgroupnsModeHost
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsEmpty indicates whether the container cgroup namespace mode is unset
|
// IsEmpty indicates whether the container cgroup namespace mode is unset
|
||||||
func (c CgroupnsMode) IsEmpty() bool {
|
func (c CgroupnsMode) IsEmpty() bool {
|
||||||
return c == ""
|
return c == CgroupnsModeEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid indicates whether the cgroup namespace mode is valid
|
// Valid indicates whether the cgroup namespace mode is valid
|
||||||
|
|
@ -37,60 +44,69 @@ func (c CgroupnsMode) Valid() bool {
|
||||||
// values are platform specific
|
// values are platform specific
|
||||||
type Isolation string
|
type Isolation string
|
||||||
|
|
||||||
|
// Isolation modes for containers
|
||||||
|
const (
|
||||||
|
IsolationEmpty Isolation = "" // IsolationEmpty is unspecified (same behavior as default)
|
||||||
|
IsolationDefault Isolation = "default" // IsolationDefault is the default isolation mode on current daemon
|
||||||
|
IsolationProcess Isolation = "process" // IsolationProcess is process isolation mode
|
||||||
|
IsolationHyperV Isolation = "hyperv" // IsolationHyperV is HyperV isolation mode
|
||||||
|
)
|
||||||
|
|
||||||
// IsDefault indicates the default isolation technology of a container. On Linux this
|
// IsDefault indicates the default isolation technology of a container. On Linux this
|
||||||
// is the native driver. On Windows, this is a Windows Server Container.
|
// is the native driver. On Windows, this is a Windows Server Container.
|
||||||
func (i Isolation) IsDefault() bool {
|
func (i Isolation) IsDefault() bool {
|
||||||
return strings.ToLower(string(i)) == "default" || string(i) == ""
|
// TODO consider making isolation-mode strict (case-sensitive)
|
||||||
|
v := Isolation(strings.ToLower(string(i)))
|
||||||
|
return v == IsolationDefault || v == IsolationEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsHyperV indicates the use of a Hyper-V partition for isolation
|
// IsHyperV indicates the use of a Hyper-V partition for isolation
|
||||||
func (i Isolation) IsHyperV() bool {
|
func (i Isolation) IsHyperV() bool {
|
||||||
return strings.ToLower(string(i)) == "hyperv"
|
// TODO consider making isolation-mode strict (case-sensitive)
|
||||||
|
return Isolation(strings.ToLower(string(i))) == IsolationHyperV
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsProcess indicates the use of process isolation
|
// IsProcess indicates the use of process isolation
|
||||||
func (i Isolation) IsProcess() bool {
|
func (i Isolation) IsProcess() bool {
|
||||||
return strings.ToLower(string(i)) == "process"
|
// TODO consider making isolation-mode strict (case-sensitive)
|
||||||
|
return Isolation(strings.ToLower(string(i))) == IsolationProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
// IsolationEmpty is unspecified (same behavior as default)
|
|
||||||
IsolationEmpty = Isolation("")
|
|
||||||
// IsolationDefault is the default isolation mode on current daemon
|
|
||||||
IsolationDefault = Isolation("default")
|
|
||||||
// IsolationProcess is process isolation mode
|
|
||||||
IsolationProcess = Isolation("process")
|
|
||||||
// IsolationHyperV is HyperV isolation mode
|
|
||||||
IsolationHyperV = Isolation("hyperv")
|
|
||||||
)
|
|
||||||
|
|
||||||
// IpcMode represents the container ipc stack.
|
// IpcMode represents the container ipc stack.
|
||||||
type IpcMode string
|
type IpcMode string
|
||||||
|
|
||||||
|
// IpcMode constants
|
||||||
|
const (
|
||||||
|
IPCModeNone IpcMode = "none"
|
||||||
|
IPCModeHost IpcMode = "host"
|
||||||
|
IPCModeContainer IpcMode = "container"
|
||||||
|
IPCModePrivate IpcMode = "private"
|
||||||
|
IPCModeShareable IpcMode = "shareable"
|
||||||
|
)
|
||||||
|
|
||||||
// IsPrivate indicates whether the container uses its own private ipc namespace which can not be shared.
|
// IsPrivate indicates whether the container uses its own private ipc namespace which can not be shared.
|
||||||
func (n IpcMode) IsPrivate() bool {
|
func (n IpcMode) IsPrivate() bool {
|
||||||
return n == "private"
|
return n == IPCModePrivate
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsHost indicates whether the container shares the host's ipc namespace.
|
// IsHost indicates whether the container shares the host's ipc namespace.
|
||||||
func (n IpcMode) IsHost() bool {
|
func (n IpcMode) IsHost() bool {
|
||||||
return n == "host"
|
return n == IPCModeHost
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsShareable indicates whether the container's ipc namespace can be shared with another container.
|
// IsShareable indicates whether the container's ipc namespace can be shared with another container.
|
||||||
func (n IpcMode) IsShareable() bool {
|
func (n IpcMode) IsShareable() bool {
|
||||||
return n == "shareable"
|
return n == IPCModeShareable
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsContainer indicates whether the container uses another container's ipc namespace.
|
// IsContainer indicates whether the container uses another container's ipc namespace.
|
||||||
func (n IpcMode) IsContainer() bool {
|
func (n IpcMode) IsContainer() bool {
|
||||||
parts := strings.SplitN(string(n), ":", 2)
|
return strings.HasPrefix(string(n), string(IPCModeContainer)+":")
|
||||||
return len(parts) > 1 && parts[0] == "container"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsNone indicates whether container IpcMode is set to "none".
|
// IsNone indicates whether container IpcMode is set to "none".
|
||||||
func (n IpcMode) IsNone() bool {
|
func (n IpcMode) IsNone() bool {
|
||||||
return n == "none"
|
return n == IPCModeNone
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsEmpty indicates whether container IpcMode is empty
|
// IsEmpty indicates whether container IpcMode is empty
|
||||||
|
|
@ -105,9 +121,8 @@ func (n IpcMode) Valid() bool {
|
||||||
|
|
||||||
// Container returns the name of the container ipc stack is going to be used.
|
// Container returns the name of the container ipc stack is going to be used.
|
||||||
func (n IpcMode) Container() string {
|
func (n IpcMode) Container() string {
|
||||||
parts := strings.SplitN(string(n), ":", 2)
|
if n.IsContainer() {
|
||||||
if len(parts) > 1 && parts[0] == "container" {
|
return strings.TrimPrefix(string(n), string(IPCModeContainer)+":")
|
||||||
return parts[1]
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
@ -326,7 +341,7 @@ type LogMode string
|
||||||
|
|
||||||
// Available logging modes
|
// Available logging modes
|
||||||
const (
|
const (
|
||||||
LogModeUnset = ""
|
LogModeUnset LogMode = ""
|
||||||
LogModeBlocking LogMode = "blocking"
|
LogModeBlocking LogMode = "blocking"
|
||||||
LogModeNonBlock LogMode = "non-blocking"
|
LogModeNonBlock LogMode = "non-blocking"
|
||||||
)
|
)
|
||||||
|
|
@ -361,8 +376,11 @@ type Resources struct {
|
||||||
Devices []DeviceMapping // List of devices to map inside the container
|
Devices []DeviceMapping // List of devices to map inside the container
|
||||||
DeviceCgroupRules []string // List of rule to be added to the device cgroup
|
DeviceCgroupRules []string // List of rule to be added to the device cgroup
|
||||||
DeviceRequests []DeviceRequest // List of device requests for device drivers
|
DeviceRequests []DeviceRequest // List of device requests for device drivers
|
||||||
KernelMemory int64 // Kernel memory limit (in bytes), Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
|
|
||||||
KernelMemoryTCP int64 // Hard limit for kernel TCP buffer memory (in bytes)
|
// KernelMemory specifies the kernel memory limit (in bytes) for the container.
|
||||||
|
// Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes.
|
||||||
|
KernelMemory int64 `json:",omitempty"`
|
||||||
|
KernelMemoryTCP int64 `json:",omitempty"` // Hard limit for kernel TCP buffer memory (in bytes)
|
||||||
MemoryReservation int64 // Memory soft limit (in bytes)
|
MemoryReservation int64 // Memory soft limit (in bytes)
|
||||||
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
|
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
|
||||||
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
|
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
|
||||||
|
|
@ -399,6 +417,7 @@ type HostConfig struct {
|
||||||
AutoRemove bool // Automatically remove container when it exits
|
AutoRemove bool // Automatically remove container when it exits
|
||||||
VolumeDriver string // Name of the volume driver used to mount volumes
|
VolumeDriver string // Name of the volume driver used to mount volumes
|
||||||
VolumesFrom []string // List of volumes to take from other container
|
VolumesFrom []string // List of volumes to take from other container
|
||||||
|
ConsoleSize [2]uint // Initial console size (height,width)
|
||||||
|
|
||||||
// Applicable to UNIX platforms
|
// Applicable to UNIX platforms
|
||||||
CapAdd strslice.StrSlice // List of kernel capabilities to add to the container
|
CapAdd strslice.StrSlice // List of kernel capabilities to add to the container
|
||||||
|
|
@ -427,7 +446,6 @@ type HostConfig struct {
|
||||||
Runtime string `json:",omitempty"` // Runtime to use with this container
|
Runtime string `json:",omitempty"` // Runtime to use with this container
|
||||||
|
|
||||||
// Applicable to Windows
|
// Applicable to Windows
|
||||||
ConsoleSize [2]uint // Initial console size (height,width)
|
|
||||||
Isolation Isolation // Isolation technology of the container (e.g. default, hyperv)
|
Isolation Isolation // Isolation technology of the container (e.g. default, hyperv)
|
||||||
|
|
||||||
// Contains container's resources (cgroups, ulimits)
|
// Contains container's resources (cgroups, ulimits)
|
||||||
|
|
|
||||||
12
vendor/github.com/docker/docker/api/types/container/wait_exit_error.go
generated
vendored
Normal file
12
vendor/github.com/docker/docker/api/types/container/wait_exit_error.go
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
package container
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// WaitExitError container waiting error, if any
|
||||||
|
// swagger:model WaitExitError
|
||||||
|
type WaitExitError struct {
|
||||||
|
|
||||||
|
// Details of an error
|
||||||
|
Message string `json:"Message,omitempty"`
|
||||||
|
}
|
||||||
18
vendor/github.com/docker/docker/api/types/container/wait_response.go
generated
vendored
Normal file
18
vendor/github.com/docker/docker/api/types/container/wait_response.go
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
package container
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// WaitResponse ContainerWaitResponse
|
||||||
|
//
|
||||||
|
// OK response to ContainerWait operation
|
||||||
|
// swagger:model WaitResponse
|
||||||
|
type WaitResponse struct {
|
||||||
|
|
||||||
|
// error
|
||||||
|
Error *WaitExitError `json:"Error,omitempty"`
|
||||||
|
|
||||||
|
// Exit code of the container
|
||||||
|
// Required: true
|
||||||
|
StatusCode int64 `json:"StatusCode"`
|
||||||
|
}
|
||||||
14
vendor/github.com/docker/docker/api/types/deprecated.go
generated
vendored
Normal file
14
vendor/github.com/docker/docker/api/types/deprecated.go
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
|
import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
|
// Volume volume
|
||||||
|
//
|
||||||
|
// Deprecated: use github.com/docker/docker/api/types/volume.Volume
|
||||||
|
type Volume = volume.Volume
|
||||||
|
|
||||||
|
// VolumeUsageData Usage details about the volume. This information is used by the
|
||||||
|
// `GET /system/df` endpoint, and omitted in other endpoints.
|
||||||
|
//
|
||||||
|
// Deprecated: use github.com/docker/docker/api/types/volume.UsageData
|
||||||
|
type VolumeUsageData = volume.UsageData
|
||||||
47
vendor/github.com/docker/docker/api/types/events/events.go
generated
vendored
47
vendor/github.com/docker/docker/api/types/events/events.go
generated
vendored
|
|
@ -1,33 +1,26 @@
|
||||||
package events // import "github.com/docker/docker/api/types/events"
|
package events // import "github.com/docker/docker/api/types/events"
|
||||||
|
|
||||||
|
// Type is used for event-types.
|
||||||
|
type Type = string
|
||||||
|
|
||||||
|
// List of known event types.
|
||||||
const (
|
const (
|
||||||
// BuilderEventType is the event type that the builder generates
|
BuilderEventType Type = "builder" // BuilderEventType is the event type that the builder generates.
|
||||||
BuilderEventType = "builder"
|
ConfigEventType Type = "config" // ConfigEventType is the event type that configs generate.
|
||||||
// ContainerEventType is the event type that containers generate
|
ContainerEventType Type = "container" // ContainerEventType is the event type that containers generate.
|
||||||
ContainerEventType = "container"
|
DaemonEventType Type = "daemon" // DaemonEventType is the event type that daemon generate.
|
||||||
// DaemonEventType is the event type that daemon generate
|
ImageEventType Type = "image" // ImageEventType is the event type that images generate.
|
||||||
DaemonEventType = "daemon"
|
NetworkEventType Type = "network" // NetworkEventType is the event type that networks generate.
|
||||||
// ImageEventType is the event type that images generate
|
NodeEventType Type = "node" // NodeEventType is the event type that nodes generate.
|
||||||
ImageEventType = "image"
|
PluginEventType Type = "plugin" // PluginEventType is the event type that plugins generate.
|
||||||
// NetworkEventType is the event type that networks generate
|
SecretEventType Type = "secret" // SecretEventType is the event type that secrets generate.
|
||||||
NetworkEventType = "network"
|
ServiceEventType Type = "service" // ServiceEventType is the event type that services generate.
|
||||||
// PluginEventType is the event type that plugins generate
|
VolumeEventType Type = "volume" // VolumeEventType is the event type that volumes generate.
|
||||||
PluginEventType = "plugin"
|
|
||||||
// VolumeEventType is the event type that volumes generate
|
|
||||||
VolumeEventType = "volume"
|
|
||||||
// ServiceEventType is the event type that services generate
|
|
||||||
ServiceEventType = "service"
|
|
||||||
// NodeEventType is the event type that nodes generate
|
|
||||||
NodeEventType = "node"
|
|
||||||
// SecretEventType is the event type that secrets generate
|
|
||||||
SecretEventType = "secret"
|
|
||||||
// ConfigEventType is the event type that configs generate
|
|
||||||
ConfigEventType = "config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Actor describes something that generates events,
|
// Actor describes something that generates events,
|
||||||
// like a container, or a network, or a volume.
|
// like a container, or a network, or a volume.
|
||||||
// It has a defined name and a set or attributes.
|
// It has a defined name and a set of attributes.
|
||||||
// The container attributes are its labels, other actors
|
// The container attributes are its labels, other actors
|
||||||
// can generate these attributes from other properties.
|
// can generate these attributes from other properties.
|
||||||
type Actor struct {
|
type Actor struct {
|
||||||
|
|
@ -39,11 +32,11 @@ type Actor struct {
|
||||||
type Message struct {
|
type Message struct {
|
||||||
// Deprecated information from JSONMessage.
|
// Deprecated information from JSONMessage.
|
||||||
// With data only in container events.
|
// With data only in container events.
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"` // Deprecated: use Action instead.
|
||||||
ID string `json:"id,omitempty"`
|
ID string `json:"id,omitempty"` // Deprecated: use Actor.ID instead.
|
||||||
From string `json:"from,omitempty"`
|
From string `json:"from,omitempty"` // Deprecated: use Actor.Attributes["image"] instead.
|
||||||
|
|
||||||
Type string
|
Type Type
|
||||||
Action string
|
Action string
|
||||||
Actor Actor
|
Actor Actor
|
||||||
// Engine events are local scope. Cluster events are swarm scope.
|
// Engine events are local scope. Cluster events are swarm scope.
|
||||||
|
|
|
||||||
9
vendor/github.com/docker/docker/api/types/filters/parse.go
generated
vendored
9
vendor/github.com/docker/docker/api/types/filters/parse.go
generated
vendored
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Args stores a mapping of keys to a set of multiple values.
|
// Args stores a mapping of keys to a set of multiple values.
|
||||||
|
|
@ -98,7 +99,7 @@ func FromJSON(p string) (Args, error) {
|
||||||
// Fallback to parsing arguments in the legacy slice format
|
// Fallback to parsing arguments in the legacy slice format
|
||||||
deprecated := map[string][]string{}
|
deprecated := map[string][]string{}
|
||||||
if legacyErr := json.Unmarshal(raw, &deprecated); legacyErr != nil {
|
if legacyErr := json.Unmarshal(raw, &deprecated); legacyErr != nil {
|
||||||
return args, err
|
return args, invalidFilter{errors.Wrap(err, "invalid filter")}
|
||||||
}
|
}
|
||||||
|
|
||||||
args.fields = deprecatedArgs(deprecated)
|
args.fields = deprecatedArgs(deprecated)
|
||||||
|
|
@ -245,10 +246,10 @@ func (args Args) Contains(field string) bool {
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
type invalidFilter string
|
type invalidFilter struct{ error }
|
||||||
|
|
||||||
func (e invalidFilter) Error() string {
|
func (e invalidFilter) Error() string {
|
||||||
return "Invalid filter '" + string(e) + "'"
|
return e.error.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (invalidFilter) InvalidParameter() {}
|
func (invalidFilter) InvalidParameter() {}
|
||||||
|
|
@ -258,7 +259,7 @@ func (invalidFilter) InvalidParameter() {}
|
||||||
func (args Args) Validate(accepted map[string]bool) error {
|
func (args Args) Validate(accepted map[string]bool) error {
|
||||||
for name := range args.fields {
|
for name := range args.fields {
|
||||||
if !accepted[name] {
|
if !accepted[name] {
|
||||||
return invalidFilter(name)
|
return invalidFilter{errors.New("invalid filter '" + name + "'")}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
12
vendor/github.com/docker/docker/api/types/graph_driver_data.go
generated
vendored
12
vendor/github.com/docker/docker/api/types/graph_driver_data.go
generated
vendored
|
|
@ -3,15 +3,21 @@ package types
|
||||||
// This file was generated by the swagger tool.
|
// This file was generated by the swagger tool.
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
// GraphDriverData Information about a container's graph driver.
|
// GraphDriverData Information about the storage driver used to store the container's and
|
||||||
|
// image's filesystem.
|
||||||
|
//
|
||||||
// swagger:model GraphDriverData
|
// swagger:model GraphDriverData
|
||||||
type GraphDriverData struct {
|
type GraphDriverData struct {
|
||||||
|
|
||||||
// data
|
// Low-level storage metadata, provided as key/value pairs.
|
||||||
|
//
|
||||||
|
// This information is driver-specific, and depends on the storage-driver
|
||||||
|
// in use, and should be used for informational purposes only.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
Data map[string]string `json:"Data"`
|
Data map[string]string `json:"Data"`
|
||||||
|
|
||||||
// name
|
// Name of the storage driver.
|
||||||
// Required: true
|
// Required: true
|
||||||
Name string `json:"Name"`
|
Name string `json:"Name"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
68
vendor/github.com/docker/docker/api/types/image_summary.go
generated
vendored
68
vendor/github.com/docker/docker/api/types/image_summary.go
generated
vendored
|
|
@ -7,43 +7,91 @@ package types
|
||||||
// swagger:model ImageSummary
|
// swagger:model ImageSummary
|
||||||
type ImageSummary struct {
|
type ImageSummary struct {
|
||||||
|
|
||||||
// containers
|
// Number of containers using this image. Includes both stopped and running
|
||||||
|
// containers.
|
||||||
|
//
|
||||||
|
// This size is not calculated by default, and depends on which API endpoint
|
||||||
|
// is used. `-1` indicates that the value has not been set / calculated.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
Containers int64 `json:"Containers"`
|
Containers int64 `json:"Containers"`
|
||||||
|
|
||||||
// created
|
// Date and time at which the image was created as a Unix timestamp
|
||||||
|
// (number of seconds sinds EPOCH).
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
Created int64 `json:"Created"`
|
Created int64 `json:"Created"`
|
||||||
|
|
||||||
// Id
|
// ID is the content-addressable ID of an image.
|
||||||
|
//
|
||||||
|
// This identifier is a content-addressable digest calculated from the
|
||||||
|
// image's configuration (which includes the digests of layers used by
|
||||||
|
// the image).
|
||||||
|
//
|
||||||
|
// Note that this digest differs from the `RepoDigests` below, which
|
||||||
|
// holds digests of image manifests that reference the image.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
ID string `json:"Id"`
|
ID string `json:"Id"`
|
||||||
|
|
||||||
// labels
|
// User-defined key/value metadata.
|
||||||
// Required: true
|
// Required: true
|
||||||
Labels map[string]string `json:"Labels"`
|
Labels map[string]string `json:"Labels"`
|
||||||
|
|
||||||
// parent Id
|
// ID of the parent image.
|
||||||
|
//
|
||||||
|
// Depending on how the image was created, this field may be empty and
|
||||||
|
// is only set for images that were built/created locally. This field
|
||||||
|
// is empty if the image was pulled from an image registry.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
ParentID string `json:"ParentId"`
|
ParentID string `json:"ParentId"`
|
||||||
|
|
||||||
// repo digests
|
// List of content-addressable digests of locally available image manifests
|
||||||
|
// that the image is referenced from. Multiple manifests can refer to the
|
||||||
|
// same image.
|
||||||
|
//
|
||||||
|
// These digests are usually only available if the image was either pulled
|
||||||
|
// from a registry, or if the image was pushed to a registry, which is when
|
||||||
|
// the manifest is generated and its digest calculated.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
RepoDigests []string `json:"RepoDigests"`
|
RepoDigests []string `json:"RepoDigests"`
|
||||||
|
|
||||||
// repo tags
|
// List of image names/tags in the local image cache that reference this
|
||||||
|
// image.
|
||||||
|
//
|
||||||
|
// Multiple image tags can refer to the same image, and this list may be
|
||||||
|
// empty if no tags reference the image, in which case the image is
|
||||||
|
// "untagged", in which case it can still be referenced by its ID.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
RepoTags []string `json:"RepoTags"`
|
RepoTags []string `json:"RepoTags"`
|
||||||
|
|
||||||
// shared size
|
// Total size of image layers that are shared between this image and other
|
||||||
|
// images.
|
||||||
|
//
|
||||||
|
// This size is not calculated by default. `-1` indicates that the value
|
||||||
|
// has not been set / calculated.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
SharedSize int64 `json:"SharedSize"`
|
SharedSize int64 `json:"SharedSize"`
|
||||||
|
|
||||||
// size
|
// Total size of the image including all layers it is composed of.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
Size int64 `json:"Size"`
|
Size int64 `json:"Size"`
|
||||||
|
|
||||||
// virtual size
|
// Total size of the image including all layers it is composed of.
|
||||||
|
//
|
||||||
|
// In versions of Docker before v1.10, this field was calculated from
|
||||||
|
// the image itself and all of its parent images. Docker v1.10 and up
|
||||||
|
// store images self-contained, and no longer use a parent-chain, making
|
||||||
|
// this field an equivalent of the Size field.
|
||||||
|
//
|
||||||
|
// This field is kept for backward compatibility, but may be removed in
|
||||||
|
// a future version of the API.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
VirtualSize int64 `json:"VirtualSize"`
|
VirtualSize int64 `json:"VirtualSize"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
vendor/github.com/docker/docker/api/types/mount/mount.go
generated
vendored
9
vendor/github.com/docker/docker/api/types/mount/mount.go
generated
vendored
|
|
@ -17,6 +17,8 @@ const (
|
||||||
TypeTmpfs Type = "tmpfs"
|
TypeTmpfs Type = "tmpfs"
|
||||||
// TypeNamedPipe is the type for mounting Windows named pipes
|
// TypeNamedPipe is the type for mounting Windows named pipes
|
||||||
TypeNamedPipe Type = "npipe"
|
TypeNamedPipe Type = "npipe"
|
||||||
|
// TypeCluster is the type for Swarm Cluster Volumes.
|
||||||
|
TypeCluster Type = "cluster"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mount represents a mount (volume).
|
// Mount represents a mount (volume).
|
||||||
|
|
@ -33,6 +35,7 @@ type Mount struct {
|
||||||
BindOptions *BindOptions `json:",omitempty"`
|
BindOptions *BindOptions `json:",omitempty"`
|
||||||
VolumeOptions *VolumeOptions `json:",omitempty"`
|
VolumeOptions *VolumeOptions `json:",omitempty"`
|
||||||
TmpfsOptions *TmpfsOptions `json:",omitempty"`
|
TmpfsOptions *TmpfsOptions `json:",omitempty"`
|
||||||
|
ClusterOptions *ClusterOptions `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propagation represents the propagation of a mount.
|
// Propagation represents the propagation of a mount.
|
||||||
|
|
@ -81,6 +84,7 @@ const (
|
||||||
type BindOptions struct {
|
type BindOptions struct {
|
||||||
Propagation Propagation `json:",omitempty"`
|
Propagation Propagation `json:",omitempty"`
|
||||||
NonRecursive bool `json:",omitempty"`
|
NonRecursive bool `json:",omitempty"`
|
||||||
|
CreateMountpoint bool `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolumeOptions represents the options for a mount of type volume.
|
// VolumeOptions represents the options for a mount of type volume.
|
||||||
|
|
@ -129,3 +133,8 @@ type TmpfsOptions struct {
|
||||||
// Some of these may be straightforward to add, but others, such as
|
// Some of these may be straightforward to add, but others, such as
|
||||||
// uid/gid have implications in a clustered system.
|
// uid/gid have implications in a clustered system.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClusterOptions specifies options for a Cluster volume.
|
||||||
|
type ClusterOptions struct {
|
||||||
|
// intentionally empty
|
||||||
|
}
|
||||||
|
|
|
||||||
10
vendor/github.com/docker/docker/api/types/swarm/common.go
generated
vendored
10
vendor/github.com/docker/docker/api/types/swarm/common.go
generated
vendored
|
|
@ -1,12 +1,20 @@
|
||||||
package swarm // import "github.com/docker/docker/api/types/swarm"
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
// Version represents the internal object version.
|
// Version represents the internal object version.
|
||||||
type Version struct {
|
type Version struct {
|
||||||
Index uint64 `json:",omitempty"`
|
Index uint64 `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String implements fmt.Stringer interface.
|
||||||
|
func (v Version) String() string {
|
||||||
|
return strconv.FormatUint(v.Index, 10)
|
||||||
|
}
|
||||||
|
|
||||||
// Meta is a base object inherited by most of the other once.
|
// Meta is a base object inherited by most of the other once.
|
||||||
type Meta struct {
|
type Meta struct {
|
||||||
Version Version `json:",omitempty"`
|
Version Version `json:",omitempty"`
|
||||||
|
|
|
||||||
24
vendor/github.com/docker/docker/api/types/swarm/node.go
generated
vendored
24
vendor/github.com/docker/docker/api/types/swarm/node.go
generated
vendored
|
|
@ -53,6 +53,7 @@ type NodeDescription struct {
|
||||||
Resources Resources `json:",omitempty"`
|
Resources Resources `json:",omitempty"`
|
||||||
Engine EngineDescription `json:",omitempty"`
|
Engine EngineDescription `json:",omitempty"`
|
||||||
TLSInfo TLSInfo `json:",omitempty"`
|
TLSInfo TLSInfo `json:",omitempty"`
|
||||||
|
CSIInfo []NodeCSIInfo `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Platform represents the platform (Arch/OS).
|
// Platform represents the platform (Arch/OS).
|
||||||
|
|
@ -68,6 +69,21 @@ type EngineDescription struct {
|
||||||
Plugins []PluginDescription `json:",omitempty"`
|
Plugins []PluginDescription `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NodeCSIInfo represents information about a CSI plugin available on the node
|
||||||
|
type NodeCSIInfo struct {
|
||||||
|
// PluginName is the name of the CSI plugin.
|
||||||
|
PluginName string `json:",omitempty"`
|
||||||
|
// NodeID is the ID of the node as reported by the CSI plugin. This is
|
||||||
|
// different from the swarm node ID.
|
||||||
|
NodeID string `json:",omitempty"`
|
||||||
|
// MaxVolumesPerNode is the maximum number of volumes that may be published
|
||||||
|
// to this node
|
||||||
|
MaxVolumesPerNode int64 `json:",omitempty"`
|
||||||
|
// AccessibleTopology indicates the location of this node in the CSI
|
||||||
|
// plugin's topology
|
||||||
|
AccessibleTopology *Topology `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// PluginDescription represents the description of an engine plugin.
|
// PluginDescription represents the description of an engine plugin.
|
||||||
type PluginDescription struct {
|
type PluginDescription struct {
|
||||||
Type string `json:",omitempty"`
|
Type string `json:",omitempty"`
|
||||||
|
|
@ -113,3 +129,11 @@ const (
|
||||||
// NodeStateDisconnected DISCONNECTED
|
// NodeStateDisconnected DISCONNECTED
|
||||||
NodeStateDisconnected NodeState = "disconnected"
|
NodeStateDisconnected NodeState = "disconnected"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Topology defines the CSI topology of this node. This type is a duplicate of
|
||||||
|
// github.com/docker/docker/api/types.Topology. Because the type definition
|
||||||
|
// is so simple and to avoid complicated structure or circular imports, we just
|
||||||
|
// duplicate it here. See that type for full documentation
|
||||||
|
type Topology struct {
|
||||||
|
Segments map[string]string `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
|
||||||
10
vendor/github.com/docker/docker/api/types/swarm/swarm.go
generated
vendored
10
vendor/github.com/docker/docker/api/types/swarm/swarm.go
generated
vendored
|
|
@ -213,6 +213,16 @@ type Info struct {
|
||||||
Warnings []string `json:",omitempty"`
|
Warnings []string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Status provides information about the current swarm status and role,
|
||||||
|
// obtained from the "Swarm" header in the API response.
|
||||||
|
type Status struct {
|
||||||
|
// NodeState represents the state of the node.
|
||||||
|
NodeState LocalNodeState
|
||||||
|
|
||||||
|
// ControlAvailable indicates if the node is a swarm manager.
|
||||||
|
ControlAvailable bool
|
||||||
|
}
|
||||||
|
|
||||||
// Peer represents a peer.
|
// Peer represents a peer.
|
||||||
type Peer struct {
|
type Peer struct {
|
||||||
NodeID string
|
NodeID string
|
||||||
|
|
|
||||||
19
vendor/github.com/docker/docker/api/types/swarm/task.go
generated
vendored
19
vendor/github.com/docker/docker/api/types/swarm/task.go
generated
vendored
|
|
@ -62,6 +62,11 @@ type Task struct {
|
||||||
// used to determine which Tasks belong to which run of the job. This field
|
// used to determine which Tasks belong to which run of the job. This field
|
||||||
// is absent if the Service mode is Replicated or Global.
|
// is absent if the Service mode is Replicated or Global.
|
||||||
JobIteration *Version `json:",omitempty"`
|
JobIteration *Version `json:",omitempty"`
|
||||||
|
|
||||||
|
// Volumes is the list of VolumeAttachments for this task. It specifies
|
||||||
|
// which particular volumes are to be used by this particular task, and
|
||||||
|
// fulfilling what mounts in the spec.
|
||||||
|
Volumes []VolumeAttachment
|
||||||
}
|
}
|
||||||
|
|
||||||
// TaskSpec represents the spec of a task.
|
// TaskSpec represents the spec of a task.
|
||||||
|
|
@ -204,3 +209,17 @@ type ContainerStatus struct {
|
||||||
type PortStatus struct {
|
type PortStatus struct {
|
||||||
Ports []PortConfig `json:",omitempty"`
|
Ports []PortConfig `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VolumeAttachment contains the associating a Volume to a Task.
|
||||||
|
type VolumeAttachment struct {
|
||||||
|
// ID is the Swarmkit ID of the Volume. This is not the CSI VolumeId.
|
||||||
|
ID string `json:",omitempty"`
|
||||||
|
|
||||||
|
// Source, together with Target, indicates the Mount, as specified in the
|
||||||
|
// ContainerSpec, that this volume fulfills.
|
||||||
|
Source string `json:",omitempty"`
|
||||||
|
|
||||||
|
// Target, together with Source, indicates the Mount, as specified
|
||||||
|
// in the ContainerSpec, that this volume fulfills.
|
||||||
|
Target string `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
|
||||||
12
vendor/github.com/docker/docker/api/types/time/duration_convert.go
generated
vendored
12
vendor/github.com/docker/docker/api/types/time/duration_convert.go
generated
vendored
|
|
@ -1,12 +0,0 @@
|
||||||
package time // import "github.com/docker/docker/api/types/time"
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DurationToSecondsString converts the specified duration to the number
|
|
||||||
// seconds it represents, formatted as a string.
|
|
||||||
func DurationToSecondsString(duration time.Duration) string {
|
|
||||||
return strconv.FormatFloat(duration.Seconds(), 'f', 0, 64)
|
|
||||||
}
|
|
||||||
192
vendor/github.com/docker/docker/api/types/types.go
generated
vendored
192
vendor/github.com/docker/docker/api/types/types.go
generated
vendored
|
|
@ -14,43 +14,136 @@ import (
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/docker/docker/api/types/registry"
|
"github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
"github.com/docker/docker/api/types/volume"
|
||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// MediaTypeRawStream is vendor specific MIME-Type set for raw TTY streams
|
||||||
|
MediaTypeRawStream = "application/vnd.docker.raw-stream"
|
||||||
|
|
||||||
|
// MediaTypeMultiplexedStream is vendor specific MIME-Type set for stdin/stdout/stderr multiplexed streams
|
||||||
|
MediaTypeMultiplexedStream = "application/vnd.docker.multiplexed-stream"
|
||||||
|
)
|
||||||
|
|
||||||
// RootFS returns Image's RootFS description including the layer IDs.
|
// RootFS returns Image's RootFS description including the layer IDs.
|
||||||
type RootFS struct {
|
type RootFS struct {
|
||||||
Type string
|
Type string `json:",omitempty"`
|
||||||
Layers []string `json:",omitempty"`
|
Layers []string `json:",omitempty"`
|
||||||
BaseLayer string `json:",omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageInspect contains response of Engine API:
|
// ImageInspect contains response of Engine API:
|
||||||
// GET "/images/{name:.*}/json"
|
// GET "/images/{name:.*}/json"
|
||||||
type ImageInspect struct {
|
type ImageInspect struct {
|
||||||
|
// ID is the content-addressable ID of an image.
|
||||||
|
//
|
||||||
|
// This identifier is a content-addressable digest calculated from the
|
||||||
|
// image's configuration (which includes the digests of layers used by
|
||||||
|
// the image).
|
||||||
|
//
|
||||||
|
// Note that this digest differs from the `RepoDigests` below, which
|
||||||
|
// holds digests of image manifests that reference the image.
|
||||||
ID string `json:"Id"`
|
ID string `json:"Id"`
|
||||||
|
|
||||||
|
// RepoTags is a list of image names/tags in the local image cache that
|
||||||
|
// reference this image.
|
||||||
|
//
|
||||||
|
// Multiple image tags can refer to the same image, and this list may be
|
||||||
|
// empty if no tags reference the image, in which case the image is
|
||||||
|
// "untagged", in which case it can still be referenced by its ID.
|
||||||
RepoTags []string
|
RepoTags []string
|
||||||
|
|
||||||
|
// RepoDigests is a list of content-addressable digests of locally available
|
||||||
|
// image manifests that the image is referenced from. Multiple manifests can
|
||||||
|
// refer to the same image.
|
||||||
|
//
|
||||||
|
// These digests are usually only available if the image was either pulled
|
||||||
|
// from a registry, or if the image was pushed to a registry, which is when
|
||||||
|
// the manifest is generated and its digest calculated.
|
||||||
RepoDigests []string
|
RepoDigests []string
|
||||||
|
|
||||||
|
// Parent is the ID of the parent image.
|
||||||
|
//
|
||||||
|
// Depending on how the image was created, this field may be empty and
|
||||||
|
// is only set for images that were built/created locally. This field
|
||||||
|
// is empty if the image was pulled from an image registry.
|
||||||
Parent string
|
Parent string
|
||||||
|
|
||||||
|
// Comment is an optional message that can be set when committing or
|
||||||
|
// importing the image.
|
||||||
Comment string
|
Comment string
|
||||||
|
|
||||||
|
// Created is the date and time at which the image was created, formatted in
|
||||||
|
// RFC 3339 nano-seconds (time.RFC3339Nano).
|
||||||
Created string
|
Created string
|
||||||
|
|
||||||
|
// Container is the ID of the container that was used to create the image.
|
||||||
|
//
|
||||||
|
// Depending on how the image was created, this field may be empty.
|
||||||
Container string
|
Container string
|
||||||
|
|
||||||
|
// ContainerConfig is an optional field containing the configuration of the
|
||||||
|
// container that was last committed when creating the image.
|
||||||
|
//
|
||||||
|
// Previous versions of Docker builder used this field to store build cache,
|
||||||
|
// and it is not in active use anymore.
|
||||||
ContainerConfig *container.Config
|
ContainerConfig *container.Config
|
||||||
|
|
||||||
|
// DockerVersion is the version of Docker that was used to build the image.
|
||||||
|
//
|
||||||
|
// Depending on how the image was created, this field may be empty.
|
||||||
DockerVersion string
|
DockerVersion string
|
||||||
|
|
||||||
|
// Author is the name of the author that was specified when committing the
|
||||||
|
// image, or as specified through MAINTAINER (deprecated) in the Dockerfile.
|
||||||
Author string
|
Author string
|
||||||
Config *container.Config
|
Config *container.Config
|
||||||
|
|
||||||
|
// Architecture is the hardware CPU architecture that the image runs on.
|
||||||
Architecture string
|
Architecture string
|
||||||
|
|
||||||
|
// Variant is the CPU architecture variant (presently ARM-only).
|
||||||
Variant string `json:",omitempty"`
|
Variant string `json:",omitempty"`
|
||||||
|
|
||||||
|
// OS is the Operating System the image is built to run on.
|
||||||
Os string
|
Os string
|
||||||
|
|
||||||
|
// OsVersion is the version of the Operating System the image is built to
|
||||||
|
// run on (especially for Windows).
|
||||||
OsVersion string `json:",omitempty"`
|
OsVersion string `json:",omitempty"`
|
||||||
|
|
||||||
|
// Size is the total size of the image including all layers it is composed of.
|
||||||
Size int64
|
Size int64
|
||||||
VirtualSize int64
|
|
||||||
|
// VirtualSize is the total size of the image including all layers it is
|
||||||
|
// composed of.
|
||||||
|
//
|
||||||
|
// In versions of Docker before v1.10, this field was calculated from
|
||||||
|
// the image itself and all of its parent images. Docker v1.10 and up
|
||||||
|
// store images self-contained, and no longer use a parent-chain, making
|
||||||
|
// this field an equivalent of the Size field.
|
||||||
|
//
|
||||||
|
// This field is kept for backward compatibility, but may be removed in
|
||||||
|
// a future version of the API.
|
||||||
|
VirtualSize int64 // TODO(thaJeztah): deprecate this field
|
||||||
|
|
||||||
|
// GraphDriver holds information about the storage driver used to store the
|
||||||
|
// container's and image's filesystem.
|
||||||
GraphDriver GraphDriverData
|
GraphDriver GraphDriverData
|
||||||
|
|
||||||
|
// RootFS contains information about the image's RootFS, including the
|
||||||
|
// layer IDs.
|
||||||
RootFS RootFS
|
RootFS RootFS
|
||||||
|
|
||||||
|
// Metadata of the image in the local cache.
|
||||||
|
//
|
||||||
|
// This information is local to the daemon, and not part of the image itself.
|
||||||
Metadata ImageMetadata
|
Metadata ImageMetadata
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageMetadata contains engine-local data about the image
|
// ImageMetadata contains engine-local data about the image
|
||||||
type ImageMetadata struct {
|
type ImageMetadata struct {
|
||||||
|
// LastTagTime is the date and time at which the image was last tagged.
|
||||||
LastTagTime time.Time `json:",omitempty"`
|
LastTagTime time.Time `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,6 +200,15 @@ type Ping struct {
|
||||||
OSType string
|
OSType string
|
||||||
Experimental bool
|
Experimental bool
|
||||||
BuilderVersion BuilderVersion
|
BuilderVersion BuilderVersion
|
||||||
|
|
||||||
|
// SwarmStatus provides information about the current swarm status of the
|
||||||
|
// engine, obtained from the "Swarm" header in the API response.
|
||||||
|
//
|
||||||
|
// It can be a nil struct if the API version does not provide this header
|
||||||
|
// in the ping response, or if an error occurred, in which case the client
|
||||||
|
// should use other ways to get the current swarm status, such as the /swarm
|
||||||
|
// endpoint.
|
||||||
|
SwarmStatus *swarm.Status
|
||||||
}
|
}
|
||||||
|
|
||||||
// ComponentVersion describes the version information for a specific component.
|
// ComponentVersion describes the version information for a specific component.
|
||||||
|
|
@ -158,8 +260,8 @@ type Info struct {
|
||||||
Plugins PluginsInfo
|
Plugins PluginsInfo
|
||||||
MemoryLimit bool
|
MemoryLimit bool
|
||||||
SwapLimit bool
|
SwapLimit bool
|
||||||
KernelMemory bool // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
|
KernelMemory bool `json:",omitempty"` // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
|
||||||
KernelMemoryTCP bool
|
KernelMemoryTCP bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2.
|
||||||
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
||||||
CPUCfsQuota bool `json:"CpuCfsQuota"`
|
CPUCfsQuota bool `json:"CpuCfsQuota"`
|
||||||
CPUShares bool
|
CPUShares bool
|
||||||
|
|
@ -212,6 +314,11 @@ type Info struct {
|
||||||
SecurityOptions []string
|
SecurityOptions []string
|
||||||
ProductLicense string `json:",omitempty"`
|
ProductLicense string `json:",omitempty"`
|
||||||
DefaultAddressPools []NetworkAddressPool `json:",omitempty"`
|
DefaultAddressPools []NetworkAddressPool `json:",omitempty"`
|
||||||
|
|
||||||
|
// Warnings contains a slice of warnings that occurred while collecting
|
||||||
|
// system information. These warnings are intended to be informational
|
||||||
|
// messages for the user, and are not intended to be parsed / used for
|
||||||
|
// other purposes, as they do not have a fixed format.
|
||||||
Warnings []string
|
Warnings []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,6 +390,8 @@ type ExecStartCheck struct {
|
||||||
Detach bool
|
Detach bool
|
||||||
// Check if there's a tty
|
// Check if there's a tty
|
||||||
Tty bool
|
Tty bool
|
||||||
|
// Terminal size [height, width], unused if Tty == false
|
||||||
|
ConsoleSize *[2]uint `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HealthcheckResult stores information about a single run of a healthcheck probe
|
// HealthcheckResult stores information about a single run of a healthcheck probe
|
||||||
|
|
@ -416,13 +525,44 @@ type DefaultNetworkSettings struct {
|
||||||
// MountPoint represents a mount point configuration inside the container.
|
// MountPoint represents a mount point configuration inside the container.
|
||||||
// This is used for reporting the mountpoints in use by a container.
|
// This is used for reporting the mountpoints in use by a container.
|
||||||
type MountPoint struct {
|
type MountPoint struct {
|
||||||
|
// Type is the type of mount, see `Type<foo>` definitions in
|
||||||
|
// github.com/docker/docker/api/types/mount.Type
|
||||||
Type mount.Type `json:",omitempty"`
|
Type mount.Type `json:",omitempty"`
|
||||||
|
|
||||||
|
// Name is the name reference to the underlying data defined by `Source`
|
||||||
|
// e.g., the volume name.
|
||||||
Name string `json:",omitempty"`
|
Name string `json:",omitempty"`
|
||||||
|
|
||||||
|
// Source is the source location of the mount.
|
||||||
|
//
|
||||||
|
// For volumes, this contains the storage location of the volume (within
|
||||||
|
// `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains
|
||||||
|
// the source (host) part of the bind-mount. For `tmpfs` mount points, this
|
||||||
|
// field is empty.
|
||||||
Source string
|
Source string
|
||||||
|
|
||||||
|
// Destination is the path relative to the container root (`/`) where the
|
||||||
|
// Source is mounted inside the container.
|
||||||
Destination string
|
Destination string
|
||||||
|
|
||||||
|
// Driver is the volume driver used to create the volume (if it is a volume).
|
||||||
Driver string `json:",omitempty"`
|
Driver string `json:",omitempty"`
|
||||||
|
|
||||||
|
// Mode is a comma separated list of options supplied by the user when
|
||||||
|
// creating the bind/volume mount.
|
||||||
|
//
|
||||||
|
// The default is platform-specific (`"z"` on Linux, empty on Windows).
|
||||||
Mode string
|
Mode string
|
||||||
|
|
||||||
|
// RW indicates whether the mount is mounted writable (read-write).
|
||||||
RW bool
|
RW bool
|
||||||
|
|
||||||
|
// Propagation describes how mounts are propagated from the host into the
|
||||||
|
// mount point, and vice-versa. Refer to the Linux kernel documentation
|
||||||
|
// for details:
|
||||||
|
// https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt
|
||||||
|
//
|
||||||
|
// This field is not used on Windows.
|
||||||
Propagation mount.Propagation
|
Propagation mount.Propagation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -530,15 +670,36 @@ type ShimConfig struct {
|
||||||
Opts interface{}
|
Opts interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DiskUsageObject represents an object type used for disk usage query filtering.
|
||||||
|
type DiskUsageObject string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ContainerObject represents a container DiskUsageObject.
|
||||||
|
ContainerObject DiskUsageObject = "container"
|
||||||
|
// ImageObject represents an image DiskUsageObject.
|
||||||
|
ImageObject DiskUsageObject = "image"
|
||||||
|
// VolumeObject represents a volume DiskUsageObject.
|
||||||
|
VolumeObject DiskUsageObject = "volume"
|
||||||
|
// BuildCacheObject represents a build-cache DiskUsageObject.
|
||||||
|
BuildCacheObject DiskUsageObject = "build-cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DiskUsageOptions holds parameters for system disk usage query.
|
||||||
|
type DiskUsageOptions struct {
|
||||||
|
// Types specifies what object types to include in the response. If empty,
|
||||||
|
// all object types are returned.
|
||||||
|
Types []DiskUsageObject
|
||||||
|
}
|
||||||
|
|
||||||
// DiskUsage contains response of Engine API:
|
// DiskUsage contains response of Engine API:
|
||||||
// GET "/system/df"
|
// GET "/system/df"
|
||||||
type DiskUsage struct {
|
type DiskUsage struct {
|
||||||
LayersSize int64
|
LayersSize int64
|
||||||
Images []*ImageSummary
|
Images []*ImageSummary
|
||||||
Containers []*Container
|
Containers []*Container
|
||||||
Volumes []*Volume
|
Volumes []*volume.Volume
|
||||||
BuildCache []*BuildCache
|
BuildCache []*BuildCache
|
||||||
BuilderSize int64 // deprecated
|
BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainersPruneReport contains the response for Engine API:
|
// ContainersPruneReport contains the response for Engine API:
|
||||||
|
|
@ -613,16 +774,29 @@ type BuildResult struct {
|
||||||
ID string
|
ID string
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildCache contains information about a build cache record
|
// BuildCache contains information about a build cache record.
|
||||||
type BuildCache struct {
|
type BuildCache struct {
|
||||||
|
// ID is the unique ID of the build cache record.
|
||||||
ID string
|
ID string
|
||||||
Parent string
|
// Parent is the ID of the parent build cache record.
|
||||||
|
//
|
||||||
|
// Deprecated: deprecated in API v1.42 and up, as it was deprecated in BuildKit; use Parents instead.
|
||||||
|
Parent string `json:"Parent,omitempty"`
|
||||||
|
// Parents is the list of parent build cache record IDs.
|
||||||
|
Parents []string `json:" Parents,omitempty"`
|
||||||
|
// Type is the cache record type.
|
||||||
Type string
|
Type string
|
||||||
|
// Description is a description of the build-step that produced the build cache.
|
||||||
Description string
|
Description string
|
||||||
|
// InUse indicates if the build cache is in use.
|
||||||
InUse bool
|
InUse bool
|
||||||
|
// Shared indicates if the build cache is shared.
|
||||||
Shared bool
|
Shared bool
|
||||||
|
// Size is the amount of disk space used by the build cache (in bytes).
|
||||||
Size int64
|
Size int64
|
||||||
|
// CreatedAt is the date and time at which the build cache was created.
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
|
// LastUsedAt is the date and time at which the build cache was last used.
|
||||||
LastUsedAt *time.Time
|
LastUsedAt *time.Time
|
||||||
UsageCount int
|
UsageCount int
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
vendor/github.com/docker/docker/api/types/versions/compare.go
generated
vendored
3
vendor/github.com/docker/docker/api/types/versions/compare.go
generated
vendored
|
|
@ -8,6 +8,9 @@ import (
|
||||||
// compare compares two version strings
|
// compare compares two version strings
|
||||||
// returns -1 if v1 < v2, 1 if v1 > v2, 0 otherwise.
|
// returns -1 if v1 < v2, 1 if v1 > v2, 0 otherwise.
|
||||||
func compare(v1, v2 string) int {
|
func compare(v1, v2 string) int {
|
||||||
|
if v1 == v2 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
var (
|
var (
|
||||||
currTab = strings.Split(v1, ".")
|
currTab = strings.Split(v1, ".")
|
||||||
otherTab = strings.Split(v2, ".")
|
otherTab = strings.Split(v2, ".")
|
||||||
|
|
|
||||||
420
vendor/github.com/docker/docker/api/types/volume/cluster_volume.go
generated
vendored
Normal file
420
vendor/github.com/docker/docker/api/types/volume/cluster_volume.go
generated
vendored
Normal file
|
|
@ -0,0 +1,420 @@
|
||||||
|
package volume
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClusterVolume contains options and information specific to, and only present
|
||||||
|
// on, Swarm CSI cluster volumes.
|
||||||
|
type ClusterVolume struct {
|
||||||
|
// ID is the Swarm ID of the volume. Because cluster volumes are Swarm
|
||||||
|
// objects, they have an ID, unlike non-cluster volumes, which only have a
|
||||||
|
// Name. This ID can be used to refer to the cluster volume.
|
||||||
|
ID string
|
||||||
|
|
||||||
|
// Meta is the swarm metadata about this volume.
|
||||||
|
swarm.Meta
|
||||||
|
|
||||||
|
// Spec is the cluster-specific options from which this volume is derived.
|
||||||
|
Spec ClusterVolumeSpec
|
||||||
|
|
||||||
|
// PublishStatus contains the status of the volume as it pertains to its
|
||||||
|
// publishing on Nodes.
|
||||||
|
PublishStatus []*PublishStatus `json:",omitempty"`
|
||||||
|
|
||||||
|
// Info is information about the global status of the volume.
|
||||||
|
Info *Info `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClusterVolumeSpec contains the spec used to create this volume.
|
||||||
|
type ClusterVolumeSpec struct {
|
||||||
|
// Group defines the volume group of this volume. Volumes belonging to the
|
||||||
|
// same group can be referred to by group name when creating Services.
|
||||||
|
// Referring to a volume by group instructs swarm to treat volumes in that
|
||||||
|
// group interchangeably for the purpose of scheduling. Volumes with an
|
||||||
|
// empty string for a group technically all belong to the same, emptystring
|
||||||
|
// group.
|
||||||
|
Group string `json:",omitempty"`
|
||||||
|
|
||||||
|
// AccessMode defines how the volume is used by tasks.
|
||||||
|
AccessMode *AccessMode `json:",omitempty"`
|
||||||
|
|
||||||
|
// AccessibilityRequirements specifies where in the cluster a volume must
|
||||||
|
// be accessible from.
|
||||||
|
//
|
||||||
|
// This field must be empty if the plugin does not support
|
||||||
|
// VOLUME_ACCESSIBILITY_CONSTRAINTS capabilities. If it is present but the
|
||||||
|
// plugin does not support it, volume will not be created.
|
||||||
|
//
|
||||||
|
// If AccessibilityRequirements is empty, but the plugin does support
|
||||||
|
// VOLUME_ACCESSIBILITY_CONSTRAINTS, then Swarmkit will assume the entire
|
||||||
|
// cluster is a valid target for the volume.
|
||||||
|
AccessibilityRequirements *TopologyRequirement `json:",omitempty"`
|
||||||
|
|
||||||
|
// CapacityRange defines the desired capacity that the volume should be
|
||||||
|
// created with. If nil, the plugin will decide the capacity.
|
||||||
|
CapacityRange *CapacityRange `json:",omitempty"`
|
||||||
|
|
||||||
|
// Secrets defines Swarm Secrets that are passed to the CSI storage plugin
|
||||||
|
// when operating on this volume.
|
||||||
|
Secrets []Secret `json:",omitempty"`
|
||||||
|
|
||||||
|
// Availability is the Volume's desired availability. Analogous to Node
|
||||||
|
// Availability, this allows the user to take volumes offline in order to
|
||||||
|
// update or delete them.
|
||||||
|
Availability Availability `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Availability specifies the availability of the volume.
|
||||||
|
type Availability string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// AvailabilityActive indicates that the volume is active and fully
|
||||||
|
// schedulable on the cluster.
|
||||||
|
AvailabilityActive Availability = "active"
|
||||||
|
|
||||||
|
// AvailabilityPause indicates that no new workloads should use the
|
||||||
|
// volume, but existing workloads can continue to use it.
|
||||||
|
AvailabilityPause Availability = "pause"
|
||||||
|
|
||||||
|
// AvailabilityDrain indicates that all workloads using this volume
|
||||||
|
// should be rescheduled, and the volume unpublished from all nodes.
|
||||||
|
AvailabilityDrain Availability = "drain"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccessMode defines the access mode of a volume.
|
||||||
|
type AccessMode struct {
|
||||||
|
// Scope defines the set of nodes this volume can be used on at one time.
|
||||||
|
Scope Scope `json:",omitempty"`
|
||||||
|
|
||||||
|
// Sharing defines the number and way that different tasks can use this
|
||||||
|
// volume at one time.
|
||||||
|
Sharing SharingMode `json:",omitempty"`
|
||||||
|
|
||||||
|
// MountVolume defines options for using this volume as a Mount-type
|
||||||
|
// volume.
|
||||||
|
//
|
||||||
|
// Either BlockVolume or MountVolume, but not both, must be present.
|
||||||
|
MountVolume *TypeMount `json:",omitempty"`
|
||||||
|
|
||||||
|
// BlockVolume defines options for using this volume as a Block-type
|
||||||
|
// volume.
|
||||||
|
//
|
||||||
|
// Either BlockVolume or MountVolume, but not both, must be present.
|
||||||
|
BlockVolume *TypeBlock `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scope defines the Scope of a Cluster Volume. This is how many nodes a
|
||||||
|
// Volume can be accessed simultaneously on.
|
||||||
|
type Scope string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ScopeSingleNode indicates the volume can be used on one node at a
|
||||||
|
// time.
|
||||||
|
ScopeSingleNode Scope = "single"
|
||||||
|
|
||||||
|
// ScopeMultiNode indicates the volume can be used on many nodes at
|
||||||
|
// the same time.
|
||||||
|
ScopeMultiNode Scope = "multi"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SharingMode defines the Sharing of a Cluster Volume. This is how Tasks using a
|
||||||
|
// Volume at the same time can use it.
|
||||||
|
type SharingMode string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// SharingNone indicates that only one Task may use the Volume at a
|
||||||
|
// time.
|
||||||
|
SharingNone SharingMode = "none"
|
||||||
|
|
||||||
|
// SharingReadOnly indicates that the Volume may be shared by any
|
||||||
|
// number of Tasks, but they must be read-only.
|
||||||
|
SharingReadOnly SharingMode = "readonly"
|
||||||
|
|
||||||
|
// SharingOneWriter indicates that the Volume may be shared by any
|
||||||
|
// number of Tasks, but all after the first must be read-only.
|
||||||
|
SharingOneWriter SharingMode = "onewriter"
|
||||||
|
|
||||||
|
// SharingAll means that the Volume may be shared by any number of
|
||||||
|
// Tasks, as readers or writers.
|
||||||
|
SharingAll SharingMode = "all"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TypeBlock defines options for using a volume as a block-type volume.
|
||||||
|
//
|
||||||
|
// Intentionally empty.
|
||||||
|
type TypeBlock struct{}
|
||||||
|
|
||||||
|
// TypeMount contains options for using a volume as a Mount-type
|
||||||
|
// volume.
|
||||||
|
type TypeMount struct {
|
||||||
|
// FsType specifies the filesystem type for the mount volume. Optional.
|
||||||
|
FsType string `json:",omitempty"`
|
||||||
|
|
||||||
|
// MountFlags defines flags to pass when mounting the volume. Optional.
|
||||||
|
MountFlags []string `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopologyRequirement expresses the user's requirements for a volume's
|
||||||
|
// accessible topology.
|
||||||
|
type TopologyRequirement struct {
|
||||||
|
// Requisite specifies a list of Topologies, at least one of which the
|
||||||
|
// volume must be accessible from.
|
||||||
|
//
|
||||||
|
// Taken verbatim from the CSI Spec:
|
||||||
|
//
|
||||||
|
// Specifies the list of topologies the provisioned volume MUST be
|
||||||
|
// accessible from.
|
||||||
|
// This field is OPTIONAL. If TopologyRequirement is specified either
|
||||||
|
// requisite or preferred or both MUST be specified.
|
||||||
|
//
|
||||||
|
// If requisite is specified, the provisioned volume MUST be
|
||||||
|
// accessible from at least one of the requisite topologies.
|
||||||
|
//
|
||||||
|
// Given
|
||||||
|
// x = number of topologies provisioned volume is accessible from
|
||||||
|
// n = number of requisite topologies
|
||||||
|
// The CO MUST ensure n >= 1. The SP MUST ensure x >= 1
|
||||||
|
// If x==n, then the SP MUST make the provisioned volume available to
|
||||||
|
// all topologies from the list of requisite topologies. If it is
|
||||||
|
// unable to do so, the SP MUST fail the CreateVolume call.
|
||||||
|
// For example, if a volume should be accessible from a single zone,
|
||||||
|
// and requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"}
|
||||||
|
// then the provisioned volume MUST be accessible from the "region"
|
||||||
|
// "R1" and the "zone" "Z2".
|
||||||
|
// Similarly, if a volume should be accessible from two zones, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// then the provisioned volume MUST be accessible from the "region"
|
||||||
|
// "R1" and both "zone" "Z2" and "zone" "Z3".
|
||||||
|
//
|
||||||
|
// If x<n, then the SP SHALL choose x unique topologies from the list
|
||||||
|
// of requisite topologies. If it is unable to do so, the SP MUST fail
|
||||||
|
// the CreateVolume call.
|
||||||
|
// For example, if a volume should be accessible from a single zone,
|
||||||
|
// and requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// then the SP may choose to make the provisioned volume available in
|
||||||
|
// either the "zone" "Z2" or the "zone" "Z3" in the "region" "R1".
|
||||||
|
// Similarly, if a volume should be accessible from two zones, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"},
|
||||||
|
// {"region": "R1", "zone": "Z4"}
|
||||||
|
// then the provisioned volume MUST be accessible from any combination
|
||||||
|
// of two unique topologies: e.g. "R1/Z2" and "R1/Z3", or "R1/Z2" and
|
||||||
|
// "R1/Z4", or "R1/Z3" and "R1/Z4".
|
||||||
|
//
|
||||||
|
// If x>n, then the SP MUST make the provisioned volume available from
|
||||||
|
// all topologies from the list of requisite topologies and MAY choose
|
||||||
|
// the remaining x-n unique topologies from the list of all possible
|
||||||
|
// topologies. If it is unable to do so, the SP MUST fail the
|
||||||
|
// CreateVolume call.
|
||||||
|
// For example, if a volume should be accessible from two zones, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"}
|
||||||
|
// then the provisioned volume MUST be accessible from the "region"
|
||||||
|
// "R1" and the "zone" "Z2" and the SP may select the second zone
|
||||||
|
// independently, e.g. "R1/Z4".
|
||||||
|
Requisite []Topology `json:",omitempty"`
|
||||||
|
|
||||||
|
// Preferred is a list of Topologies that the volume should attempt to be
|
||||||
|
// provisioned in.
|
||||||
|
//
|
||||||
|
// Taken from the CSI spec:
|
||||||
|
//
|
||||||
|
// Specifies the list of topologies the CO would prefer the volume to
|
||||||
|
// be provisioned in.
|
||||||
|
//
|
||||||
|
// This field is OPTIONAL. If TopologyRequirement is specified either
|
||||||
|
// requisite or preferred or both MUST be specified.
|
||||||
|
//
|
||||||
|
// An SP MUST attempt to make the provisioned volume available using
|
||||||
|
// the preferred topologies in order from first to last.
|
||||||
|
//
|
||||||
|
// If requisite is specified, all topologies in preferred list MUST
|
||||||
|
// also be present in the list of requisite topologies.
|
||||||
|
//
|
||||||
|
// If the SP is unable to to make the provisioned volume available
|
||||||
|
// from any of the preferred topologies, the SP MAY choose a topology
|
||||||
|
// from the list of requisite topologies.
|
||||||
|
// If the list of requisite topologies is not specified, then the SP
|
||||||
|
// MAY choose from the list of all possible topologies.
|
||||||
|
// If the list of requisite topologies is specified and the SP is
|
||||||
|
// unable to to make the provisioned volume available from any of the
|
||||||
|
// requisite topologies it MUST fail the CreateVolume call.
|
||||||
|
//
|
||||||
|
// Example 1:
|
||||||
|
// Given a volume should be accessible from a single zone, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// preferred =
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// then the the SP SHOULD first attempt to make the provisioned volume
|
||||||
|
// available from "zone" "Z3" in the "region" "R1" and fall back to
|
||||||
|
// "zone" "Z2" in the "region" "R1" if that is not possible.
|
||||||
|
//
|
||||||
|
// Example 2:
|
||||||
|
// Given a volume should be accessible from a single zone, and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"},
|
||||||
|
// {"region": "R1", "zone": "Z4"},
|
||||||
|
// {"region": "R1", "zone": "Z5"}
|
||||||
|
// preferred =
|
||||||
|
// {"region": "R1", "zone": "Z4"},
|
||||||
|
// {"region": "R1", "zone": "Z2"}
|
||||||
|
// then the the SP SHOULD first attempt to make the provisioned volume
|
||||||
|
// accessible from "zone" "Z4" in the "region" "R1" and fall back to
|
||||||
|
// "zone" "Z2" in the "region" "R1" if that is not possible. If that
|
||||||
|
// is not possible, the SP may choose between either the "zone"
|
||||||
|
// "Z3" or "Z5" in the "region" "R1".
|
||||||
|
//
|
||||||
|
// Example 3:
|
||||||
|
// Given a volume should be accessible from TWO zones (because an
|
||||||
|
// opaque parameter in CreateVolumeRequest, for example, specifies
|
||||||
|
// the volume is accessible from two zones, aka synchronously
|
||||||
|
// replicated), and
|
||||||
|
// requisite =
|
||||||
|
// {"region": "R1", "zone": "Z2"},
|
||||||
|
// {"region": "R1", "zone": "Z3"},
|
||||||
|
// {"region": "R1", "zone": "Z4"},
|
||||||
|
// {"region": "R1", "zone": "Z5"}
|
||||||
|
// preferred =
|
||||||
|
// {"region": "R1", "zone": "Z5"},
|
||||||
|
// {"region": "R1", "zone": "Z3"}
|
||||||
|
// then the the SP SHOULD first attempt to make the provisioned volume
|
||||||
|
// accessible from the combination of the two "zones" "Z5" and "Z3" in
|
||||||
|
// the "region" "R1". If that's not possible, it should fall back to
|
||||||
|
// a combination of "Z5" and other possibilities from the list of
|
||||||
|
// requisite. If that's not possible, it should fall back to a
|
||||||
|
// combination of "Z3" and other possibilities from the list of
|
||||||
|
// requisite. If that's not possible, it should fall back to a
|
||||||
|
// combination of other possibilities from the list of requisite.
|
||||||
|
Preferred []Topology `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Topology is a map of topological domains to topological segments.
|
||||||
|
//
|
||||||
|
// This description is taken verbatim from the CSI Spec:
|
||||||
|
//
|
||||||
|
// A topological domain is a sub-division of a cluster, like "region",
|
||||||
|
// "zone", "rack", etc.
|
||||||
|
// A topological segment is a specific instance of a topological domain,
|
||||||
|
// like "zone3", "rack3", etc.
|
||||||
|
// For example {"com.company/zone": "Z1", "com.company/rack": "R3"}
|
||||||
|
// Valid keys have two segments: an OPTIONAL prefix and name, separated
|
||||||
|
// by a slash (/), for example: "com.company.example/zone".
|
||||||
|
// The key name segment is REQUIRED. The prefix is OPTIONAL.
|
||||||
|
// The key name MUST be 63 characters or less, begin and end with an
|
||||||
|
// alphanumeric character ([a-z0-9A-Z]), and contain only dashes (-),
|
||||||
|
// underscores (_), dots (.), or alphanumerics in between, for example
|
||||||
|
// "zone".
|
||||||
|
// The key prefix MUST be 63 characters or less, begin and end with a
|
||||||
|
// lower-case alphanumeric character ([a-z0-9]), contain only
|
||||||
|
// dashes (-), dots (.), or lower-case alphanumerics in between, and
|
||||||
|
// follow domain name notation format
|
||||||
|
// (https://tools.ietf.org/html/rfc1035#section-2.3.1).
|
||||||
|
// The key prefix SHOULD include the plugin's host company name and/or
|
||||||
|
// the plugin name, to minimize the possibility of collisions with keys
|
||||||
|
// from other plugins.
|
||||||
|
// If a key prefix is specified, it MUST be identical across all
|
||||||
|
// topology keys returned by the SP (across all RPCs).
|
||||||
|
// Keys MUST be case-insensitive. Meaning the keys "Zone" and "zone"
|
||||||
|
// MUST not both exist.
|
||||||
|
// Each value (topological segment) MUST contain 1 or more strings.
|
||||||
|
// Each string MUST be 63 characters or less and begin and end with an
|
||||||
|
// alphanumeric character with '-', '_', '.', or alphanumerics in
|
||||||
|
// between.
|
||||||
|
type Topology struct {
|
||||||
|
Segments map[string]string `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CapacityRange describes the minimum and maximum capacity a volume should be
|
||||||
|
// created with
|
||||||
|
type CapacityRange struct {
|
||||||
|
// RequiredBytes specifies that a volume must be at least this big. The
|
||||||
|
// value of 0 indicates an unspecified minimum.
|
||||||
|
RequiredBytes int64
|
||||||
|
|
||||||
|
// LimitBytes specifies that a volume must not be bigger than this. The
|
||||||
|
// value of 0 indicates an unspecified maximum
|
||||||
|
LimitBytes int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// Secret represents a Swarm Secret value that must be passed to the CSI
|
||||||
|
// storage plugin when operating on this Volume. It represents one key-value
|
||||||
|
// pair of possibly many.
|
||||||
|
type Secret struct {
|
||||||
|
// Key is the name of the key of the key-value pair passed to the plugin.
|
||||||
|
Key string
|
||||||
|
|
||||||
|
// Secret is the swarm Secret object from which to read data. This can be a
|
||||||
|
// Secret name or ID. The Secret data is retrieved by Swarm and used as the
|
||||||
|
// value of the key-value pair passed to the plugin.
|
||||||
|
Secret string
|
||||||
|
}
|
||||||
|
|
||||||
|
// PublishState represents the state of a Volume as it pertains to its
|
||||||
|
// use on a particular Node.
|
||||||
|
type PublishState string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// StatePending indicates that the volume should be published on
|
||||||
|
// this node, but the call to ControllerPublishVolume has not been
|
||||||
|
// successfully completed yet and the result recorded by swarmkit.
|
||||||
|
StatePending PublishState = "pending-publish"
|
||||||
|
|
||||||
|
// StatePublished means the volume is published successfully to the node.
|
||||||
|
StatePublished PublishState = "published"
|
||||||
|
|
||||||
|
// StatePendingNodeUnpublish indicates that the Volume should be
|
||||||
|
// unpublished on the Node, and we're waiting for confirmation that it has
|
||||||
|
// done so. After the Node has confirmed that the Volume has been
|
||||||
|
// unpublished, the state will move to StatePendingUnpublish.
|
||||||
|
StatePendingNodeUnpublish PublishState = "pending-node-unpublish"
|
||||||
|
|
||||||
|
// StatePendingUnpublish means the volume is still published to the node
|
||||||
|
// by the controller, awaiting the operation to unpublish it.
|
||||||
|
StatePendingUnpublish PublishState = "pending-controller-unpublish"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PublishStatus represents the status of the volume as published to an
|
||||||
|
// individual node
|
||||||
|
type PublishStatus struct {
|
||||||
|
// NodeID is the ID of the swarm node this Volume is published to.
|
||||||
|
NodeID string `json:",omitempty"`
|
||||||
|
|
||||||
|
// State is the publish state of the volume.
|
||||||
|
State PublishState `json:",omitempty"`
|
||||||
|
|
||||||
|
// PublishContext is the PublishContext returned by the CSI plugin when
|
||||||
|
// a volume is published.
|
||||||
|
PublishContext map[string]string `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info contains information about the Volume as a whole as provided by
|
||||||
|
// the CSI storage plugin.
|
||||||
|
type Info struct {
|
||||||
|
// CapacityBytes is the capacity of the volume in bytes. A value of 0
|
||||||
|
// indicates that the capacity is unknown.
|
||||||
|
CapacityBytes int64 `json:",omitempty"`
|
||||||
|
|
||||||
|
// VolumeContext is the context originating from the CSI storage plugin
|
||||||
|
// when the Volume is created.
|
||||||
|
VolumeContext map[string]string `json:",omitempty"`
|
||||||
|
|
||||||
|
// VolumeID is the ID of the Volume as seen by the CSI storage plugin. This
|
||||||
|
// is distinct from the Volume's Swarm ID, which is the ID used by all of
|
||||||
|
// the Docker Engine to refer to the Volume. If this field is blank, then
|
||||||
|
// the Volume has not been successfully created yet.
|
||||||
|
VolumeID string `json:",omitempty"`
|
||||||
|
|
||||||
|
// AccessibleTopolgoy is the topology this volume is actually accessible
|
||||||
|
// from.
|
||||||
|
AccessibleTopology []Topology `json:",omitempty"`
|
||||||
|
}
|
||||||
29
vendor/github.com/docker/docker/api/types/volume/create_options.go
generated
vendored
Normal file
29
vendor/github.com/docker/docker/api/types/volume/create_options.go
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
package volume
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// CreateOptions VolumeConfig
|
||||||
|
//
|
||||||
|
// Volume configuration
|
||||||
|
// swagger:model CreateOptions
|
||||||
|
type CreateOptions struct {
|
||||||
|
|
||||||
|
// cluster volume spec
|
||||||
|
ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"`
|
||||||
|
|
||||||
|
// Name of the volume driver to use.
|
||||||
|
Driver string `json:"Driver,omitempty"`
|
||||||
|
|
||||||
|
// A mapping of driver options and values. These options are
|
||||||
|
// passed directly to the driver and are driver specific.
|
||||||
|
//
|
||||||
|
DriverOpts map[string]string `json:"DriverOpts,omitempty"`
|
||||||
|
|
||||||
|
// User-defined key/value metadata.
|
||||||
|
Labels map[string]string `json:"Labels,omitempty"`
|
||||||
|
|
||||||
|
// The new volume's name. If not specified, Docker generates a name.
|
||||||
|
//
|
||||||
|
Name string `json:"Name,omitempty"`
|
||||||
|
}
|
||||||
11
vendor/github.com/docker/docker/api/types/volume/deprecated.go
generated
vendored
Normal file
11
vendor/github.com/docker/docker/api/types/volume/deprecated.go
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
package volume // import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
|
// VolumeCreateBody Volume configuration
|
||||||
|
//
|
||||||
|
// Deprecated: use CreateOptions
|
||||||
|
type VolumeCreateBody = CreateOptions
|
||||||
|
|
||||||
|
// VolumeListOKBody Volume list response
|
||||||
|
//
|
||||||
|
// Deprecated: use ListResponse
|
||||||
|
type VolumeListOKBody = ListResponse
|
||||||
18
vendor/github.com/docker/docker/api/types/volume/list_response.go
generated
vendored
Normal file
18
vendor/github.com/docker/docker/api/types/volume/list_response.go
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
package volume
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// ListResponse VolumeListResponse
|
||||||
|
//
|
||||||
|
// Volume list response
|
||||||
|
// swagger:model ListResponse
|
||||||
|
type ListResponse struct {
|
||||||
|
|
||||||
|
// List of volumes
|
||||||
|
Volumes []*Volume `json:"Volumes"`
|
||||||
|
|
||||||
|
// Warnings that occurred when fetching the list of volumes.
|
||||||
|
//
|
||||||
|
Warnings []string `json:"Warnings"`
|
||||||
|
}
|
||||||
8
vendor/github.com/docker/docker/api/types/volume/options.go
generated
vendored
Normal file
8
vendor/github.com/docker/docker/api/types/volume/options.go
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
package volume // import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
|
import "github.com/docker/docker/api/types/filters"
|
||||||
|
|
||||||
|
// ListOptions holds parameters to list volumes.
|
||||||
|
type ListOptions struct {
|
||||||
|
Filters filters.Args
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package types
|
package volume
|
||||||
|
|
||||||
// This file was generated by the swagger tool.
|
// This file was generated by the swagger tool.
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
@ -7,6 +7,9 @@ package types
|
||||||
// swagger:model Volume
|
// swagger:model Volume
|
||||||
type Volume struct {
|
type Volume struct {
|
||||||
|
|
||||||
|
// cluster volume
|
||||||
|
ClusterVolume *ClusterVolume `json:"ClusterVolume,omitempty"`
|
||||||
|
|
||||||
// Date/Time the volume was created.
|
// Date/Time the volume was created.
|
||||||
CreatedAt string `json:"CreatedAt,omitempty"`
|
CreatedAt string `json:"CreatedAt,omitempty"`
|
||||||
|
|
||||||
|
|
@ -47,14 +50,14 @@ type Volume struct {
|
||||||
Status map[string]interface{} `json:"Status,omitempty"`
|
Status map[string]interface{} `json:"Status,omitempty"`
|
||||||
|
|
||||||
// usage data
|
// usage data
|
||||||
UsageData *VolumeUsageData `json:"UsageData,omitempty"`
|
UsageData *UsageData `json:"UsageData,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolumeUsageData Usage details about the volume. This information is used by the
|
// UsageData Usage details about the volume. This information is used by the
|
||||||
// `GET /system/df` endpoint, and omitted in other endpoints.
|
// `GET /system/df` endpoint, and omitted in other endpoints.
|
||||||
//
|
//
|
||||||
// swagger:model VolumeUsageData
|
// swagger:model UsageData
|
||||||
type VolumeUsageData struct {
|
type UsageData struct {
|
||||||
|
|
||||||
// The number of containers referencing this volume. This field
|
// The number of containers referencing this volume. This field
|
||||||
// is set to `-1` if the reference-count is not available.
|
// is set to `-1` if the reference-count is not available.
|
||||||
31
vendor/github.com/docker/docker/api/types/volume/volume_create.go
generated
vendored
31
vendor/github.com/docker/docker/api/types/volume/volume_create.go
generated
vendored
|
|
@ -1,31 +0,0 @@
|
||||||
package volume // import "github.com/docker/docker/api/types/volume"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Code generated by `swagger generate operation`. DO NOT EDIT.
|
|
||||||
//
|
|
||||||
// See hack/generate-swagger-api.sh
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// VolumeCreateBody Volume configuration
|
|
||||||
// swagger:model VolumeCreateBody
|
|
||||||
type VolumeCreateBody struct {
|
|
||||||
|
|
||||||
// Name of the volume driver to use.
|
|
||||||
// Required: true
|
|
||||||
Driver string `json:"Driver"`
|
|
||||||
|
|
||||||
// A mapping of driver options and values. These options are
|
|
||||||
// passed directly to the driver and are driver specific.
|
|
||||||
//
|
|
||||||
// Required: true
|
|
||||||
DriverOpts map[string]string `json:"DriverOpts"`
|
|
||||||
|
|
||||||
// User-defined key/value metadata.
|
|
||||||
// Required: true
|
|
||||||
Labels map[string]string `json:"Labels"`
|
|
||||||
|
|
||||||
// The new volume's name. If not specified, Docker generates a name.
|
|
||||||
//
|
|
||||||
// Required: true
|
|
||||||
Name string `json:"Name"`
|
|
||||||
}
|
|
||||||
23
vendor/github.com/docker/docker/api/types/volume/volume_list.go
generated
vendored
23
vendor/github.com/docker/docker/api/types/volume/volume_list.go
generated
vendored
|
|
@ -1,23 +0,0 @@
|
||||||
package volume // import "github.com/docker/docker/api/types/volume"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Code generated by `swagger generate operation`. DO NOT EDIT.
|
|
||||||
//
|
|
||||||
// See hack/generate-swagger-api.sh
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
import "github.com/docker/docker/api/types"
|
|
||||||
|
|
||||||
// VolumeListOKBody Volume list response
|
|
||||||
// swagger:model VolumeListOKBody
|
|
||||||
type VolumeListOKBody struct {
|
|
||||||
|
|
||||||
// List of volumes
|
|
||||||
// Required: true
|
|
||||||
Volumes []*types.Volume `json:"Volumes"`
|
|
||||||
|
|
||||||
// Warnings that occurred when fetching the list of volumes.
|
|
||||||
//
|
|
||||||
// Required: true
|
|
||||||
Warnings []string `json:"Warnings"`
|
|
||||||
}
|
|
||||||
7
vendor/github.com/docker/docker/api/types/volume/volume_update.go
generated
vendored
Normal file
7
vendor/github.com/docker/docker/api/types/volume/volume_update.go
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
package volume // import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
|
// UpdateOptions is configuration to update a Volume with.
|
||||||
|
type UpdateOptions struct {
|
||||||
|
// Spec is the ClusterVolumeSpec to update the volume to.
|
||||||
|
Spec *ClusterVolumeSpec `json:"Spec,omitempty"`
|
||||||
|
}
|
||||||
2
vendor/github.com/docker/docker/client/build_cancel.go
generated
vendored
2
vendor/github.com/docker/docker/client/build_cancel.go
generated
vendored
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BuildCancel requests the daemon to cancel ongoing build request
|
// BuildCancel requests the daemon to cancel the ongoing build request.
|
||||||
func (cli *Client) BuildCancel(ctx context.Context, id string) error {
|
func (cli *Client) BuildCancel(ctx context.Context, id string) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("id", id)
|
query.Set("id", id)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/checkpoint_list.go
generated
vendored
2
vendor/github.com/docker/docker/client/checkpoint_list.go
generated
vendored
|
|
@ -20,7 +20,7 @@ func (cli *Client) CheckpointList(ctx context.Context, container string, options
|
||||||
resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", query, nil)
|
resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", query, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return checkpoints, wrapResponseError(err, resp, "container", container)
|
return checkpoints, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.NewDecoder(resp.body).Decode(&checkpoints)
|
err = json.NewDecoder(resp.body).Decode(&checkpoints)
|
||||||
|
|
|
||||||
129
vendor/github.com/docker/docker/client/client.go
generated
vendored
129
vendor/github.com/docker/docker/client/client.go
generated
vendored
|
|
@ -6,9 +6,10 @@ https://docs.docker.com/engine/api/
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
You use the library by creating a client object and calling methods on it. The
|
You use the library by constructing a client object using [NewClientWithOpts]
|
||||||
client can be created either from environment variables with NewClientWithOpts(client.FromEnv),
|
and calling methods on it. The client can be configured from environment
|
||||||
or configured manually with NewClient().
|
variables by passing the [FromEnv] option, or configured manually by passing any
|
||||||
|
of the other available [Opts].
|
||||||
|
|
||||||
For example, to list running containers (the equivalent of "docker ps"):
|
For example, to list running containers (the equivalent of "docker ps"):
|
||||||
|
|
||||||
|
|
@ -42,7 +43,6 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
@ -122,15 +122,18 @@ type Client struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckRedirect specifies the policy for dealing with redirect responses:
|
// CheckRedirect specifies the policy for dealing with redirect responses:
|
||||||
// If the request is non-GET return `ErrRedirect`. Otherwise use the last response.
|
// If the request is non-GET return ErrRedirect, otherwise use the last response.
|
||||||
//
|
//
|
||||||
// Go 1.8 changes behavior for HTTP redirects (specifically 301, 307, and 308) in the client .
|
// Go 1.8 changes behavior for HTTP redirects (specifically 301, 307, and 308)
|
||||||
// The Docker client (and by extension docker API client) can be made to send a request
|
// in the client. The Docker client (and by extension docker API client) can be
|
||||||
// like POST /containers//start where what would normally be in the name section of the URL is empty.
|
// made to send a request like POST /containers//start where what would normally
|
||||||
// This triggers an HTTP 301 from the daemon.
|
// be in the name section of the URL is empty. This triggers an HTTP 301 from
|
||||||
// In go 1.8 this 301 will be converted to a GET request, and ends up getting a 404 from the daemon.
|
// the daemon.
|
||||||
// This behavior change manifests in the client in that before the 301 was not followed and
|
//
|
||||||
// the client did not generate an error, but now results in a message like Error response from daemon: page not found.
|
// In go 1.8 this 301 will be converted to a GET request, and ends up getting
|
||||||
|
// a 404 from the daemon. This behavior change manifests in the client in that
|
||||||
|
// before, the 301 was not followed and the client did not generate an error,
|
||||||
|
// but now results in a message like Error response from daemon: page not found.
|
||||||
func CheckRedirect(req *http.Request, via []*http.Request) error {
|
func CheckRedirect(req *http.Request, via []*http.Request) error {
|
||||||
if via[0].Method == http.MethodGet {
|
if via[0].Method == http.MethodGet {
|
||||||
return http.ErrUseLastResponse
|
return http.ErrUseLastResponse
|
||||||
|
|
@ -138,13 +141,20 @@ func CheckRedirect(req *http.Request, via []*http.Request) error {
|
||||||
return ErrRedirect
|
return ErrRedirect
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClientWithOpts initializes a new API client with default values. It takes functors
|
// NewClientWithOpts initializes a new API client with a default HTTPClient, and
|
||||||
// to modify values when creating it, like `NewClientWithOpts(WithVersion(…))`
|
// default API host and version. It also initializes the custom HTTP headers to
|
||||||
// It also initializes the custom http headers to add to each request.
|
// add to each request.
|
||||||
//
|
//
|
||||||
// It won't send any version information if the version number is empty. It is
|
// It takes an optional list of Opt functional arguments, which are applied in
|
||||||
// highly recommended that you set a version or your client may break if the
|
// the order they're provided, which allows modifying the defaults when creating
|
||||||
// server is upgraded.
|
// the client. For example, the following initializes a client that configures
|
||||||
|
// itself with values from environment variables (client.FromEnv), and has
|
||||||
|
// automatic API version negotiation enabled (client.WithAPIVersionNegotiation()).
|
||||||
|
//
|
||||||
|
// cli, err := client.NewClientWithOpts(
|
||||||
|
// client.FromEnv,
|
||||||
|
// client.WithAPIVersionNegotiation(),
|
||||||
|
// )
|
||||||
func NewClientWithOpts(ops ...Opt) (*Client, error) {
|
func NewClientWithOpts(ops ...Opt) (*Client, error) {
|
||||||
client, err := defaultHTTPClient(DefaultDockerHost)
|
client, err := defaultHTTPClient(DefaultDockerHost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -182,12 +192,12 @@ func NewClientWithOpts(ops ...Opt) (*Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultHTTPClient(host string) (*http.Client, error) {
|
func defaultHTTPClient(host string) (*http.Client, error) {
|
||||||
url, err := ParseHostURL(host)
|
hostURL, err := ParseHostURL(host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
transport := new(http.Transport)
|
transport := &http.Transport{}
|
||||||
sockets.ConfigureTransport(transport, url.Scheme, url.Host)
|
_ = sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host)
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
CheckRedirect: CheckRedirect,
|
CheckRedirect: CheckRedirect,
|
||||||
|
|
@ -223,11 +233,21 @@ func (cli *Client) ClientVersion() string {
|
||||||
return cli.version
|
return cli.version
|
||||||
}
|
}
|
||||||
|
|
||||||
// NegotiateAPIVersion queries the API and updates the version to match the
|
// NegotiateAPIVersion queries the API and updates the version to match the API
|
||||||
// API version. Any errors are silently ignored. If a manual override is in place,
|
// version. NegotiateAPIVersion downgrades the client's API version to match the
|
||||||
// either through the `DOCKER_API_VERSION` environment variable, or if the client
|
// APIVersion if the ping version is lower than the default version. If the API
|
||||||
// was initialized with a fixed version (`opts.WithVersion(xx)`), no negotiation
|
// version reported by the server is higher than the maximum version supported
|
||||||
// will be performed.
|
// by the client, it uses the client's maximum version.
|
||||||
|
//
|
||||||
|
// If a manual override is in place, either through the "DOCKER_API_VERSION"
|
||||||
|
// (EnvOverrideAPIVersion) environment variable, or if the client is initialized
|
||||||
|
// with a fixed version (WithVersion(xx)), no negotiation is performed.
|
||||||
|
//
|
||||||
|
// If the API server's ping response does not contain an API version, or if the
|
||||||
|
// client did not get a successful ping response, it assumes it is connected with
|
||||||
|
// an old daemon that does not support API version negotiation, in which case it
|
||||||
|
// downgrades to the latest version of the API before version negotiation was
|
||||||
|
// added (1.24).
|
||||||
func (cli *Client) NegotiateAPIVersion(ctx context.Context) {
|
func (cli *Client) NegotiateAPIVersion(ctx context.Context) {
|
||||||
if !cli.manualOverride {
|
if !cli.manualOverride {
|
||||||
ping, _ := cli.Ping(ctx)
|
ping, _ := cli.Ping(ctx)
|
||||||
|
|
@ -235,23 +255,31 @@ func (cli *Client) NegotiateAPIVersion(ctx context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NegotiateAPIVersionPing updates the client version to match the Ping.APIVersion
|
// NegotiateAPIVersionPing downgrades the client's API version to match the
|
||||||
// if the ping version is less than the default version. If a manual override is
|
// APIVersion in the ping response. If the API version in pingResponse is higher
|
||||||
// in place, either through the `DOCKER_API_VERSION` environment variable, or if
|
// than the maximum version supported by the client, it uses the client's maximum
|
||||||
// the client was initialized with a fixed version (`opts.WithVersion(xx)`), no
|
// version.
|
||||||
// negotiation is performed.
|
//
|
||||||
func (cli *Client) NegotiateAPIVersionPing(p types.Ping) {
|
// If a manual override is in place, either through the "DOCKER_API_VERSION"
|
||||||
|
// (EnvOverrideAPIVersion) environment variable, or if the client is initialized
|
||||||
|
// with a fixed version (WithVersion(xx)), no negotiation is performed.
|
||||||
|
//
|
||||||
|
// If the API server's ping response does not contain an API version, we assume
|
||||||
|
// we are connected with an old daemon without API version negotiation support,
|
||||||
|
// and downgrade to the latest version of the API before version negotiation was
|
||||||
|
// added (1.24).
|
||||||
|
func (cli *Client) NegotiateAPIVersionPing(pingResponse types.Ping) {
|
||||||
if !cli.manualOverride {
|
if !cli.manualOverride {
|
||||||
cli.negotiateAPIVersionPing(p)
|
cli.negotiateAPIVersionPing(pingResponse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// negotiateAPIVersionPing queries the API and updates the version to match the
|
// negotiateAPIVersionPing queries the API and updates the version to match the
|
||||||
// API version. Any errors are silently ignored.
|
// API version from the ping response.
|
||||||
func (cli *Client) negotiateAPIVersionPing(p types.Ping) {
|
func (cli *Client) negotiateAPIVersionPing(pingResponse types.Ping) {
|
||||||
// try the latest version before versioning headers existed
|
// default to the latest version before versioning headers existed
|
||||||
if p.APIVersion == "" {
|
if pingResponse.APIVersion == "" {
|
||||||
p.APIVersion = "1.24"
|
pingResponse.APIVersion = "1.24"
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the client is not initialized with a version, start with the latest supported version
|
// if the client is not initialized with a version, start with the latest supported version
|
||||||
|
|
@ -260,8 +288,8 @@ func (cli *Client) negotiateAPIVersionPing(p types.Ping) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if server version is lower than the client version, downgrade
|
// if server version is lower than the client version, downgrade
|
||||||
if versions.LessThan(p.APIVersion, cli.version) {
|
if versions.LessThan(pingResponse.APIVersion, cli.version) {
|
||||||
cli.version = p.APIVersion
|
cli.version = pingResponse.APIVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the results, so that automatic API version negotiation (if enabled)
|
// Store the results, so that automatic API version negotiation (if enabled)
|
||||||
|
|
@ -287,7 +315,7 @@ func (cli *Client) HTTPClient() *http.Client {
|
||||||
func ParseHostURL(host string) (*url.URL, error) {
|
func ParseHostURL(host string) (*url.URL, error) {
|
||||||
protoAddrParts := strings.SplitN(host, "://", 2)
|
protoAddrParts := strings.SplitN(host, "://", 2)
|
||||||
if len(protoAddrParts) == 1 {
|
if len(protoAddrParts) == 1 {
|
||||||
return nil, fmt.Errorf("unable to parse docker host `%s`", host)
|
return nil, errors.Errorf("unable to parse docker host `%s`", host)
|
||||||
}
|
}
|
||||||
|
|
||||||
var basePath string
|
var basePath string
|
||||||
|
|
@ -307,22 +335,9 @@ func ParseHostURL(host string) (*url.URL, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomHTTPHeaders returns the custom http headers stored by the client.
|
// Dialer returns a dialer for a raw stream connection, with an HTTP/1.1 header,
|
||||||
func (cli *Client) CustomHTTPHeaders() map[string]string {
|
// that can be used for proxying the daemon connection.
|
||||||
m := make(map[string]string)
|
//
|
||||||
for k, v := range cli.customHTTPHeaders {
|
|
||||||
m[k] = v
|
|
||||||
}
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCustomHTTPHeaders that will be set on every HTTP request made by the client.
|
|
||||||
// Deprecated: use WithHTTPHeaders when creating the client.
|
|
||||||
func (cli *Client) SetCustomHTTPHeaders(headers map[string]string) {
|
|
||||||
cli.customHTTPHeaders = headers
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dialer returns a dialer for a raw stream connection, with HTTP/1.1 header, that can be used for proxying the daemon connection.
|
|
||||||
// Used by `docker dial-stdio` (docker/cli#889).
|
// Used by `docker dial-stdio` (docker/cli#889).
|
||||||
func (cli *Client) Dialer() func(context.Context) (net.Conn, error) {
|
func (cli *Client) Dialer() func(context.Context) (net.Conn, error) {
|
||||||
return func(ctx context.Context) (net.Conn, error) {
|
return func(ctx context.Context) (net.Conn, error) {
|
||||||
|
|
|
||||||
8
vendor/github.com/docker/docker/client/client_deprecated.go
generated
vendored
8
vendor/github.com/docker/docker/client/client_deprecated.go
generated
vendored
|
|
@ -9,7 +9,11 @@ import "net/http"
|
||||||
// It won't send any version information if the version number is empty. It is
|
// It won't send any version information if the version number is empty. It is
|
||||||
// highly recommended that you set a version or your client may break if the
|
// highly recommended that you set a version or your client may break if the
|
||||||
// server is upgraded.
|
// server is upgraded.
|
||||||
// Deprecated: use NewClientWithOpts
|
//
|
||||||
|
// Deprecated: use [NewClientWithOpts] passing the [WithHost], [WithVersion],
|
||||||
|
// [WithHTTPClient] and [WithHTTPHeaders] options. We recommend enabling API
|
||||||
|
// version negotiation by passing the [WithAPIVersionNegotiation] option instead
|
||||||
|
// of WithVersion.
|
||||||
func NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error) {
|
func NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error) {
|
||||||
return NewClientWithOpts(WithHost(host), WithVersion(version), WithHTTPClient(client), WithHTTPHeaders(httpHeaders))
|
return NewClientWithOpts(WithHost(host), WithVersion(version), WithHTTPClient(client), WithHTTPHeaders(httpHeaders))
|
||||||
}
|
}
|
||||||
|
|
@ -17,7 +21,7 @@ func NewClient(host string, version string, client *http.Client, httpHeaders map
|
||||||
// NewEnvClient initializes a new API client based on environment variables.
|
// NewEnvClient initializes a new API client based on environment variables.
|
||||||
// See FromEnv for a list of support environment variables.
|
// See FromEnv for a list of support environment variables.
|
||||||
//
|
//
|
||||||
// Deprecated: use NewClientWithOpts(FromEnv)
|
// Deprecated: use [NewClientWithOpts] passing the [FromEnv] option.
|
||||||
func NewEnvClient() (*Client, error) {
|
func NewEnvClient() (*Client, error) {
|
||||||
return NewClientWithOpts(FromEnv)
|
return NewClientWithOpts(FromEnv)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
vendor/github.com/docker/docker/client/client_unix.go
generated
vendored
3
vendor/github.com/docker/docker/client/client_unix.go
generated
vendored
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
package client // import "github.com/docker/docker/client"
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
// DefaultDockerHost defines os specific default if DOCKER_HOST is unset
|
// DefaultDockerHost defines OS-specific default host if the DOCKER_HOST
|
||||||
|
// (EnvOverrideHost) environment variable is unset or empty.
|
||||||
const DefaultDockerHost = "unix:///var/run/docker.sock"
|
const DefaultDockerHost = "unix:///var/run/docker.sock"
|
||||||
|
|
||||||
const defaultProto = "unix"
|
const defaultProto = "unix"
|
||||||
|
|
|
||||||
3
vendor/github.com/docker/docker/client/client_windows.go
generated
vendored
3
vendor/github.com/docker/docker/client/client_windows.go
generated
vendored
|
|
@ -1,6 +1,7 @@
|
||||||
package client // import "github.com/docker/docker/client"
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
// DefaultDockerHost defines os specific default if DOCKER_HOST is unset
|
// DefaultDockerHost defines OS-specific default host if the DOCKER_HOST
|
||||||
|
// (EnvOverrideHost) environment variable is unset or empty.
|
||||||
const DefaultDockerHost = "npipe:////./pipe/docker_engine"
|
const DefaultDockerHost = "npipe:////./pipe/docker_engine"
|
||||||
|
|
||||||
const defaultProto = "npipe"
|
const defaultProto = "npipe"
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/config_create.go
generated
vendored
2
vendor/github.com/docker/docker/client/config_create.go
generated
vendored
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigCreate creates a new Config.
|
// ConfigCreate creates a new config.
|
||||||
func (cli *Client) ConfigCreate(ctx context.Context, config swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
|
func (cli *Client) ConfigCreate(ctx context.Context, config swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
|
||||||
var response types.ConfigCreateResponse
|
var response types.ConfigCreateResponse
|
||||||
if err := cli.NewVersionError("1.30", "config create"); err != nil {
|
if err := cli.NewVersionError("1.30", "config create"); err != nil {
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/config_inspect.go
generated
vendored
2
vendor/github.com/docker/docker/client/config_inspect.go
generated
vendored
|
|
@ -20,7 +20,7 @@ func (cli *Client) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.C
|
||||||
resp, err := cli.get(ctx, "/configs/"+id, nil, nil)
|
resp, err := cli.get(ctx, "/configs/"+id, nil, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return swarm.Config{}, nil, wrapResponseError(err, resp, "config", id)
|
return swarm.Config{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
|
|
|
||||||
4
vendor/github.com/docker/docker/client/config_remove.go
generated
vendored
4
vendor/github.com/docker/docker/client/config_remove.go
generated
vendored
|
|
@ -2,12 +2,12 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import "context"
|
import "context"
|
||||||
|
|
||||||
// ConfigRemove removes a Config.
|
// ConfigRemove removes a config.
|
||||||
func (cli *Client) ConfigRemove(ctx context.Context, id string) error {
|
func (cli *Client) ConfigRemove(ctx context.Context, id string) error {
|
||||||
if err := cli.NewVersionError("1.30", "config remove"); err != nil {
|
if err := cli.NewVersionError("1.30", "config remove"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
resp, err := cli.delete(ctx, "/configs/"+id, nil, nil)
|
resp, err := cli.delete(ctx, "/configs/"+id, nil, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
return wrapResponseError(err, resp, "config", id)
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
vendor/github.com/docker/docker/client/config_update.go
generated
vendored
5
vendor/github.com/docker/docker/client/config_update.go
generated
vendored
|
|
@ -3,18 +3,17 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigUpdate attempts to update a Config
|
// ConfigUpdate attempts to update a config
|
||||||
func (cli *Client) ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error {
|
func (cli *Client) ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error {
|
||||||
if err := cli.NewVersionError("1.30", "config update"); err != nil {
|
if err := cli.NewVersionError("1.30", "config update"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("version", strconv.FormatUint(version.Index, 10))
|
query.Set("version", version.String())
|
||||||
resp, err := cli.post(ctx, "/configs/"+id+"/update", query, config, nil)
|
resp, err := cli.post(ctx, "/configs/"+id+"/update", query, config, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
4
vendor/github.com/docker/docker/client/container_attach.go
generated
vendored
4
vendor/github.com/docker/docker/client/container_attach.go
generated
vendored
|
|
@ -52,6 +52,8 @@ func (cli *Client) ContainerAttach(ctx context.Context, container string, option
|
||||||
query.Set("logs", "1")
|
query.Set("logs", "1")
|
||||||
}
|
}
|
||||||
|
|
||||||
headers := map[string][]string{"Content-Type": {"text/plain"}}
|
headers := map[string][]string{
|
||||||
|
"Content-Type": {"text/plain"},
|
||||||
|
}
|
||||||
return cli.postHijacked(ctx, "/containers/"+container+"/attach", query, nil, headers)
|
return cli.postHijacked(ctx, "/containers/"+container+"/attach", query, nil, headers)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/container_commit.go
generated
vendored
2
vendor/github.com/docker/docker/client/container_commit.go
generated
vendored
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerCommit applies changes into a container and creates a new tagged image.
|
// ContainerCommit applies changes to a container and creates a new tagged image.
|
||||||
func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) {
|
func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) {
|
||||||
var repository, tag string
|
var repository, tag string
|
||||||
if options.Reference != "" {
|
if options.Reference != "" {
|
||||||
|
|
|
||||||
18
vendor/github.com/docker/docker/client/container_copy.go
generated
vendored
18
vendor/github.com/docker/docker/client/container_copy.go
generated
vendored
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerStatPath returns Stat information about a path inside the container filesystem.
|
// ContainerStatPath returns stat information about a path inside the container filesystem.
|
||||||
func (cli *Client) ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error) {
|
func (cli *Client) ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("path", filepath.ToSlash(path)) // Normalize the paths used in the API.
|
query.Set("path", filepath.ToSlash(path)) // Normalize the paths used in the API.
|
||||||
|
|
@ -23,7 +23,7 @@ func (cli *Client) ContainerStatPath(ctx context.Context, containerID, path stri
|
||||||
response, err := cli.head(ctx, urlStr, query, nil)
|
response, err := cli.head(ctx, urlStr, query, nil)
|
||||||
defer ensureReaderClosed(response)
|
defer ensureReaderClosed(response)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.ContainerPathStat{}, wrapResponseError(err, response, "container:path", containerID+":"+path)
|
return types.ContainerPathStat{}, err
|
||||||
}
|
}
|
||||||
return getContainerPathStatFromHeader(response.header)
|
return getContainerPathStatFromHeader(response.header)
|
||||||
}
|
}
|
||||||
|
|
@ -47,12 +47,7 @@ func (cli *Client) CopyToContainer(ctx context.Context, containerID, dstPath str
|
||||||
response, err := cli.putRaw(ctx, apiPath, query, content, nil)
|
response, err := cli.putRaw(ctx, apiPath, query, content, nil)
|
||||||
defer ensureReaderClosed(response)
|
defer ensureReaderClosed(response)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return wrapResponseError(err, response, "container:path", containerID+":"+dstPath)
|
return err
|
||||||
}
|
|
||||||
|
|
||||||
// TODO this code converts non-error status-codes (e.g., "204 No Content") into an error; verify if this is the desired behavior
|
|
||||||
if response.statusCode != http.StatusOK {
|
|
||||||
return fmt.Errorf("unexpected status code from daemon: %d", response.statusCode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -67,12 +62,7 @@ func (cli *Client) CopyFromContainer(ctx context.Context, containerID, srcPath s
|
||||||
apiPath := "/containers/" + containerID + "/archive"
|
apiPath := "/containers/" + containerID + "/archive"
|
||||||
response, err := cli.get(ctx, apiPath, query, nil)
|
response, err := cli.get(ctx, apiPath, query, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, types.ContainerPathStat{}, wrapResponseError(err, response, "container:path", containerID+":"+srcPath)
|
return nil, types.ContainerPathStat{}, err
|
||||||
}
|
|
||||||
|
|
||||||
// TODO this code converts non-error status-codes (e.g., "204 No Content") into an error; verify if this is the desired behavior
|
|
||||||
if response.statusCode != http.StatusOK {
|
|
||||||
return nil, types.ContainerPathStat{}, fmt.Errorf("unexpected status code from daemon: %d", response.statusCode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// In order to get the copy behavior right, we need to know information
|
// In order to get the copy behavior right, we need to know information
|
||||||
|
|
|
||||||
27
vendor/github.com/docker/docker/client/container_create.go
generated
vendored
27
vendor/github.com/docker/docker/client/container_create.go
generated
vendored
|
|
@ -18,24 +18,33 @@ type configWrapper struct {
|
||||||
NetworkingConfig *network.NetworkingConfig
|
NetworkingConfig *network.NetworkingConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerCreate creates a new container based in the given configuration.
|
// ContainerCreate creates a new container based on the given configuration.
|
||||||
// It can be associated with a name, but it's not mandatory.
|
// It can be associated with a name, but it's not mandatory.
|
||||||
func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.ContainerCreateCreatedBody, error) {
|
func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.CreateResponse, error) {
|
||||||
var response container.ContainerCreateCreatedBody
|
var response container.CreateResponse
|
||||||
|
|
||||||
if err := cli.NewVersionError("1.25", "stop timeout"); config != nil && config.StopTimeout != nil && err != nil {
|
if err := cli.NewVersionError("1.25", "stop timeout"); config != nil && config.StopTimeout != nil && err != nil {
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// When using API 1.24 and under, the client is responsible for removing the container
|
|
||||||
if hostConfig != nil && versions.LessThan(cli.ClientVersion(), "1.25") {
|
|
||||||
hostConfig.AutoRemove = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := cli.NewVersionError("1.41", "specify container image platform"); platform != nil && err != nil {
|
if err := cli.NewVersionError("1.41", "specify container image platform"); platform != nil && err != nil {
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hostConfig != nil {
|
||||||
|
if versions.LessThan(cli.ClientVersion(), "1.25") {
|
||||||
|
// When using API 1.24 and under, the client is responsible for removing the container
|
||||||
|
hostConfig.AutoRemove = false
|
||||||
|
}
|
||||||
|
if versions.GreaterThanOrEqualTo(cli.ClientVersion(), "1.42") || versions.LessThan(cli.ClientVersion(), "1.40") {
|
||||||
|
// KernelMemory was added in API 1.40, and deprecated in API 1.42
|
||||||
|
hostConfig.KernelMemory = 0
|
||||||
|
}
|
||||||
|
if platform != nil && platform.OS == "linux" && versions.LessThan(cli.ClientVersion(), "1.42") {
|
||||||
|
// When using API under 1.42, the Linux daemon doesn't respect the ConsoleSize
|
||||||
|
hostConfig.ConsoleSize = [2]uint{0, 0}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if p := formatPlatform(platform); p != "" {
|
if p := formatPlatform(platform); p != "" {
|
||||||
query.Set("platform", p)
|
query.Set("platform", p)
|
||||||
|
|
|
||||||
14
vendor/github.com/docker/docker/client/container_exec.go
generated
vendored
14
vendor/github.com/docker/docker/client/container_exec.go
generated
vendored
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/versions"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerExecCreate creates a new exec configuration to run an exec process.
|
// ContainerExecCreate creates a new exec configuration to run an exec process.
|
||||||
|
|
@ -14,6 +15,9 @@ func (cli *Client) ContainerExecCreate(ctx context.Context, container string, co
|
||||||
if err := cli.NewVersionError("1.25", "env"); len(config.Env) != 0 && err != nil {
|
if err := cli.NewVersionError("1.25", "env"); len(config.Env) != 0 && err != nil {
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
if versions.LessThan(cli.ClientVersion(), "1.42") {
|
||||||
|
config.ConsoleSize = nil
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := cli.post(ctx, "/containers/"+container+"/exec", nil, config, nil)
|
resp, err := cli.post(ctx, "/containers/"+container+"/exec", nil, config, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
|
|
@ -26,6 +30,9 @@ func (cli *Client) ContainerExecCreate(ctx context.Context, container string, co
|
||||||
|
|
||||||
// ContainerExecStart starts an exec process already created in the docker host.
|
// ContainerExecStart starts an exec process already created in the docker host.
|
||||||
func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error {
|
func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error {
|
||||||
|
if versions.LessThan(cli.ClientVersion(), "1.42") {
|
||||||
|
config.ConsoleSize = nil
|
||||||
|
}
|
||||||
resp, err := cli.post(ctx, "/exec/"+execID+"/start", nil, config, nil)
|
resp, err := cli.post(ctx, "/exec/"+execID+"/start", nil, config, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
return err
|
return err
|
||||||
|
|
@ -36,7 +43,12 @@ func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config
|
||||||
// and the a reader to get output. It's up to the called to close
|
// and the a reader to get output. It's up to the called to close
|
||||||
// the hijacked connection by calling types.HijackedResponse.Close.
|
// the hijacked connection by calling types.HijackedResponse.Close.
|
||||||
func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) {
|
func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) {
|
||||||
headers := map[string][]string{"Content-Type": {"application/json"}}
|
if versions.LessThan(cli.ClientVersion(), "1.42") {
|
||||||
|
config.ConsoleSize = nil
|
||||||
|
}
|
||||||
|
headers := map[string][]string{
|
||||||
|
"Content-Type": {"application/json"},
|
||||||
|
}
|
||||||
return cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, config, headers)
|
return cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, config, headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
vendor/github.com/docker/docker/client/container_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/container_inspect.go
generated
vendored
|
|
@ -18,7 +18,7 @@ func (cli *Client) ContainerInspect(ctx context.Context, containerID string) (ty
|
||||||
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", nil, nil)
|
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", nil, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.ContainerJSON{}, wrapResponseError(err, serverResp, "container", containerID)
|
return types.ContainerJSON{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var response types.ContainerJSON
|
var response types.ContainerJSON
|
||||||
|
|
@ -38,7 +38,7 @@ func (cli *Client) ContainerInspectWithRaw(ctx context.Context, containerID stri
|
||||||
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", query, nil)
|
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", query, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.ContainerJSON{}, nil, wrapResponseError(err, serverResp, "container", containerID)
|
return types.ContainerJSON{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(serverResp.body)
|
body, err := io.ReadAll(serverResp.body)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/container_kill.go
generated
vendored
2
vendor/github.com/docker/docker/client/container_kill.go
generated
vendored
|
|
@ -8,7 +8,9 @@ import (
|
||||||
// ContainerKill terminates the container process but does not remove the container from the docker host.
|
// ContainerKill terminates the container process but does not remove the container from the docker host.
|
||||||
func (cli *Client) ContainerKill(ctx context.Context, containerID, signal string) error {
|
func (cli *Client) ContainerKill(ctx context.Context, containerID, signal string) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
if signal != "" {
|
||||||
query.Set("signal", signal)
|
query.Set("signal", signal)
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/kill", query, nil, nil)
|
resp, err := cli.post(ctx, "/containers/"+containerID+"/kill", query, nil, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/container_list.go
generated
vendored
2
vendor/github.com/docker/docker/client/container_list.go
generated
vendored
|
|
@ -18,7 +18,7 @@ func (cli *Client) ContainerList(ctx context.Context, options types.ContainerLis
|
||||||
query.Set("all", "1")
|
query.Set("all", "1")
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Limit != -1 {
|
if options.Limit > 0 {
|
||||||
query.Set("limit", strconv.Itoa(options.Limit))
|
query.Set("limit", strconv.Itoa(options.Limit))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/container_logs.go
generated
vendored
2
vendor/github.com/docker/docker/client/container_logs.go
generated
vendored
|
|
@ -74,7 +74,7 @@ func (cli *Client) ContainerLogs(ctx context.Context, container string, options
|
||||||
|
|
||||||
resp, err := cli.get(ctx, "/containers/"+container+"/logs", query, nil)
|
resp, err := cli.get(ctx, "/containers/"+container+"/logs", query, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, wrapResponseError(err, resp, "container", container)
|
return nil, err
|
||||||
}
|
}
|
||||||
return resp.body, nil
|
return resp.body, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/container_remove.go
generated
vendored
2
vendor/github.com/docker/docker/client/container_remove.go
generated
vendored
|
|
@ -23,5 +23,5 @@ func (cli *Client) ContainerRemove(ctx context.Context, containerID string, opti
|
||||||
|
|
||||||
resp, err := cli.delete(ctx, "/containers/"+containerID, query, nil)
|
resp, err := cli.delete(ctx, "/containers/"+containerID, query, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
return wrapResponseError(err, resp, "container", containerID)
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
vendor/github.com/docker/docker/client/container_restart.go
generated
vendored
16
vendor/github.com/docker/docker/client/container_restart.go
generated
vendored
|
|
@ -3,18 +3,22 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"strconv"
|
||||||
|
|
||||||
timetypes "github.com/docker/docker/api/types/time"
|
"github.com/docker/docker/api/types/container"
|
||||||
|
"github.com/docker/docker/api/types/versions"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerRestart stops and starts a container again.
|
// ContainerRestart stops and starts a container again.
|
||||||
// It makes the daemon to wait for the container to be up again for
|
// It makes the daemon wait for the container to be up again for
|
||||||
// a specific amount of time, given the timeout.
|
// a specific amount of time, given the timeout.
|
||||||
func (cli *Client) ContainerRestart(ctx context.Context, containerID string, timeout *time.Duration) error {
|
func (cli *Client) ContainerRestart(ctx context.Context, containerID string, options container.StopOptions) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if timeout != nil {
|
if options.Timeout != nil {
|
||||||
query.Set("t", timetypes.DurationToSecondsString(*timeout))
|
query.Set("t", strconv.Itoa(*options.Timeout))
|
||||||
|
}
|
||||||
|
if options.Signal != "" && versions.GreaterThanOrEqualTo(cli.version, "1.42") {
|
||||||
|
query.Set("signal", options.Signal)
|
||||||
}
|
}
|
||||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/restart", query, nil, nil)
|
resp, err := cli.post(ctx, "/containers/"+containerID+"/restart", query, nil, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
|
|
|
||||||
14
vendor/github.com/docker/docker/client/container_stop.go
generated
vendored
14
vendor/github.com/docker/docker/client/container_stop.go
generated
vendored
|
|
@ -3,9 +3,10 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"strconv"
|
||||||
|
|
||||||
timetypes "github.com/docker/docker/api/types/time"
|
"github.com/docker/docker/api/types/container"
|
||||||
|
"github.com/docker/docker/api/types/versions"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerStop stops a container. In case the container fails to stop
|
// ContainerStop stops a container. In case the container fails to stop
|
||||||
|
|
@ -15,10 +16,13 @@ import (
|
||||||
// If the timeout is nil, the container's StopTimeout value is used, if set,
|
// If the timeout is nil, the container's StopTimeout value is used, if set,
|
||||||
// otherwise the engine default. A negative timeout value can be specified,
|
// otherwise the engine default. A negative timeout value can be specified,
|
||||||
// meaning no timeout, i.e. no forceful termination is performed.
|
// meaning no timeout, i.e. no forceful termination is performed.
|
||||||
func (cli *Client) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error {
|
func (cli *Client) ContainerStop(ctx context.Context, containerID string, options container.StopOptions) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if timeout != nil {
|
if options.Timeout != nil {
|
||||||
query.Set("t", timetypes.DurationToSecondsString(*timeout))
|
query.Set("t", strconv.Itoa(*options.Timeout))
|
||||||
|
}
|
||||||
|
if options.Signal != "" && versions.GreaterThanOrEqualTo(cli.version, "1.42") {
|
||||||
|
query.Set("signal", options.Signal)
|
||||||
}
|
}
|
||||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/stop", query, nil, nil)
|
resp, err := cli.post(ctx, "/containers/"+containerID+"/stop", query, nil, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/container_update.go
generated
vendored
2
vendor/github.com/docker/docker/client/container_update.go
generated
vendored
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerUpdate updates resources of a container
|
// ContainerUpdate updates the resources of a container.
|
||||||
func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error) {
|
func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error) {
|
||||||
var response container.ContainerUpdateOKBody
|
var response container.ContainerUpdateOKBody
|
||||||
serverResp, err := cli.post(ctx, "/containers/"+containerID+"/update", nil, updateConfig, nil)
|
serverResp, err := cli.post(ctx, "/containers/"+containerID+"/update", nil, updateConfig, nil)
|
||||||
|
|
|
||||||
39
vendor/github.com/docker/docker/client/container_wait.go
generated
vendored
39
vendor/github.com/docker/docker/client/container_wait.go
generated
vendored
|
|
@ -1,14 +1,19 @@
|
||||||
package client // import "github.com/docker/docker/client"
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const containerWaitErrorMsgLimit = 2 * 1024 /* Max: 2KiB */
|
||||||
|
|
||||||
// ContainerWait waits until the specified container is in a certain state
|
// ContainerWait waits until the specified container is in a certain state
|
||||||
// indicated by the given condition, either "not-running" (default),
|
// indicated by the given condition, either "not-running" (default),
|
||||||
// "next-exit", or "removed".
|
// "next-exit", or "removed".
|
||||||
|
|
@ -24,16 +29,18 @@ import (
|
||||||
// wait request or in getting the response. This allows the caller to
|
// wait request or in getting the response. This allows the caller to
|
||||||
// synchronize ContainerWait with other calls, such as specifying a
|
// synchronize ContainerWait with other calls, such as specifying a
|
||||||
// "next-exit" condition before issuing a ContainerStart request.
|
// "next-exit" condition before issuing a ContainerStart request.
|
||||||
func (cli *Client) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error) {
|
func (cli *Client) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error) {
|
||||||
if versions.LessThan(cli.ClientVersion(), "1.30") {
|
if versions.LessThan(cli.ClientVersion(), "1.30") {
|
||||||
return cli.legacyContainerWait(ctx, containerID)
|
return cli.legacyContainerWait(ctx, containerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
resultC := make(chan container.ContainerWaitOKBody)
|
resultC := make(chan container.WaitResponse)
|
||||||
errC := make(chan error, 1)
|
errC := make(chan error, 1)
|
||||||
|
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
if condition != "" {
|
||||||
query.Set("condition", string(condition))
|
query.Set("condition", string(condition))
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/wait", query, nil, nil)
|
resp, err := cli.post(ctx, "/containers/"+containerID+"/wait", query, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -44,9 +51,27 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
var res container.ContainerWaitOKBody
|
|
||||||
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
|
body := resp.body
|
||||||
|
responseText := bytes.NewBuffer(nil)
|
||||||
|
stream := io.TeeReader(body, responseText)
|
||||||
|
|
||||||
|
var res container.WaitResponse
|
||||||
|
if err := json.NewDecoder(stream).Decode(&res); err != nil {
|
||||||
|
// NOTE(nicks): The /wait API does not work well with HTTP proxies.
|
||||||
|
// At any time, the proxy could cut off the response stream.
|
||||||
|
//
|
||||||
|
// But because the HTTP status has already been written, the proxy's
|
||||||
|
// only option is to write a plaintext error message.
|
||||||
|
//
|
||||||
|
// If there's a JSON parsing error, read the real error message
|
||||||
|
// off the body and send it to the client.
|
||||||
|
if errors.As(err, new(*json.SyntaxError)) {
|
||||||
|
_, _ = io.ReadAll(io.LimitReader(stream, containerWaitErrorMsgLimit))
|
||||||
|
errC <- errors.New(responseText.String())
|
||||||
|
} else {
|
||||||
errC <- err
|
errC <- err
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,8 +83,8 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit
|
||||||
|
|
||||||
// legacyContainerWait returns immediately and doesn't have an option to wait
|
// legacyContainerWait returns immediately and doesn't have an option to wait
|
||||||
// until the container is removed.
|
// until the container is removed.
|
||||||
func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) (<-chan container.ContainerWaitOKBody, <-chan error) {
|
func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) (<-chan container.WaitResponse, <-chan error) {
|
||||||
resultC := make(chan container.ContainerWaitOKBody)
|
resultC := make(chan container.WaitResponse)
|
||||||
errC := make(chan error)
|
errC := make(chan error)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
|
@ -70,7 +95,7 @@ func (cli *Client) legacyContainerWait(ctx context.Context, containerID string)
|
||||||
}
|
}
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
|
|
||||||
var res container.ContainerWaitOKBody
|
var res container.WaitResponse
|
||||||
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
|
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
|
||||||
errC <- err
|
errC <- err
|
||||||
return
|
return
|
||||||
|
|
|
||||||
19
vendor/github.com/docker/docker/client/disk_usage.go
generated
vendored
19
vendor/github.com/docker/docker/client/disk_usage.go
generated
vendored
|
|
@ -4,23 +4,30 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DiskUsage requests the current data usage from the daemon
|
// DiskUsage requests the current data usage from the daemon
|
||||||
func (cli *Client) DiskUsage(ctx context.Context) (types.DiskUsage, error) {
|
func (cli *Client) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error) {
|
||||||
var du types.DiskUsage
|
var query url.Values
|
||||||
|
if len(options.Types) > 0 {
|
||||||
|
query = url.Values{}
|
||||||
|
for _, t := range options.Types {
|
||||||
|
query.Add("type", string(t))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
serverResp, err := cli.get(ctx, "/system/df", nil, nil)
|
serverResp, err := cli.get(ctx, "/system/df", query, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return du, err
|
return types.DiskUsage{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var du types.DiskUsage
|
||||||
if err := json.NewDecoder(serverResp.body).Decode(&du); err != nil {
|
if err := json.NewDecoder(serverResp.body).Decode(&du); err != nil {
|
||||||
return du, fmt.Errorf("Error retrieving disk usage: %v", err)
|
return types.DiskUsage{}, fmt.Errorf("Error retrieving disk usage: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return du, nil
|
return du, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/distribution_inspect.go
generated
vendored
2
vendor/github.com/docker/docker/client/distribution_inspect.go
generated
vendored
|
|
@ -8,7 +8,7 @@ import (
|
||||||
registrytypes "github.com/docker/docker/api/types/registry"
|
registrytypes "github.com/docker/docker/api/types/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DistributionInspect returns the image digest with full Manifest
|
// DistributionInspect returns the image digest with the full manifest.
|
||||||
func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegistryAuth string) (registrytypes.DistributionInspect, error) {
|
func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegistryAuth string) (registrytypes.DistributionInspect, error) {
|
||||||
// Contact the registry to retrieve digest and platform information
|
// Contact the registry to retrieve digest and platform information
|
||||||
var distributionInspect registrytypes.DistributionInspect
|
var distributionInspect registrytypes.DistributionInspect
|
||||||
|
|
|
||||||
90
vendor/github.com/docker/docker/client/envvars.go
generated
vendored
Normal file
90
vendor/github.com/docker/docker/client/envvars.go
generated
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
const (
|
||||||
|
// EnvOverrideHost is the name of the environment variable that can be used
|
||||||
|
// to override the default host to connect to (DefaultDockerHost).
|
||||||
|
//
|
||||||
|
// This env-var is read by FromEnv and WithHostFromEnv and when set to a
|
||||||
|
// non-empty value, takes precedence over the default host (which is platform
|
||||||
|
// specific), or any host already set.
|
||||||
|
EnvOverrideHost = "DOCKER_HOST"
|
||||||
|
|
||||||
|
// EnvOverrideAPIVersion is the name of the environment variable that can
|
||||||
|
// be used to override the API version to use. Value should be
|
||||||
|
// formatted as MAJOR.MINOR, for example, "1.19".
|
||||||
|
//
|
||||||
|
// This env-var is read by FromEnv and WithVersionFromEnv and when set to a
|
||||||
|
// non-empty value, takes precedence over API version negotiation.
|
||||||
|
//
|
||||||
|
// This environment variable should be used for debugging purposes only, as
|
||||||
|
// it can set the client to use an incompatible (or invalid) API version.
|
||||||
|
EnvOverrideAPIVersion = "DOCKER_API_VERSION"
|
||||||
|
|
||||||
|
// EnvOverrideCertPath is the name of the environment variable that can be
|
||||||
|
// used to specify the directory from which to load the TLS certificates
|
||||||
|
// (ca.pem, cert.pem, key.pem) from. These certificates are used to configure
|
||||||
|
// the Client for a TCP connection protected by TLS client authentication.
|
||||||
|
//
|
||||||
|
// TLS certificate verification is enabled by default if the Client is configured
|
||||||
|
// to use a TLS connection. Refer to EnvTLSVerify below to learn how to
|
||||||
|
// disable verification for testing purposes.
|
||||||
|
//
|
||||||
|
// WARNING: Access to the remote API is equivalent to root access to the
|
||||||
|
// host where the daemon runs. Do not expose the API without protection,
|
||||||
|
// and only if needed. Make sure you are familiar with the "daemon attack
|
||||||
|
// surface" (https://docs.docker.com/go/attack-surface/).
|
||||||
|
//
|
||||||
|
// For local access to the API, it is recommended to connect with the daemon
|
||||||
|
// using the default local socket connection (on Linux), or the named pipe
|
||||||
|
// (on Windows).
|
||||||
|
//
|
||||||
|
// If you need to access the API of a remote daemon, consider using an SSH
|
||||||
|
// (ssh://) connection, which is easier to set up, and requires no additional
|
||||||
|
// configuration if the host is accessible using ssh.
|
||||||
|
//
|
||||||
|
// If you cannot use the alternatives above, and you must expose the API over
|
||||||
|
// a TCP connection, refer to https://docs.docker.com/engine/security/protect-access/
|
||||||
|
// to learn how to configure the daemon and client to use a TCP connection
|
||||||
|
// with TLS client authentication. Make sure you know the differences between
|
||||||
|
// a regular TLS connection and a TLS connection protected by TLS client
|
||||||
|
// authentication, and verify that the API cannot be accessed by other clients.
|
||||||
|
EnvOverrideCertPath = "DOCKER_CERT_PATH"
|
||||||
|
|
||||||
|
// EnvTLSVerify is the name of the environment variable that can be used to
|
||||||
|
// enable or disable TLS certificate verification. When set to a non-empty
|
||||||
|
// value, TLS certificate verification is enabled, and the client is configured
|
||||||
|
// to use a TLS connection, using certificates from the default directories
|
||||||
|
// (within `~/.docker`); refer to EnvOverrideCertPath above for additional
|
||||||
|
// details.
|
||||||
|
//
|
||||||
|
// WARNING: Access to the remote API is equivalent to root access to the
|
||||||
|
// host where the daemon runs. Do not expose the API without protection,
|
||||||
|
// and only if needed. Make sure you are familiar with the "daemon attack
|
||||||
|
// surface" (https://docs.docker.com/go/attack-surface/).
|
||||||
|
//
|
||||||
|
// Before setting up your client and daemon to use a TCP connection with TLS
|
||||||
|
// client authentication, consider using one of the alternatives mentioned
|
||||||
|
// in EnvOverrideCertPath above.
|
||||||
|
//
|
||||||
|
// Disabling TLS certificate verification (for testing purposes)
|
||||||
|
//
|
||||||
|
// TLS certificate verification is enabled by default if the Client is configured
|
||||||
|
// to use a TLS connection, and it is highly recommended to keep verification
|
||||||
|
// enabled to prevent machine-in-the-middle attacks. Refer to the documentation
|
||||||
|
// at https://docs.docker.com/engine/security/protect-access/ and pages linked
|
||||||
|
// from that page to learn how to configure the daemon and client to use a
|
||||||
|
// TCP connection with TLS client authentication enabled.
|
||||||
|
//
|
||||||
|
// Set the "DOCKER_TLS_VERIFY" environment to an empty string ("") to
|
||||||
|
// disable TLS certificate verification. Disabling verification is insecure,
|
||||||
|
// so should only be done for testing purposes. From the Go documentation
|
||||||
|
// (https://pkg.go.dev/crypto/tls#Config):
|
||||||
|
//
|
||||||
|
// InsecureSkipVerify controls whether a client verifies the server's
|
||||||
|
// certificate chain and host name. If InsecureSkipVerify is true, crypto/tls
|
||||||
|
// accepts any certificate presented by the server and any host name in that
|
||||||
|
// certificate. In this mode, TLS is susceptible to machine-in-the-middle
|
||||||
|
// attacks unless custom verification is used. This should be used only for
|
||||||
|
// testing or in combination with VerifyConnection or VerifyPeerCertificate.
|
||||||
|
EnvTLSVerify = "DOCKER_TLS_VERIFY"
|
||||||
|
)
|
||||||
59
vendor/github.com/docker/docker/client/errors.go
generated
vendored
59
vendor/github.com/docker/docker/client/errors.go
generated
vendored
|
|
@ -2,7 +2,6 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
|
|
@ -41,11 +40,11 @@ type notFound interface {
|
||||||
// IsErrNotFound returns true if the error is a NotFound error, which is returned
|
// IsErrNotFound returns true if the error is a NotFound error, which is returned
|
||||||
// by the API when some object is not found.
|
// by the API when some object is not found.
|
||||||
func IsErrNotFound(err error) bool {
|
func IsErrNotFound(err error) bool {
|
||||||
var e notFound
|
if errdefs.IsNotFound(err) {
|
||||||
if errors.As(err, &e) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return errdefs.IsNotFound(err)
|
var e notFound
|
||||||
|
return errors.As(err, &e)
|
||||||
}
|
}
|
||||||
|
|
||||||
type objectNotFoundError struct {
|
type objectNotFoundError struct {
|
||||||
|
|
@ -59,35 +58,11 @@ func (e objectNotFoundError) Error() string {
|
||||||
return fmt.Sprintf("Error: No such %s: %s", e.object, e.id)
|
return fmt.Sprintf("Error: No such %s: %s", e.object, e.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func wrapResponseError(err error, resp serverResponse, object, id string) error {
|
|
||||||
switch {
|
|
||||||
case err == nil:
|
|
||||||
return nil
|
|
||||||
case resp.statusCode == http.StatusNotFound:
|
|
||||||
return objectNotFoundError{object: object, id: id}
|
|
||||||
case resp.statusCode == http.StatusNotImplemented:
|
|
||||||
return errdefs.NotImplemented(err)
|
|
||||||
default:
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// unauthorizedError represents an authorization error in a remote registry.
|
|
||||||
type unauthorizedError struct {
|
|
||||||
cause error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error returns a string representation of an unauthorizedError
|
|
||||||
func (u unauthorizedError) Error() string {
|
|
||||||
return u.cause.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsErrUnauthorized returns true if the error is caused
|
// IsErrUnauthorized returns true if the error is caused
|
||||||
// when a remote registry authentication fails
|
// when a remote registry authentication fails
|
||||||
|
//
|
||||||
|
// Deprecated: use errdefs.IsUnauthorized
|
||||||
func IsErrUnauthorized(err error) bool {
|
func IsErrUnauthorized(err error) bool {
|
||||||
if _, ok := err.(unauthorizedError); ok {
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
return errdefs.IsUnauthorized(err)
|
return errdefs.IsUnauthorized(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,32 +74,12 @@ func (e pluginPermissionDenied) Error() string {
|
||||||
return "Permission denied while installing plugin " + e.name
|
return "Permission denied while installing plugin " + e.name
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrPluginPermissionDenied returns true if the error is caused
|
|
||||||
// when a user denies a plugin's permissions
|
|
||||||
func IsErrPluginPermissionDenied(err error) bool {
|
|
||||||
_, ok := err.(pluginPermissionDenied)
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
|
|
||||||
type notImplementedError struct {
|
|
||||||
message string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e notImplementedError) Error() string {
|
|
||||||
return e.message
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e notImplementedError) NotImplemented() bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsErrNotImplemented returns true if the error is a NotImplemented error.
|
// IsErrNotImplemented returns true if the error is a NotImplemented error.
|
||||||
// This is returned by the API when a requested feature has not been
|
// This is returned by the API when a requested feature has not been
|
||||||
// implemented.
|
// implemented.
|
||||||
|
//
|
||||||
|
// Deprecated: use errdefs.IsNotImplemented
|
||||||
func IsErrNotImplemented(err error) bool {
|
func IsErrNotImplemented(err error) bool {
|
||||||
if _, ok := err.(notImplementedError); ok {
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
return errdefs.IsNotImplemented(err)
|
return errdefs.IsNotImplemented(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
vendor/github.com/docker/docker/client/events.go
generated
vendored
1
vendor/github.com/docker/docker/client/events.go
generated
vendored
|
|
@ -17,7 +17,6 @@ import (
|
||||||
// be sent over the error channel. If an error is sent all processing will be stopped. It's up
|
// be sent over the error channel. If an error is sent all processing will be stopped. It's up
|
||||||
// to the caller to reopen the stream in the event of an error by reinvoking this method.
|
// to the caller to reopen the stream in the event of an error by reinvoking this method.
|
||||||
func (cli *Client) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error) {
|
func (cli *Client) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error) {
|
||||||
|
|
||||||
messages := make(chan events.Message)
|
messages := make(chan events.Message)
|
||||||
errs := make(chan error, 1)
|
errs := make(chan error, 1)
|
||||||
|
|
||||||
|
|
|
||||||
26
vendor/github.com/docker/docker/client/hijack.go
generated
vendored
26
vendor/github.com/docker/docker/client/hijack.go
generated
vendored
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/docker/go-connections/sockets"
|
"github.com/docker/go-connections/sockets"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
@ -30,12 +31,12 @@ func (cli *Client) postHijacked(ctx context.Context, path string, query url.Valu
|
||||||
}
|
}
|
||||||
req = cli.addHeaders(req, headers)
|
req = cli.addHeaders(req, headers)
|
||||||
|
|
||||||
conn, err := cli.setupHijackConn(ctx, req, "tcp")
|
conn, mediaType, err := cli.setupHijackConn(ctx, req, "tcp")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.HijackedResponse{}, err
|
return types.HijackedResponse{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.HijackedResponse{Conn: conn, Reader: bufio.NewReader(conn)}, err
|
return types.NewHijackedResponse(conn, mediaType), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// DialHijack returns a hijacked connection with negotiated protocol proto.
|
// DialHijack returns a hijacked connection with negotiated protocol proto.
|
||||||
|
|
@ -46,7 +47,8 @@ func (cli *Client) DialHijack(ctx context.Context, url, proto string, meta map[s
|
||||||
}
|
}
|
||||||
req = cli.addHeaders(req, meta)
|
req = cli.addHeaders(req, meta)
|
||||||
|
|
||||||
return cli.setupHijackConn(ctx, req, proto)
|
conn, _, err := cli.setupHijackConn(ctx, req, proto)
|
||||||
|
return conn, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallbackDial is used when WithDialer() was not called.
|
// fallbackDial is used when WithDialer() was not called.
|
||||||
|
|
@ -61,7 +63,7 @@ func fallbackDial(proto, addr string, tlsConfig *tls.Config) (net.Conn, error) {
|
||||||
return net.Dial(proto, addr)
|
return net.Dial(proto, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto string) (net.Conn, error) {
|
func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto string) (net.Conn, string, error) {
|
||||||
req.URL.Host = cli.addr
|
req.URL.Host = cli.addr
|
||||||
if cli.proto == "unix" || cli.proto == "npipe" {
|
if cli.proto == "unix" || cli.proto == "npipe" {
|
||||||
// Override host header for non-tcp connections.
|
// Override host header for non-tcp connections.
|
||||||
|
|
@ -73,7 +75,7 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto
|
||||||
dialer := cli.Dialer()
|
dialer := cli.Dialer()
|
||||||
conn, err := dialer(ctx)
|
conn, err := dialer(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "cannot connect to the Docker daemon. Is 'docker daemon' running on this host?")
|
return nil, "", errors.Wrap(err, "cannot connect to the Docker daemon. Is 'docker daemon' running on this host?")
|
||||||
}
|
}
|
||||||
|
|
||||||
// When we set up a TCP connection for hijack, there could be long periods
|
// When we set up a TCP connection for hijack, there could be long periods
|
||||||
|
|
@ -95,18 +97,18 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto
|
||||||
//nolint:staticcheck // ignore SA1019 for connecting to old (pre go1.8) daemons
|
//nolint:staticcheck // ignore SA1019 for connecting to old (pre go1.8) daemons
|
||||||
if err != httputil.ErrPersistEOF {
|
if err != httputil.ErrPersistEOF {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
if resp.StatusCode != http.StatusSwitchingProtocols {
|
if resp.StatusCode != http.StatusSwitchingProtocols {
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
return nil, fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode)
|
return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c, br := clientconn.Hijack()
|
c, br := clientconn.Hijack()
|
||||||
if br.Buffered() > 0 {
|
if br.Buffered() > 0 {
|
||||||
// If there is buffered content, wrap the connection. We return an
|
// If there is buffered content, wrap the connection. We return an
|
||||||
// object that implements CloseWrite iff the underlying connection
|
// object that implements CloseWrite if the underlying connection
|
||||||
// implements it.
|
// implements it.
|
||||||
if _, ok := c.(types.CloseWriter); ok {
|
if _, ok := c.(types.CloseWriter); ok {
|
||||||
c = &hijackedConnCloseWriter{&hijackedConn{c, br}}
|
c = &hijackedConnCloseWriter{&hijackedConn{c, br}}
|
||||||
|
|
@ -117,7 +119,13 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto
|
||||||
br.Reset(nil)
|
br.Reset(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
return c, nil
|
var mediaType string
|
||||||
|
if versions.GreaterThanOrEqualTo(cli.ClientVersion(), "1.42") {
|
||||||
|
// Prior to 1.42, Content-Type is always set to raw-stream and not relevant
|
||||||
|
mediaType = resp.Header.Get("Content-Type")
|
||||||
|
}
|
||||||
|
|
||||||
|
return c, mediaType, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// hijackedConn wraps a net.Conn and is returned by setupHijackConn in the case
|
// hijackedConn wraps a net.Conn and is returned by setupHijackConn in the case
|
||||||
|
|
|
||||||
4
vendor/github.com/docker/docker/client/image_build.go
generated
vendored
4
vendor/github.com/docker/docker/client/image_build.go
generated
vendored
|
|
@ -14,8 +14,8 @@ import (
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImageBuild sends request to the daemon to build images.
|
// ImageBuild sends a request to the daemon to build images.
|
||||||
// The Body in the response implement an io.ReadCloser and it's up to the caller to
|
// The Body in the response implements an io.ReadCloser and it's up to the caller to
|
||||||
// close it.
|
// close it.
|
||||||
func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) {
|
func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) {
|
||||||
query, err := cli.imageBuildOptionsToQuery(options)
|
query, err := cli.imageBuildOptionsToQuery(options)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/image_create.go
generated
vendored
2
vendor/github.com/docker/docker/client/image_create.go
generated
vendored
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImageCreate creates a new image based in the parent options.
|
// ImageCreate creates a new image based on the parent options.
|
||||||
// It returns the JSON content in the response body.
|
// It returns the JSON content in the response body.
|
||||||
func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) {
|
func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) {
|
||||||
ref, err := reference.ParseNormalizedNamed(parentReference)
|
ref, err := reference.ParseNormalizedNamed(parentReference)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/image_import.go
generated
vendored
2
vendor/github.com/docker/docker/client/image_import.go
generated
vendored
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImageImport creates a new image based in the source options.
|
// ImageImport creates a new image based on the source options.
|
||||||
// It returns the JSON content in the response body.
|
// It returns the JSON content in the response body.
|
||||||
func (cli *Client) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) {
|
func (cli *Client) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) {
|
||||||
if ref != "" {
|
if ref != "" {
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/image_inspect.go
generated
vendored
2
vendor/github.com/docker/docker/client/image_inspect.go
generated
vendored
|
|
@ -17,7 +17,7 @@ func (cli *Client) ImageInspectWithRaw(ctx context.Context, imageID string) (typ
|
||||||
serverResp, err := cli.get(ctx, "/images/"+imageID+"/json", nil, nil)
|
serverResp, err := cli.get(ctx, "/images/"+imageID+"/json", nil, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.ImageInspect{}, nil, wrapResponseError(err, serverResp, "image", imageID)
|
return types.ImageInspect{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(serverResp.body)
|
body, err := io.ReadAll(serverResp.body)
|
||||||
|
|
|
||||||
3
vendor/github.com/docker/docker/client/image_list.go
generated
vendored
3
vendor/github.com/docker/docker/client/image_list.go
generated
vendored
|
|
@ -34,6 +34,9 @@ func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions
|
||||||
if options.All {
|
if options.All {
|
||||||
query.Set("all", "1")
|
query.Set("all", "1")
|
||||||
}
|
}
|
||||||
|
if options.SharedSize && versions.GreaterThanOrEqualTo(cli.version, "1.42") {
|
||||||
|
query.Set("shared-size", "1")
|
||||||
|
}
|
||||||
|
|
||||||
serverResp, err := cli.get(ctx, "/images/json", query, nil)
|
serverResp, err := cli.get(ctx, "/images/json", query, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/image_remove.go
generated
vendored
2
vendor/github.com/docker/docker/client/image_remove.go
generated
vendored
|
|
@ -23,7 +23,7 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options type
|
||||||
resp, err := cli.delete(ctx, "/images/"+imageID, query, nil)
|
resp, err := cli.delete(ctx, "/images/"+imageID, query, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return dels, wrapResponseError(err, resp, "image", imageID)
|
return dels, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.NewDecoder(resp.body).Decode(&dels)
|
err = json.NewDecoder(resp.body).Decode(&dels)
|
||||||
|
|
|
||||||
8
vendor/github.com/docker/docker/client/image_search.go
generated
vendored
8
vendor/github.com/docker/docker/client/image_search.go
generated
vendored
|
|
@ -3,8 +3,8 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
|
@ -12,13 +12,15 @@ import (
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImageSearch makes the docker host to search by a term in a remote registry.
|
// ImageSearch makes the docker host search by a term in a remote registry.
|
||||||
// The list of results is not sorted in any fashion.
|
// The list of results is not sorted in any fashion.
|
||||||
func (cli *Client) ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error) {
|
func (cli *Client) ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error) {
|
||||||
var results []registry.SearchResult
|
var results []registry.SearchResult
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("term", term)
|
query.Set("term", term)
|
||||||
query.Set("limit", fmt.Sprintf("%d", options.Limit))
|
if options.Limit > 0 {
|
||||||
|
query.Set("limit", strconv.Itoa(options.Limit))
|
||||||
|
}
|
||||||
|
|
||||||
if options.Filters.Len() > 0 {
|
if options.Filters.Len() > 0 {
|
||||||
filterJSON, err := filters.ToJSON(options.Filters)
|
filterJSON, err := filters.ToJSON(options.Filters)
|
||||||
|
|
|
||||||
34
vendor/github.com/docker/docker/client/interface.go
generated
vendored
34
vendor/github.com/docker/docker/client/interface.go
generated
vendored
|
|
@ -5,17 +5,16 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/events"
|
"github.com/docker/docker/api/types/events"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/docker/docker/api/types/image"
|
"github.com/docker/docker/api/types/image"
|
||||||
networktypes "github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/docker/docker/api/types/registry"
|
"github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
volumetypes "github.com/docker/docker/api/types/volume"
|
"github.com/docker/docker/api/types/volume"
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -48,8 +47,8 @@ type CommonAPIClient interface {
|
||||||
type ContainerAPIClient interface {
|
type ContainerAPIClient interface {
|
||||||
ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
|
ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
|
||||||
ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
|
ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
|
||||||
ContainerCreate(ctx context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, platform *specs.Platform, containerName string) (containertypes.ContainerCreateCreatedBody, error)
|
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.CreateResponse, error)
|
||||||
ContainerDiff(ctx context.Context, container string) ([]containertypes.ContainerChangeResponseItem, error)
|
ContainerDiff(ctx context.Context, container string) ([]container.ContainerChangeResponseItem, error)
|
||||||
ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
|
ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
|
||||||
ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
|
ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
|
||||||
ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
|
ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
|
||||||
|
|
@ -65,16 +64,16 @@ type ContainerAPIClient interface {
|
||||||
ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
|
ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
|
||||||
ContainerRename(ctx context.Context, container, newContainerName string) error
|
ContainerRename(ctx context.Context, container, newContainerName string) error
|
||||||
ContainerResize(ctx context.Context, container string, options types.ResizeOptions) error
|
ContainerResize(ctx context.Context, container string, options types.ResizeOptions) error
|
||||||
ContainerRestart(ctx context.Context, container string, timeout *time.Duration) error
|
ContainerRestart(ctx context.Context, container string, options container.StopOptions) error
|
||||||
ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
|
ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
|
||||||
ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
|
ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
|
||||||
ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error)
|
ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error)
|
||||||
ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
|
ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
|
||||||
ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
|
ContainerStop(ctx context.Context, container string, options container.StopOptions) error
|
||||||
ContainerTop(ctx context.Context, container string, arguments []string) (containertypes.ContainerTopOKBody, error)
|
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
|
||||||
ContainerUnpause(ctx context.Context, container string) error
|
ContainerUnpause(ctx context.Context, container string) error
|
||||||
ContainerUpdate(ctx context.Context, container string, updateConfig containertypes.UpdateConfig) (containertypes.ContainerUpdateOKBody, error)
|
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
|
||||||
ContainerWait(ctx context.Context, container string, condition containertypes.WaitCondition) (<-chan containertypes.ContainerWaitOKBody, <-chan error)
|
ContainerWait(ctx context.Context, container string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
|
||||||
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
|
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
|
||||||
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
|
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
|
||||||
ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error)
|
ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error)
|
||||||
|
|
@ -107,7 +106,7 @@ type ImageAPIClient interface {
|
||||||
|
|
||||||
// NetworkAPIClient defines API client methods for the networks
|
// NetworkAPIClient defines API client methods for the networks
|
||||||
type NetworkAPIClient interface {
|
type NetworkAPIClient interface {
|
||||||
NetworkConnect(ctx context.Context, network, container string, config *networktypes.EndpointSettings) error
|
NetworkConnect(ctx context.Context, network, container string, config *network.EndpointSettings) error
|
||||||
NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
|
NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
|
||||||
NetworkDisconnect(ctx context.Context, network, container string, force bool) error
|
NetworkDisconnect(ctx context.Context, network, container string, force bool) error
|
||||||
NetworkInspect(ctx context.Context, network string, options types.NetworkInspectOptions) (types.NetworkResource, error)
|
NetworkInspect(ctx context.Context, network string, options types.NetworkInspectOptions) (types.NetworkResource, error)
|
||||||
|
|
@ -168,18 +167,19 @@ type SystemAPIClient interface {
|
||||||
Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
|
Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
|
||||||
Info(ctx context.Context) (types.Info, error)
|
Info(ctx context.Context) (types.Info, error)
|
||||||
RegistryLogin(ctx context.Context, auth types.AuthConfig) (registry.AuthenticateOKBody, error)
|
RegistryLogin(ctx context.Context, auth types.AuthConfig) (registry.AuthenticateOKBody, error)
|
||||||
DiskUsage(ctx context.Context) (types.DiskUsage, error)
|
DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error)
|
||||||
Ping(ctx context.Context) (types.Ping, error)
|
Ping(ctx context.Context) (types.Ping, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolumeAPIClient defines API client methods for the volumes
|
// VolumeAPIClient defines API client methods for the volumes
|
||||||
type VolumeAPIClient interface {
|
type VolumeAPIClient interface {
|
||||||
VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (types.Volume, error)
|
VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error)
|
||||||
VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error)
|
VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
|
||||||
VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error)
|
VolumeInspectWithRaw(ctx context.Context, volumeID string) (volume.Volume, []byte, error)
|
||||||
VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error)
|
VolumeList(ctx context.Context, filter filters.Args) (volume.ListResponse, error)
|
||||||
VolumeRemove(ctx context.Context, volumeID string, force bool) error
|
VolumeRemove(ctx context.Context, volumeID string, force bool) error
|
||||||
VolumesPrune(ctx context.Context, pruneFilter filters.Args) (types.VolumesPruneReport, error)
|
VolumesPrune(ctx context.Context, pruneFilter filters.Args) (types.VolumesPruneReport, error)
|
||||||
|
VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options volume.UpdateOptions) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// SecretAPIClient defines API client methods for secrets
|
// SecretAPIClient defines API client methods for secrets
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/network_inspect.go
generated
vendored
2
vendor/github.com/docker/docker/client/network_inspect.go
generated
vendored
|
|
@ -36,7 +36,7 @@ func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string,
|
||||||
resp, err = cli.get(ctx, "/networks/"+networkID, query, nil)
|
resp, err = cli.get(ctx, "/networks/"+networkID, query, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return networkResource, nil, wrapResponseError(err, resp, "network", networkID)
|
return networkResource, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/network_remove.go
generated
vendored
2
vendor/github.com/docker/docker/client/network_remove.go
generated
vendored
|
|
@ -6,5 +6,5 @@ import "context"
|
||||||
func (cli *Client) NetworkRemove(ctx context.Context, networkID string) error {
|
func (cli *Client) NetworkRemove(ctx context.Context, networkID string) error {
|
||||||
resp, err := cli.delete(ctx, "/networks/"+networkID, nil, nil)
|
resp, err := cli.delete(ctx, "/networks/"+networkID, nil, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
return wrapResponseError(err, resp, "network", networkID)
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/node_inspect.go
generated
vendored
2
vendor/github.com/docker/docker/client/node_inspect.go
generated
vendored
|
|
@ -17,7 +17,7 @@ func (cli *Client) NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm
|
||||||
serverResp, err := cli.get(ctx, "/nodes/"+nodeID, nil, nil)
|
serverResp, err := cli.get(ctx, "/nodes/"+nodeID, nil, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return swarm.Node{}, nil, wrapResponseError(err, serverResp, "node", nodeID)
|
return swarm.Node{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(serverResp.body)
|
body, err := io.ReadAll(serverResp.body)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/node_remove.go
generated
vendored
2
vendor/github.com/docker/docker/client/node_remove.go
generated
vendored
|
|
@ -16,5 +16,5 @@ func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options types.
|
||||||
|
|
||||||
resp, err := cli.delete(ctx, "/nodes/"+nodeID, query, nil)
|
resp, err := cli.delete(ctx, "/nodes/"+nodeID, query, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
return wrapResponseError(err, resp, "node", nodeID)
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
vendor/github.com/docker/docker/client/node_update.go
generated
vendored
3
vendor/github.com/docker/docker/client/node_update.go
generated
vendored
|
|
@ -3,7 +3,6 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
|
@ -11,7 +10,7 @@ import (
|
||||||
// NodeUpdate updates a Node.
|
// NodeUpdate updates a Node.
|
||||||
func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error {
|
func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("version", strconv.FormatUint(version.Index, 10))
|
query.Set("version", version.String())
|
||||||
resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, node, nil)
|
resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, node, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
112
vendor/github.com/docker/docker/client/options.go
generated
vendored
112
vendor/github.com/docker/docker/client/options.go
generated
vendored
|
|
@ -18,51 +18,32 @@ type Opt func(*Client) error
|
||||||
|
|
||||||
// FromEnv configures the client with values from environment variables.
|
// FromEnv configures the client with values from environment variables.
|
||||||
//
|
//
|
||||||
// Supported environment variables:
|
// FromEnv uses the following environment variables:
|
||||||
// DOCKER_HOST to set the url to the docker server.
|
//
|
||||||
// DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
|
// DOCKER_HOST (EnvOverrideHost) to set the URL to the docker server.
|
||||||
// DOCKER_CERT_PATH to load the TLS certificates from.
|
//
|
||||||
// DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
|
// DOCKER_API_VERSION (EnvOverrideAPIVersion) to set the version of the API to
|
||||||
|
// use, leave empty for latest.
|
||||||
|
//
|
||||||
|
// DOCKER_CERT_PATH (EnvOverrideCertPath) to specify the directory from which to
|
||||||
|
// load the TLS certificates (ca.pem, cert.pem, key.pem).
|
||||||
|
//
|
||||||
|
// DOCKER_TLS_VERIFY (EnvTLSVerify) to enable or disable TLS verification (off by
|
||||||
|
// default).
|
||||||
func FromEnv(c *Client) error {
|
func FromEnv(c *Client) error {
|
||||||
if dockerCertPath := os.Getenv("DOCKER_CERT_PATH"); dockerCertPath != "" {
|
ops := []Opt{
|
||||||
options := tlsconfig.Options{
|
WithTLSClientConfigFromEnv(),
|
||||||
CAFile: filepath.Join(dockerCertPath, "ca.pem"),
|
WithHostFromEnv(),
|
||||||
CertFile: filepath.Join(dockerCertPath, "cert.pem"),
|
WithVersionFromEnv(),
|
||||||
KeyFile: filepath.Join(dockerCertPath, "key.pem"),
|
|
||||||
InsecureSkipVerify: os.Getenv("DOCKER_TLS_VERIFY") == "",
|
|
||||||
}
|
}
|
||||||
tlsc, err := tlsconfig.Client(options)
|
for _, op := range ops {
|
||||||
if err != nil {
|
if err := op(c); err != nil {
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
c.client = &http.Client{
|
|
||||||
Transport: &http.Transport{TLSClientConfig: tlsc},
|
|
||||||
CheckRedirect: CheckRedirect,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if host := os.Getenv("DOCKER_HOST"); host != "" {
|
|
||||||
if err := WithHost(host)(c); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if version := os.Getenv("DOCKER_API_VERSION"); version != "" {
|
|
||||||
if err := WithVersion(version)(c); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithDialer applies the dialer.DialContext to the client transport. This can be
|
|
||||||
// used to set the Timeout and KeepAlive settings of the client.
|
|
||||||
// Deprecated: use WithDialContext
|
|
||||||
func WithDialer(dialer *net.Dialer) Opt {
|
|
||||||
return WithDialContext(dialer.DialContext)
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithDialContext applies the dialer to the client transport. This can be
|
// WithDialContext applies the dialer to the client transport. This can be
|
||||||
// used to set the Timeout and KeepAlive settings of the client.
|
// used to set the Timeout and KeepAlive settings of the client.
|
||||||
func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) Opt {
|
func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) Opt {
|
||||||
|
|
@ -93,6 +74,18 @@ func WithHost(host string) Opt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithHostFromEnv overrides the client host with the host specified in the
|
||||||
|
// DOCKER_HOST (EnvOverrideHost) environment variable. If DOCKER_HOST is not set,
|
||||||
|
// or set to an empty value, the host is not modified.
|
||||||
|
func WithHostFromEnv() Opt {
|
||||||
|
return func(c *Client) error {
|
||||||
|
if host := os.Getenv(EnvOverrideHost); host != "" {
|
||||||
|
return WithHost(host)(c)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithHTTPClient overrides the client http client with the specified one
|
// WithHTTPClient overrides the client http client with the specified one
|
||||||
func WithHTTPClient(client *http.Client) Opt {
|
func WithHTTPClient(client *http.Client) Opt {
|
||||||
return func(c *Client) error {
|
return func(c *Client) error {
|
||||||
|
|
@ -148,6 +141,42 @@ func WithTLSClientConfig(cacertPath, certPath, keyPath string) Opt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithTLSClientConfigFromEnv configures the client's TLS settings with the
|
||||||
|
// settings in the DOCKER_CERT_PATH and DOCKER_TLS_VERIFY environment variables.
|
||||||
|
// If DOCKER_CERT_PATH is not set or empty, TLS configuration is not modified.
|
||||||
|
//
|
||||||
|
// WithTLSClientConfigFromEnv uses the following environment variables:
|
||||||
|
//
|
||||||
|
// DOCKER_CERT_PATH (EnvOverrideCertPath) to specify the directory from which to
|
||||||
|
// load the TLS certificates (ca.pem, cert.pem, key.pem).
|
||||||
|
//
|
||||||
|
// DOCKER_TLS_VERIFY (EnvTLSVerify) to enable or disable TLS verification (off by
|
||||||
|
// default).
|
||||||
|
func WithTLSClientConfigFromEnv() Opt {
|
||||||
|
return func(c *Client) error {
|
||||||
|
dockerCertPath := os.Getenv(EnvOverrideCertPath)
|
||||||
|
if dockerCertPath == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
options := tlsconfig.Options{
|
||||||
|
CAFile: filepath.Join(dockerCertPath, "ca.pem"),
|
||||||
|
CertFile: filepath.Join(dockerCertPath, "cert.pem"),
|
||||||
|
KeyFile: filepath.Join(dockerCertPath, "key.pem"),
|
||||||
|
InsecureSkipVerify: os.Getenv(EnvTLSVerify) == "",
|
||||||
|
}
|
||||||
|
tlsc, err := tlsconfig.Client(options)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
c.client = &http.Client{
|
||||||
|
Transport: &http.Transport{TLSClientConfig: tlsc},
|
||||||
|
CheckRedirect: CheckRedirect,
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithVersion overrides the client version with the specified one. If an empty
|
// WithVersion overrides the client version with the specified one. If an empty
|
||||||
// version is specified, the value will be ignored to allow version negotiation.
|
// version is specified, the value will be ignored to allow version negotiation.
|
||||||
func WithVersion(version string) Opt {
|
func WithVersion(version string) Opt {
|
||||||
|
|
@ -160,6 +189,15 @@ func WithVersion(version string) Opt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithVersionFromEnv overrides the client version with the version specified in
|
||||||
|
// the DOCKER_API_VERSION environment variable. If DOCKER_API_VERSION is not set,
|
||||||
|
// the version is not modified.
|
||||||
|
func WithVersionFromEnv() Opt {
|
||||||
|
return func(c *Client) error {
|
||||||
|
return WithVersion(os.Getenv(EnvOverrideAPIVersion))(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithAPIVersionNegotiation enables automatic API version negotiation for the client.
|
// WithAPIVersionNegotiation enables automatic API version negotiation for the client.
|
||||||
// With this option enabled, the client automatically negotiates the API version
|
// With this option enabled, the client automatically negotiates the API version
|
||||||
// to use when making requests. API version negotiation is performed on the first
|
// to use when making requests. API version negotiation is performed on the first
|
||||||
|
|
|
||||||
9
vendor/github.com/docker/docker/client/ping.go
generated
vendored
9
vendor/github.com/docker/docker/client/ping.go
generated
vendored
|
|
@ -4,8 +4,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -61,6 +63,13 @@ func parsePingResponse(cli *Client, resp serverResponse) (types.Ping, error) {
|
||||||
if bv := resp.header.Get("Builder-Version"); bv != "" {
|
if bv := resp.header.Get("Builder-Version"); bv != "" {
|
||||||
ping.BuilderVersion = types.BuilderVersion(bv)
|
ping.BuilderVersion = types.BuilderVersion(bv)
|
||||||
}
|
}
|
||||||
|
if si := resp.header.Get("Swarm"); si != "" {
|
||||||
|
parts := strings.SplitN(si, "/", 2)
|
||||||
|
ping.SwarmStatus = &swarm.Status{
|
||||||
|
NodeState: swarm.LocalNodeState(parts[0]),
|
||||||
|
ControlAvailable: len(parts) == 2 && parts[1] == "manager",
|
||||||
|
}
|
||||||
|
}
|
||||||
err := cli.checkResponseErr(resp)
|
err := cli.checkResponseErr(resp)
|
||||||
return ping, errdefs.FromStatusCode(err, resp.statusCode)
|
return ping, errdefs.FromStatusCode(err, resp.statusCode)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/plugin_inspect.go
generated
vendored
2
vendor/github.com/docker/docker/client/plugin_inspect.go
generated
vendored
|
|
@ -17,7 +17,7 @@ func (cli *Client) PluginInspectWithRaw(ctx context.Context, name string) (*type
|
||||||
resp, err := cli.get(ctx, "/plugins/"+name+"/json", nil, nil)
|
resp, err := cli.get(ctx, "/plugins/"+name+"/json", nil, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, wrapResponseError(err, resp, "plugin", name)
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/plugin_list.go
generated
vendored
2
vendor/github.com/docker/docker/client/plugin_list.go
generated
vendored
|
|
@ -25,7 +25,7 @@ func (cli *Client) PluginList(ctx context.Context, filter filters.Args) (types.P
|
||||||
resp, err := cli.get(ctx, "/plugins", query, nil)
|
resp, err := cli.get(ctx, "/plugins", query, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return plugins, wrapResponseError(err, resp, "plugin", "")
|
return plugins, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.NewDecoder(resp.body).Decode(&plugins)
|
err = json.NewDecoder(resp.body).Decode(&plugins)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/plugin_remove.go
generated
vendored
2
vendor/github.com/docker/docker/client/plugin_remove.go
generated
vendored
|
|
@ -16,5 +16,5 @@ func (cli *Client) PluginRemove(ctx context.Context, name string, options types.
|
||||||
|
|
||||||
resp, err := cli.delete(ctx, "/plugins/"+name, query, nil)
|
resp, err := cli.delete(ctx, "/plugins/"+name, query, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
return wrapResponseError(err, resp, "plugin", name)
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
vendor/github.com/docker/docker/client/request.go
generated
vendored
23
vendor/github.com/docker/docker/client/request.go
generated
vendored
|
|
@ -49,6 +49,14 @@ func (cli *Client) postRaw(ctx context.Context, path string, query url.Values, b
|
||||||
return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers)
|
return cli.sendRequest(ctx, http.MethodPost, path, query, body, headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cli *Client) put(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (serverResponse, error) {
|
||||||
|
body, headers, err := encodeBody(obj, headers)
|
||||||
|
if err != nil {
|
||||||
|
return serverResponse{}, err
|
||||||
|
}
|
||||||
|
return cli.sendRequest(ctx, http.MethodPut, path, query, body, headers)
|
||||||
|
}
|
||||||
|
|
||||||
// putRaw sends an http request to the docker API using the method PUT.
|
// putRaw sends an http request to the docker API using the method PUT.
|
||||||
func (cli *Client) putRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers map[string][]string) (serverResponse, error) {
|
func (cli *Client) putRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers map[string][]string) (serverResponse, error) {
|
||||||
return cli.sendRequest(ctx, http.MethodPut, path, query, body, headers)
|
return cli.sendRequest(ctx, http.MethodPut, path, query, body, headers)
|
||||||
|
|
@ -107,11 +115,16 @@ func (cli *Client) sendRequest(ctx context.Context, method, path string, query u
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return serverResponse{}, err
|
return serverResponse{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := cli.doRequest(ctx, req)
|
resp, err := cli.doRequest(ctx, req)
|
||||||
if err != nil {
|
switch {
|
||||||
return resp, errdefs.FromStatusCode(err, resp.statusCode)
|
case errors.Is(err, context.Canceled):
|
||||||
}
|
return serverResponse{}, errdefs.Cancelled(err)
|
||||||
|
case errors.Is(err, context.DeadlineExceeded):
|
||||||
|
return serverResponse{}, errdefs.Deadline(err)
|
||||||
|
case err == nil:
|
||||||
err = cli.checkResponseErr(resp)
|
err = cli.checkResponseErr(resp)
|
||||||
|
}
|
||||||
return resp, errdefs.FromStatusCode(err, resp.statusCode)
|
return resp, errdefs.FromStatusCode(err, resp.statusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,14 +244,14 @@ func (cli *Client) addHeaders(req *http.Request, headers headers) *http.Request
|
||||||
// Add CLI Config's HTTP Headers BEFORE we set the Docker headers
|
// Add CLI Config's HTTP Headers BEFORE we set the Docker headers
|
||||||
// then the user can't change OUR headers
|
// then the user can't change OUR headers
|
||||||
for k, v := range cli.customHTTPHeaders {
|
for k, v := range cli.customHTTPHeaders {
|
||||||
if versions.LessThan(cli.version, "1.25") && k == "User-Agent" {
|
if versions.LessThan(cli.version, "1.25") && http.CanonicalHeaderKey(k) == "User-Agent" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
req.Header.Set(k, v)
|
req.Header.Set(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range headers {
|
for k, v := range headers {
|
||||||
req.Header[k] = v
|
req.Header[http.CanonicalHeaderKey(k)] = v
|
||||||
}
|
}
|
||||||
return req
|
return req
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/secret_create.go
generated
vendored
2
vendor/github.com/docker/docker/client/secret_create.go
generated
vendored
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SecretCreate creates a new Secret.
|
// SecretCreate creates a new secret.
|
||||||
func (cli *Client) SecretCreate(ctx context.Context, secret swarm.SecretSpec) (types.SecretCreateResponse, error) {
|
func (cli *Client) SecretCreate(ctx context.Context, secret swarm.SecretSpec) (types.SecretCreateResponse, error) {
|
||||||
var response types.SecretCreateResponse
|
var response types.SecretCreateResponse
|
||||||
if err := cli.NewVersionError("1.25", "secret create"); err != nil {
|
if err := cli.NewVersionError("1.25", "secret create"); err != nil {
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/secret_inspect.go
generated
vendored
2
vendor/github.com/docker/docker/client/secret_inspect.go
generated
vendored
|
|
@ -20,7 +20,7 @@ func (cli *Client) SecretInspectWithRaw(ctx context.Context, id string) (swarm.S
|
||||||
resp, err := cli.get(ctx, "/secrets/"+id, nil, nil)
|
resp, err := cli.get(ctx, "/secrets/"+id, nil, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return swarm.Secret{}, nil, wrapResponseError(err, resp, "secret", id)
|
return swarm.Secret{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
|
|
|
||||||
4
vendor/github.com/docker/docker/client/secret_remove.go
generated
vendored
4
vendor/github.com/docker/docker/client/secret_remove.go
generated
vendored
|
|
@ -2,12 +2,12 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import "context"
|
import "context"
|
||||||
|
|
||||||
// SecretRemove removes a Secret.
|
// SecretRemove removes a secret.
|
||||||
func (cli *Client) SecretRemove(ctx context.Context, id string) error {
|
func (cli *Client) SecretRemove(ctx context.Context, id string) error {
|
||||||
if err := cli.NewVersionError("1.25", "secret remove"); err != nil {
|
if err := cli.NewVersionError("1.25", "secret remove"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
resp, err := cli.delete(ctx, "/secrets/"+id, nil, nil)
|
resp, err := cli.delete(ctx, "/secrets/"+id, nil, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
return wrapResponseError(err, resp, "secret", id)
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
vendor/github.com/docker/docker/client/secret_update.go
generated
vendored
5
vendor/github.com/docker/docker/client/secret_update.go
generated
vendored
|
|
@ -3,18 +3,17 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SecretUpdate attempts to update a Secret
|
// SecretUpdate attempts to update a secret.
|
||||||
func (cli *Client) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error {
|
func (cli *Client) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error {
|
||||||
if err := cli.NewVersionError("1.25", "secret update"); err != nil {
|
if err := cli.NewVersionError("1.25", "secret update"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("version", strconv.FormatUint(version.Index, 10))
|
query.Set("version", version.String())
|
||||||
resp, err := cli.post(ctx, "/secrets/"+id+"/update", query, secret, nil)
|
resp, err := cli.post(ctx, "/secrets/"+id+"/update", query, secret, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
4
vendor/github.com/docker/docker/client/service_create.go
generated
vendored
4
vendor/github.com/docker/docker/client/service_create.go
generated
vendored
|
|
@ -9,11 +9,11 @@ import (
|
||||||
"github.com/docker/distribution/reference"
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceCreate creates a new Service.
|
// ServiceCreate creates a new service.
|
||||||
func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error) {
|
func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error) {
|
||||||
var response types.ServiceCreateResponse
|
var response types.ServiceCreateResponse
|
||||||
headers := map[string][]string{
|
headers := map[string][]string{
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/service_inspect.go
generated
vendored
2
vendor/github.com/docker/docker/client/service_inspect.go
generated
vendored
|
|
@ -22,7 +22,7 @@ func (cli *Client) ServiceInspectWithRaw(ctx context.Context, serviceID string,
|
||||||
serverResp, err := cli.get(ctx, "/services/"+serviceID, query, nil)
|
serverResp, err := cli.get(ctx, "/services/"+serviceID, query, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return swarm.Service{}, nil, wrapResponseError(err, serverResp, "service", serviceID)
|
return swarm.Service{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(serverResp.body)
|
body, err := io.ReadAll(serverResp.body)
|
||||||
|
|
|
||||||
2
vendor/github.com/docker/docker/client/service_remove.go
generated
vendored
2
vendor/github.com/docker/docker/client/service_remove.go
generated
vendored
|
|
@ -6,5 +6,5 @@ import "context"
|
||||||
func (cli *Client) ServiceRemove(ctx context.Context, serviceID string) error {
|
func (cli *Client) ServiceRemove(ctx context.Context, serviceID string) error {
|
||||||
resp, err := cli.delete(ctx, "/services/"+serviceID, nil, nil)
|
resp, err := cli.delete(ctx, "/services/"+serviceID, nil, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
return wrapResponseError(err, resp, "service", serviceID)
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
vendor/github.com/docker/docker/client/service_update.go
generated
vendored
3
vendor/github.com/docker/docker/client/service_update.go
generated
vendored
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
|
@ -35,7 +34,7 @@ func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version
|
||||||
query.Set("rollback", options.Rollback)
|
query.Set("rollback", options.Rollback)
|
||||||
}
|
}
|
||||||
|
|
||||||
query.Set("version", strconv.FormatUint(version.Index, 10))
|
query.Set("version", version.String())
|
||||||
|
|
||||||
if err := validateServiceSpec(service); err != nil {
|
if err := validateServiceSpec(service); err != nil {
|
||||||
return response, err
|
return response, err
|
||||||
|
|
|
||||||
9
vendor/github.com/docker/docker/client/swarm_update.go
generated
vendored
9
vendor/github.com/docker/docker/client/swarm_update.go
generated
vendored
|
|
@ -2,7 +2,6 @@ package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
|
@ -12,10 +11,10 @@ import (
|
||||||
// SwarmUpdate updates the swarm.
|
// SwarmUpdate updates the swarm.
|
||||||
func (cli *Client) SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error {
|
func (cli *Client) SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("version", strconv.FormatUint(version.Index, 10))
|
query.Set("version", version.String())
|
||||||
query.Set("rotateWorkerToken", fmt.Sprintf("%v", flags.RotateWorkerToken))
|
query.Set("rotateWorkerToken", strconv.FormatBool(flags.RotateWorkerToken))
|
||||||
query.Set("rotateManagerToken", fmt.Sprintf("%v", flags.RotateManagerToken))
|
query.Set("rotateManagerToken", strconv.FormatBool(flags.RotateManagerToken))
|
||||||
query.Set("rotateManagerUnlockKey", fmt.Sprintf("%v", flags.RotateManagerUnlockKey))
|
query.Set("rotateManagerUnlockKey", strconv.FormatBool(flags.RotateManagerUnlockKey))
|
||||||
resp, err := cli.post(ctx, "/swarm/update", query, swarm, nil)
|
resp, err := cli.post(ctx, "/swarm/update", query, swarm, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
4
vendor/github.com/docker/docker/client/task_inspect.go
generated
vendored
4
vendor/github.com/docker/docker/client/task_inspect.go
generated
vendored
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TaskInspectWithRaw returns the task information and its raw representation..
|
// TaskInspectWithRaw returns the task information and its raw representation.
|
||||||
func (cli *Client) TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error) {
|
func (cli *Client) TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error) {
|
||||||
if taskID == "" {
|
if taskID == "" {
|
||||||
return swarm.Task{}, nil, objectNotFoundError{object: "task", id: taskID}
|
return swarm.Task{}, nil, objectNotFoundError{object: "task", id: taskID}
|
||||||
|
|
@ -17,7 +17,7 @@ func (cli *Client) TaskInspectWithRaw(ctx context.Context, taskID string) (swarm
|
||||||
serverResp, err := cli.get(ctx, "/tasks/"+taskID, nil, nil)
|
serverResp, err := cli.get(ctx, "/tasks/"+taskID, nil, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return swarm.Task{}, nil, wrapResponseError(err, serverResp, "task", taskID)
|
return swarm.Task{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(serverResp.body)
|
body, err := io.ReadAll(serverResp.body)
|
||||||
|
|
|
||||||
13
vendor/github.com/docker/docker/client/volume_create.go
generated
vendored
13
vendor/github.com/docker/docker/client/volume_create.go
generated
vendored
|
|
@ -4,18 +4,17 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/volume"
|
||||||
volumetypes "github.com/docker/docker/api/types/volume"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// VolumeCreate creates a volume in the docker host.
|
// VolumeCreate creates a volume in the docker host.
|
||||||
func (cli *Client) VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (types.Volume, error) {
|
func (cli *Client) VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error) {
|
||||||
var volume types.Volume
|
var vol volume.Volume
|
||||||
resp, err := cli.post(ctx, "/volumes/create", nil, options, nil)
|
resp, err := cli.post(ctx, "/volumes/create", nil, options, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return volume, err
|
return vol, err
|
||||||
}
|
}
|
||||||
err = json.NewDecoder(resp.body).Decode(&volume)
|
err = json.NewDecoder(resp.body).Decode(&vol)
|
||||||
return volume, err
|
return vol, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
vendor/github.com/docker/docker/client/volume_inspect.go
generated
vendored
22
vendor/github.com/docker/docker/client/volume_inspect.go
generated
vendored
|
|
@ -6,33 +6,33 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VolumeInspect returns the information about a specific volume in the docker host.
|
// VolumeInspect returns the information about a specific volume in the docker host.
|
||||||
func (cli *Client) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) {
|
func (cli *Client) VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error) {
|
||||||
volume, _, err := cli.VolumeInspectWithRaw(ctx, volumeID)
|
vol, _, err := cli.VolumeInspectWithRaw(ctx, volumeID)
|
||||||
return volume, err
|
return vol, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolumeInspectWithRaw returns the information about a specific volume in the docker host and its raw representation
|
// VolumeInspectWithRaw returns the information about a specific volume in the docker host and its raw representation
|
||||||
func (cli *Client) VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) {
|
func (cli *Client) VolumeInspectWithRaw(ctx context.Context, volumeID string) (volume.Volume, []byte, error) {
|
||||||
if volumeID == "" {
|
if volumeID == "" {
|
||||||
return types.Volume{}, nil, objectNotFoundError{object: "volume", id: volumeID}
|
return volume.Volume{}, nil, objectNotFoundError{object: "volume", id: volumeID}
|
||||||
}
|
}
|
||||||
|
|
||||||
var volume types.Volume
|
var vol volume.Volume
|
||||||
resp, err := cli.get(ctx, "/volumes/"+volumeID, nil, nil)
|
resp, err := cli.get(ctx, "/volumes/"+volumeID, nil, nil)
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return volume, nil, wrapResponseError(err, resp, "volume", volumeID)
|
return vol, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := io.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return volume, nil, err
|
return vol, nil, err
|
||||||
}
|
}
|
||||||
rdr := bytes.NewReader(body)
|
rdr := bytes.NewReader(body)
|
||||||
err = json.NewDecoder(rdr).Decode(&volume)
|
err = json.NewDecoder(rdr).Decode(&vol)
|
||||||
return volume, body, err
|
return vol, body, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue