Skip to content

Commit f8c6f50

Browse files
committed
vendor: github.com/moby/moby/api, moby/moby/client 531be96bf9ec (master)
full diff: - moby/moby@api/v1.52.0-alpha.1...531be96 - moby/moby@client/v0.1.0-alpha.0...531be96 Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent fda64eb commit f8c6f50

File tree

107 files changed

+336
-401
lines changed

Some content is hidden

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

107 files changed

+336
-401
lines changed

cli/command/completion/functions.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77
"github.com/docker/cli/cli/command/formatter"
88
"github.com/moby/moby/api/types/container"
99
"github.com/moby/moby/api/types/image"
10-
"github.com/moby/moby/api/types/network"
11-
"github.com/moby/moby/api/types/volume"
1210
"github.com/moby/moby/client"
1311
"github.com/spf13/cobra"
1412
)
@@ -79,7 +77,7 @@ func ContainerNames(dockerCLI APIClientProvider, all bool, filters ...func(conta
7977
// VolumeNames offers completion for volumes
8078
func VolumeNames(dockerCLI APIClientProvider) cobra.CompletionFunc {
8179
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
82-
list, err := dockerCLI.Client().VolumeList(cmd.Context(), volume.ListOptions{})
80+
list, err := dockerCLI.Client().VolumeList(cmd.Context(), client.VolumeListOptions{})
8381
if err != nil {
8482
return nil, cobra.ShellCompDirectiveError
8583
}
@@ -94,7 +92,7 @@ func VolumeNames(dockerCLI APIClientProvider) cobra.CompletionFunc {
9492
// NetworkNames offers completion for networks
9593
func NetworkNames(dockerCLI APIClientProvider) cobra.CompletionFunc {
9694
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
97-
list, err := dockerCLI.Client().NetworkList(cmd.Context(), network.ListOptions{})
95+
list, err := dockerCLI.Client().NetworkList(cmd.Context(), client.NetworkListOptions{})
9896
if err != nil {
9997
return nil, cobra.ShellCompDirectiveError
10098
}

cli/command/completion/functions_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type fakeClient struct {
3232
client.Client
3333
containerListFunc func(options container.ListOptions) ([]container.Summary, error)
3434
imageListFunc func(options image.ListOptions) ([]image.Summary, error)
35-
networkListFunc func(ctx context.Context, options network.ListOptions) ([]network.Summary, error)
35+
networkListFunc func(ctx context.Context, options client.NetworkListOptions) ([]network.Summary, error)
3636
volumeListFunc func(filter filters.Args) (volume.ListResponse, error)
3737
}
3838

@@ -50,14 +50,14 @@ func (c *fakeClient) ImageList(_ context.Context, options image.ListOptions) ([]
5050
return []image.Summary{}, nil
5151
}
5252

53-
func (c *fakeClient) NetworkList(ctx context.Context, options network.ListOptions) ([]network.Summary, error) {
53+
func (c *fakeClient) NetworkList(ctx context.Context, options client.NetworkListOptions) ([]network.Summary, error) {
5454
if c.networkListFunc != nil {
5555
return c.networkListFunc(ctx, options)
5656
}
5757
return []network.Inspect{}, nil
5858
}
5959

60-
func (c *fakeClient) VolumeList(_ context.Context, options volume.ListOptions) (volume.ListResponse, error) {
60+
func (c *fakeClient) VolumeList(_ context.Context, options client.VolumeListOptions) (volume.ListResponse, error) {
6161
if c.volumeListFunc != nil {
6262
return c.volumeListFunc(options.Filters)
6363
}
@@ -273,7 +273,7 @@ func TestCompleteNetworkNames(t *testing.T) {
273273
for _, tc := range tests {
274274
t.Run(tc.doc, func(t *testing.T) {
275275
comp := NetworkNames(fakeCLI{&fakeClient{
276-
networkListFunc: func(ctx context.Context, options network.ListOptions) ([]network.Summary, error) {
276+
networkListFunc: func(ctx context.Context, options client.NetworkListOptions) ([]network.Summary, error) {
277277
if tc.expDirective == cobra.ShellCompDirectiveError {
278278
return nil, errors.New("some error occurred")
279279
}

cli/command/container/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type fakeClient struct {
3232
waitFunc func(string) (<-chan container.WaitResponse, <-chan error)
3333
containerListFunc func(container.ListOptions) ([]container.Summary, error)
3434
containerExportFunc func(string) (io.ReadCloser, error)
35-
containerExecResizeFunc func(id string, options container.ResizeOptions) error
35+
containerExecResizeFunc func(id string, options client.ContainerResizeOptions) error
3636
containerRemoveFunc func(ctx context.Context, containerID string, options container.RemoveOptions) error
3737
containerRestartFunc func(ctx context.Context, containerID string, options container.StopOptions) error
3838
containerStopFunc func(ctx context.Context, containerID string, options container.StopOptions) error
@@ -159,7 +159,7 @@ func (f *fakeClient) ContainerExport(_ context.Context, containerID string) (io.
159159
return nil, nil
160160
}
161161

162-
func (f *fakeClient) ContainerExecResize(_ context.Context, id string, options container.ResizeOptions) error {
162+
func (f *fakeClient) ContainerExecResize(_ context.Context, id string, options client.ContainerResizeOptions) error {
163163
if f.containerExecResizeFunc != nil {
164164
return f.containerExecResizeFunc(id, options)
165165
}

cli/command/container/opts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ func TestParseLabelfileVariables(t *testing.T) {
10161016
func TestParseEntryPoint(t *testing.T) {
10171017
config, _, _, err := parseRun([]string{"--entrypoint=anything", "cmd", "img"})
10181018
assert.NilError(t, err)
1019-
assert.Check(t, is.DeepEqual([]string(config.Entrypoint), []string{"anything"}))
1019+
assert.Check(t, is.DeepEqual(config.Entrypoint, []string{"anything"}))
10201020
}
10211021

10221022
func TestValidateDevice(t *testing.T) {

cli/command/container/stats.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/moby/moby/api/types/container"
1919
"github.com/moby/moby/api/types/events"
2020
"github.com/moby/moby/api/types/filters"
21+
"github.com/moby/moby/client"
2122
"github.com/sirupsen/logrus"
2223
"github.com/spf13/cobra"
2324
)
@@ -164,7 +165,7 @@ func RunStats(ctx context.Context, dockerCLI command.Cli, options *StatsOptions)
164165
// is not valid for filtering containers.
165166
f := options.Filters.Clone()
166167
f.Add("type", string(events.ContainerEventType))
167-
eventChan, errChan := apiClient.Events(ctx, events.ListOptions{
168+
eventChan, errChan := apiClient.Events(ctx, client.EventsListOptions{
168169
Filters: f,
169170
})
170171

cli/command/container/tty.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"time"
1010

1111
"github.com/docker/cli/cli/command"
12-
"github.com/moby/moby/api/types/container"
1312
"github.com/moby/moby/client"
1413
"github.com/moby/sys/signal"
1514
"github.com/sirupsen/logrus"
@@ -21,7 +20,7 @@ func resizeTtyTo(ctx context.Context, apiClient client.ContainerAPIClient, id st
2120
return nil
2221
}
2322

24-
options := container.ResizeOptions{
23+
options := client.ContainerResizeOptions{
2524
Height: height,
2625
Width: width,
2726
}

cli/command/container/tty_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import (
88

99
"github.com/docker/cli/cli/command"
1010
"github.com/docker/cli/internal/test"
11-
"github.com/moby/moby/api/types/container"
11+
"github.com/moby/moby/client"
1212
"gotest.tools/v3/assert"
1313
is "gotest.tools/v3/assert/cmp"
1414
)
1515

1616
func TestInitTtySizeErrors(t *testing.T) {
1717
expectedError := "failed to resize tty, using default size\n"
18-
fakeContainerExecResizeFunc := func(id string, options container.ResizeOptions) error {
18+
fakeContainerExecResizeFunc := func(id string, options client.ContainerResizeOptions) error {
1919
return errors.New("Error response from daemon: no such exec")
2020
}
2121
fakeResizeTtyFunc := func(ctx context.Context, cli command.Cli, id string, isExec bool) error {

cli/command/container/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func legacyWaitExitOrRemoved(ctx context.Context, apiClient client.APIClient, co
6969
f.Add("container", containerID)
7070

7171
eventCtx, cancel := context.WithCancel(ctx)
72-
eventq, errq := apiClient.Events(eventCtx, events.ListOptions{
72+
eventq, errq := apiClient.Events(eventCtx, client.EventsListOptions{
7373
Filters: f,
7474
})
7575

cli/command/formatter/container.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func (c *ContainerContext) Networks() string {
344344
// DisplayablePorts returns formatted string representing open ports of container
345345
// e.g. "0.0.0.0:80->9090/tcp, 9988/tcp"
346346
// it's used by command 'docker ps'
347-
func DisplayablePorts(ports []container.Port) string {
347+
func DisplayablePorts(ports []container.PortSummary) string {
348348
type portGroup struct {
349349
first uint16
350350
last uint16
@@ -410,7 +410,7 @@ func formGroup(key string, start, last uint16) string {
410410
return group + "/" + groupType
411411
}
412412

413-
func comparePorts(i, j container.Port) bool {
413+
func comparePorts(i, j container.PortSummary) bool {
414414
if i.PrivatePort != j.PrivatePort {
415415
return i.PrivatePort < j.PrivatePort
416416
}

cli/command/formatter/container_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func TestContainerPsContext(t *testing.T) {
137137
call: ctx.CreatedAt,
138138
},
139139
{
140-
container: container.Summary{Ports: []container.Port{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}}},
140+
container: container.Summary{Ports: []container.PortSummary{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}}},
141141
trunc: true,
142142
expValue: "8080/tcp",
143143
call: ctx.Ports,
@@ -586,7 +586,7 @@ func TestContainerBackCompat(t *testing.T) {
586586
ImageManifestDescriptor: nil,
587587
Command: "/bin/sh",
588588
Created: createdAtTime.UTC().Unix(),
589-
Ports: []container.Port{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}},
589+
Ports: []container.PortSummary{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}},
590590
SizeRw: 123,
591591
SizeRootFs: 12345,
592592
Labels: map[string]string{"label1": "value1", "label2": "value2"},
@@ -633,14 +633,14 @@ func TestContainerBackCompat(t *testing.T) {
633633
}
634634

635635
type ports struct {
636-
ports []container.Port
636+
ports []container.PortSummary
637637
expected string
638638
}
639639

640640
func TestDisplayablePorts(t *testing.T) {
641641
cases := []ports{
642642
{
643-
ports: []container.Port{
643+
ports: []container.PortSummary{
644644
{
645645
PrivatePort: 9988,
646646
Type: "tcp",
@@ -649,7 +649,7 @@ func TestDisplayablePorts(t *testing.T) {
649649
expected: "9988/tcp",
650650
},
651651
{
652-
ports: []container.Port{
652+
ports: []container.PortSummary{
653653
{
654654
PrivatePort: 9988,
655655
Type: "udp",
@@ -658,7 +658,7 @@ func TestDisplayablePorts(t *testing.T) {
658658
expected: "9988/udp",
659659
},
660660
{
661-
ports: []container.Port{
661+
ports: []container.PortSummary{
662662
{
663663
IP: "0.0.0.0",
664664
PrivatePort: 9988,
@@ -668,7 +668,7 @@ func TestDisplayablePorts(t *testing.T) {
668668
expected: "0.0.0.0:0->9988/tcp",
669669
},
670670
{
671-
ports: []container.Port{
671+
ports: []container.PortSummary{
672672
{
673673
IP: "::",
674674
PrivatePort: 9988,
@@ -678,7 +678,7 @@ func TestDisplayablePorts(t *testing.T) {
678678
expected: "[::]:0->9988/tcp",
679679
},
680680
{
681-
ports: []container.Port{
681+
ports: []container.PortSummary{
682682
{
683683
PrivatePort: 9988,
684684
PublicPort: 8899,
@@ -688,7 +688,7 @@ func TestDisplayablePorts(t *testing.T) {
688688
expected: "9988/tcp",
689689
},
690690
{
691-
ports: []container.Port{
691+
ports: []container.PortSummary{
692692
{
693693
IP: "4.3.2.1",
694694
PrivatePort: 9988,
@@ -699,7 +699,7 @@ func TestDisplayablePorts(t *testing.T) {
699699
expected: "4.3.2.1:8899->9988/tcp",
700700
},
701701
{
702-
ports: []container.Port{
702+
ports: []container.PortSummary{
703703
{
704704
IP: "::1",
705705
PrivatePort: 9988,
@@ -710,7 +710,7 @@ func TestDisplayablePorts(t *testing.T) {
710710
expected: "[::1]:8899->9988/tcp",
711711
},
712712
{
713-
ports: []container.Port{
713+
ports: []container.PortSummary{
714714
{
715715
IP: "4.3.2.1",
716716
PrivatePort: 9988,
@@ -721,7 +721,7 @@ func TestDisplayablePorts(t *testing.T) {
721721
expected: "4.3.2.1:9988->9988/tcp",
722722
},
723723
{
724-
ports: []container.Port{
724+
ports: []container.PortSummary{
725725
{
726726
IP: "::1",
727727
PrivatePort: 9988,
@@ -732,7 +732,7 @@ func TestDisplayablePorts(t *testing.T) {
732732
expected: "[::1]:9988->9988/tcp",
733733
},
734734
{
735-
ports: []container.Port{
735+
ports: []container.PortSummary{
736736
{
737737
PrivatePort: 9988,
738738
Type: "udp",
@@ -744,7 +744,7 @@ func TestDisplayablePorts(t *testing.T) {
744744
expected: "9988/udp, 9988/udp",
745745
},
746746
{
747-
ports: []container.Port{
747+
ports: []container.PortSummary{
748748
{
749749
IP: "1.2.3.4",
750750
PublicPort: 9998,
@@ -760,7 +760,7 @@ func TestDisplayablePorts(t *testing.T) {
760760
expected: "1.2.3.4:9998-9999->9998-9999/udp",
761761
},
762762
{
763-
ports: []container.Port{
763+
ports: []container.PortSummary{
764764
{
765765
IP: "::1",
766766
PublicPort: 9998,
@@ -776,7 +776,7 @@ func TestDisplayablePorts(t *testing.T) {
776776
expected: "[::1]:9998-9999->9998-9999/udp",
777777
},
778778
{
779-
ports: []container.Port{
779+
ports: []container.PortSummary{
780780
{
781781
IP: "1.2.3.4",
782782
PublicPort: 8887,
@@ -792,7 +792,7 @@ func TestDisplayablePorts(t *testing.T) {
792792
expected: "1.2.3.4:8887->9998/udp, 1.2.3.4:8888->9999/udp",
793793
},
794794
{
795-
ports: []container.Port{
795+
ports: []container.PortSummary{
796796
{
797797
IP: "::1",
798798
PublicPort: 8887,
@@ -808,7 +808,7 @@ func TestDisplayablePorts(t *testing.T) {
808808
expected: "[::1]:8887->9998/udp, [::1]:8888->9999/udp",
809809
},
810810
{
811-
ports: []container.Port{
811+
ports: []container.PortSummary{
812812
{
813813
PrivatePort: 9998,
814814
Type: "udp",
@@ -820,7 +820,7 @@ func TestDisplayablePorts(t *testing.T) {
820820
expected: "9998-9999/udp",
821821
},
822822
{
823-
ports: []container.Port{
823+
ports: []container.PortSummary{
824824
{
825825
IP: "1.2.3.4",
826826
PrivatePort: 6677,
@@ -835,7 +835,7 @@ func TestDisplayablePorts(t *testing.T) {
835835
expected: "9988/udp, 1.2.3.4:7766->6677/tcp",
836836
},
837837
{
838-
ports: []container.Port{
838+
ports: []container.PortSummary{
839839
{
840840
IP: "1.2.3.4",
841841
PrivatePort: 9988,
@@ -861,7 +861,7 @@ func TestDisplayablePorts(t *testing.T) {
861861
expected: "4.3.2.1:3322->2233/tcp, [::1]:3322->2233/tcp, 1.2.3.4:8899->9988/tcp, 1.2.3.4:8899->9988/udp",
862862
},
863863
{
864-
ports: []container.Port{
864+
ports: []container.PortSummary{
865865
{
866866
PrivatePort: 9988,
867867
PublicPort: 8899,
@@ -881,7 +881,7 @@ func TestDisplayablePorts(t *testing.T) {
881881
expected: "9988/udp, 4.3.2.1:3322->2233/tcp, 1.2.3.4:7766->6677/tcp",
882882
},
883883
{
884-
ports: []container.Port{
884+
ports: []container.PortSummary{
885885
{
886886
PrivatePort: 80,
887887
Type: "tcp",

0 commit comments

Comments
 (0)