diff --git a/cli/command/completion/functions.go b/cli/command/completion/functions.go index 7a53ede243..ae79f811fe 100644 --- a/cli/command/completion/functions.go +++ b/cli/command/completion/functions.go @@ -7,6 +7,7 @@ import ( "github.com/docker/cli/cli/command/formatter" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/volume" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ type ValidArgsFn func(cmd *cobra.Command, args []string, toComplete string) ([]s // ImageNames offers completion for images present within the local store func ImageNames(dockerCli command.Cli) ValidArgsFn { return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - list, err := dockerCli.Client().ImageList(cmd.Context(), types.ImageListOptions{}) + list, err := dockerCli.Client().ImageList(cmd.Context(), image.ListOptions{}) if err != nil { return nil, cobra.ShellCompDirectiveError } diff --git a/cli/command/container/client_test.go b/cli/command/container/client_test.go index 68f56c70b5..4b17fb3ca9 100644 --- a/cli/command/container/client_test.go +++ b/cli/command/container/client_test.go @@ -6,6 +6,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/system" "github.com/docker/docker/client" @@ -23,7 +24,7 @@ type fakeClient struct { platform *specs.Platform, containerName string) (container.CreateResponse, error) containerStartFunc func(containerID string, options container.StartOptions) error - imageCreateFunc func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) + imageCreateFunc func(parentReference string, options image.CreateOptions) (io.ReadCloser, error) infoFunc func() (system.Info, error) containerStatPathFunc func(containerID, path string) (types.ContainerPathStat, error) containerCopyFromFunc func(containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) @@ -90,7 +91,7 @@ func (f *fakeClient) ContainerRemove(ctx context.Context, containerID string, op return nil } -func (f *fakeClient) ImageCreate(_ context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { +func (f *fakeClient) ImageCreate(_ context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) { if f.imageCreateFunc != nil { return f.imageCreateFunc(parentReference, options) } diff --git a/cli/command/container/create.go b/cli/command/container/create.go index beaad77fd0..70bf509c4e 100644 --- a/cli/command/container/create.go +++ b/cli/command/container/create.go @@ -15,8 +15,8 @@ import ( "github.com/docker/cli/cli/command/image" "github.com/docker/cli/cli/streams" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + imagetypes "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/errdefs" "github.com/docker/docker/pkg/jsonmessage" @@ -119,7 +119,7 @@ func pullImage(ctx context.Context, dockerCli command.Cli, img string, options * return err } - responseBody, err := dockerCli.Client().ImageCreate(ctx, img, types.ImageCreateOptions{ + responseBody, err := dockerCli.Client().ImageCreate(ctx, img, imagetypes.CreateOptions{ RegistryAuth: encodedAuth, Platform: options.platform, }) diff --git a/cli/command/container/create_test.go b/cli/command/container/create_test.go index 546da0d095..36158dd3be 100644 --- a/cli/command/container/create_test.go +++ b/cli/command/container/create_test.go @@ -15,8 +15,8 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/notary" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/system" "github.com/google/go-cmp/cmp" @@ -134,7 +134,7 @@ func TestCreateContainerImagePullPolicy(t *testing.T) { return container.CreateResponse{ID: containerID}, nil } }, - imageCreateFunc: func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { + imageCreateFunc: func(parentReference string, options image.CreateOptions) (io.ReadCloser, error) { defer func() { pullCounter++ }() return io.NopCloser(strings.NewReader("")), nil }, diff --git a/cli/command/image/client_test.go b/cli/command/image/client_test.go index 5c5bf985a4..3700b53930 100644 --- a/cli/command/image/client_test.go +++ b/cli/command/image/client_test.go @@ -17,15 +17,15 @@ type fakeClient struct { client.Client imageTagFunc func(string, string) error imageSaveFunc func(images []string) (io.ReadCloser, error) - imageRemoveFunc func(image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) - imagePushFunc func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) + imageRemoveFunc func(image string, options image.RemoveOptions) ([]image.DeleteResponse, error) + imagePushFunc func(ref string, options image.PushOptions) (io.ReadCloser, error) infoFunc func() (system.Info, error) - imagePullFunc func(ref string, options types.ImagePullOptions) (io.ReadCloser, error) + imagePullFunc func(ref string, options image.PullOptions) (io.ReadCloser, error) imagesPruneFunc func(pruneFilter filters.Args) (types.ImagesPruneReport, error) imageLoadFunc func(input io.Reader, quiet bool) (types.ImageLoadResponse, error) - imageListFunc func(options types.ImageListOptions) ([]image.Summary, error) + imageListFunc func(options image.ListOptions) ([]image.Summary, error) imageInspectFunc func(image string) (types.ImageInspect, []byte, error) - imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) + imageImportFunc func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) imageHistoryFunc func(image string) ([]image.HistoryResponseItem, error) imageBuildFunc func(context.Context, io.Reader, types.ImageBuildOptions) (types.ImageBuildResponse, error) } @@ -45,7 +45,7 @@ func (cli *fakeClient) ImageSave(_ context.Context, images []string) (io.ReadClo } func (cli *fakeClient) ImageRemove(_ context.Context, img string, - options types.ImageRemoveOptions, + options image.RemoveOptions, ) ([]image.DeleteResponse, error) { if cli.imageRemoveFunc != nil { return cli.imageRemoveFunc(img, options) @@ -53,7 +53,7 @@ func (cli *fakeClient) ImageRemove(_ context.Context, img string, return []image.DeleteResponse{}, nil } -func (cli *fakeClient) ImagePush(_ context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) { +func (cli *fakeClient) ImagePush(_ context.Context, ref string, options image.PushOptions) (io.ReadCloser, error) { if cli.imagePushFunc != nil { return cli.imagePushFunc(ref, options) } @@ -67,7 +67,7 @@ func (cli *fakeClient) Info(_ context.Context) (system.Info, error) { return system.Info{}, nil } -func (cli *fakeClient) ImagePull(_ context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) { +func (cli *fakeClient) ImagePull(_ context.Context, ref string, options image.PullOptions) (io.ReadCloser, error) { if cli.imagePullFunc != nil { cli.imagePullFunc(ref, options) } @@ -88,7 +88,7 @@ func (cli *fakeClient) ImageLoad(_ context.Context, input io.Reader, quiet bool) return types.ImageLoadResponse{}, nil } -func (cli *fakeClient) ImageList(_ context.Context, options types.ImageListOptions) ([]image.Summary, error) { +func (cli *fakeClient) ImageList(_ context.Context, options image.ListOptions) ([]image.Summary, error) { if cli.imageListFunc != nil { return cli.imageListFunc(options) } @@ -103,7 +103,7 @@ func (cli *fakeClient) ImageInspectWithRaw(_ context.Context, img string) (types } func (cli *fakeClient) ImageImport(_ context.Context, source types.ImageImportSource, ref string, - options types.ImageImportOptions, + options image.ImportOptions, ) (io.ReadCloser, error) { if cli.imageImportFunc != nil { return cli.imageImportFunc(source, ref, options) diff --git a/cli/command/image/import.go b/cli/command/image/import.go index f7a0af8832..d3bf698300 100644 --- a/cli/command/image/import.go +++ b/cli/command/image/import.go @@ -9,6 +9,7 @@ import ( "github.com/docker/cli/cli/command" dockeropts "github.com/docker/cli/opts" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/pkg/jsonmessage" "github.com/spf13/cobra" ) @@ -78,7 +79,7 @@ func runImport(ctx context.Context, dockerCli command.Cli, options importOptions } } - responseBody, err := dockerCli.Client().ImageImport(ctx, source, options.reference, types.ImageImportOptions{ + responseBody, err := dockerCli.Client().ImageImport(ctx, source, options.reference, image.ImportOptions{ Message: options.message, Changes: options.changes.GetAll(), Platform: options.platform, diff --git a/cli/command/image/import_test.go b/cli/command/image/import_test.go index 4196f4fbbe..6531e2ca35 100644 --- a/cli/command/image/import_test.go +++ b/cli/command/image/import_test.go @@ -7,6 +7,7 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -17,7 +18,7 @@ func TestNewImportCommandErrors(t *testing.T) { name string args []string expectedError string - imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) + imageImportFunc func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) }{ { name: "wrong-args", @@ -28,7 +29,7 @@ func TestNewImportCommandErrors(t *testing.T) { name: "import-failed", args: []string{"testdata/import-command-success.input.txt"}, expectedError: "something went wrong", - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { return nil, errors.Errorf("something went wrong") }, }, @@ -52,7 +53,7 @@ func TestNewImportCommandSuccess(t *testing.T) { testCases := []struct { name string args []string - imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) + imageImportFunc func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) }{ { name: "simple", @@ -65,7 +66,7 @@ func TestNewImportCommandSuccess(t *testing.T) { { name: "double", args: []string{"-", "image:local"}, - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal("image:local", ref)) return io.NopCloser(strings.NewReader("")), nil }, @@ -73,7 +74,7 @@ func TestNewImportCommandSuccess(t *testing.T) { { name: "message", args: []string{"--message", "test message", "-"}, - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal("test message", options.Message)) return io.NopCloser(strings.NewReader("")), nil }, @@ -81,7 +82,7 @@ func TestNewImportCommandSuccess(t *testing.T) { { name: "change", args: []string{"--change", "ENV DEBUG=true", "-"}, - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal("ENV DEBUG=true", options.Changes[0])) return io.NopCloser(strings.NewReader("")), nil }, @@ -89,7 +90,7 @@ func TestNewImportCommandSuccess(t *testing.T) { { name: "change legacy syntax", args: []string{"--change", "ENV DEBUG true", "-"}, - imageImportFunc: func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) { + imageImportFunc: func(source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal("ENV DEBUG true", options.Changes[0])) return io.NopCloser(strings.NewReader("")), nil }, diff --git a/cli/command/image/list.go b/cli/command/image/list.go index 81ce4d914b..887ca9c9a4 100644 --- a/cli/command/image/list.go +++ b/cli/command/image/list.go @@ -8,7 +8,7 @@ import ( "github.com/docker/cli/cli/command/formatter" flagsHelper "github.com/docker/cli/cli/flags" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/spf13/cobra" ) @@ -68,7 +68,7 @@ func runImages(ctx context.Context, dockerCli command.Cli, options imagesOptions filters.Add("reference", options.matchName) } - listOptions := types.ImageListOptions{ + listOptions := image.ListOptions{ All: options.all, Filters: filters, } diff --git a/cli/command/image/list_test.go b/cli/command/image/list_test.go index 11c8b47943..d8b583d8d4 100644 --- a/cli/command/image/list_test.go +++ b/cli/command/image/list_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "gotest.tools/v3/assert" @@ -20,7 +19,7 @@ func TestNewImagesCommandErrors(t *testing.T) { name string args []string expectedError string - imageListFunc func(options types.ImageListOptions) ([]image.Summary, error) + imageListFunc func(options image.ListOptions) ([]image.Summary, error) }{ { name: "wrong-args", @@ -30,7 +29,7 @@ func TestNewImagesCommandErrors(t *testing.T) { { name: "failed-list", expectedError: "something went wrong", - imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) { + imageListFunc: func(options image.ListOptions) ([]image.Summary, error) { return []image.Summary{}, errors.Errorf("something went wrong") }, }, @@ -48,7 +47,7 @@ func TestNewImagesCommandSuccess(t *testing.T) { name string args []string imageFormat string - imageListFunc func(options types.ImageListOptions) ([]image.Summary, error) + imageListFunc func(options image.ListOptions) ([]image.Summary, error) }{ { name: "simple", @@ -65,7 +64,7 @@ func TestNewImagesCommandSuccess(t *testing.T) { { name: "match-name", args: []string{"image"}, - imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) { + imageListFunc: func(options image.ListOptions) ([]image.Summary, error) { assert.Check(t, is.Equal("image", options.Filters.Get("reference")[0])) return []image.Summary{}, nil }, @@ -73,7 +72,7 @@ func TestNewImagesCommandSuccess(t *testing.T) { { name: "filters", args: []string{"--filter", "name=value"}, - imageListFunc: func(options types.ImageListOptions) ([]image.Summary, error) { + imageListFunc: func(options image.ListOptions) ([]image.Summary, error) { assert.Check(t, is.Equal("value", options.Filters.Get("name")[0])) return []image.Summary{}, nil }, diff --git a/cli/command/image/pull_test.go b/cli/command/image/pull_test.go index 8d197b9f95..51e8ece6e6 100644 --- a/cli/command/image/pull_test.go +++ b/cli/command/image/pull_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/notary" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" "gotest.tools/v3/golden" @@ -69,7 +69,7 @@ func TestNewPullCommandSuccess(t *testing.T) { } for _, tc := range testCases { cli := test.NewFakeCli(&fakeClient{ - imagePullFunc: func(ref string, options types.ImagePullOptions) (io.ReadCloser, error) { + imagePullFunc: func(ref string, options image.PullOptions) (io.ReadCloser, error) { assert.Check(t, is.Equal(tc.expectedTag, ref), tc.name) return io.NopCloser(strings.NewReader("")), nil }, @@ -111,7 +111,7 @@ func TestNewPullCommandWithContentTrustErrors(t *testing.T) { } for _, tc := range testCases { cli := test.NewFakeCli(&fakeClient{ - imagePullFunc: func(ref string, options types.ImagePullOptions) (io.ReadCloser, error) { + imagePullFunc: func(ref string, options image.PullOptions) (io.ReadCloser, error) { return io.NopCloser(strings.NewReader("")), fmt.Errorf("shouldn't try to pull image") }, }, test.EnableContentTrust) diff --git a/cli/command/image/push.go b/cli/command/image/push.go index 98b9f24da7..18b4e9ecbb 100644 --- a/cli/command/image/push.go +++ b/cli/command/image/push.go @@ -10,7 +10,7 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/cli/streams" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" registrytypes "github.com/docker/docker/api/types/registry" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/registry" @@ -80,7 +80,7 @@ func RunPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error return err } requestPrivilege := command.RegistryAuthenticationPrivilegedFunc(dockerCli, repoInfo.Index, "push") - options := types.ImagePushOptions{ + options := image.PushOptions{ All: opts.all, RegistryAuth: encodedAuth, PrivilegeFunc: requestPrivilege, diff --git a/cli/command/image/push_test.go b/cli/command/image/push_test.go index bcff265a79..6ba7235775 100644 --- a/cli/command/image/push_test.go +++ b/cli/command/image/push_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "gotest.tools/v3/assert" ) @@ -16,7 +16,7 @@ func TestNewPushCommandErrors(t *testing.T) { name string args []string expectedError string - imagePushFunc func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) + imagePushFunc func(ref string, options image.PushOptions) (io.ReadCloser, error) }{ { name: "wrong-args", @@ -32,7 +32,7 @@ func TestNewPushCommandErrors(t *testing.T) { name: "push-failed", args: []string{"image:repo"}, expectedError: "Failed to push", - imagePushFunc: func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) { + imagePushFunc: func(ref string, options image.PushOptions) (io.ReadCloser, error) { return io.NopCloser(strings.NewReader("")), errors.Errorf("Failed to push") }, }, @@ -67,7 +67,7 @@ func TestNewPushCommandSuccess(t *testing.T) { tc := tc t.Run(tc.name, func(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - imagePushFunc: func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) { + imagePushFunc: func(ref string, options image.PushOptions) (io.ReadCloser, error) { return io.NopCloser(strings.NewReader("")), nil }, }) diff --git a/cli/command/image/remove.go b/cli/command/image/remove.go index 4f18c41cb0..e0983f377f 100644 --- a/cli/command/image/remove.go +++ b/cli/command/image/remove.go @@ -7,7 +7,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/errdefs" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -52,7 +52,7 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command { func runRemove(ctx context.Context, dockerCli command.Cli, opts removeOptions, images []string) error { client := dockerCli.Client() - options := types.ImageRemoveOptions{ + options := image.RemoveOptions{ Force: opts.force, PruneChildren: !opts.noPrune, } diff --git a/cli/command/image/remove_test.go b/cli/command/image/remove_test.go index 566053b49d..9220a5a16b 100644 --- a/cli/command/image/remove_test.go +++ b/cli/command/image/remove_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image" "github.com/pkg/errors" "gotest.tools/v3/assert" @@ -36,7 +35,7 @@ func TestNewRemoveCommandErrors(t *testing.T) { name string args []string expectedError string - imageRemoveFunc func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) + imageRemoveFunc func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) }{ { name: "wrong args", @@ -46,7 +45,7 @@ func TestNewRemoveCommandErrors(t *testing.T) { name: "ImageRemove fail with force option", args: []string{"-f", "image1"}, expectedError: "error removing image", - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, is.Equal("image1", img)) return []image.DeleteResponse{}, errors.Errorf("error removing image") }, @@ -55,7 +54,7 @@ func TestNewRemoveCommandErrors(t *testing.T) { name: "ImageRemove fail", args: []string{"arg1"}, expectedError: "error removing image", - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, !options.Force) assert.Check(t, options.PruneChildren) return []image.DeleteResponse{}, errors.Errorf("error removing image") @@ -78,13 +77,13 @@ func TestNewRemoveCommandSuccess(t *testing.T) { testCases := []struct { name string args []string - imageRemoveFunc func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) + imageRemoveFunc func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) expectedStderr string }{ { name: "Image Deleted", args: []string{"image1"}, - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, is.Equal("image1", img)) return []image.DeleteResponse{{Deleted: img}}, nil }, @@ -92,7 +91,7 @@ func TestNewRemoveCommandSuccess(t *testing.T) { { name: "Image not found with force option", args: []string{"-f", "image1"}, - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, is.Equal("image1", img)) assert.Check(t, is.Equal(true, options.Force)) return []image.DeleteResponse{}, notFound{"image1"} @@ -103,7 +102,7 @@ func TestNewRemoveCommandSuccess(t *testing.T) { { name: "Image Untagged", args: []string{"image1"}, - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { assert.Check(t, is.Equal("image1", img)) return []image.DeleteResponse{{Untagged: img}}, nil }, @@ -111,7 +110,7 @@ func TestNewRemoveCommandSuccess(t *testing.T) { { name: "Image Deleted and Untagged", args: []string{"image1", "image2"}, - imageRemoveFunc: func(img string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) { + imageRemoveFunc: func(img string, options image.RemoveOptions) ([]image.DeleteResponse, error) { if img == "image1" { return []image.DeleteResponse{{Untagged: img}}, nil } diff --git a/cli/command/image/trust.go b/cli/command/image/trust.go index 675da83fd6..59601a2544 100644 --- a/cli/command/image/trust.go +++ b/cli/command/image/trust.go @@ -13,6 +13,7 @@ import ( "github.com/docker/cli/cli/streams" "github.com/docker/cli/cli/trust" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" registrytypes "github.com/docker/docker/api/types/registry" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/registry" @@ -30,7 +31,7 @@ type target struct { } // TrustedPush handles content trust pushing of an image -func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, options types.ImagePushOptions) error { +func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, options image.PushOptions) error { responseBody, err := cli.Client().ImagePush(ctx, reference.FamiliarString(ref), options) if err != nil { return err @@ -267,7 +268,7 @@ func imagePullPrivileged(ctx context.Context, cli command.Cli, imgRefAndAuth tru return err } requestPrivilege := command.RegistryAuthenticationPrivilegedFunc(cli, imgRefAndAuth.RepoInfo().Index, "pull") - responseBody, err := cli.Client().ImagePull(ctx, reference.FamiliarString(imgRefAndAuth.Reference()), types.ImagePullOptions{ + responseBody, err := cli.Client().ImagePull(ctx, reference.FamiliarString(imgRefAndAuth.Reference()), image.PullOptions{ RegistryAuth: encodedAuth, PrivilegeFunc: requestPrivilege, All: opts.all, diff --git a/cli/command/trust/inspect_pretty_test.go b/cli/command/trust/inspect_pretty_test.go index 196bbd7e62..4ae00725e9 100644 --- a/cli/command/trust/inspect_pretty_test.go +++ b/cli/command/trust/inspect_pretty_test.go @@ -11,6 +11,7 @@ import ( "github.com/docker/cli/internal/test" notaryfake "github.com/docker/cli/internal/test/notary" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/system" apiclient "github.com/docker/docker/client" "github.com/theupdateframework/notary" @@ -36,7 +37,7 @@ func (c *fakeClient) ImageInspectWithRaw(context.Context, string) (types.ImageIn return types.ImageInspect{}, []byte{}, nil } -func (c *fakeClient) ImagePush(context.Context, string, types.ImagePushOptions) (io.ReadCloser, error) { +func (c *fakeClient) ImagePush(context.Context, string, image.PushOptions) (io.ReadCloser, error) { return &utils.NoopCloser{Reader: bytes.NewBuffer([]byte{})}, nil } diff --git a/cli/command/trust/sign.go b/cli/command/trust/sign.go index 72cfc2d103..54da63643f 100644 --- a/cli/command/trust/sign.go +++ b/cli/command/trust/sign.go @@ -12,7 +12,7 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/image" "github.com/docker/cli/cli/trust" - "github.com/docker/docker/api/types" + imagetypes "github.com/docker/docker/api/types/image" registrytypes "github.com/docker/docker/api/types/registry" apiclient "github.com/docker/docker/client" "github.com/pkg/errors" @@ -98,7 +98,7 @@ func runSignImage(ctx context.Context, dockerCLI command.Cli, options signOption if err != nil { return err } - options := types.ImagePushOptions{ + options := imagetypes.PushOptions{ RegistryAuth: encodedAuth, PrivilegeFunc: requestPrivilege, }