Skip to content

Commit e386a22

Browse files
committed
vendor: github.com/moby/moby/api, moby/moby/client master
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 3a0b588 commit e386a22

File tree

92 files changed

+287
-359
lines changed

Some content is hidden

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

92 files changed

+287
-359
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/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/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
@@ -338,7 +338,7 @@ func (c *ContainerContext) Networks() string {
338338
// DisplayablePorts returns formatted string representing open ports of container
339339
// e.g. "0.0.0.0:80->9090/tcp, 9988/tcp"
340340
// it's used by command 'docker ps'
341-
func DisplayablePorts(ports []container.Port) string {
341+
func DisplayablePorts(ports []container.PortSummary) string {
342342
type portGroup struct {
343343
first uint16
344344
last uint16
@@ -404,7 +404,7 @@ func formGroup(key string, start, last uint16) string {
404404
return group + "/" + groupType
405405
}
406406

407-
func comparePorts(i, j container.Port) bool {
407+
func comparePorts(i, j container.PortSummary) bool {
408408
if i.PrivatePort != j.PrivatePort {
409409
return i.PrivatePort < j.PrivatePort
410410
}

cli/command/formatter/container_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TestContainerPsContext(t *testing.T) {
100100
call: ctx.CreatedAt,
101101
},
102102
{
103-
container: container.Summary{Ports: []container.Port{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}}},
103+
container: container.Summary{Ports: []container.PortSummary{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}}},
104104
trunc: true,
105105
expValue: "8080/tcp",
106106
call: ctx.Ports,
@@ -549,7 +549,7 @@ func TestContainerBackCompat(t *testing.T) {
549549
ImageManifestDescriptor: nil,
550550
Command: "/bin/sh",
551551
Created: createdAtTime.UTC().Unix(),
552-
Ports: []container.Port{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}},
552+
Ports: []container.PortSummary{{PrivatePort: 8080, PublicPort: 8080, Type: "tcp"}},
553553
SizeRw: 123,
554554
SizeRootFs: 12345,
555555
Labels: map[string]string{"label1": "value1", "label2": "value2"},
@@ -596,14 +596,14 @@ func TestContainerBackCompat(t *testing.T) {
596596
}
597597

598598
type ports struct {
599-
ports []container.Port
599+
ports []container.PortSummary
600600
expected string
601601
}
602602

603603
func TestDisplayablePorts(t *testing.T) {
604604
cases := []ports{
605605
{
606-
ports: []container.Port{
606+
ports: []container.PortSummary{
607607
{
608608
PrivatePort: 9988,
609609
Type: "tcp",
@@ -612,7 +612,7 @@ func TestDisplayablePorts(t *testing.T) {
612612
expected: "9988/tcp",
613613
},
614614
{
615-
ports: []container.Port{
615+
ports: []container.PortSummary{
616616
{
617617
PrivatePort: 9988,
618618
Type: "udp",
@@ -621,7 +621,7 @@ func TestDisplayablePorts(t *testing.T) {
621621
expected: "9988/udp",
622622
},
623623
{
624-
ports: []container.Port{
624+
ports: []container.PortSummary{
625625
{
626626
IP: "0.0.0.0",
627627
PrivatePort: 9988,
@@ -631,7 +631,7 @@ func TestDisplayablePorts(t *testing.T) {
631631
expected: "0.0.0.0:0->9988/tcp",
632632
},
633633
{
634-
ports: []container.Port{
634+
ports: []container.PortSummary{
635635
{
636636
IP: "::",
637637
PrivatePort: 9988,
@@ -641,7 +641,7 @@ func TestDisplayablePorts(t *testing.T) {
641641
expected: "[::]:0->9988/tcp",
642642
},
643643
{
644-
ports: []container.Port{
644+
ports: []container.PortSummary{
645645
{
646646
PrivatePort: 9988,
647647
PublicPort: 8899,
@@ -651,7 +651,7 @@ func TestDisplayablePorts(t *testing.T) {
651651
expected: "9988/tcp",
652652
},
653653
{
654-
ports: []container.Port{
654+
ports: []container.PortSummary{
655655
{
656656
IP: "4.3.2.1",
657657
PrivatePort: 9988,
@@ -662,7 +662,7 @@ func TestDisplayablePorts(t *testing.T) {
662662
expected: "4.3.2.1:8899->9988/tcp",
663663
},
664664
{
665-
ports: []container.Port{
665+
ports: []container.PortSummary{
666666
{
667667
IP: "::1",
668668
PrivatePort: 9988,
@@ -673,7 +673,7 @@ func TestDisplayablePorts(t *testing.T) {
673673
expected: "[::1]:8899->9988/tcp",
674674
},
675675
{
676-
ports: []container.Port{
676+
ports: []container.PortSummary{
677677
{
678678
IP: "4.3.2.1",
679679
PrivatePort: 9988,
@@ -684,7 +684,7 @@ func TestDisplayablePorts(t *testing.T) {
684684
expected: "4.3.2.1:9988->9988/tcp",
685685
},
686686
{
687-
ports: []container.Port{
687+
ports: []container.PortSummary{
688688
{
689689
IP: "::1",
690690
PrivatePort: 9988,
@@ -695,7 +695,7 @@ func TestDisplayablePorts(t *testing.T) {
695695
expected: "[::1]:9988->9988/tcp",
696696
},
697697
{
698-
ports: []container.Port{
698+
ports: []container.PortSummary{
699699
{
700700
PrivatePort: 9988,
701701
Type: "udp",
@@ -707,7 +707,7 @@ func TestDisplayablePorts(t *testing.T) {
707707
expected: "9988/udp, 9988/udp",
708708
},
709709
{
710-
ports: []container.Port{
710+
ports: []container.PortSummary{
711711
{
712712
IP: "1.2.3.4",
713713
PublicPort: 9998,
@@ -723,7 +723,7 @@ func TestDisplayablePorts(t *testing.T) {
723723
expected: "1.2.3.4:9998-9999->9998-9999/udp",
724724
},
725725
{
726-
ports: []container.Port{
726+
ports: []container.PortSummary{
727727
{
728728
IP: "::1",
729729
PublicPort: 9998,
@@ -739,7 +739,7 @@ func TestDisplayablePorts(t *testing.T) {
739739
expected: "[::1]:9998-9999->9998-9999/udp",
740740
},
741741
{
742-
ports: []container.Port{
742+
ports: []container.PortSummary{
743743
{
744744
IP: "1.2.3.4",
745745
PublicPort: 8887,
@@ -755,7 +755,7 @@ func TestDisplayablePorts(t *testing.T) {
755755
expected: "1.2.3.4:8887->9998/udp, 1.2.3.4:8888->9999/udp",
756756
},
757757
{
758-
ports: []container.Port{
758+
ports: []container.PortSummary{
759759
{
760760
IP: "::1",
761761
PublicPort: 8887,
@@ -771,7 +771,7 @@ func TestDisplayablePorts(t *testing.T) {
771771
expected: "[::1]:8887->9998/udp, [::1]:8888->9999/udp",
772772
},
773773
{
774-
ports: []container.Port{
774+
ports: []container.PortSummary{
775775
{
776776
PrivatePort: 9998,
777777
Type: "udp",
@@ -783,7 +783,7 @@ func TestDisplayablePorts(t *testing.T) {
783783
expected: "9998-9999/udp",
784784
},
785785
{
786-
ports: []container.Port{
786+
ports: []container.PortSummary{
787787
{
788788
IP: "1.2.3.4",
789789
PrivatePort: 6677,
@@ -798,7 +798,7 @@ func TestDisplayablePorts(t *testing.T) {
798798
expected: "9988/udp, 1.2.3.4:7766->6677/tcp",
799799
},
800800
{
801-
ports: []container.Port{
801+
ports: []container.PortSummary{
802802
{
803803
IP: "1.2.3.4",
804804
PrivatePort: 9988,
@@ -824,7 +824,7 @@ func TestDisplayablePorts(t *testing.T) {
824824
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",
825825
},
826826
{
827-
ports: []container.Port{
827+
ports: []container.PortSummary{
828828
{
829829
PrivatePort: 9988,
830830
PublicPort: 8899,
@@ -844,7 +844,7 @@ func TestDisplayablePorts(t *testing.T) {
844844
expected: "9988/udp, 4.3.2.1:3322->2233/tcp, 1.2.3.4:7766->6677/tcp",
845845
},
846846
{
847-
ports: []container.Port{
847+
ports: []container.PortSummary{
848848
{
849849
PrivatePort: 80,
850850
Type: "tcp",

cli/command/network/inspect.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/docker/cli/cli/command/completion"
1313
"github.com/docker/cli/cli/command/inspect"
1414
flagsHelper "github.com/docker/cli/cli/flags"
15-
"github.com/moby/moby/api/types/network"
1615
"github.com/moby/moby/client"
1716
"github.com/spf13/cobra"
1817
)
@@ -45,6 +44,6 @@ func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
4544

4645
func runInspect(ctx context.Context, apiClient client.NetworkAPIClient, output io.Writer, opts inspectOptions) error {
4746
return inspect.Inspect(output, opts.names, opts.format, func(name string) (any, []byte, error) {
48-
return apiClient.NetworkInspectWithRaw(ctx, name, network.InspectOptions{Verbose: opts.verbose})
47+
return apiClient.NetworkInspectWithRaw(ctx, name, client.NetworkInspectOptions{Verbose: opts.verbose})
4948
})
5049
}

cli/command/network/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
flagsHelper "github.com/docker/cli/cli/flags"
1212
"github.com/docker/cli/opts"
1313
"github.com/fvbommel/sortorder"
14-
"github.com/moby/moby/api/types/network"
14+
"github.com/moby/moby/client"
1515
"github.com/spf13/cobra"
1616
)
1717

@@ -47,7 +47,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
4747

4848
func runList(ctx context.Context, dockerCLI command.Cli, options listOptions) error {
4949
apiClient := dockerCLI.Client()
50-
networkResources, err := apiClient.NetworkList(ctx, network.ListOptions{Filters: options.filter.Value()})
50+
networkResources, err := apiClient.NetworkList(ctx, client.NetworkListOptions{Filters: options.filter.Value()})
5151
if err != nil {
5252
return err
5353
}

0 commit comments

Comments
 (0)