diff --git a/cli/command/container/attach.go b/cli/command/container/attach.go index 60e5da3b48..287159b97e 100644 --- a/cli/command/container/attach.go +++ b/cli/command/container/attach.go @@ -142,7 +142,7 @@ func runAttach(dockerCli command.Cli, opts *attachOptions) error { return getExitStatus(errC, resultC) } -func getExitStatus(errC <-chan error, resultC <-chan container.ContainerWaitOKBody) error { +func getExitStatus(errC <-chan error, resultC <-chan container.WaitResponse) error { select { case result := <-resultC: if result.Error != nil { diff --git a/cli/command/container/attach_test.go b/cli/command/container/attach_test.go index d0b45a6827..b0aaea688c 100644 --- a/cli/command/container/attach_test.go +++ b/cli/command/container/attach_test.go @@ -81,16 +81,16 @@ func TestGetExitStatus(t *testing.T) { var ( expectedErr = fmt.Errorf("unexpected error") errC = make(chan error, 1) - resultC = make(chan container.ContainerWaitOKBody, 1) + resultC = make(chan container.WaitResponse, 1) ) testcases := []struct { - result *container.ContainerWaitOKBody + result *container.WaitResponse err error expectedError error }{ { - result: &container.ContainerWaitOKBody{ + result: &container.WaitResponse{ StatusCode: 0, }, }, @@ -99,13 +99,13 @@ func TestGetExitStatus(t *testing.T) { expectedError: expectedErr, }, { - result: &container.ContainerWaitOKBody{ - Error: &container.ContainerWaitOKBodyError{Message: expectedErr.Error()}, + result: &container.WaitResponse{ + Error: &container.WaitExitError{Message: expectedErr.Error()}, }, expectedError: expectedErr, }, { - result: &container.ContainerWaitOKBody{ + result: &container.WaitResponse{ StatusCode: 15, }, expectedError: cli.StatusError{StatusCode: 15}, diff --git a/cli/command/container/client_test.go b/cli/command/container/client_test.go index 6aa7d9991e..e8085367ef 100644 --- a/cli/command/container/client_test.go +++ b/cli/command/container/client_test.go @@ -20,14 +20,14 @@ type fakeClient struct { hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, - containerName string) (container.ContainerCreateCreatedBody, error) + containerName string) (container.CreateResponse, error) containerStartFunc func(container string, options types.ContainerStartOptions) error imageCreateFunc func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) infoFunc func() (types.Info, error) containerStatPathFunc func(container, path string) (types.ContainerPathStat, error) containerCopyFromFunc func(container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) logFunc func(string, types.ContainerLogsOptions) (io.ReadCloser, error) - waitFunc func(string) (<-chan container.ContainerWaitOKBody, <-chan error) + waitFunc func(string) (<-chan container.WaitResponse, <-chan error) containerListFunc func(types.ContainerListOptions) ([]types.Container, error) containerExportFunc func(string) (io.ReadCloser, error) containerExecResizeFunc func(id string, options types.ResizeOptions) error @@ -75,11 +75,11 @@ func (f *fakeClient) ContainerCreate( networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string, -) (container.ContainerCreateCreatedBody, error) { +) (container.CreateResponse, error) { if f.createContainerFunc != nil { return f.createContainerFunc(config, hostConfig, networkingConfig, platform, containerName) } - return container.ContainerCreateCreatedBody{}, nil + return container.CreateResponse{}, nil } func (f *fakeClient) ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error { @@ -128,7 +128,7 @@ func (f *fakeClient) ClientVersion() string { return f.Version } -func (f *fakeClient) ContainerWait(_ context.Context, container string, _ container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error) { +func (f *fakeClient) ContainerWait(_ context.Context, container string, _ container.WaitCondition) (<-chan container.WaitResponse, <-chan error) { if f.waitFunc != nil { return f.waitFunc(container) } diff --git a/cli/command/container/create.go b/cli/command/container/create.go index 6abbb4a4a1..b8bf86e2ac 100644 --- a/cli/command/container/create.go +++ b/cli/command/container/create.go @@ -191,7 +191,7 @@ func newCIDFile(path string) (*cidFile, error) { } // nolint: gocyclo -func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig *containerConfig, opts *createOptions) (*container.ContainerCreateCreatedBody, error) { +func createContainer(ctx context.Context, dockerCli command.Cli, containerConfig *containerConfig, opts *createOptions) (*container.CreateResponse, error) { config := containerConfig.Config hostConfig := containerConfig.HostConfig networkingConfig := containerConfig.NetworkingConfig diff --git a/cli/command/container/create_test.go b/cli/command/container/create_test.go index 3634c194d2..05c1d87b4b 100644 --- a/cli/command/container/create_test.go +++ b/cli/command/container/create_test.go @@ -88,18 +88,18 @@ func TestCreateContainerImagePullPolicy(t *testing.T) { cases := []struct { PullPolicy string ExpectedPulls int - ExpectedBody container.ContainerCreateCreatedBody + ExpectedBody container.CreateResponse ExpectedErrMsg string ResponseCounter int }{ { PullPolicy: PullImageMissing, ExpectedPulls: 1, - ExpectedBody: container.ContainerCreateCreatedBody{ID: containerID}, + ExpectedBody: container.CreateResponse{ID: containerID}, }, { PullPolicy: PullImageAlways, ExpectedPulls: 1, - ExpectedBody: container.ContainerCreateCreatedBody{ID: containerID}, + ExpectedBody: container.CreateResponse{ID: containerID}, ResponseCounter: 1, // This lets us return a container on the first pull }, { PullPolicy: PullImageNever, @@ -118,13 +118,13 @@ func TestCreateContainerImagePullPolicy(t *testing.T) { networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string, - ) (container.ContainerCreateCreatedBody, error) { + ) (container.CreateResponse, error) { defer func() { c.ResponseCounter++ }() switch c.ResponseCounter { case 0: - return container.ContainerCreateCreatedBody{}, fakeNotFound{} + return container.CreateResponse{}, fakeNotFound{} default: - return container.ContainerCreateCreatedBody{ID: containerID}, nil + return container.CreateResponse{ID: containerID}, nil } }, imageCreateFunc: func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { @@ -187,8 +187,8 @@ func TestNewCreateCommandWithContentTrustErrors(t *testing.T) { networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string, - ) (container.ContainerCreateCreatedBody, error) { - return container.ContainerCreateCreatedBody{}, fmt.Errorf("shouldn't try to pull image") + ) (container.CreateResponse, error) { + return container.CreateResponse{}, fmt.Errorf("shouldn't try to pull image") }, }, test.EnableContentTrust) cli.SetNotaryClient(tc.notaryFunc) @@ -248,8 +248,8 @@ func TestNewCreateCommandWithWarnings(t *testing.T) { networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string, - ) (container.ContainerCreateCreatedBody, error) { - return container.ContainerCreateCreatedBody{}, nil + ) (container.CreateResponse, error) { + return container.CreateResponse{}, nil }, }) cmd := NewCreateCommand(cli) @@ -287,10 +287,10 @@ func TestCreateContainerWithProxyConfig(t *testing.T) { networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string, - ) (container.ContainerCreateCreatedBody, error) { + ) (container.CreateResponse, error) { sort.Strings(config.Env) assert.DeepEqual(t, config.Env, expected) - return container.ContainerCreateCreatedBody{}, nil + return container.CreateResponse{}, nil }, }) cli.SetConfigFile(&configfile.ConfigFile{ diff --git a/cli/command/container/restart.go b/cli/command/container/restart.go index 6e02ee46d1..b13bfe52da 100644 --- a/cli/command/container/restart.go +++ b/cli/command/container/restart.go @@ -4,10 +4,10 @@ import ( "context" "fmt" "strings" - "time" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" + "github.com/docker/docker/api/types/container" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -42,18 +42,19 @@ func NewRestartCommand(dockerCli command.Cli) *cobra.Command { func runRestart(dockerCli command.Cli, opts *restartOptions) error { ctx := context.Background() var errs []string - var timeout *time.Duration + var timeout *int if opts.nSecondsChanged { - timeoutValue := time.Duration(opts.nSeconds) * time.Second - timeout = &timeoutValue + timeout = &opts.nSeconds } - for _, name := range opts.containers { - if err := dockerCli.Client().ContainerRestart(ctx, name, timeout); err != nil { + err := dockerCli.Client().ContainerRestart(ctx, name, container.StopOptions{ + Timeout: timeout, + }) + if err != nil { errs = append(errs, err.Error()) continue } - fmt.Fprintln(dockerCli.Out(), name) + _, _ = fmt.Fprintln(dockerCli.Out(), name) } if len(errs) > 0 { return errors.New(strings.Join(errs, "\n")) diff --git a/cli/command/container/run_test.go b/cli/command/container/run_test.go index 1b81eb4dad..1ac353fe86 100644 --- a/cli/command/container/run_test.go +++ b/cli/command/container/run_test.go @@ -16,8 +16,8 @@ import ( func TestRunLabel(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ *specs.Platform, _ string) (container.ContainerCreateCreatedBody, error) { - return container.ContainerCreateCreatedBody{ + createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ *specs.Platform, _ string) (container.CreateResponse, error) { + return container.CreateResponse{ ID: "id", }, nil }, @@ -61,8 +61,8 @@ func TestRunCommandWithContentTrustErrors(t *testing.T) { networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string, - ) (container.ContainerCreateCreatedBody, error) { - return container.ContainerCreateCreatedBody{}, fmt.Errorf("shouldn't try to pull image") + ) (container.CreateResponse, error) { + return container.CreateResponse{}, fmt.Errorf("shouldn't try to pull image") }, }, test.EnableContentTrust) cli.SetNotaryClient(tc.notaryFunc) diff --git a/cli/command/container/stop.go b/cli/command/container/stop.go index e299175436..e7a7df7984 100644 --- a/cli/command/container/stop.go +++ b/cli/command/container/stop.go @@ -4,10 +4,10 @@ import ( "context" "fmt" "strings" - "time" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" + "github.com/docker/docker/api/types/container" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -40,25 +40,23 @@ func NewStopCommand(dockerCli command.Cli) *cobra.Command { } func runStop(dockerCli command.Cli, opts *stopOptions) error { - ctx := context.Background() - - var timeout *time.Duration + var timeout *int if opts.timeChanged { - timeoutValue := time.Duration(opts.time) * time.Second - timeout = &timeoutValue + timeout = &opts.time } - var errs []string - - errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, id string) error { - return dockerCli.Client().ContainerStop(ctx, id, timeout) + errChan := parallelOperation(context.Background(), opts.containers, func(ctx context.Context, id string) error { + return dockerCli.Client().ContainerStop(ctx, id, container.StopOptions{ + Timeout: timeout, + }) }) - for _, container := range opts.containers { + var errs []string + for _, ctr := range opts.containers { if err := <-errChan; err != nil { errs = append(errs, err.Error()) continue } - fmt.Fprintln(dockerCli.Out(), container) + _, _ = fmt.Fprintln(dockerCli.Out(), ctr) } if len(errs) > 0 { return errors.New(strings.Join(errs, "\n")) diff --git a/cli/command/container/utils_test.go b/cli/command/container/utils_test.go index a7151b3346..295b347882 100644 --- a/cli/command/container/utils_test.go +++ b/cli/command/container/utils_test.go @@ -13,10 +13,10 @@ import ( is "gotest.tools/v3/assert/cmp" ) -func waitFn(cid string) (<-chan container.ContainerWaitOKBody, <-chan error) { - resC := make(chan container.ContainerWaitOKBody) +func waitFn(cid string) (<-chan container.WaitResponse, <-chan error) { + resC := make(chan container.WaitResponse) errC := make(chan error, 1) - var res container.ContainerWaitOKBody + var res container.WaitResponse go func() { switch { @@ -24,10 +24,10 @@ func waitFn(cid string) (<-chan container.ContainerWaitOKBody, <-chan error) { res.StatusCode = 42 resC <- res case strings.Contains(cid, "non-existent"): - err := errors.Errorf("No such container: %v", cid) + err := errors.Errorf("no such container: %v", cid) errC <- err case strings.Contains(cid, "wait-error"): - res.Error = &container.ContainerWaitOKBodyError{Message: "removal failed"} + res.Error = &container.WaitExitError{Message: "removal failed"} resC <- res default: // normal exit diff --git a/cli/command/formatter/disk_usage.go b/cli/command/formatter/disk_usage.go index dd3f9676af..cd8119076b 100644 --- a/cli/command/formatter/disk_usage.go +++ b/cli/command/formatter/disk_usage.go @@ -3,11 +3,13 @@ package formatter import ( "bytes" "fmt" + "strconv" "strings" "text/template" "github.com/docker/distribution/reference" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/volume" units "github.com/docker/go-units" ) @@ -34,7 +36,7 @@ type DiskUsageContext struct { LayersSize int64 Images []*types.ImageSummary Containers []*types.Container - Volumes []*types.Volume + Volumes []*volume.Volume BuildCache []*types.BuildCache BuilderSize int64 } @@ -271,7 +273,7 @@ func (c *diskUsageImagesContext) Type() string { } func (c *diskUsageImagesContext) TotalCount() string { - return fmt.Sprintf("%d", len(c.images)) + return strconv.Itoa(len(c.images)) } func (c *diskUsageImagesContext) Active() string { @@ -282,7 +284,7 @@ func (c *diskUsageImagesContext) Active() string { } } - return fmt.Sprintf("%d", used) + return strconv.Itoa(used) } func (c *diskUsageImagesContext) Size() string { @@ -323,7 +325,7 @@ func (c *diskUsageContainersContext) Type() string { } func (c *diskUsageContainersContext) TotalCount() string { - return fmt.Sprintf("%d", len(c.containers)) + return strconv.Itoa(len(c.containers)) } func (c *diskUsageContainersContext) isActive(container types.Container) bool { @@ -340,7 +342,7 @@ func (c *diskUsageContainersContext) Active() string { } } - return fmt.Sprintf("%d", used) + return strconv.Itoa(used) } func (c *diskUsageContainersContext) Size() string { @@ -373,7 +375,7 @@ func (c *diskUsageContainersContext) Reclaimable() string { type diskUsageVolumesContext struct { HeaderContext - volumes []*types.Volume + volumes []*volume.Volume } func (c *diskUsageVolumesContext) MarshalJSON() ([]byte, error) { @@ -385,7 +387,7 @@ func (c *diskUsageVolumesContext) Type() string { } func (c *diskUsageVolumesContext) TotalCount() string { - return fmt.Sprintf("%d", len(c.volumes)) + return strconv.Itoa(len(c.volumes)) } func (c *diskUsageVolumesContext) Active() string { @@ -397,7 +399,7 @@ func (c *diskUsageVolumesContext) Active() string { } } - return fmt.Sprintf("%d", used) + return strconv.Itoa(used) } func (c *diskUsageVolumesContext) Size() string { @@ -447,7 +449,7 @@ func (c *diskUsageBuilderContext) Type() string { } func (c *diskUsageBuilderContext) TotalCount() string { - return fmt.Sprintf("%d", len(c.buildCache)) + return strconv.Itoa(len(c.buildCache)) } func (c *diskUsageBuilderContext) Active() string { @@ -457,7 +459,7 @@ func (c *diskUsageBuilderContext) Active() string { numActive++ } } - return fmt.Sprintf("%d", numActive) + return strconv.Itoa(numActive) } func (c *diskUsageBuilderContext) Size() string { diff --git a/cli/command/formatter/volume.go b/cli/command/formatter/volume.go index 67144591da..1309061aba 100644 --- a/cli/command/formatter/volume.go +++ b/cli/command/formatter/volume.go @@ -1,10 +1,10 @@ package formatter import ( - "fmt" + "strconv" "strings" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/volume" units "github.com/docker/go-units" ) @@ -36,10 +36,10 @@ func NewVolumeFormat(source string, quiet bool) Format { } // VolumeWrite writes formatted volumes using the Context -func VolumeWrite(ctx Context, volumes []*types.Volume) error { +func VolumeWrite(ctx Context, volumes []*volume.Volume) error { render := func(format func(subContext SubContext) error) error { - for _, volume := range volumes { - if err := format(&volumeContext{v: *volume}); err != nil { + for _, vol := range volumes { + if err := format(&volumeContext{v: *vol}); err != nil { return err } } @@ -50,7 +50,7 @@ func VolumeWrite(ctx Context, volumes []*types.Volume) error { type volumeContext struct { HeaderContext - v types.Volume + v volume.Volume } func newVolumeContext() *volumeContext { @@ -94,7 +94,7 @@ func (c *volumeContext) Labels() string { var joinLabels []string for k, v := range c.v.Labels { - joinLabels = append(joinLabels, fmt.Sprintf("%s=%s", k, v)) + joinLabels = append(joinLabels, k+"="+v) } return strings.Join(joinLabels, ",") } @@ -110,7 +110,7 @@ func (c *volumeContext) Links() string { if c.v.UsageData == nil { return "N/A" } - return fmt.Sprintf("%d", c.v.UsageData.RefCount) + return strconv.FormatInt(c.v.UsageData.RefCount, 10) } func (c *volumeContext) Size() string { diff --git a/cli/command/formatter/volume_test.go b/cli/command/formatter/volume_test.go index b34dc74676..01e17500ca 100644 --- a/cli/command/formatter/volume_test.go +++ b/cli/command/formatter/volume_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/volume" "github.com/docker/docker/pkg/stringid" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -24,22 +24,22 @@ func TestVolumeContext(t *testing.T) { call func() string }{ {volumeContext{ - v: types.Volume{Name: volumeName}, + v: volume.Volume{Name: volumeName}, }, volumeName, ctx.Name}, {volumeContext{ - v: types.Volume{Driver: "driver_name"}, + v: volume.Volume{Driver: "driver_name"}, }, "driver_name", ctx.Driver}, {volumeContext{ - v: types.Volume{Scope: "local"}, + v: volume.Volume{Scope: "local"}, }, "local", ctx.Scope}, {volumeContext{ - v: types.Volume{Mountpoint: "mountpoint"}, + v: volume.Volume{Mountpoint: "mountpoint"}, }, "mountpoint", ctx.Mountpoint}, {volumeContext{ - v: types.Volume{}, + v: volume.Volume{}, }, "", ctx.Labels}, {volumeContext{ - v: types.Volume{Labels: map[string]string{"label1": "value1", "label2": "value2"}}, + v: volume.Volume{Labels: map[string]string{"label1": "value1", "label2": "value2"}}, }, "label1=value1,label2=value2", ctx.Labels}, } @@ -122,7 +122,7 @@ foobar_bar }, } - volumes := []*types.Volume{ + volumes := []*volume.Volume{ {Name: "foobar_baz", Driver: "foo"}, {Name: "foobar_bar", Driver: "bar"}, } @@ -143,7 +143,7 @@ foobar_bar } func TestVolumeContextWriteJSON(t *testing.T) { - volumes := []*types.Volume{ + volumes := []*volume.Volume{ {Driver: "foo", Name: "foobar_baz"}, {Driver: "bar", Name: "foobar_bar"}, } @@ -166,7 +166,7 @@ func TestVolumeContextWriteJSON(t *testing.T) { } func TestVolumeContextWriteJSONField(t *testing.T) { - volumes := []*types.Volume{ + volumes := []*volume.Volume{ {Driver: "foo", Name: "foobar_baz"}, {Driver: "bar", Name: "foobar_bar"}, } diff --git a/cli/command/image/build.go b/cli/command/image/build.go index 99307e256b..7692109827 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -22,12 +22,12 @@ import ( "github.com/docker/docker/api" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/builder/remotecontext/urlutil" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/pkg/progress" "github.com/docker/docker/pkg/streamformatter" - "github.com/docker/docker/pkg/urlutil" units "github.com/docker/go-units" "github.com/pkg/errors" "github.com/spf13/cobra" diff --git a/cli/command/volume/client_test.go b/cli/command/volume/client_test.go index 644cad6031..ff662ef0c6 100644 --- a/cli/command/volume/client_test.go +++ b/cli/command/volume/client_test.go @@ -5,48 +5,48 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" - volumetypes "github.com/docker/docker/api/types/volume" + "github.com/docker/docker/api/types/volume" "github.com/docker/docker/client" ) type fakeClient struct { client.Client - volumeCreateFunc func(volumetypes.VolumeCreateBody) (types.Volume, error) - volumeInspectFunc func(volumeID string) (types.Volume, error) - volumeListFunc func(filter filters.Args) (volumetypes.VolumeListOKBody, error) + volumeCreateFunc func(volume.CreateOptions) (volume.Volume, error) + volumeInspectFunc func(volumeID string) (volume.Volume, error) + volumeListFunc func(filter filters.Args) (volume.ListResponse, error) volumeRemoveFunc func(volumeID string, force bool) error volumePruneFunc func(filter filters.Args) (types.VolumesPruneReport, error) } -func (c *fakeClient) VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (types.Volume, error) { +func (c *fakeClient) VolumeCreate(_ context.Context, options volume.CreateOptions) (volume.Volume, error) { if c.volumeCreateFunc != nil { return c.volumeCreateFunc(options) } - return types.Volume{}, nil + return volume.Volume{}, nil } -func (c *fakeClient) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) { +func (c *fakeClient) VolumeInspect(_ context.Context, volumeID string) (volume.Volume, error) { if c.volumeInspectFunc != nil { return c.volumeInspectFunc(volumeID) } - return types.Volume{}, nil + return volume.Volume{}, nil } -func (c *fakeClient) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error) { +func (c *fakeClient) VolumeList(_ context.Context, filter filters.Args) (volume.ListResponse, error) { if c.volumeListFunc != nil { return c.volumeListFunc(filter) } - return volumetypes.VolumeListOKBody{}, nil + return volume.ListResponse{}, nil } -func (c *fakeClient) VolumesPrune(ctx context.Context, filter filters.Args) (types.VolumesPruneReport, error) { +func (c *fakeClient) VolumesPrune(_ context.Context, filter filters.Args) (types.VolumesPruneReport, error) { if c.volumePruneFunc != nil { return c.volumePruneFunc(filter) } return types.VolumesPruneReport{}, nil } -func (c *fakeClient) VolumeRemove(ctx context.Context, volumeID string, force bool) error { +func (c *fakeClient) VolumeRemove(_ context.Context, volumeID string, force bool) error { if c.volumeRemoveFunc != nil { return c.volumeRemoveFunc(volumeID, force) } diff --git a/cli/command/volume/create.go b/cli/command/volume/create.go index 180cea6928..12a2a3ad02 100644 --- a/cli/command/volume/create.go +++ b/cli/command/volume/create.go @@ -7,7 +7,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/docker/cli/opts" - volumetypes "github.com/docker/docker/api/types/volume" + "github.com/docker/docker/api/types/volume" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -50,20 +50,16 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command { } func runCreate(dockerCli command.Cli, options createOptions) error { - client := dockerCli.Client() - - volReq := volumetypes.VolumeCreateBody{ + vol, err := dockerCli.Client().VolumeCreate(context.Background(), volume.CreateOptions{ Driver: options.driver, DriverOpts: options.driverOpts.GetAll(), Name: options.name, Labels: opts.ConvertKVStringsToMap(options.labels.GetAll()), - } - - vol, err := client.VolumeCreate(context.Background(), volReq) + }) if err != nil { return err } - fmt.Fprintf(dockerCli.Out(), "%s\n", vol.Name) + _, _ = fmt.Fprintln(dockerCli.Out(), vol.Name) return nil } diff --git a/cli/command/volume/create_test.go b/cli/command/volume/create_test.go index 875253b5c8..43168d9570 100644 --- a/cli/command/volume/create_test.go +++ b/cli/command/volume/create_test.go @@ -7,8 +7,7 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - volumetypes "github.com/docker/docker/api/types/volume" + "github.com/docker/docker/api/types/volume" "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -18,7 +17,7 @@ func TestVolumeCreateErrors(t *testing.T) { testCases := []struct { args []string flags map[string]string - volumeCreateFunc func(volumetypes.VolumeCreateBody) (types.Volume, error) + volumeCreateFunc func(volume.CreateOptions) (volume.Volume, error) expectedError string }{ { @@ -33,8 +32,8 @@ func TestVolumeCreateErrors(t *testing.T) { expectedError: "requires at most 1 argument", }, { - volumeCreateFunc: func(createBody volumetypes.VolumeCreateBody) (types.Volume, error) { - return types.Volume{}, errors.Errorf("error creating volume") + volumeCreateFunc: func(createBody volume.CreateOptions) (volume.Volume, error) { + return volume.Volume{}, errors.Errorf("error creating volume") }, expectedError: "error creating volume", }, @@ -57,11 +56,11 @@ func TestVolumeCreateErrors(t *testing.T) { func TestVolumeCreateWithName(t *testing.T) { name := "foo" cli := test.NewFakeCli(&fakeClient{ - volumeCreateFunc: func(body volumetypes.VolumeCreateBody) (types.Volume, error) { + volumeCreateFunc: func(body volume.CreateOptions) (volume.Volume, error) { if body.Name != name { - return types.Volume{}, errors.Errorf("expected name %q, got %q", name, body.Name) + return volume.Volume{}, errors.Errorf("expected name %q, got %q", name, body.Name) } - return types.Volume{ + return volume.Volume{ Name: body.Name, }, nil }, @@ -96,20 +95,20 @@ func TestVolumeCreateWithFlags(t *testing.T) { name := "banana" cli := test.NewFakeCli(&fakeClient{ - volumeCreateFunc: func(body volumetypes.VolumeCreateBody) (types.Volume, error) { + volumeCreateFunc: func(body volume.CreateOptions) (volume.Volume, error) { if body.Name != "" { - return types.Volume{}, errors.Errorf("expected empty name, got %q", body.Name) + return volume.Volume{}, errors.Errorf("expected empty name, got %q", body.Name) } if body.Driver != expectedDriver { - return types.Volume{}, errors.Errorf("expected driver %q, got %q", expectedDriver, body.Driver) + return volume.Volume{}, errors.Errorf("expected driver %q, got %q", expectedDriver, body.Driver) } if !reflect.DeepEqual(body.DriverOpts, expectedOpts) { - return types.Volume{}, errors.Errorf("expected drivers opts %v, got %v", expectedOpts, body.DriverOpts) + return volume.Volume{}, errors.Errorf("expected drivers opts %v, got %v", expectedOpts, body.DriverOpts) } if !reflect.DeepEqual(body.Labels, expectedLabels) { - return types.Volume{}, errors.Errorf("expected labels %v, got %v", expectedLabels, body.Labels) + return volume.Volume{}, errors.Errorf("expected labels %v, got %v", expectedLabels, body.Labels) } - return types.Volume{ + return volume.Volume{ Name: name, }, nil }, diff --git a/cli/command/volume/inspect_test.go b/cli/command/volume/inspect_test.go index 40ab82c50b..0389a0203a 100644 --- a/cli/command/volume/inspect_test.go +++ b/cli/command/volume/inspect_test.go @@ -7,7 +7,7 @@ import ( "github.com/docker/cli/internal/test" . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/volume" "github.com/pkg/errors" "gotest.tools/v3/assert" "gotest.tools/v3/golden" @@ -17,7 +17,7 @@ func TestVolumeInspectErrors(t *testing.T) { testCases := []struct { args []string flags map[string]string - volumeInspectFunc func(volumeID string) (types.Volume, error) + volumeInspectFunc func(volumeID string) (volume.Volume, error) expectedError string }{ { @@ -25,8 +25,8 @@ func TestVolumeInspectErrors(t *testing.T) { }, { args: []string{"foo"}, - volumeInspectFunc: func(volumeID string) (types.Volume, error) { - return types.Volume{}, errors.Errorf("error while inspecting the volume") + volumeInspectFunc: func(volumeID string) (volume.Volume, error) { + return volume.Volume{}, errors.Errorf("error while inspecting the volume") }, expectedError: "error while inspecting the volume", }, @@ -39,13 +39,13 @@ func TestVolumeInspectErrors(t *testing.T) { }, { args: []string{"foo", "bar"}, - volumeInspectFunc: func(volumeID string) (types.Volume, error) { + volumeInspectFunc: func(volumeID string) (volume.Volume, error) { if volumeID == "foo" { - return types.Volume{ + return volume.Volume{ Name: "foo", }, nil } - return types.Volume{}, errors.Errorf("error while inspecting the volume") + return volume.Volume{}, errors.Errorf("error while inspecting the volume") }, expectedError: "error while inspecting the volume", }, @@ -69,14 +69,14 @@ func TestVolumeInspectWithoutFormat(t *testing.T) { testCases := []struct { name string args []string - volumeInspectFunc func(volumeID string) (types.Volume, error) + volumeInspectFunc func(volumeID string) (volume.Volume, error) }{ { name: "single-volume", args: []string{"foo"}, - volumeInspectFunc: func(volumeID string) (types.Volume, error) { + volumeInspectFunc: func(volumeID string) (volume.Volume, error) { if volumeID != "foo" { - return types.Volume{}, errors.Errorf("Invalid volumeID, expected %s, got %s", "foo", volumeID) + return volume.Volume{}, errors.Errorf("Invalid volumeID, expected %s, got %s", "foo", volumeID) } return *Volume(), nil }, @@ -84,7 +84,7 @@ func TestVolumeInspectWithoutFormat(t *testing.T) { { name: "multiple-volume-with-labels", args: []string{"foo", "bar"}, - volumeInspectFunc: func(volumeID string) (types.Volume, error) { + volumeInspectFunc: func(volumeID string) (volume.Volume, error) { return *Volume(VolumeName(volumeID), VolumeLabels(map[string]string{ "foo": "bar", })), nil @@ -103,7 +103,7 @@ func TestVolumeInspectWithoutFormat(t *testing.T) { } func TestVolumeInspectWithFormat(t *testing.T) { - volumeInspectFunc := func(volumeID string) (types.Volume, error) { + volumeInspectFunc := func(volumeID string) (volume.Volume, error) { return *Volume(VolumeLabels(map[string]string{ "foo": "bar", })), nil @@ -112,7 +112,7 @@ func TestVolumeInspectWithFormat(t *testing.T) { name string format string args []string - volumeInspectFunc func(volumeID string) (types.Volume, error) + volumeInspectFunc func(volumeID string) (volume.Volume, error) }{ { name: "simple-template", diff --git a/cli/command/volume/list_test.go b/cli/command/volume/list_test.go index 77f63d5219..b225c49093 100644 --- a/cli/command/volume/list_test.go +++ b/cli/command/volume/list_test.go @@ -7,9 +7,8 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" - volumetypes "github.com/docker/docker/api/types/volume" + "github.com/docker/docker/api/types/volume" "github.com/pkg/errors" "gotest.tools/v3/assert" "gotest.tools/v3/golden" @@ -19,7 +18,7 @@ func TestVolumeListErrors(t *testing.T) { testCases := []struct { args []string flags map[string]string - volumeListFunc func(filter filters.Args) (volumetypes.VolumeListOKBody, error) + volumeListFunc func(filter filters.Args) (volume.ListResponse, error) expectedError string }{ { @@ -27,8 +26,8 @@ func TestVolumeListErrors(t *testing.T) { expectedError: "accepts no argument", }, { - volumeListFunc: func(filter filters.Args) (volumetypes.VolumeListOKBody, error) { - return volumetypes.VolumeListOKBody{}, errors.Errorf("error listing volumes") + volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) { + return volume.ListResponse{}, errors.Errorf("error listing volumes") }, expectedError: "error listing volumes", }, @@ -50,9 +49,9 @@ func TestVolumeListErrors(t *testing.T) { func TestVolumeListWithoutFormat(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - volumeListFunc: func(filter filters.Args) (volumetypes.VolumeListOKBody, error) { - return volumetypes.VolumeListOKBody{ - Volumes: []*types.Volume{ + volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) { + return volume.ListResponse{ + Volumes: []*volume.Volume{ Volume(), Volume(VolumeName("foo"), VolumeDriver("bar")), Volume(VolumeName("baz"), VolumeLabels(map[string]string{ @@ -69,9 +68,9 @@ func TestVolumeListWithoutFormat(t *testing.T) { func TestVolumeListWithConfigFormat(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - volumeListFunc: func(filter filters.Args) (volumetypes.VolumeListOKBody, error) { - return volumetypes.VolumeListOKBody{ - Volumes: []*types.Volume{ + volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) { + return volume.ListResponse{ + Volumes: []*volume.Volume{ Volume(), Volume(VolumeName("foo"), VolumeDriver("bar")), Volume(VolumeName("baz"), VolumeLabels(map[string]string{ @@ -91,9 +90,9 @@ func TestVolumeListWithConfigFormat(t *testing.T) { func TestVolumeListWithFormat(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - volumeListFunc: func(filter filters.Args) (volumetypes.VolumeListOKBody, error) { - return volumetypes.VolumeListOKBody{ - Volumes: []*types.Volume{ + volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) { + return volume.ListResponse{ + Volumes: []*volume.Volume{ Volume(), Volume(VolumeName("foo"), VolumeDriver("bar")), Volume(VolumeName("baz"), VolumeLabels(map[string]string{ @@ -111,9 +110,9 @@ func TestVolumeListWithFormat(t *testing.T) { func TestVolumeListSortOrder(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - volumeListFunc: func(filter filters.Args) (volumetypes.VolumeListOKBody, error) { - return volumetypes.VolumeListOKBody{ - Volumes: []*types.Volume{ + volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) { + return volume.ListResponse{ + Volumes: []*volume.Volume{ Volume(VolumeName("volume-2-foo")), Volume(VolumeName("volume-10-foo")), Volume(VolumeName("volume-1-foo")), diff --git a/internal/test/builders/volume.go b/internal/test/builders/volume.go index c3c879905d..3f8fa90ef8 100644 --- a/internal/test/builders/volume.go +++ b/internal/test/builders/volume.go @@ -1,13 +1,11 @@ package builders -import ( - "github.com/docker/docker/api/types" -) +import "github.com/docker/docker/api/types/volume" // Volume creates a volume with default values. // Any number of volume function builder can be passed to augment it. -func Volume(builders ...func(volume *types.Volume)) *types.Volume { - volume := &types.Volume{ +func Volume(builders ...func(volume *volume.Volume)) *volume.Volume { + vol := &volume.Volume{ Name: "volume", Driver: "local", Mountpoint: "/data/volume", @@ -15,29 +13,29 @@ func Volume(builders ...func(volume *types.Volume)) *types.Volume { } for _, builder := range builders { - builder(volume) + builder(vol) } - return volume + return vol } // VolumeLabels sets the volume labels -func VolumeLabels(labels map[string]string) func(volume *types.Volume) { - return func(volume *types.Volume) { +func VolumeLabels(labels map[string]string) func(volume *volume.Volume) { + return func(volume *volume.Volume) { volume.Labels = labels } } // VolumeName sets the volume labels -func VolumeName(name string) func(volume *types.Volume) { - return func(volume *types.Volume) { +func VolumeName(name string) func(volume *volume.Volume) { + return func(volume *volume.Volume) { volume.Name = name } } // VolumeDriver sets the volume driver -func VolumeDriver(name string) func(volume *types.Volume) { - return func(volume *types.Volume) { +func VolumeDriver(name string) func(volume *volume.Volume) { + return func(volume *volume.Volume) { volume.Driver = name } } diff --git a/vendor.mod b/vendor.mod index 85ec98d01d..7bf5181d00 100644 --- a/vendor.mod +++ b/vendor.mod @@ -76,6 +76,6 @@ require ( ) replace ( - github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220326171151-8941dcfcc5db+incompatible // master (v22.04-dev) + github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220429181837-2ed904cad705+incompatible // master (v22.04-dev) github.com/gogo/googleapis => github.com/gogo/googleapis v1.3.2 ) diff --git a/vendor.sum b/vendor.sum index ba7594c16f..21eb300067 100644 --- a/vendor.sum +++ b/vendor.sum @@ -105,8 +105,8 @@ github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xb github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.3-0.20220326171151-8941dcfcc5db+incompatible h1:5DYFLB020CbxyjsxBle60QaEUb4krFjr30O0eLXsNp0= -github.com/docker/docker v20.10.3-0.20220326171151-8941dcfcc5db+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.3-0.20220429181837-2ed904cad705+incompatible h1:Bs9PQ1/7QUa5bvhBiQNK2b39Ve3gU1o0Lr4ZfNUk1gc= +github.com/docker/docker v20.10.3-0.20220429181837-2ed904cad705+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o= github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= diff --git a/vendor/github.com/docker/docker/AUTHORS b/vendor/github.com/docker/docker/AUTHORS index 2ae76d2c2c..9a673e4ed9 100644 --- a/vendor/github.com/docker/docker/AUTHORS +++ b/vendor/github.com/docker/docker/AUTHORS @@ -7,7 +7,7 @@ Aaron Feng Aaron Hnatiw Aaron Huslage Aaron L. Xu -Aaron Lehmann +Aaron Lehmann Aaron Welch Aaron.L.Xu Abel Muiño @@ -61,10 +61,11 @@ Alan Scherger Alan Thompson Albert Callarisa Albert Zhang -Albin Kerouanton +Albin Kerouanton Alec Benson Alejandro González Hevia Aleksa Sarai +Aleksandr Chebotov Aleksandrs Fadins Alena Prokharchyk Alessandro Boch @@ -76,6 +77,7 @@ Alex Crawford Alex Ellis Alex Gaynor Alex Goodman +Alex Nordlund Alex Olshansky Alex Samorukov Alex Warhawk @@ -83,7 +85,7 @@ Alexander Artemenko Alexander Boyd Alexander Larsson Alexander Midlash -Alexander Morozov +Alexander Morozov Alexander Polakov Alexander Shopov Alexandre Beslic @@ -192,13 +194,15 @@ Antony Messerli Anuj Bahuguna Anuj Varma Anusha Ragunathan +Anyu Wang apocas Arash Deshmeh ArikaChen -Arko Dasgupta +Arko Dasgupta Arnaud Lefebvre -Arnaud Porterie +Arnaud Porterie Arnaud Rebillout +Artem Khramov Arthur Barr Arthur Gautier Artur Meyster @@ -343,6 +347,7 @@ Chen Qiu Cheng-mean Liu Chengfei Shang Chengguang Xu +Chenyang Yan chenyuzhu Chetan Birajdar Chewey @@ -406,20 +411,23 @@ Colin Walters Collin Guarino Colm Hally companycy +Conor Evans Corbin Coleman Corey Farrell Cory Forsyth +Cory Snider cressie176 -CrimsonGlory Cristian Ariza Cristian Staretu cristiano balducci Cristina Yenyxe Gonzalez Garcia Cruceru Calin-Cristian CUI Wei +cuishuang Cuong Manh Le Cyprian Gracz Cyril F +Da McGrady Daan van Berkel Daehyeok Mun Dafydd Crosby @@ -437,6 +445,7 @@ Dan Hirsch Dan Keder Dan Levy Dan McPherson +Dan Plamadeala Dan Stine Dan Williams Dani Hodovic @@ -457,6 +466,7 @@ Daniel Mizyrycki Daniel Nephin Daniel Norberg Daniel Nordberg +Daniel P. Berrangé Daniel Robinson Daniel S Daniel Sweet @@ -465,6 +475,7 @@ Daniel Watkins Daniel X Moore Daniel YC Lin Daniel Zhang +Daniele Rondina Danny Berger Danny Milosavljevic Danny Yates @@ -530,7 +541,7 @@ Dennis Docter Derek Derek Derek Ch -Derek McGowan +Derek McGowan Deric Crago Deshi Xiao devmeyster @@ -550,9 +561,11 @@ Dimitris Rozakis Dimitry Andric Dinesh Subhraveti Ding Fei +dingwei Diogo Monica DiuDiugirl Djibril Koné +Djordje Lukic dkumor Dmitri Logvinenko Dmitri Shuralyov @@ -601,6 +614,7 @@ Elango Sivanandam Elena Morozova Eli Uriegas Elias Faxö +Elias Koromilas Elias Probst Elijah Zupancic eluck @@ -610,6 +624,7 @@ Emil Hernvall Emily Maier Emily Rose Emir Ozer +Eng Zer Jun Enguerran Eohyung Lee epeterso @@ -724,11 +739,14 @@ Frederik Loeffert Frederik Nordahl Jul Sabroe Freek Kalter Frieder Bluemle +frobnicaty <92033765+frobnicaty@users.noreply.github.com> +Frédéric Dalleau Fu JinLin Félix Baylac-Jacqué Félix Cantournet Gabe Rosenhouse Gabor Nagy +Gabriel Goller Gabriel L. Somlo Gabriel Linder Gabriel Monroy @@ -751,6 +769,7 @@ George Kontridze George MacRorie George Xie Georgi Hristozov +Georgy Yakovlev Gereon Frey German DZ Gert van Valkenhoef @@ -762,6 +781,7 @@ Gildas Cuisinier Giovan Isa Musthofa gissehel Giuseppe Mazzotta +Giuseppe Scrivano Gleb Fotengauer-Malinovskiy Gleb M Borisov Glyn Normington @@ -785,6 +805,7 @@ Guilherme Salgado Guillaume Dufour Guillaume J. Charmes Gunadhya S. <6939749+gunadhya@users.noreply.github.com> +Guoqiang QI guoxiuyan Guri Gurjeet Singh @@ -794,6 +815,7 @@ gwx296173 Günter Zöchbauer Haichao Yang haikuoliu +haining.cao Hakan Özler Hamish Hutchings Hannes Ljungberg @@ -889,6 +911,7 @@ Jake Champlin Jake Moshenko Jake Sanders Jakub Drahos +Jakub Guzik James Allen James Carey James Carr @@ -900,6 +923,7 @@ James Lal James Mills James Nesbitt James Nugent +James Sanders James Turnbull James Watkins-Harvey Jamie Hannaford @@ -932,6 +956,7 @@ Jason Shepherd Jason Smith Jason Sommer Jason Stangroome +Javier Bassi jaxgeller Jay Jay @@ -1100,6 +1125,7 @@ Justas Brazauskas Justen Martin Justin Cormack Justin Force +Justin Keller <85903732+jk-vb@users.noreply.github.com> Justin Menga Justin Plock Justin Simonelis @@ -1148,6 +1174,7 @@ Kenjiro Nakayama Kent Johnson Kenta Tada Kevin "qwazerty" Houdebert +Kevin Alvarez Kevin Burke Kevin Clark Kevin Feyrer @@ -1332,6 +1359,7 @@ Markus Fix Markus Kortlang Martijn Dwars Martijn van Oosterhout +Martin Dojcak Martin Honermeyer Martin Kelly Martin Mosegaard Amdisen @@ -1348,6 +1376,7 @@ Mathias Monnerville Mathieu Champlon Mathieu Le Marec - Pasquet Mathieu Parent +Mathieu Paturel Matt Apperson Matt Bachmann Matt Bajor @@ -1356,6 +1385,7 @@ Matt Haggard Matt Hoyle Matt McCormick Matt Moore +Matt Morrison <3maven@gmail.com> Matt Richardson Matt Rickard Matt Robenolt @@ -1400,7 +1430,7 @@ Michael Beskin Michael Bridgen Michael Brown Michael Chiang -Michael Crosby +Michael Crosby Michael Currie Michael Friis Michael Gorsuch @@ -1409,6 +1439,7 @@ Michael Holzheu Michael Hudson-Doyle Michael Huettermann Michael Irwin +Michael Kuehn Michael Käufl Michael Neale Michael Nussbaum @@ -1418,6 +1449,7 @@ Michael Spetsiotis Michael Stapelberg Michael Steinert Michael Thies +Michael Weidmann Michael West Michael Zhao Michal Fojtik @@ -1458,6 +1490,7 @@ Mike Snitzer mikelinjie <294893458@qq.com> Mikhail Sobolev Miklos Szegedi +Milas Bowman Milind Chawre Miloslav Trmač mingqing @@ -1533,6 +1566,7 @@ Nicolas Kaiser Nicolas Sterchele Nicolas V Castet Nicolás Hock Isaza +Niel Drummond Nigel Poulton Nik Nyby Nikhil Chawla @@ -1621,6 +1655,7 @@ Peng Tao Penghan Wang Per Weijnitz perhapszzy@sina.com +Pete Woods Peter Bourgon Peter Braden Peter Bücker @@ -1638,7 +1673,7 @@ Peter Waller Petr Švihlík Petros Angelatos Phil -Phil Estes +Phil Estes Phil Spitler Philip Alexander Etling Philip Monroe @@ -1707,6 +1742,7 @@ Renaud Gaubert Rhys Hiltner Ri Xu Ricardo N Feliciano +Rich Horwood Rich Moyse Rich Seymour Richard @@ -1731,6 +1767,7 @@ Robert Bachmann Robert Bittle Robert Obryk Robert Schneider +Robert Shade Robert Stern Robert Terhaar Robert Wallis @@ -1743,6 +1780,7 @@ Robin Speekenbrink Robin Thoni robpc Rodolfo Carvalho +Rodrigo Campos Rodrigo Vaz Roel Van Nyen Roger Peppe @@ -1757,6 +1795,8 @@ Roma Sokolov Roman Dudin Roman Mazur Roman Strashkin +Roman Volosatovs +Roman Zabaluev Ron Smits Ron Williams Rong Gao @@ -1790,6 +1830,7 @@ Ryan Liu Ryan McLaughlin Ryan O'Donnell Ryan Seto +Ryan Shea Ryan Simmen Ryan Stelly Ryan Thomas @@ -1822,8 +1863,9 @@ Sambuddha Basu Sami Wagiaalla Samuel Andaya Samuel Dion-Girardeau -Samuel Karp +Samuel Karp Samuel PHAN +sanchayanghosh Sandeep Bansal Sankar சங்கர் Sanket Saurav @@ -1881,6 +1923,7 @@ Shengbo Song Shengjing Zhu Shev Yan Shih-Yuan Lee +Shihao Xia Shijiang Wei Shijun Qin Shishir Mahajan @@ -1933,6 +1976,7 @@ Stefan S. Stefan Scherer Stefan Staudenmeyer Stefan Weil +Steffen Butzer Stephan Spindler Stephen Benjamin Stephen Crosby @@ -1951,6 +1995,7 @@ Steven Iveson Steven Merrill Steven Richards Steven Taylor +Stéphane Este-Gracias Stig Larsson Su Wang Subhajit Ghosh @@ -1962,12 +2007,13 @@ Sunny Gogoi Suryakumar Sudar Sven Dowideit Swapnil Daingade -Sylvain Baubeau +Sylvain Baubeau Sylvain Bellemare Sébastien Sébastien HOUZÉ Sébastien Luttringer Sébastien Stormacq +Sören Tempel Tabakhase Tadej Janež TAGOMORI Satoshi @@ -1996,6 +2042,7 @@ Thomas Gazagnaire Thomas Graf Thomas Grainger Thomas Hansen +Thomas Ledos Thomas Leonard Thomas Léveil Thomas Orozco @@ -2064,9 +2111,11 @@ Tomas Tomecek Tomasz Kopczynski Tomasz Lipinski Tomasz Nurkiewicz +Tomek Mańko Tommaso Visconti Tomoya Tabuchi Tomáš Hrčka +tonic Tonny Xu Tony Abboud Tony Daws @@ -2196,6 +2245,7 @@ Wolfgang Powisch Wonjun Kim WuLonghui xamyzhao +Xia Wu Xian Chaobo Xianglin Gao Xianjie @@ -2220,6 +2270,7 @@ Xuecong Liao xuzhaokui Yadnyawalkya Tale Yahya +yalpul YAMADA Tsuyoshi Yamasaki Masahide Yan Feng @@ -2254,6 +2305,7 @@ Yu-Ju Hong Yuan Sun Yuanhong Peng Yue Zhang +Yufei Xiong Yuhao Fang Yuichiro Kaneko YujiOshima diff --git a/vendor/github.com/docker/docker/api/swagger.yaml b/vendor/github.com/docker/docker/api/swagger.yaml index f0e463bd16..c1c8a1b245 100644 --- a/vendor/github.com/docker/docker/api/swagger.yaml +++ b/vendor/github.com/docker/docker/api/swagger.yaml @@ -1154,6 +1154,13 @@ definitions: ContainerConfig: description: | Configuration for a container that is portable between hosts. + + When used as `ContainerConfig` field in an image, `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. type: "object" properties: Hostname: @@ -1600,7 +1607,7 @@ definitions: description: | ID is the content-addressable ID of an image. - This identified is a content-addressable digest calculated from the + This identifier is a content-addressable digest calculated from the image's configuration (which includes the digests of layers used by the image). @@ -1788,41 +1795,119 @@ definitions: - Containers properties: Id: + description: | + 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. type: "string" x-nullable: false + example: "sha256:ec3f0931a6e6b6855d76b2d7b0be30e81860baccd891b2e243280bf1cd8ad710" ParentId: + description: | + 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. type: "string" x-nullable: false + example: "" RepoTags: + description: | + List of image names/tags in the local image cache that reference this + image. + + Multiple image tags can refer to the same imagem 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. type: "array" x-nullable: false items: type: "string" + example: + - "example:1.0" + - "example:latest" + - "example:stable" + - "internal.registry.example.com:5000/example:1.0" RepoDigests: + description: | + 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. type: "array" x-nullable: false items: type: "string" + example: + - "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb" + - "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578" Created: + description: | + Date and time at which the image was created as a Unix timestamp + (number of seconds sinds EPOCH). type: "integer" x-nullable: false + example: "1644009612" Size: + description: | + Total size of the image including all layers it is composed of. type: "integer" + format: "int64" x-nullable: false + example: 172064416 SharedSize: + description: | + 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. type: "integer" x-nullable: false + example: 1239828 VirtualSize: + description: | + 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. type: "integer" + format: "int64" x-nullable: false + example: 172064416 Labels: + description: "User-defined key/value metadata." type: "object" x-nullable: false additionalProperties: type: "string" + example: + com.example.some-label: "some-value" + com.example.some-other-label: "some-other-value" Containers: + description: | + 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. x-nullable: false type: "integer" + example: 2 AuthConfig: type: "object" @@ -1924,6 +2009,7 @@ definitions: UsageData: type: "object" x-nullable: true + x-go-name: "UsageData" required: [Size, RefCount] description: | Usage details about the volume. This information is used by the @@ -1950,7 +2036,7 @@ definitions: description: "Volume configuration" type: "object" title: "VolumeConfig" - x-go-name: "VolumeCreateBody" + x-go-name: "CreateOptions" properties: Name: description: | @@ -1984,6 +2070,25 @@ definitions: com.example.some-label: "some-value" com.example.some-other-label: "some-other-value" + VolumeListResponse: + type: "object" + title: "VolumeListResponse" + x-go-name: "ListResponse" + description: "Volume list response" + properties: + Volumes: + type: "array" + description: "List of volumes" + items: + $ref: "#/definitions/Volume" + Warnings: + type: "array" + description: | + Warnings that occurred when fetching the list of volumes. + items: + type: "string" + example: [] + Network: type: "object" properties: @@ -4512,10 +4617,30 @@ definitions: Health: $ref: "#/definitions/Health" + ContainerCreateResponse: + description: "OK response to ContainerCreate operation" + type: "object" + title: "ContainerCreateResponse" + x-go-name: "CreateResponse" + required: [Id, Warnings] + properties: + Id: + description: "The ID of the created container" + type: "string" + x-nullable: false + example: "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743" + Warnings: + description: "Warnings encountered when creating the container" + type: "array" + x-nullable: false + items: + type: "string" + example: [] + ContainerWaitResponse: description: "OK response to ContainerWait operation" type: "object" - x-go-name: "ContainerWaitOKBody" + x-go-name: "WaitResponse" title: "ContainerWaitResponse" required: [StatusCode, Error] properties: @@ -4529,7 +4654,7 @@ definitions: ContainerWaitExitError: description: "container waiting error, if any" type: "object" - x-go-name: "ContainerWaitOKBodyError" + x-go-name: "WaitExitError" properties: Message: description: "Details of an error" @@ -5976,25 +6101,7 @@ paths: 201: description: "Container created successfully" schema: - type: "object" - title: "ContainerCreateResponse" - description: "OK response to ContainerCreate operation" - required: [Id, Warnings] - properties: - Id: - description: "The ID of the created container" - type: "string" - x-nullable: false - Warnings: - description: "Warnings encountered when creating the container" - type: "array" - x-nullable: false - items: - type: "string" - examples: - application/json: - Id: "e90e34656806" - Warnings: [] + $ref: "#/definitions/ContainerCreateResponse" 400: description: "bad parameter" schema: @@ -6784,6 +6891,11 @@ paths: required: true description: "ID or name of the container" type: "string" + - name: "signal" + in: "query" + description: | + Signal to send to the container as an integer or string (e.g. `SIGINT`). + type: "string" - name: "t" in: "query" description: "Number of seconds to wait before killing the container" @@ -6813,6 +6925,11 @@ paths: required: true description: "ID or name of the container" type: "string" + - name: "signal" + in: "query" + description: | + Signal to send to the container as an integer or string (e.g. `SIGINT`). + type: "string" - name: "t" in: "query" description: "Number of seconds to wait before killing the container" @@ -6854,7 +6971,8 @@ paths: type: "string" - name: "signal" in: "query" - description: "Signal to send to the container as an integer or string (e.g. `SIGINT`)" + description: | + Signal to send to the container as an integer or string (e.g. `SIGINT`). type: "string" default: "SIGKILL" tags: ["Container"] @@ -7542,35 +7660,6 @@ paths: type: "array" items: $ref: "#/definitions/ImageSummary" - examples: - application/json: - - Id: "sha256:e216a057b1cb1efc11f8a268f37ef62083e70b1b38323ba252e25ac88904a7e8" - ParentId: "" - RepoTags: - - "ubuntu:12.04" - - "ubuntu:precise" - RepoDigests: - - "ubuntu@sha256:992069aee4016783df6345315302fa59681aae51a8eeb2f889dea59290f21787" - Created: 1474925151 - Size: 103579269 - VirtualSize: 103579269 - SharedSize: 0 - Labels: {} - Containers: 2 - - Id: "sha256:3e314f95dcace0f5e4fd37b10862fe8398e3c60ed36600bc0ca5fda78b087175" - ParentId: "" - RepoTags: - - "ubuntu:12.10" - - "ubuntu:quantal" - RepoDigests: - - "ubuntu@sha256:002fba3e3255af10be97ea26e476692a7ebed0bb074a9ab960b2e7a1526b15d7" - - "ubuntu@sha256:68ea0200f0b90df725d99d823905b04cf844f6039ef60c60bf3e019915017bd3" - Created: 1403128455 - Size: 172064416 - VirtualSize: 172064416 - SharedSize: 0 - Labels: {} - Containers: 5 500: description: "server error" schema: @@ -9078,24 +9167,7 @@ paths: 200: description: "Summary volume data that matches the query" schema: - type: "object" - title: "VolumeListResponse" - description: "Volume list response" - required: [Volumes, Warnings] - properties: - Volumes: - type: "array" - x-nullable: false - description: "List of volumes" - items: - $ref: "#/definitions/Volume" - Warnings: - type: "array" - x-nullable: false - description: | - Warnings that occurred when fetching the list of volumes. - items: - type: "string" + $ref: "#/definitions/VolumeListResponse" 500: description: "Server error" schema: diff --git a/vendor/github.com/docker/docker/api/types/container/config.go b/vendor/github.com/docker/docker/api/types/container/config.go index f767195b94..b073e5dd36 100644 --- a/vendor/github.com/docker/docker/api/types/container/config.go +++ b/vendor/github.com/docker/docker/api/types/container/config.go @@ -13,6 +13,24 @@ import ( // Docker interprets it as 3 nanoseconds. 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. type HealthConfig struct { // Test is the test to perform to check that the container is healthy. diff --git a/vendor/github.com/docker/docker/api/types/container/container_create.go b/vendor/github.com/docker/docker/api/types/container/container_create.go deleted file mode 100644 index d0c852f84d..0000000000 --- a/vendor/github.com/docker/docker/api/types/container/container_create.go +++ /dev/null @@ -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"` -} diff --git a/vendor/github.com/docker/docker/api/types/container/create_response.go b/vendor/github.com/docker/docker/api/types/container/create_response.go new file mode 100644 index 0000000000..aa0e7f7d07 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/container/create_response.go @@ -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"` +} diff --git a/vendor/github.com/docker/docker/api/types/container/deprecated.go b/vendor/github.com/docker/docker/api/types/container/deprecated.go new file mode 100644 index 0000000000..0cb70e3638 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/container/deprecated.go @@ -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 diff --git a/vendor/github.com/docker/docker/api/types/container/container_wait_o_k_body_error.go b/vendor/github.com/docker/docker/api/types/container/wait_exit_error.go similarity index 61% rename from vendor/github.com/docker/docker/api/types/container/container_wait_o_k_body_error.go rename to vendor/github.com/docker/docker/api/types/container/wait_exit_error.go index ee598973ec..ab56d4eed8 100644 --- a/vendor/github.com/docker/docker/api/types/container/container_wait_o_k_body_error.go +++ b/vendor/github.com/docker/docker/api/types/container/wait_exit_error.go @@ -3,9 +3,9 @@ package container // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command -// ContainerWaitOKBodyError container waiting error, if any -// swagger:model ContainerWaitOKBodyError -type ContainerWaitOKBodyError struct { +// WaitExitError container waiting error, if any +// swagger:model WaitExitError +type WaitExitError struct { // Details of an error Message string `json:"Message,omitempty"` diff --git a/vendor/github.com/docker/docker/api/types/container/container_wait_o_k_body.go b/vendor/github.com/docker/docker/api/types/container/wait_response.go similarity index 66% rename from vendor/github.com/docker/docker/api/types/container/container_wait_o_k_body.go rename to vendor/github.com/docker/docker/api/types/container/wait_response.go index 3219207fbb..d2fb63aac5 100644 --- a/vendor/github.com/docker/docker/api/types/container/container_wait_o_k_body.go +++ b/vendor/github.com/docker/docker/api/types/container/wait_response.go @@ -3,15 +3,15 @@ package container // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command -// ContainerWaitOKBody ContainerWaitResponse +// WaitResponse ContainerWaitResponse // // OK response to ContainerWait operation -// swagger:model ContainerWaitOKBody -type ContainerWaitOKBody struct { +// swagger:model WaitResponse +type WaitResponse struct { // error // Required: true - Error *ContainerWaitOKBodyError `json:"Error"` + Error *WaitExitError `json:"Error"` // Exit code of the container // Required: true diff --git a/vendor/github.com/docker/docker/api/types/deprecated.go b/vendor/github.com/docker/docker/api/types/deprecated.go new file mode 100644 index 0000000000..216d1df0ff --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/deprecated.go @@ -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 diff --git a/vendor/github.com/docker/docker/api/types/image_summary.go b/vendor/github.com/docker/docker/api/types/image_summary.go index e145b3dcfc..53c2885758 100644 --- a/vendor/github.com/docker/docker/api/types/image_summary.go +++ b/vendor/github.com/docker/docker/api/types/image_summary.go @@ -7,43 +7,91 @@ package types // swagger:model ImageSummary 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 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 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 ID string `json:"Id"` - // labels + // User-defined key/value metadata. // Required: true 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 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 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 imagem 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 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 SharedSize int64 `json:"SharedSize"` - // size + // Total size of the image including all layers it is composed of. + // // Required: true 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 VirtualSize int64 `json:"VirtualSize"` } diff --git a/vendor/github.com/docker/docker/api/types/time/duration_convert.go b/vendor/github.com/docker/docker/api/types/time/duration_convert.go deleted file mode 100644 index 84b6f07322..0000000000 --- a/vendor/github.com/docker/docker/api/types/time/duration_convert.go +++ /dev/null @@ -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) -} diff --git a/vendor/github.com/docker/docker/api/types/types.go b/vendor/github.com/docker/docker/api/types/types.go index ee52f46212..aa879c81d6 100644 --- a/vendor/github.com/docker/docker/api/types/types.go +++ b/vendor/github.com/docker/docker/api/types/types.go @@ -14,6 +14,7 @@ import ( "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" + "github.com/docker/docker/api/types/volume" "github.com/docker/go-connections/nat" ) @@ -28,7 +29,7 @@ type RootFS struct { type ImageInspect struct { // ID is the content-addressable ID of an image. // - // This identified is a content-addressable digest calculated from the + // This identifier is a content-addressable digest calculated from the // image's configuration (which includes the digests of layers used by // the image). // @@ -73,8 +74,11 @@ type ImageInspect struct { // Depending on how the image was created, this field may be empty. Container string - // ContainerConfig is the configuration of the container that was committed - // into the image. + // 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 // DockerVersion is the version of Docker that was used to build the image. @@ -683,7 +687,7 @@ type DiskUsage struct { LayersSize int64 Images []*ImageSummary Containers []*Container - Volumes []*Volume + Volumes []*volume.Volume BuildCache []*BuildCache BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40. } diff --git a/vendor/github.com/docker/docker/api/types/volume/volume_create_body.go b/vendor/github.com/docker/docker/api/types/volume/create_options.go similarity index 86% rename from vendor/github.com/docker/docker/api/types/volume/volume_create_body.go rename to vendor/github.com/docker/docker/api/types/volume/create_options.go index f40fe1377f..df7a252cf9 100644 --- a/vendor/github.com/docker/docker/api/types/volume/volume_create_body.go +++ b/vendor/github.com/docker/docker/api/types/volume/create_options.go @@ -3,11 +3,11 @@ package volume // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command -// VolumeCreateBody VolumeConfig +// CreateOptions VolumeConfig // // Volume configuration -// swagger:model VolumeCreateBody -type VolumeCreateBody struct { +// swagger:model CreateOptions +type CreateOptions struct { // Name of the volume driver to use. Driver string `json:"Driver,omitempty"` diff --git a/vendor/github.com/docker/docker/api/types/volume/deprecated.go b/vendor/github.com/docker/docker/api/types/volume/deprecated.go new file mode 100644 index 0000000000..ab622d8ccb --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/volume/deprecated.go @@ -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 diff --git a/vendor/github.com/docker/docker/api/types/volume/list_response.go b/vendor/github.com/docker/docker/api/types/volume/list_response.go new file mode 100644 index 0000000000..ca5192a2a9 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/volume/list_response.go @@ -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"` +} diff --git a/vendor/github.com/docker/docker/api/types/volume.go b/vendor/github.com/docker/docker/api/types/volume/volume.go similarity index 89% rename from vendor/github.com/docker/docker/api/types/volume.go rename to vendor/github.com/docker/docker/api/types/volume/volume.go index c69b08448d..2e40247505 100644 --- a/vendor/github.com/docker/docker/api/types/volume.go +++ b/vendor/github.com/docker/docker/api/types/volume/volume.go @@ -1,4 +1,4 @@ -package types +package volume // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command @@ -47,14 +47,14 @@ type Volume struct { Status map[string]interface{} `json:"Status,omitempty"` // 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. // -// swagger:model VolumeUsageData -type VolumeUsageData struct { +// swagger:model UsageData +type UsageData struct { // The number of containers referencing this volume. This field // is set to `-1` if the reference-count is not available. diff --git a/vendor/github.com/docker/docker/api/types/volume/volume_list.go b/vendor/github.com/docker/docker/api/types/volume/volume_list.go deleted file mode 100644 index be06179bf4..0000000000 --- a/vendor/github.com/docker/docker/api/types/volume/volume_list.go +++ /dev/null @@ -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"` -} diff --git a/vendor/github.com/docker/docker/builder/remotecontext/urlutil/urlutil.go b/vendor/github.com/docker/docker/builder/remotecontext/urlutil/urlutil.go new file mode 100644 index 0000000000..d4078942e9 --- /dev/null +++ b/vendor/github.com/docker/docker/builder/remotecontext/urlutil/urlutil.go @@ -0,0 +1,88 @@ +// Package urlutil provides helper function to check if a given build-context +// location should be considered a URL or a remote Git repository. +// +// This package is specifically written for use with docker build contexts, and +// should not be used as a general-purpose utility. +package urlutil // import "github.com/docker/docker/builder/remotecontext/urlutil" + +import ( + "regexp" + "strings" +) + +// urlPathWithFragmentSuffix matches fragments to use as Git reference and build +// context from the Git repository. See IsGitURL for details. +var urlPathWithFragmentSuffix = regexp.MustCompile(".git(?:#.+)?$") + +// IsURL returns true if the provided str is an HTTP(S) URL by checking if it +// has a http:// or https:// scheme. No validation is performed to verify if the +// URL is well-formed. +func IsURL(str string) bool { + return strings.HasPrefix(str, "https://") || strings.HasPrefix(str, "http://") +} + +// IsGitURL returns true if the provided str is a remote git repository "URL". +// +// This function only performs a rudimentary check (no validation is performed +// to ensure the URL is well-formed), and is written specifically for use with +// docker build, with some logic for backward compatibility with older versions +// of docker: do not use this function as a general-purpose utility. +// +// The following patterns are considered to be a Git URL: +// +// - https://(.*).git(?:#.+)?$ git repository URL with optional fragment, as +// known to be used by GitHub and GitLab. +// - http://(.*).git(?:#.+)?$ same, but non-TLS +// - git://(.*) URLs using git:// scheme +// - git@(.*) +// - github.com/ see description below +// +// The github.com/ prefix is a special case used to treat context-paths +// starting with "github.com/" as a git URL if the given path does not +// exist locally. The "github.com/" prefix is kept for backward compatibility, +// and is a legacy feature. +// +// Going forward, no additional prefixes should be added, and users should +// be encouraged to use explicit URLs (https://github.com/user/repo.git) instead. +// +// Note that IsGitURL does not check if "github.com/" prefixes exist as a local +// path. Code using this function should check if the path exists locally before +// using it as a URL. +// +// Fragments +// +// Git URLs accept context configuration in their fragment section, separated by +// a colon (`:`). The first part represents the reference to check out, and can +// be either a branch, a tag, or a remote reference. The second part represents +// a subdirectory inside the repository to use as the build context. +// +// For example,the following URL uses a directory named "docker" in the branch +// "container" in the https://github.com/myorg/my-repo.git repository: +// +// https://github.com/myorg/my-repo.git#container:docker +// +// The following table represents all the valid suffixes with their build +// contexts: +// +// | Build Syntax Suffix | Git reference used | Build Context Used | +// |--------------------------------|----------------------|--------------------| +// | my-repo.git | refs/heads/master | / | +// | my-repo.git#mytag | refs/tags/my-tag | / | +// | my-repo.git#mybranch | refs/heads/my-branch | / | +// | my-repo.git#pull/42/head | refs/pull/42/head | / | +// | my-repo.git#:directory | refs/heads/master | /directory | +// | my-repo.git#master:directory | refs/heads/master | /directory | +// | my-repo.git#mytag:directory | refs/tags/my-tag | /directory | +// | my-repo.git#mybranch:directory | refs/heads/my-branch | /directory | +// +func IsGitURL(str string) bool { + if IsURL(str) && urlPathWithFragmentSuffix.MatchString(str) { + return true + } + for _, prefix := range []string{"git://", "github.com/", "git@"} { + if strings.HasPrefix(str, prefix) { + return true + } + } + return false +} diff --git a/vendor/github.com/docker/docker/client/container_copy.go b/vendor/github.com/docker/docker/client/container_copy.go index d8b7bb6b91..883be7fa34 100644 --- a/vendor/github.com/docker/docker/client/container_copy.go +++ b/vendor/github.com/docker/docker/client/container_copy.go @@ -50,11 +50,6 @@ func (cli *Client) CopyToContainer(ctx context.Context, containerID, dstPath str 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 } @@ -70,11 +65,6 @@ func (cli *Client) CopyFromContainer(ctx context.Context, containerID, srcPath s 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 // about both the source and the destination. The response headers include // stat info about the source that we can use in deciding exactly how to diff --git a/vendor/github.com/docker/docker/client/container_create.go b/vendor/github.com/docker/docker/client/container_create.go index 47d15c2bbd..754e7c195d 100644 --- a/vendor/github.com/docker/docker/client/container_create.go +++ b/vendor/github.com/docker/docker/client/container_create.go @@ -20,8 +20,8 @@ type configWrapper struct { // ContainerCreate creates a new container based on the given configuration. // 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) { - var response container.ContainerCreateCreatedBody +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.CreateResponse if err := cli.NewVersionError("1.25", "stop timeout"); config != nil && config.StopTimeout != nil && err != nil { return response, err diff --git a/vendor/github.com/docker/docker/client/container_kill.go b/vendor/github.com/docker/docker/client/container_kill.go index 4d6f1d23da..7c9529f1e1 100644 --- a/vendor/github.com/docker/docker/client/container_kill.go +++ b/vendor/github.com/docker/docker/client/container_kill.go @@ -8,7 +8,9 @@ import ( // 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 { query := url.Values{} - query.Set("signal", signal) + if signal != "" { + query.Set("signal", signal) + } resp, err := cli.post(ctx, "/containers/"+containerID+"/kill", query, nil, nil) ensureReaderClosed(resp) diff --git a/vendor/github.com/docker/docker/client/container_list.go b/vendor/github.com/docker/docker/client/container_list.go index a973de597f..bd491b3db9 100644 --- a/vendor/github.com/docker/docker/client/container_list.go +++ b/vendor/github.com/docker/docker/client/container_list.go @@ -18,7 +18,7 @@ func (cli *Client) ContainerList(ctx context.Context, options types.ContainerLis query.Set("all", "1") } - if options.Limit != -1 { + if options.Limit > 0 { query.Set("limit", strconv.Itoa(options.Limit)) } diff --git a/vendor/github.com/docker/docker/client/container_restart.go b/vendor/github.com/docker/docker/client/container_restart.go index aa0d6485de..1e0ad99981 100644 --- a/vendor/github.com/docker/docker/client/container_restart.go +++ b/vendor/github.com/docker/docker/client/container_restart.go @@ -3,18 +3,22 @@ package client // import "github.com/docker/docker/client" import ( "context" "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. // It makes the daemon wait for the container to be up again for // 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{} - if timeout != nil { - query.Set("t", timetypes.DurationToSecondsString(*timeout)) + if options.Timeout != nil { + 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) ensureReaderClosed(resp) diff --git a/vendor/github.com/docker/docker/client/container_stop.go b/vendor/github.com/docker/docker/client/container_stop.go index 629d7ab64c..2a43ce2274 100644 --- a/vendor/github.com/docker/docker/client/container_stop.go +++ b/vendor/github.com/docker/docker/client/container_stop.go @@ -3,9 +3,10 @@ package client // import "github.com/docker/docker/client" import ( "context" "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 @@ -15,10 +16,13 @@ import ( // 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, // 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{} - if timeout != nil { - query.Set("t", timetypes.DurationToSecondsString(*timeout)) + if options.Timeout != nil { + 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) ensureReaderClosed(resp) diff --git a/vendor/github.com/docker/docker/client/container_wait.go b/vendor/github.com/docker/docker/client/container_wait.go index e9b134c9d2..9aff716132 100644 --- a/vendor/github.com/docker/docker/client/container_wait.go +++ b/vendor/github.com/docker/docker/client/container_wait.go @@ -24,12 +24,12 @@ import ( // wait request or in getting the response. This allows the caller to // synchronize ContainerWait with other calls, such as specifying a // "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") { return cli.legacyContainerWait(ctx, containerID) } - resultC := make(chan container.ContainerWaitOKBody) + resultC := make(chan container.WaitResponse) errC := make(chan error, 1) query := url.Values{} @@ -46,7 +46,7 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit go func() { defer ensureReaderClosed(resp) - var res container.ContainerWaitOKBody + var res container.WaitResponse if err := json.NewDecoder(resp.body).Decode(&res); err != nil { errC <- err return @@ -60,8 +60,8 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit // legacyContainerWait returns immediately and doesn't have an option to wait // until the container is removed. -func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) (<-chan container.ContainerWaitOKBody, <-chan error) { - resultC := make(chan container.ContainerWaitOKBody) +func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) (<-chan container.WaitResponse, <-chan error) { + resultC := make(chan container.WaitResponse) errC := make(chan error) go func() { @@ -72,7 +72,7 @@ func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) } defer ensureReaderClosed(resp) - var res container.ContainerWaitOKBody + var res container.WaitResponse if err := json.NewDecoder(resp.body).Decode(&res); err != nil { errC <- err return diff --git a/vendor/github.com/docker/docker/client/interface.go b/vendor/github.com/docker/docker/client/interface.go index 7277d1bbdd..f8dc4a6d28 100644 --- a/vendor/github.com/docker/docker/client/interface.go +++ b/vendor/github.com/docker/docker/client/interface.go @@ -5,17 +5,16 @@ import ( "io" "net" "net/http" - "time" "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/filters" "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/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" ) @@ -48,8 +47,8 @@ type CommonAPIClient interface { type ContainerAPIClient interface { ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, 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) - ContainerDiff(ctx context.Context, container string) ([]containertypes.ContainerChangeResponseItem, 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) ([]container.ContainerChangeResponseItem, 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) 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 ContainerRename(ctx context.Context, container, newContainerName string) 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) ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error) ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error) ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error - ContainerStop(ctx context.Context, container string, timeout *time.Duration) error - ContainerTop(ctx context.Context, container string, arguments []string) (containertypes.ContainerTopOKBody, error) + ContainerStop(ctx context.Context, container string, options container.StopOptions) error + ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error) ContainerUnpause(ctx context.Context, container string) error - ContainerUpdate(ctx context.Context, container string, updateConfig containertypes.UpdateConfig) (containertypes.ContainerUpdateOKBody, error) - ContainerWait(ctx context.Context, container string, condition containertypes.WaitCondition) (<-chan containertypes.ContainerWaitOKBody, <-chan error) + ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, 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) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) 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 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) NetworkDisconnect(ctx context.Context, network, container string, force bool) error NetworkInspect(ctx context.Context, network string, options types.NetworkInspectOptions) (types.NetworkResource, error) @@ -174,10 +173,10 @@ type SystemAPIClient interface { // VolumeAPIClient defines API client methods for the volumes type VolumeAPIClient interface { - VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (types.Volume, error) - VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) - VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) - VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error) + VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error) + VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error) + VolumeInspectWithRaw(ctx context.Context, volumeID string) (volume.Volume, []byte, error) + VolumeList(ctx context.Context, filter filters.Args) (volume.ListResponse, error) VolumeRemove(ctx context.Context, volumeID string, force bool) error VolumesPrune(ctx context.Context, pruneFilter filters.Args) (types.VolumesPruneReport, error) } diff --git a/vendor/github.com/docker/docker/client/volume_create.go b/vendor/github.com/docker/docker/client/volume_create.go index 92761b3c63..b3b182437b 100644 --- a/vendor/github.com/docker/docker/client/volume_create.go +++ b/vendor/github.com/docker/docker/client/volume_create.go @@ -4,18 +4,17 @@ import ( "context" "encoding/json" - "github.com/docker/docker/api/types" - volumetypes "github.com/docker/docker/api/types/volume" + "github.com/docker/docker/api/types/volume" ) // VolumeCreate creates a volume in the docker host. -func (cli *Client) VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (types.Volume, error) { - var volume types.Volume +func (cli *Client) VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error) { + var vol volume.Volume resp, err := cli.post(ctx, "/volumes/create", nil, options, nil) defer ensureReaderClosed(resp) if err != nil { - return volume, err + return vol, err } - err = json.NewDecoder(resp.body).Decode(&volume) - return volume, err + err = json.NewDecoder(resp.body).Decode(&vol) + return vol, err } diff --git a/vendor/github.com/docker/docker/client/volume_inspect.go b/vendor/github.com/docker/docker/client/volume_inspect.go index 070209b35e..b3ba4e6046 100644 --- a/vendor/github.com/docker/docker/client/volume_inspect.go +++ b/vendor/github.com/docker/docker/client/volume_inspect.go @@ -6,33 +6,33 @@ import ( "encoding/json" "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. -func (cli *Client) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) { - volume, _, err := cli.VolumeInspectWithRaw(ctx, volumeID) - return volume, err +func (cli *Client) VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error) { + vol, _, err := cli.VolumeInspectWithRaw(ctx, volumeID) + return vol, err } // 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 == "" { - 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) defer ensureReaderClosed(resp) if err != nil { - return volume, nil, err + return vol, nil, err } body, err := io.ReadAll(resp.body) if err != nil { - return volume, nil, err + return vol, nil, err } rdr := bytes.NewReader(body) - err = json.NewDecoder(rdr).Decode(&volume) - return volume, body, err + err = json.NewDecoder(rdr).Decode(&vol) + return vol, body, err } diff --git a/vendor/github.com/docker/docker/client/volume_list.go b/vendor/github.com/docker/docker/client/volume_list.go index 942498dde2..d8204f8db5 100644 --- a/vendor/github.com/docker/docker/client/volume_list.go +++ b/vendor/github.com/docker/docker/client/volume_list.go @@ -6,12 +6,12 @@ import ( "net/url" "github.com/docker/docker/api/types/filters" - volumetypes "github.com/docker/docker/api/types/volume" + "github.com/docker/docker/api/types/volume" ) // VolumeList returns the volumes configured in the docker host. -func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error) { - var volumes volumetypes.VolumeListOKBody +func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volume.ListResponse, error) { + var volumes volume.ListResponse query := url.Values{} if filter.Len() > 0 { diff --git a/vendor/github.com/docker/docker/pkg/urlutil/urlutil.go b/vendor/github.com/docker/docker/pkg/urlutil/urlutil.go deleted file mode 100644 index 9cf348c723..0000000000 --- a/vendor/github.com/docker/docker/pkg/urlutil/urlutil.go +++ /dev/null @@ -1,52 +0,0 @@ -// Package urlutil provides helper function to check urls kind. -// It supports http urls, git urls and transport url (tcp://, …) -package urlutil // import "github.com/docker/docker/pkg/urlutil" - -import ( - "regexp" - "strings" -) - -var ( - validPrefixes = map[string][]string{ - "url": {"http://", "https://"}, - - // The github.com/ prefix is a special case used to treat context-paths - // starting with `github.com` as a git URL if the given path does not - // exist locally. The "github.com/" prefix is kept for backward compatibility, - // and is a legacy feature. - // - // Going forward, no additional prefixes should be added, and users should - // be encouraged to use explicit URLs (https://github.com/user/repo.git) instead. - "git": {"git://", "github.com/", "git@"}, - "transport": {"tcp://", "tcp+tls://", "udp://", "unix://", "unixgram://"}, - } - urlPathWithFragmentSuffix = regexp.MustCompile(".git(?:#.+)?$") -) - -// IsURL returns true if the provided str is an HTTP(S) URL. -func IsURL(str string) bool { - return checkURL(str, "url") -} - -// IsGitURL returns true if the provided str is a git repository URL. -func IsGitURL(str string) bool { - if IsURL(str) && urlPathWithFragmentSuffix.MatchString(str) { - return true - } - return checkURL(str, "git") -} - -// IsTransportURL returns true if the provided str is a transport (tcp, tcp+tls, udp, unix) URL. -func IsTransportURL(str string) bool { - return checkURL(str, "transport") -} - -func checkURL(str, kind string) bool { - for _, prefix := range validPrefixes[kind] { - if strings.HasPrefix(str, prefix) { - return true - } - } - return false -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 69ab2165dd..9427214920 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -39,7 +39,7 @@ github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/uuid -# github.com/docker/docker v20.10.14+incompatible => github.com/docker/docker v20.10.3-0.20220326171151-8941dcfcc5db+incompatible +# github.com/docker/docker v20.10.14+incompatible => github.com/docker/docker v20.10.3-0.20220429181837-2ed904cad705+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types @@ -58,6 +58,7 @@ github.com/docker/docker/api/types/time github.com/docker/docker/api/types/versions github.com/docker/docker/api/types/volume github.com/docker/docker/builder/remotecontext/git +github.com/docker/docker/builder/remotecontext/urlutil github.com/docker/docker/client github.com/docker/docker/errdefs github.com/docker/docker/pkg/archive @@ -73,7 +74,6 @@ github.com/docker/docker/pkg/stdcopy github.com/docker/docker/pkg/streamformatter github.com/docker/docker/pkg/stringid github.com/docker/docker/pkg/system -github.com/docker/docker/pkg/urlutil github.com/docker/docker/registry # github.com/docker/docker-credential-helpers v0.6.4 ## explicit; go 1.13 @@ -390,5 +390,5 @@ gotest.tools/v3/internal/format gotest.tools/v3/internal/source gotest.tools/v3/poll gotest.tools/v3/skip -# github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220326171151-8941dcfcc5db+incompatible +# github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220429181837-2ed904cad705+incompatible # github.com/gogo/googleapis => github.com/gogo/googleapis v1.3.2