vendor: update docker, api, client to master
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
85
vendor/github.com/moby/moby/api/types/client.go
generated
vendored
85
vendor/github.com/moby/moby/api/types/client.go
generated
vendored
@ -1,85 +0,0 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"net"
|
||||
)
|
||||
|
||||
// NewHijackedResponse initializes 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.
|
||||
type HijackedResponse struct {
|
||||
mediaType string
|
||||
Conn net.Conn
|
||||
Reader *bufio.Reader
|
||||
}
|
||||
|
||||
// Close closes the hijacked connection and reader.
|
||||
func (h *HijackedResponse) 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
|
||||
// that close input streams to prevent from writing.
|
||||
type CloseWriter interface {
|
||||
CloseWrite() error
|
||||
}
|
||||
|
||||
// CloseWrite closes a readWriter for writing.
|
||||
func (h *HijackedResponse) CloseWrite() error {
|
||||
if conn, ok := h.Conn.(CloseWriter); ok {
|
||||
return conn.CloseWrite()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PluginRemoveOptions holds parameters to remove plugins.
|
||||
type PluginRemoveOptions struct {
|
||||
Force bool
|
||||
}
|
||||
|
||||
// PluginEnableOptions holds parameters to enable plugins.
|
||||
type PluginEnableOptions struct {
|
||||
Timeout int
|
||||
}
|
||||
|
||||
// PluginDisableOptions holds parameters to disable plugins.
|
||||
type PluginDisableOptions struct {
|
||||
Force bool
|
||||
}
|
||||
|
||||
// PluginInstallOptions holds parameters to install a plugin.
|
||||
type PluginInstallOptions struct {
|
||||
Disabled bool
|
||||
AcceptAllPermissions bool
|
||||
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
|
||||
RemoteRef string // RemoteRef is the plugin name on the registry
|
||||
|
||||
// PrivilegeFunc is a function that clients can supply to retry operations
|
||||
// after getting an authorization error. This function returns the registry
|
||||
// authentication header value in base64 encoded format, or an error if the
|
||||
// privilege request fails.
|
||||
//
|
||||
// For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig].
|
||||
PrivilegeFunc func(context.Context) (string, error)
|
||||
AcceptPermissionsFunc func(context.Context, PluginPrivileges) (bool, error)
|
||||
Args []string
|
||||
}
|
||||
|
||||
// PluginCreateOptions hold all options to plugin create.
|
||||
type PluginCreateOptions struct {
|
||||
RepoName string
|
||||
}
|
||||
33
vendor/github.com/moby/moby/api/types/system/disk_usage.go
generated
vendored
33
vendor/github.com/moby/moby/api/types/system/disk_usage.go
generated
vendored
@ -7,11 +7,34 @@ import (
|
||||
"github.com/moby/moby/api/types/volume"
|
||||
)
|
||||
|
||||
// DiskUsage contains response of Engine API for API 1.49 and greater:
|
||||
// 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:
|
||||
// GET "/system/df"
|
||||
type DiskUsage struct {
|
||||
Images *image.DiskUsage
|
||||
Containers *container.DiskUsage
|
||||
Volumes *volume.DiskUsage
|
||||
BuildCache *build.CacheDiskUsage
|
||||
LayersSize int64
|
||||
Images []*image.Summary
|
||||
Containers []*container.Summary
|
||||
Volumes []*volume.Volume
|
||||
BuildCache []*build.CacheRecord
|
||||
BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
|
||||
}
|
||||
|
||||
35
vendor/github.com/moby/moby/api/types/types.go
generated
vendored
35
vendor/github.com/moby/moby/api/types/types.go
generated
vendored
@ -2,10 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"github.com/moby/moby/api/types/build"
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/image"
|
||||
"github.com/moby/moby/api/types/swarm"
|
||||
"github.com/moby/moby/api/types/volume"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -61,38 +58,6 @@ type Version struct {
|
||||
BuildTime string `json:",omitempty"`
|
||||
}
|
||||
|
||||
// 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:
|
||||
// GET "/system/df"
|
||||
type DiskUsage struct {
|
||||
LayersSize int64
|
||||
Images []*image.Summary
|
||||
Containers []*container.Summary
|
||||
Volumes []*volume.Volume
|
||||
BuildCache []*build.CacheRecord
|
||||
BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
|
||||
}
|
||||
|
||||
// PushResult contains the tag, manifest digest, and manifest size from the
|
||||
// push. It's used to signal this information to the trust code in the client
|
||||
// so it can sign the manifest if necessary.
|
||||
|
||||
18
vendor/github.com/moby/moby/client/client_interfaces.go
generated
vendored
18
vendor/github.com/moby/moby/client/client_interfaces.go
generated
vendored
@ -64,11 +64,11 @@ type HijackDialer interface {
|
||||
|
||||
// ContainerAPIClient defines API client methods for the containers
|
||||
type ContainerAPIClient interface {
|
||||
ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error)
|
||||
ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (HijackedResponse, error)
|
||||
ContainerCommit(ctx context.Context, container string, options container.CommitOptions) (container.CommitResponse, error)
|
||||
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
|
||||
ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error)
|
||||
ContainerExecAttach(ctx context.Context, execID string, options container.ExecAttachOptions) (types.HijackedResponse, error)
|
||||
ContainerExecAttach(ctx context.Context, execID string, options container.ExecAttachOptions) (HijackedResponse, error)
|
||||
ContainerExecCreate(ctx context.Context, container string, options container.ExecOptions) (container.ExecCreateResponse, error)
|
||||
ContainerExecInspect(ctx context.Context, execID string) (container.ExecInspect, error)
|
||||
ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error
|
||||
@ -148,15 +148,15 @@ type NodeAPIClient interface {
|
||||
// PluginAPIClient defines API client methods for the plugins
|
||||
type PluginAPIClient interface {
|
||||
PluginList(ctx context.Context, filter filters.Args) (types.PluginsListResponse, error)
|
||||
PluginRemove(ctx context.Context, name string, options types.PluginRemoveOptions) error
|
||||
PluginEnable(ctx context.Context, name string, options types.PluginEnableOptions) error
|
||||
PluginDisable(ctx context.Context, name string, options types.PluginDisableOptions) error
|
||||
PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error)
|
||||
PluginUpgrade(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error)
|
||||
PluginRemove(ctx context.Context, name string, options PluginRemoveOptions) error
|
||||
PluginEnable(ctx context.Context, name string, options PluginEnableOptions) error
|
||||
PluginDisable(ctx context.Context, name string, options PluginDisableOptions) error
|
||||
PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (io.ReadCloser, error)
|
||||
PluginUpgrade(ctx context.Context, name string, options PluginInstallOptions) (io.ReadCloser, error)
|
||||
PluginPush(ctx context.Context, name string, registryAuth string) (io.ReadCloser, error)
|
||||
PluginSet(ctx context.Context, name string, args []string) error
|
||||
PluginInspectWithRaw(ctx context.Context, name string) (*types.Plugin, []byte, error)
|
||||
PluginCreate(ctx context.Context, createContext io.Reader, options types.PluginCreateOptions) error
|
||||
PluginCreate(ctx context.Context, createContext io.Reader, options PluginCreateOptions) error
|
||||
}
|
||||
|
||||
// ServiceAPIClient defines API client methods for the services
|
||||
@ -188,7 +188,7 @@ type SystemAPIClient interface {
|
||||
Events(ctx context.Context, options events.ListOptions) (<-chan events.Message, <-chan error)
|
||||
Info(ctx context.Context) (system.Info, error)
|
||||
RegistryLogin(ctx context.Context, auth registry.AuthConfig) (registry.AuthenticateOKBody, error)
|
||||
DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error)
|
||||
DiskUsage(ctx context.Context, options system.DiskUsageOptions) (system.DiskUsage, error)
|
||||
Ping(ctx context.Context) (types.Ping, error)
|
||||
}
|
||||
|
||||
|
||||
5
vendor/github.com/moby/moby/client/container_attach.go
generated
vendored
5
vendor/github.com/moby/moby/client/container_attach.go
generated
vendored
@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
"github.com/moby/moby/api/types/container"
|
||||
)
|
||||
|
||||
@ -33,10 +32,10 @@ import (
|
||||
//
|
||||
// You can use github.com/moby/moby/api/stdcopy.StdCopy to demultiplex this
|
||||
// stream.
|
||||
func (cli *Client) ContainerAttach(ctx context.Context, containerID string, options container.AttachOptions) (types.HijackedResponse, error) {
|
||||
func (cli *Client) ContainerAttach(ctx context.Context, containerID string, options container.AttachOptions) (HijackedResponse, error) {
|
||||
containerID, err := trimID("container", containerID)
|
||||
if err != nil {
|
||||
return types.HijackedResponse{}, err
|
||||
return HijackedResponse{}, err
|
||||
}
|
||||
|
||||
query := url.Values{}
|
||||
|
||||
3
vendor/github.com/moby/moby/client/container_exec.go
generated
vendored
3
vendor/github.com/moby/moby/client/container_exec.go
generated
vendored
@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/versions"
|
||||
)
|
||||
@ -80,7 +79,7 @@ func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config
|
||||
// You can use [github.com/moby/moby/api/stdcopy.StdCopy] to demultiplex this
|
||||
// stream. Refer to [Client.ContainerAttach] for details about the multiplexed
|
||||
// stream.
|
||||
func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config container.ExecAttachOptions) (types.HijackedResponse, error) {
|
||||
func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config container.ExecAttachOptions) (HijackedResponse, error) {
|
||||
if versions.LessThan(cli.ClientVersion(), "1.42") {
|
||||
config.ConsoleSize = nil
|
||||
}
|
||||
|
||||
57
vendor/github.com/moby/moby/client/hijack.go
generated
vendored
57
vendor/github.com/moby/moby/client/hijack.go
generated
vendored
@ -9,25 +9,24 @@ import (
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
"github.com/moby/moby/api/types/versions"
|
||||
"github.com/pkg/errors"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
)
|
||||
|
||||
// postHijacked sends a POST request and hijacks the connection.
|
||||
func (cli *Client) postHijacked(ctx context.Context, path string, query url.Values, body interface{}, headers map[string][]string) (types.HijackedResponse, error) {
|
||||
func (cli *Client) postHijacked(ctx context.Context, path string, query url.Values, body interface{}, headers map[string][]string) (HijackedResponse, error) {
|
||||
jsonBody, err := jsonEncode(body)
|
||||
if err != nil {
|
||||
return types.HijackedResponse{}, err
|
||||
return HijackedResponse{}, err
|
||||
}
|
||||
req, err := cli.buildRequest(ctx, http.MethodPost, cli.getAPIPath(ctx, path, query), jsonBody, headers)
|
||||
if err != nil {
|
||||
return types.HijackedResponse{}, err
|
||||
return HijackedResponse{}, err
|
||||
}
|
||||
conn, mediaType, err := setupHijackConn(cli.dialer(), req, "tcp")
|
||||
if err != nil {
|
||||
return types.HijackedResponse{}, err
|
||||
return HijackedResponse{}, err
|
||||
}
|
||||
|
||||
if versions.LessThan(cli.ClientVersion(), "1.42") {
|
||||
@ -35,7 +34,7 @@ func (cli *Client) postHijacked(ctx context.Context, path string, query url.Valu
|
||||
mediaType = ""
|
||||
}
|
||||
|
||||
return types.NewHijackedResponse(conn, mediaType), nil
|
||||
return NewHijackedResponse(conn, mediaType), nil
|
||||
}
|
||||
|
||||
// DialHijack returns a hijacked connection with negotiated protocol proto.
|
||||
@ -91,7 +90,7 @@ func setupHijackConn(dialer func(context.Context) (net.Conn, error), req *http.R
|
||||
// If there is buffered content, wrap the connection. We return an
|
||||
// object that implements CloseWrite if the underlying connection
|
||||
// implements it.
|
||||
if _, ok := hc.Conn.(types.CloseWriter); ok {
|
||||
if _, ok := hc.Conn.(CloseWriter); ok {
|
||||
conn = &hijackedConnCloseWriter{hc}
|
||||
} else {
|
||||
conn = hc
|
||||
@ -131,9 +130,49 @@ type hijackedConnCloseWriter struct {
|
||||
*hijackedConn
|
||||
}
|
||||
|
||||
var _ types.CloseWriter = &hijackedConnCloseWriter{}
|
||||
var _ CloseWriter = &hijackedConnCloseWriter{}
|
||||
|
||||
func (c *hijackedConnCloseWriter) CloseWrite() error {
|
||||
conn := c.Conn.(types.CloseWriter)
|
||||
conn := c.Conn.(CloseWriter)
|
||||
return conn.CloseWrite()
|
||||
}
|
||||
|
||||
// NewHijackedResponse initializes 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.
|
||||
type HijackedResponse struct {
|
||||
mediaType string
|
||||
Conn net.Conn
|
||||
Reader *bufio.Reader
|
||||
}
|
||||
|
||||
// Close closes the hijacked connection and reader.
|
||||
func (h *HijackedResponse) 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
|
||||
// that close input streams to prevent from writing.
|
||||
type CloseWriter interface {
|
||||
CloseWrite() error
|
||||
}
|
||||
|
||||
// CloseWrite closes a readWriter for writing.
|
||||
func (h *HijackedResponse) CloseWrite() error {
|
||||
if conn, ok := h.Conn.(CloseWriter); ok {
|
||||
return conn.CloseWrite()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
9
vendor/github.com/moby/moby/client/plugin_create.go
generated
vendored
9
vendor/github.com/moby/moby/client/plugin_create.go
generated
vendored
@ -5,12 +5,15 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
)
|
||||
|
||||
// PluginCreateOptions hold all options to plugin create.
|
||||
type PluginCreateOptions struct {
|
||||
RepoName string
|
||||
}
|
||||
|
||||
// PluginCreate creates a plugin
|
||||
func (cli *Client) PluginCreate(ctx context.Context, createContext io.Reader, createOptions types.PluginCreateOptions) error {
|
||||
func (cli *Client) PluginCreate(ctx context.Context, createContext io.Reader, createOptions PluginCreateOptions) error {
|
||||
headers := http.Header(make(map[string][]string))
|
||||
headers.Set("Content-Type", "application/x-tar")
|
||||
|
||||
|
||||
9
vendor/github.com/moby/moby/client/plugin_disable.go
generated
vendored
9
vendor/github.com/moby/moby/client/plugin_disable.go
generated
vendored
@ -3,12 +3,15 @@ package client
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
)
|
||||
|
||||
// PluginDisableOptions holds parameters to disable plugins.
|
||||
type PluginDisableOptions struct {
|
||||
Force bool
|
||||
}
|
||||
|
||||
// PluginDisable disables a plugin
|
||||
func (cli *Client) PluginDisable(ctx context.Context, name string, options types.PluginDisableOptions) error {
|
||||
func (cli *Client) PluginDisable(ctx context.Context, name string, options PluginDisableOptions) error {
|
||||
name, err := trimID("plugin", name)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
9
vendor/github.com/moby/moby/client/plugin_enable.go
generated
vendored
9
vendor/github.com/moby/moby/client/plugin_enable.go
generated
vendored
@ -4,12 +4,15 @@ import (
|
||||
"context"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
)
|
||||
|
||||
// PluginEnableOptions holds parameters to enable plugins.
|
||||
type PluginEnableOptions struct {
|
||||
Timeout int
|
||||
}
|
||||
|
||||
// PluginEnable enables a plugin
|
||||
func (cli *Client) PluginEnable(ctx context.Context, name string, options types.PluginEnableOptions) error {
|
||||
func (cli *Client) PluginEnable(ctx context.Context, name string, options PluginEnableOptions) error {
|
||||
name, err := trimID("plugin", name)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
24
vendor/github.com/moby/moby/client/plugin_install.go
generated
vendored
24
vendor/github.com/moby/moby/client/plugin_install.go
generated
vendored
@ -14,8 +14,26 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// PluginInstallOptions holds parameters to install a plugin.
|
||||
type PluginInstallOptions struct {
|
||||
Disabled bool
|
||||
AcceptAllPermissions bool
|
||||
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
|
||||
RemoteRef string // RemoteRef is the plugin name on the registry
|
||||
|
||||
// PrivilegeFunc is a function that clients can supply to retry operations
|
||||
// after getting an authorization error. This function returns the registry
|
||||
// authentication header value in base64 encoded format, or an error if the
|
||||
// privilege request fails.
|
||||
//
|
||||
// For details, refer to [github.com/moby/moby/api/types/registry.RequestAuthConfig].
|
||||
PrivilegeFunc func(context.Context) (string, error)
|
||||
AcceptPermissionsFunc func(context.Context, types.PluginPrivileges) (bool, error)
|
||||
Args []string
|
||||
}
|
||||
|
||||
// PluginInstall installs a plugin
|
||||
func (cli *Client) PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (_ io.ReadCloser, retErr error) {
|
||||
func (cli *Client) PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (_ io.ReadCloser, retErr error) {
|
||||
query := url.Values{}
|
||||
if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil {
|
||||
return nil, errors.Wrap(err, "invalid remote reference")
|
||||
@ -62,7 +80,7 @@ func (cli *Client) PluginInstall(ctx context.Context, name string, options types
|
||||
return
|
||||
}
|
||||
|
||||
enableErr := cli.PluginEnable(ctx, name, types.PluginEnableOptions{Timeout: 0})
|
||||
enableErr := cli.PluginEnable(ctx, name, PluginEnableOptions{Timeout: 0})
|
||||
_ = pw.CloseWithError(enableErr)
|
||||
}()
|
||||
return pr, nil
|
||||
@ -80,7 +98,7 @@ func (cli *Client) tryPluginPull(ctx context.Context, query url.Values, privileg
|
||||
})
|
||||
}
|
||||
|
||||
func (cli *Client) checkPluginPermissions(ctx context.Context, query url.Values, options types.PluginInstallOptions) (types.PluginPrivileges, error) {
|
||||
func (cli *Client) checkPluginPermissions(ctx context.Context, query url.Values, options PluginInstallOptions) (types.PluginPrivileges, error) {
|
||||
resp, err := cli.tryPluginPrivileges(ctx, query, options.RegistryAuth)
|
||||
if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil {
|
||||
// todo: do inspect before to check existing name before checking privileges
|
||||
|
||||
9
vendor/github.com/moby/moby/client/plugin_remove.go
generated
vendored
9
vendor/github.com/moby/moby/client/plugin_remove.go
generated
vendored
@ -3,12 +3,15 @@ package client
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
)
|
||||
|
||||
// PluginRemoveOptions holds parameters to remove plugins.
|
||||
type PluginRemoveOptions struct {
|
||||
Force bool
|
||||
}
|
||||
|
||||
// PluginRemove removes a plugin
|
||||
func (cli *Client) PluginRemove(ctx context.Context, name string, options types.PluginRemoveOptions) error {
|
||||
func (cli *Client) PluginRemove(ctx context.Context, name string, options PluginRemoveOptions) error {
|
||||
name, err := trimID("plugin", name)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
2
vendor/github.com/moby/moby/client/plugin_upgrade.go
generated
vendored
2
vendor/github.com/moby/moby/client/plugin_upgrade.go
generated
vendored
@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// PluginUpgrade upgrades a plugin
|
||||
func (cli *Client) PluginUpgrade(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error) {
|
||||
func (cli *Client) PluginUpgrade(ctx context.Context, name string, options PluginInstallOptions) (io.ReadCloser, error) {
|
||||
name, err := trimID("plugin", name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@ -6,11 +6,11 @@ import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/moby/moby/api/types"
|
||||
"github.com/moby/moby/api/types/system"
|
||||
)
|
||||
|
||||
// DiskUsage requests the current data usage from the daemon
|
||||
func (cli *Client) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error) {
|
||||
func (cli *Client) DiskUsage(ctx context.Context, options system.DiskUsageOptions) (system.DiskUsage, error) {
|
||||
var query url.Values
|
||||
if len(options.Types) > 0 {
|
||||
query = url.Values{}
|
||||
@ -22,12 +22,12 @@ func (cli *Client) DiskUsage(ctx context.Context, options types.DiskUsageOptions
|
||||
resp, err := cli.get(ctx, "/system/df", query, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
if err != nil {
|
||||
return types.DiskUsage{}, err
|
||||
return system.DiskUsage{}, err
|
||||
}
|
||||
|
||||
var du types.DiskUsage
|
||||
var du system.DiskUsage
|
||||
if err := json.NewDecoder(resp.Body).Decode(&du); err != nil {
|
||||
return types.DiskUsage{}, fmt.Errorf("Error retrieving disk usage: %v", err)
|
||||
return system.DiskUsage{}, fmt.Errorf("Error retrieving disk usage: %v", err)
|
||||
}
|
||||
return du, nil
|
||||
}
|
||||
Reference in New Issue
Block a user