Skip to content

Commit 10072c3

Browse files
committed
vendor: github.com/moby/moby/api, github.com/moby/moby/client 62884141100c
full diffs: - moby/moby@7145e76...6288414 Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 701b678 commit 10072c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+274
-273
lines changed

cli/command/completion/functions.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import (
66

77
"github.com/docker/cli/cli/command/formatter"
88
"github.com/moby/moby/api/types/container"
9-
"github.com/moby/moby/api/types/image"
109
"github.com/moby/moby/client"
1110
"github.com/spf13/cobra"
1211
)
1312

14-
// APIClientProvider provides a method to get an [client.APIClient], initializing
13+
// APIClientProvider provides a method to get a [client.APIClient], initializing
1514
// it if needed.
1615
//
1716
// It's a smaller interface than [command.Cli], and used in situations where an
@@ -27,7 +26,7 @@ func ImageNames(dockerCLI APIClientProvider, limit int) cobra.CompletionFunc {
2726
if limit > 0 && len(args) >= limit {
2827
return nil, cobra.ShellCompDirectiveNoFileComp
2928
}
30-
list, err := dockerCLI.Client().ImageList(cmd.Context(), image.ListOptions{})
29+
list, err := dockerCLI.Client().ImageList(cmd.Context(), client.ImageListOptions{})
3130
if err != nil {
3231
return nil, cobra.ShellCompDirectiveError
3332
}

cli/command/completion/functions_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (c fakeCLI) Client() client.APIClient {
3131
type fakeClient struct {
3232
client.Client
3333
containerListFunc func(options container.ListOptions) ([]container.Summary, error)
34-
imageListFunc func(options image.ListOptions) ([]image.Summary, error)
34+
imageListFunc func(options client.ImageListOptions) ([]image.Summary, error)
3535
networkListFunc func(ctx context.Context, options client.NetworkListOptions) ([]network.Summary, error)
3636
volumeListFunc func(filter filters.Args) (volume.ListResponse, error)
3737
}
@@ -43,7 +43,7 @@ func (c *fakeClient) ContainerList(_ context.Context, options container.ListOpti
4343
return []container.Summary{}, nil
4444
}
4545

46-
func (c *fakeClient) ImageList(_ context.Context, options image.ListOptions) ([]image.Summary, error) {
46+
func (c *fakeClient) ImageList(_ context.Context, options client.ImageListOptions) ([]image.Summary, error) {
4747
if c.imageListFunc != nil {
4848
return c.imageListFunc(options)
4949
}
@@ -228,7 +228,7 @@ func TestCompleteImageNames(t *testing.T) {
228228
for _, tc := range tests {
229229
t.Run(tc.doc, func(t *testing.T) {
230230
comp := ImageNames(fakeCLI{&fakeClient{
231-
imageListFunc: func(options image.ListOptions) ([]image.Summary, error) {
231+
imageListFunc: func(options client.ImageListOptions) ([]image.Summary, error) {
232232
if tc.expDirective == cobra.ShellCompDirectiveError {
233233
return nil, errors.New("some error occurred")
234234
}

cli/command/container/client_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"github.com/moby/moby/api/types/container"
88
"github.com/moby/moby/api/types/filters"
9-
"github.com/moby/moby/api/types/image"
109
"github.com/moby/moby/api/types/network"
1110
"github.com/moby/moby/api/types/system"
1211
"github.com/moby/moby/client"
@@ -24,7 +23,7 @@ type fakeClient struct {
2423
platform *ocispec.Platform,
2524
containerName string) (container.CreateResponse, error)
2625
containerStartFunc func(containerID string, options container.StartOptions) error
27-
imageCreateFunc func(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error)
26+
imageCreateFunc func(ctx context.Context, parentReference string, options client.ImageCreateOptions) (io.ReadCloser, error)
2827
infoFunc func() (system.Info, error)
2928
containerStatPathFunc func(containerID, path string) (container.PathStat, error)
3029
containerCopyFromFunc func(containerID, srcPath string) (io.ReadCloser, container.PathStat, error)
@@ -99,7 +98,7 @@ func (f *fakeClient) ContainerRemove(ctx context.Context, containerID string, op
9998
return nil
10099
}
101100

102-
func (f *fakeClient) ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) {
101+
func (f *fakeClient) ImageCreate(ctx context.Context, parentReference string, options client.ImageCreateOptions) (io.ReadCloser, error) {
103102
if f.imageCreateFunc != nil {
104103
return f.imageCreateFunc(ctx, parentReference, options)
105104
}

cli/command/container/create.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"github.com/docker/cli/internal/jsonstream"
2727
"github.com/docker/cli/opts"
2828
"github.com/moby/moby/api/types/container"
29-
imagetypes "github.com/moby/moby/api/types/image"
3029
"github.com/moby/moby/api/types/mount"
3130
"github.com/moby/moby/api/types/versions"
3231
"github.com/moby/moby/client"
@@ -144,7 +143,7 @@ func pullImage(ctx context.Context, dockerCli command.Cli, img string, options *
144143
return err
145144
}
146145

147-
responseBody, err := dockerCli.Client().ImageCreate(ctx, img, imagetypes.CreateOptions{
146+
responseBody, err := dockerCli.Client().ImageCreate(ctx, img, client.ImageCreateOptions{
148147
RegistryAuth: encodedAuth,
149148
Platform: options.platform,
150149
})

cli/command/container/create_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import (
1616
"github.com/docker/cli/internal/test/notary"
1717
"github.com/google/go-cmp/cmp"
1818
"github.com/moby/moby/api/types/container"
19-
"github.com/moby/moby/api/types/image"
2019
"github.com/moby/moby/api/types/network"
2120
"github.com/moby/moby/api/types/system"
21+
"github.com/moby/moby/client"
2222
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2323
"github.com/spf13/pflag"
2424
"gotest.tools/v3/assert"
@@ -132,7 +132,7 @@ func TestCreateContainerImagePullPolicy(t *testing.T) {
132132
return container.CreateResponse{ID: containerID}, nil
133133
}
134134
},
135-
imageCreateFunc: func(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) {
135+
imageCreateFunc: func(ctx context.Context, parentReference string, options client.ImageCreateOptions) (io.ReadCloser, error) {
136136
defer func() { pullCounter++ }()
137137
return io.NopCloser(strings.NewReader("")), nil
138138
},

cli/command/container/run_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/moby/moby/api/pkg/streamformatter"
1919
"github.com/moby/moby/api/types"
2020
"github.com/moby/moby/api/types/container"
21-
"github.com/moby/moby/api/types/image"
2221
"github.com/moby/moby/api/types/network"
2322
"github.com/moby/moby/client"
2423
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
@@ -236,7 +235,7 @@ func TestRunPullTermination(t *testing.T) {
236235
containerAttachFunc: func(ctx context.Context, containerID string, options container.AttachOptions) (client.HijackedResponse, error) {
237236
return client.HijackedResponse{}, errors.New("shouldn't try to attach to a container")
238237
},
239-
imageCreateFunc: func(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) {
238+
imageCreateFunc: func(ctx context.Context, parentReference string, options client.ImageCreateOptions) (io.ReadCloser, error) {
240239
server, respReader := net.Pipe()
241240
t.Cleanup(func() {
242241
_ = server.Close()

cli/command/image/client_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ type fakeClient struct {
1717
client.Client
1818
imageTagFunc func(string, string) error
1919
imageSaveFunc func(images []string, options ...client.ImageSaveOption) (io.ReadCloser, error)
20-
imageRemoveFunc func(image string, options image.RemoveOptions) ([]image.DeleteResponse, error)
21-
imagePushFunc func(ref string, options image.PushOptions) (io.ReadCloser, error)
20+
imageRemoveFunc func(image string, options client.ImageRemoveOptions) ([]image.DeleteResponse, error)
21+
imagePushFunc func(ref string, options client.ImagePushOptions) (io.ReadCloser, error)
2222
infoFunc func() (system.Info, error)
23-
imagePullFunc func(ref string, options image.PullOptions) (io.ReadCloser, error)
23+
imagePullFunc func(ref string, options client.ImagePullOptions) (io.ReadCloser, error)
2424
imagesPruneFunc func(pruneFilter filters.Args) (image.PruneReport, error)
2525
imageLoadFunc func(input io.Reader, options ...client.ImageLoadOption) (image.LoadResponse, error)
26-
imageListFunc func(options image.ListOptions) ([]image.Summary, error)
26+
imageListFunc func(options client.ImageListOptions) ([]image.Summary, error)
2727
imageInspectFunc func(img string) (image.InspectResponse, error)
28-
imageImportFunc func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)
28+
imageImportFunc func(source client.ImageImportSource, ref string, options client.ImageImportOptions) (io.ReadCloser, error)
2929
imageHistoryFunc func(img string, options ...client.ImageHistoryOption) ([]image.HistoryResponseItem, error)
3030
imageBuildFunc func(context.Context, io.Reader, build.ImageBuildOptions) (build.ImageBuildResponse, error)
3131
}
@@ -45,15 +45,15 @@ func (cli *fakeClient) ImageSave(_ context.Context, images []string, options ...
4545
}
4646

4747
func (cli *fakeClient) ImageRemove(_ context.Context, img string,
48-
options image.RemoveOptions,
48+
options client.ImageRemoveOptions,
4949
) ([]image.DeleteResponse, error) {
5050
if cli.imageRemoveFunc != nil {
5151
return cli.imageRemoveFunc(img, options)
5252
}
5353
return []image.DeleteResponse{}, nil
5454
}
5555

56-
func (cli *fakeClient) ImagePush(_ context.Context, ref string, options image.PushOptions) (io.ReadCloser, error) {
56+
func (cli *fakeClient) ImagePush(_ context.Context, ref string, options client.ImagePushOptions) (io.ReadCloser, error) {
5757
if cli.imagePushFunc != nil {
5858
return cli.imagePushFunc(ref, options)
5959
}
@@ -67,7 +67,7 @@ func (cli *fakeClient) Info(_ context.Context) (system.Info, error) {
6767
return system.Info{}, nil
6868
}
6969

70-
func (cli *fakeClient) ImagePull(_ context.Context, ref string, options image.PullOptions) (io.ReadCloser, error) {
70+
func (cli *fakeClient) ImagePull(_ context.Context, ref string, options client.ImagePullOptions) (io.ReadCloser, error) {
7171
if cli.imagePullFunc != nil {
7272
return cli.imagePullFunc(ref, options)
7373
}
@@ -88,7 +88,7 @@ func (cli *fakeClient) ImageLoad(_ context.Context, input io.Reader, options ...
8888
return image.LoadResponse{}, nil
8989
}
9090

91-
func (cli *fakeClient) ImageList(_ context.Context, options image.ListOptions) ([]image.Summary, error) {
91+
func (cli *fakeClient) ImageList(_ context.Context, options client.ImageListOptions) ([]image.Summary, error) {
9292
if cli.imageListFunc != nil {
9393
return cli.imageListFunc(options)
9494
}
@@ -102,8 +102,8 @@ func (cli *fakeClient) ImageInspect(_ context.Context, img string, _ ...client.I
102102
return image.InspectResponse{}, nil
103103
}
104104

105-
func (cli *fakeClient) ImageImport(_ context.Context, source image.ImportSource, ref string,
106-
options image.ImportOptions,
105+
func (cli *fakeClient) ImageImport(_ context.Context, source client.ImageImportSource, ref string,
106+
options client.ImageImportOptions,
107107
) (io.ReadCloser, error) {
108108
if cli.imageImportFunc != nil {
109109
return cli.imageImportFunc(source, ref, options)

cli/command/image/import.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/docker/cli/cli/command/completion"
1111
"github.com/docker/cli/internal/jsonstream"
1212
dockeropts "github.com/docker/cli/opts"
13-
"github.com/moby/moby/api/types/image"
13+
"github.com/moby/moby/client"
1414
"github.com/spf13/cobra"
1515
)
1616

@@ -54,17 +54,17 @@ func newImportCommand(dockerCLI command.Cli) *cobra.Command {
5454
}
5555

5656
func runImport(ctx context.Context, dockerCli command.Cli, options importOptions) error {
57-
var source image.ImportSource
57+
var source client.ImageImportSource
5858
switch {
5959
case options.source == "-":
6060
// import from STDIN
61-
source = image.ImportSource{
61+
source = client.ImageImportSource{
6262
Source: dockerCli.In(),
6363
SourceName: options.source,
6464
}
6565
case strings.HasPrefix(options.source, "https://"), strings.HasPrefix(options.source, "http://"):
6666
// import from a remote source (handled by the daemon)
67-
source = image.ImportSource{
67+
source = client.ImageImportSource{
6868
SourceName: options.source,
6969
}
7070
default:
@@ -74,13 +74,13 @@ func runImport(ctx context.Context, dockerCli command.Cli, options importOptions
7474
return err
7575
}
7676
defer file.Close()
77-
source = image.ImportSource{
77+
source = client.ImageImportSource{
7878
Source: file,
7979
SourceName: "-",
8080
}
8181
}
8282

83-
responseBody, err := dockerCli.Client().ImageImport(ctx, source, options.reference, image.ImportOptions{
83+
responseBody, err := dockerCli.Client().ImageImport(ctx, source, options.reference, client.ImageImportOptions{
8484
Message: options.message,
8585
Changes: options.changes.GetSlice(),
8686
Platform: options.platform,

cli/command/image/import_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"testing"
88

99
"github.com/docker/cli/internal/test"
10-
"github.com/moby/moby/api/types/image"
10+
"github.com/moby/moby/client"
1111
"gotest.tools/v3/assert"
1212
is "gotest.tools/v3/assert/cmp"
1313
)
@@ -17,7 +17,7 @@ func TestNewImportCommandErrors(t *testing.T) {
1717
name string
1818
args []string
1919
expectedError string
20-
imageImportFunc func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)
20+
imageImportFunc func(source client.ImageImportSource, ref string, options client.ImageImportOptions) (io.ReadCloser, error)
2121
}{
2222
{
2323
name: "wrong-args",
@@ -28,7 +28,7 @@ func TestNewImportCommandErrors(t *testing.T) {
2828
name: "import-failed",
2929
args: []string{"testdata/import-command-success.input.txt"},
3030
expectedError: "something went wrong",
31-
imageImportFunc: func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) {
31+
imageImportFunc: func(source client.ImageImportSource, ref string, options client.ImageImportOptions) (io.ReadCloser, error) {
3232
return nil, errors.New("something went wrong")
3333
},
3434
},
@@ -54,7 +54,7 @@ func TestNewImportCommandSuccess(t *testing.T) {
5454
testCases := []struct {
5555
name string
5656
args []string
57-
imageImportFunc func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)
57+
imageImportFunc func(source client.ImageImportSource, ref string, options client.ImageImportOptions) (io.ReadCloser, error)
5858
}{
5959
{
6060
name: "simple",
@@ -67,31 +67,31 @@ func TestNewImportCommandSuccess(t *testing.T) {
6767
{
6868
name: "double",
6969
args: []string{"-", "image:local"},
70-
imageImportFunc: func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) {
70+
imageImportFunc: func(source client.ImageImportSource, ref string, options client.ImageImportOptions) (io.ReadCloser, error) {
7171
assert.Check(t, is.Equal("image:local", ref))
7272
return io.NopCloser(strings.NewReader("")), nil
7373
},
7474
},
7575
{
7676
name: "message",
7777
args: []string{"--message", "test message", "-"},
78-
imageImportFunc: func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) {
78+
imageImportFunc: func(source client.ImageImportSource, ref string, options client.ImageImportOptions) (io.ReadCloser, error) {
7979
assert.Check(t, is.Equal("test message", options.Message))
8080
return io.NopCloser(strings.NewReader("")), nil
8181
},
8282
},
8383
{
8484
name: "change",
8585
args: []string{"--change", "ENV DEBUG=true", "-"},
86-
imageImportFunc: func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) {
86+
imageImportFunc: func(source client.ImageImportSource, ref string, options client.ImageImportOptions) (io.ReadCloser, error) {
8787
assert.Check(t, is.Equal("ENV DEBUG=true", options.Changes[0]))
8888
return io.NopCloser(strings.NewReader("")), nil
8989
},
9090
},
9191
{
9292
name: "change legacy syntax",
9393
args: []string{"--change", "ENV DEBUG true", "-"},
94-
imageImportFunc: func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) {
94+
imageImportFunc: func(source client.ImageImportSource, ref string, options client.ImageImportOptions) (io.ReadCloser, error) {
9595
assert.Check(t, is.Equal("ENV DEBUG true", options.Changes[0]))
9696
return io.NopCloser(strings.NewReader("")), nil
9797
},

cli/command/image/list.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
flagsHelper "github.com/docker/cli/cli/flags"
1313
"github.com/docker/cli/opts"
1414
"github.com/moby/moby/api/types/image"
15+
"github.com/moby/moby/client"
1516
"github.com/spf13/cobra"
1617
)
1718

@@ -101,7 +102,7 @@ func runImages(ctx context.Context, dockerCLI command.Cli, options imagesOptions
101102
})
102103
}
103104

104-
images, err := dockerCLI.Client().ImageList(ctx, image.ListOptions{
105+
images, err := dockerCLI.Client().ImageList(ctx, client.ImageListOptions{
105106
All: options.all,
106107
Filters: filters,
107108
})

0 commit comments

Comments
 (0)