vendor: github.com/moby/moby/api, moby/moby/client master
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -35,7 +35,7 @@ type fakeClient struct {
|
||||
containerRestartFunc func(ctx context.Context, containerID string, options client.ContainerStopOptions) error
|
||||
containerStopFunc func(ctx context.Context, containerID string, options client.ContainerStopOptions) error
|
||||
containerKillFunc func(ctx context.Context, containerID, signal string) error
|
||||
containerPruneFunc func(ctx context.Context, pruneFilters client.Filters) (container.PruneReport, error)
|
||||
containerPruneFunc func(ctx context.Context, options client.ContainerPruneOptions) (client.ContainerPruneResult, error)
|
||||
containerAttachFunc func(ctx context.Context, containerID string, options client.ContainerAttachOptions) (client.HijackedResponse, error)
|
||||
containerDiffFunc func(ctx context.Context, containerID string) ([]container.FilesystemChange, error)
|
||||
containerRenameFunc func(ctx context.Context, oldName, newName string) error
|
||||
@ -171,11 +171,11 @@ func (f *fakeClient) ContainerKill(ctx context.Context, containerID, signal stri
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *fakeClient) ContainersPrune(ctx context.Context, pruneFilters client.Filters) (container.PruneReport, error) {
|
||||
func (f *fakeClient) ContainersPrune(ctx context.Context, options client.ContainerPruneOptions) (client.ContainerPruneResult, error) {
|
||||
if f.containerPruneFunc != nil {
|
||||
return f.containerPruneFunc(ctx, pruneFilters)
|
||||
return f.containerPruneFunc(ctx, options)
|
||||
}
|
||||
return container.PruneReport{}, nil
|
||||
return client.ContainerPruneResult{}, nil
|
||||
}
|
||||
|
||||
func (f *fakeClient) ContainerRestart(ctx context.Context, containerID string, options client.ContainerStopOptions) error {
|
||||
|
||||
@ -11,6 +11,7 @@ import (
|
||||
"github.com/docker/cli/internal/prompt"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -73,17 +74,19 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||
}
|
||||
}
|
||||
|
||||
report, err := dockerCli.Client().ContainersPrune(ctx, pruneFilters)
|
||||
res, err := dockerCli.Client().ContainersPrune(ctx, client.ContainerPruneOptions{
|
||||
Filters: pruneFilters,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, "", err
|
||||
}
|
||||
|
||||
if len(report.ContainersDeleted) > 0 {
|
||||
if len(res.Report.ContainersDeleted) > 0 {
|
||||
output = "Deleted Containers:\n"
|
||||
for _, id := range report.ContainersDeleted {
|
||||
for _, id := range res.Report.ContainersDeleted {
|
||||
output += id + "\n"
|
||||
}
|
||||
spaceReclaimed = report.SpaceReclaimed
|
||||
spaceReclaimed = res.Report.SpaceReclaimed
|
||||
}
|
||||
|
||||
return spaceReclaimed, output, nil
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/docker/cli/internal/test"
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/client"
|
||||
)
|
||||
|
||||
@ -16,8 +15,8 @@ func TestContainerPrunePromptTermination(t *testing.T) {
|
||||
t.Cleanup(cancel)
|
||||
|
||||
cli := test.NewFakeCli(&fakeClient{
|
||||
containerPruneFunc: func(ctx context.Context, pruneFilters client.Filters) (container.PruneReport, error) {
|
||||
return container.PruneReport{}, errors.New("fakeClient containerPruneFunc should not be called")
|
||||
containerPruneFunc: func(ctx context.Context, opts client.ContainerPruneOptions) (client.ContainerPruneResult, error) {
|
||||
return client.ContainerPruneResult{}, errors.New("fakeClient containerPruneFunc should not be called")
|
||||
},
|
||||
})
|
||||
cmd := newPruneCommand(cli)
|
||||
|
||||
@ -19,7 +19,7 @@ type fakeClient struct {
|
||||
imagePushFunc func(ref string, options client.ImagePushOptions) (io.ReadCloser, error)
|
||||
infoFunc func() (system.Info, error)
|
||||
imagePullFunc func(ref string, options client.ImagePullOptions) (client.ImagePullResponse, error)
|
||||
imagesPruneFunc func(pruneFilter client.Filters) (image.PruneReport, error)
|
||||
imagesPruneFunc func(options client.ImagePruneOptions) (client.ImagePruneResult, error)
|
||||
imageLoadFunc func(input io.Reader, options ...client.ImageLoadOption) (client.LoadResponse, error)
|
||||
imageListFunc func(options client.ImageListOptions) ([]image.Summary, error)
|
||||
imageInspectFunc func(img string) (image.InspectResponse, error)
|
||||
@ -72,11 +72,11 @@ func (cli *fakeClient) ImagePull(_ context.Context, ref string, options client.I
|
||||
return client.ImagePullResponse{}, nil
|
||||
}
|
||||
|
||||
func (cli *fakeClient) ImagesPrune(_ context.Context, pruneFilter client.Filters) (image.PruneReport, error) {
|
||||
func (cli *fakeClient) ImagesPrune(_ context.Context, opts client.ImagePruneOptions) (client.ImagePruneResult, error) {
|
||||
if cli.imagesPruneFunc != nil {
|
||||
return cli.imagesPruneFunc(pruneFilter)
|
||||
return cli.imagesPruneFunc(opts)
|
||||
}
|
||||
return image.PruneReport{}, nil
|
||||
return client.ImagePruneResult{}, nil
|
||||
}
|
||||
|
||||
func (cli *fakeClient) ImageLoad(_ context.Context, input io.Reader, options ...client.ImageLoadOption) (client.LoadResponse, error) {
|
||||
|
||||
@ -13,6 +13,7 @@ import (
|
||||
"github.com/docker/cli/internal/prompt"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -86,15 +87,17 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||
}
|
||||
}
|
||||
|
||||
report, err := dockerCli.Client().ImagesPrune(ctx, pruneFilters)
|
||||
res, err := dockerCli.Client().ImagesPrune(ctx, client.ImagePruneOptions{
|
||||
Filters: pruneFilters,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, "", err
|
||||
}
|
||||
|
||||
if len(report.ImagesDeleted) > 0 {
|
||||
var sb strings.Builder
|
||||
var sb strings.Builder
|
||||
if len(res.Report.ImagesDeleted) > 0 {
|
||||
sb.WriteString("Deleted Images:\n")
|
||||
for _, st := range report.ImagesDeleted {
|
||||
for _, st := range res.Report.ImagesDeleted {
|
||||
if st.Untagged != "" {
|
||||
sb.WriteString("untagged: ")
|
||||
sb.WriteString(st.Untagged)
|
||||
@ -105,11 +108,9 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||
sb.WriteByte('\n')
|
||||
}
|
||||
}
|
||||
output = sb.String()
|
||||
spaceReclaimed = report.SpaceReclaimed
|
||||
}
|
||||
|
||||
return spaceReclaimed, output, nil
|
||||
return res.Report.SpaceReclaimed, sb.String(), nil
|
||||
}
|
||||
|
||||
type cancelledErr struct{ error }
|
||||
|
||||
@ -21,7 +21,7 @@ func TestNewPruneCommandErrors(t *testing.T) {
|
||||
name string
|
||||
args []string
|
||||
expectedError string
|
||||
imagesPruneFunc func(pruneFilter client.Filters) (image.PruneReport, error)
|
||||
imagesPruneFunc func(client.ImagePruneOptions) (client.ImagePruneResult, error)
|
||||
}{
|
||||
{
|
||||
name: "wrong-args",
|
||||
@ -32,8 +32,8 @@ func TestNewPruneCommandErrors(t *testing.T) {
|
||||
name: "prune-error",
|
||||
args: []string{"--force"},
|
||||
expectedError: "something went wrong",
|
||||
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
|
||||
return image.PruneReport{}, errors.New("something went wrong")
|
||||
imagesPruneFunc: func(client.ImagePruneOptions) (client.ImagePruneResult, error) {
|
||||
return client.ImagePruneResult{}, errors.New("something went wrong")
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -54,43 +54,47 @@ func TestNewPruneCommandSuccess(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
imagesPruneFunc func(pruneFilter client.Filters) (image.PruneReport, error)
|
||||
imagesPruneFunc func(client.ImagePruneOptions) (client.ImagePruneResult, error)
|
||||
}{
|
||||
{
|
||||
name: "all",
|
||||
args: []string{"--all"},
|
||||
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
|
||||
assert.Check(t, pruneFilter["dangling"]["false"])
|
||||
return image.PruneReport{}, nil
|
||||
imagesPruneFunc: func(opts client.ImagePruneOptions) (client.ImagePruneResult, error) {
|
||||
assert.Check(t, opts.Filters["dangling"]["false"])
|
||||
return client.ImagePruneResult{}, nil
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "force-deleted",
|
||||
args: []string{"--force"},
|
||||
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
|
||||
assert.Check(t, pruneFilter["dangling"]["true"])
|
||||
return image.PruneReport{
|
||||
ImagesDeleted: []image.DeleteResponse{{Deleted: "image1"}},
|
||||
SpaceReclaimed: 1,
|
||||
imagesPruneFunc: func(opts client.ImagePruneOptions) (client.ImagePruneResult, error) {
|
||||
assert.Check(t, opts.Filters["dangling"]["true"])
|
||||
return client.ImagePruneResult{
|
||||
Report: image.PruneReport{
|
||||
ImagesDeleted: []image.DeleteResponse{{Deleted: "image1"}},
|
||||
SpaceReclaimed: 1,
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "label-filter",
|
||||
args: []string{"--force", "--filter", "label=foobar"},
|
||||
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
|
||||
assert.Check(t, pruneFilter["label"]["foobar"])
|
||||
return image.PruneReport{}, nil
|
||||
imagesPruneFunc: func(opts client.ImagePruneOptions) (client.ImagePruneResult, error) {
|
||||
assert.Check(t, opts.Filters["label"]["foobar"])
|
||||
return client.ImagePruneResult{}, nil
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "force-untagged",
|
||||
args: []string{"--force"},
|
||||
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
|
||||
assert.Check(t, pruneFilter["dangling"]["true"])
|
||||
return image.PruneReport{
|
||||
ImagesDeleted: []image.DeleteResponse{{Untagged: "image1"}},
|
||||
SpaceReclaimed: 2,
|
||||
imagesPruneFunc: func(opts client.ImagePruneOptions) (client.ImagePruneResult, error) {
|
||||
assert.Check(t, opts.Filters["dangling"]["true"])
|
||||
return client.ImagePruneResult{
|
||||
Report: image.PruneReport{
|
||||
ImagesDeleted: []image.DeleteResponse{{Untagged: "image1"}},
|
||||
SpaceReclaimed: 2,
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
},
|
||||
@ -116,8 +120,8 @@ func TestPrunePromptTermination(t *testing.T) {
|
||||
t.Cleanup(cancel)
|
||||
|
||||
cli := test.NewFakeCli(&fakeClient{
|
||||
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
|
||||
return image.PruneReport{}, errors.New("fakeClient imagesPruneFunc should not be called")
|
||||
imagesPruneFunc: func(client.ImagePruneOptions) (client.ImagePruneResult, error) {
|
||||
return client.ImagePruneResult{}, errors.New("fakeClient imagesPruneFunc should not be called")
|
||||
},
|
||||
})
|
||||
cmd := newPruneCommand(cli)
|
||||
|
||||
@ -14,7 +14,7 @@ type fakeClient struct {
|
||||
networkDisconnectFunc func(ctx context.Context, networkID, container string, force bool) error
|
||||
networkRemoveFunc func(ctx context.Context, networkID string) error
|
||||
networkListFunc func(ctx context.Context, options client.NetworkListOptions) ([]network.Summary, error)
|
||||
networkPruneFunc func(ctx context.Context, pruneFilters client.Filters) (network.PruneReport, error)
|
||||
networkPruneFunc func(ctx context.Context, options client.NetworkPruneOptions) (client.NetworkPruneResult, error)
|
||||
networkInspectFunc func(ctx context.Context, networkID string, options client.NetworkInspectOptions) (network.Inspect, []byte, error)
|
||||
}
|
||||
|
||||
@ -60,9 +60,9 @@ func (c *fakeClient) NetworkInspectWithRaw(ctx context.Context, networkID string
|
||||
return network.Inspect{}, nil, nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) NetworksPrune(ctx context.Context, pruneFilter client.Filters) (network.PruneReport, error) {
|
||||
func (c *fakeClient) NetworksPrune(ctx context.Context, opts client.NetworkPruneOptions) (client.NetworkPruneResult, error) {
|
||||
if c.networkPruneFunc != nil {
|
||||
return c.networkPruneFunc(ctx, pruneFilter)
|
||||
return c.networkPruneFunc(ctx, opts)
|
||||
}
|
||||
return network.PruneReport{}, nil
|
||||
return client.NetworkPruneResult{}, nil
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"github.com/docker/cli/cli/command/system/pruner"
|
||||
"github.com/docker/cli/internal/prompt"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -70,14 +71,16 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||
}
|
||||
}
|
||||
|
||||
report, err := dockerCli.Client().NetworksPrune(ctx, pruneFilters)
|
||||
res, err := dockerCli.Client().NetworksPrune(ctx, client.NetworkPruneOptions{
|
||||
Filters: pruneFilters,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if len(report.NetworksDeleted) > 0 {
|
||||
if len(res.Report.NetworksDeleted) > 0 {
|
||||
output = "Deleted Networks:\n"
|
||||
for _, id := range report.NetworksDeleted {
|
||||
for _, id := range res.Report.NetworksDeleted {
|
||||
output += id + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/docker/cli/internal/test"
|
||||
"github.com/moby/moby/api/types/network"
|
||||
"github.com/moby/moby/client"
|
||||
)
|
||||
|
||||
@ -16,8 +15,8 @@ func TestNetworkPrunePromptTermination(t *testing.T) {
|
||||
t.Cleanup(cancel)
|
||||
|
||||
cli := test.NewFakeCli(&fakeClient{
|
||||
networkPruneFunc: func(ctx context.Context, pruneFilters client.Filters) (network.PruneReport, error) {
|
||||
return network.PruneReport{}, errors.New("fakeClient networkPruneFunc should not be called")
|
||||
networkPruneFunc: func(ctx context.Context, opts client.NetworkPruneOptions) (client.NetworkPruneResult, error) {
|
||||
return client.NetworkPruneResult{}, errors.New("fakeClient networkPruneFunc should not be called")
|
||||
},
|
||||
})
|
||||
cmd := newPruneCommand(cli)
|
||||
|
||||
@ -11,54 +11,54 @@ import (
|
||||
|
||||
type fakeClient struct {
|
||||
client.Client
|
||||
pluginCreateFunc func(createContext io.Reader, createOptions client.PluginCreateOptions) error
|
||||
pluginDisableFunc func(name string, disableOptions client.PluginDisableOptions) error
|
||||
pluginCreateFunc func(createContext io.Reader, options client.PluginCreateOptions) error
|
||||
pluginDisableFunc func(name string, options client.PluginDisableOptions) error
|
||||
pluginEnableFunc func(name string, options client.PluginEnableOptions) error
|
||||
pluginRemoveFunc func(name string, options client.PluginRemoveOptions) error
|
||||
pluginInstallFunc func(name string, options client.PluginInstallOptions) (io.ReadCloser, error)
|
||||
pluginListFunc func(filter client.Filters) (plugin.ListResponse, error)
|
||||
pluginListFunc func(options client.PluginListOptions) (plugin.ListResponse, error)
|
||||
pluginInspectFunc func(name string) (*plugin.Plugin, []byte, error)
|
||||
pluginUpgradeFunc func(name string, options client.PluginInstallOptions) (io.ReadCloser, error)
|
||||
}
|
||||
|
||||
func (c *fakeClient) PluginCreate(_ context.Context, createContext io.Reader, createOptions client.PluginCreateOptions) error {
|
||||
func (c *fakeClient) PluginCreate(_ context.Context, createContext io.Reader, options client.PluginCreateOptions) error {
|
||||
if c.pluginCreateFunc != nil {
|
||||
return c.pluginCreateFunc(createContext, createOptions)
|
||||
return c.pluginCreateFunc(createContext, options)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) PluginEnable(_ context.Context, name string, enableOptions client.PluginEnableOptions) error {
|
||||
func (c *fakeClient) PluginEnable(_ context.Context, name string, options client.PluginEnableOptions) error {
|
||||
if c.pluginEnableFunc != nil {
|
||||
return c.pluginEnableFunc(name, enableOptions)
|
||||
return c.pluginEnableFunc(name, options)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) PluginDisable(_ context.Context, name string, disableOptions client.PluginDisableOptions) error {
|
||||
func (c *fakeClient) PluginDisable(_ context.Context, name string, options client.PluginDisableOptions) error {
|
||||
if c.pluginDisableFunc != nil {
|
||||
return c.pluginDisableFunc(name, disableOptions)
|
||||
return c.pluginDisableFunc(name, options)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) PluginRemove(_ context.Context, name string, removeOptions client.PluginRemoveOptions) error {
|
||||
func (c *fakeClient) PluginRemove(_ context.Context, name string, options client.PluginRemoveOptions) error {
|
||||
if c.pluginRemoveFunc != nil {
|
||||
return c.pluginRemoveFunc(name, removeOptions)
|
||||
return c.pluginRemoveFunc(name, options)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) PluginInstall(_ context.Context, name string, installOptions client.PluginInstallOptions) (io.ReadCloser, error) {
|
||||
func (c *fakeClient) PluginInstall(_ context.Context, name string, options client.PluginInstallOptions) (io.ReadCloser, error) {
|
||||
if c.pluginInstallFunc != nil {
|
||||
return c.pluginInstallFunc(name, installOptions)
|
||||
return c.pluginInstallFunc(name, options)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) PluginList(_ context.Context, filter client.Filters) (plugin.ListResponse, error) {
|
||||
func (c *fakeClient) PluginList(_ context.Context, options client.PluginListOptions) (plugin.ListResponse, error) {
|
||||
if c.pluginListFunc != nil {
|
||||
return c.pluginListFunc(filter)
|
||||
return c.pluginListFunc(options)
|
||||
}
|
||||
|
||||
return plugin.ListResponse{}, nil
|
||||
|
||||
@ -32,7 +32,9 @@ func completeNames(dockerCLI completion.APIClientProvider, state pluginState) co
|
||||
// no filter
|
||||
}
|
||||
|
||||
list, err := dockerCLI.Client().PluginList(cmd.Context(), f)
|
||||
list, err := dockerCLI.Client().PluginList(cmd.Context(), client.PluginListOptions{
|
||||
Filters: f,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, cobra.ShellCompDirectiveError
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
flagsHelper "github.com/docker/cli/cli/flags"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/fvbommel/sortorder"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -46,13 +47,15 @@ func newListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
}
|
||||
|
||||
func runList(ctx context.Context, dockerCli command.Cli, options listOptions) error {
|
||||
plugins, err := dockerCli.Client().PluginList(ctx, options.filter.Value())
|
||||
resp, err := dockerCli.Client().PluginList(ctx, client.PluginListOptions{
|
||||
Filters: options.filter.Value(),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sort.Slice(plugins, func(i, j int) bool {
|
||||
return sortorder.NaturalLess(plugins[i].Name, plugins[j].Name)
|
||||
sort.Slice(resp, func(i, j int) bool {
|
||||
return sortorder.NaturalLess(resp[i].Name, resp[j].Name)
|
||||
})
|
||||
|
||||
format := options.format
|
||||
@ -69,5 +72,5 @@ func runList(ctx context.Context, dockerCli command.Cli, options listOptions) er
|
||||
Format: newFormat(format, options.quiet),
|
||||
Trunc: !options.noTrunc,
|
||||
}
|
||||
return formatWrite(pluginsCtx, plugins)
|
||||
return formatWrite(pluginsCtx, resp)
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ func TestListErrors(t *testing.T) {
|
||||
args []string
|
||||
flags map[string]string
|
||||
expectedError string
|
||||
listFunc func(filter client.Filters) (plugin.ListResponse, error)
|
||||
listFunc func(client.PluginListOptions) (plugin.ListResponse, error)
|
||||
}{
|
||||
{
|
||||
description: "too many arguments",
|
||||
@ -30,7 +30,7 @@ func TestListErrors(t *testing.T) {
|
||||
description: "error listing plugins",
|
||||
args: []string{},
|
||||
expectedError: "error listing plugins",
|
||||
listFunc: func(filter client.Filters) (plugin.ListResponse, error) {
|
||||
listFunc: func(client.PluginListOptions) (plugin.ListResponse, error) {
|
||||
return plugin.ListResponse{}, errors.New("error listing plugins")
|
||||
},
|
||||
},
|
||||
@ -60,7 +60,7 @@ func TestListErrors(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
singlePluginListFunc := func(_ client.Filters) (plugin.ListResponse, error) {
|
||||
singlePluginListFunc := func(client.PluginListOptions) (plugin.ListResponse, error) {
|
||||
return plugin.ListResponse{
|
||||
{
|
||||
ID: "id-foo",
|
||||
@ -78,7 +78,7 @@ func TestList(t *testing.T) {
|
||||
args []string
|
||||
flags map[string]string
|
||||
golden string
|
||||
listFunc func(filter client.Filters) (plugin.ListResponse, error)
|
||||
listFunc func(client.PluginListOptions) (plugin.ListResponse, error)
|
||||
}{
|
||||
{
|
||||
description: "list with no additional flags",
|
||||
@ -93,9 +93,9 @@ func TestList(t *testing.T) {
|
||||
"filter": "foo=bar",
|
||||
},
|
||||
golden: "plugin-list-without-format.golden",
|
||||
listFunc: func(filter client.Filters) (plugin.ListResponse, error) {
|
||||
assert.Check(t, filter["foo"]["bar"])
|
||||
return singlePluginListFunc(filter)
|
||||
listFunc: func(opts client.PluginListOptions) (plugin.ListResponse, error) {
|
||||
assert.Check(t, opts.Filters["foo"]["bar"])
|
||||
return singlePluginListFunc(opts)
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -115,7 +115,7 @@ func TestList(t *testing.T) {
|
||||
"format": "{{ .ID }}",
|
||||
},
|
||||
golden: "plugin-list-with-no-trunc-option.golden",
|
||||
listFunc: func(_ client.Filters) (plugin.ListResponse, error) {
|
||||
listFunc: func(client.PluginListOptions) (plugin.ListResponse, error) {
|
||||
return plugin.ListResponse{
|
||||
{
|
||||
ID: "xyg4z2hiSLO5yTnBJfg4OYia9gKA6Qjd",
|
||||
@ -144,7 +144,7 @@ func TestList(t *testing.T) {
|
||||
"format": "{{ .Name }}",
|
||||
},
|
||||
golden: "plugin-list-sort.golden",
|
||||
listFunc: func(_ client.Filters) (plugin.ListResponse, error) {
|
||||
listFunc: func(client.PluginListOptions) (plugin.ListResponse, error) {
|
||||
return plugin.ListResponse{
|
||||
{
|
||||
ID: "id-1",
|
||||
|
||||
@ -19,12 +19,12 @@ type fakeClient struct {
|
||||
|
||||
version string
|
||||
containerListFunc func(context.Context, client.ContainerListOptions) ([]container.Summary, error)
|
||||
containerPruneFunc func(ctx context.Context, pruneFilters client.Filters) (container.PruneReport, error)
|
||||
containerPruneFunc func(ctx context.Context, options client.ContainerPruneOptions) (client.ContainerPruneResult, error)
|
||||
eventsFn func(context.Context, client.EventsListOptions) (<-chan events.Message, <-chan error)
|
||||
imageListFunc func(ctx context.Context, options client.ImageListOptions) ([]image.Summary, error)
|
||||
infoFunc func(ctx context.Context) (system.Info, error)
|
||||
networkListFunc func(ctx context.Context, options client.NetworkListOptions) ([]network.Summary, error)
|
||||
networkPruneFunc func(ctx context.Context, pruneFilter client.Filters) (network.PruneReport, error)
|
||||
networkPruneFunc func(ctx context.Context, options client.NetworkPruneOptions) (client.NetworkPruneResult, error)
|
||||
nodeListFunc func(ctx context.Context, options client.NodeListOptions) ([]swarm.Node, error)
|
||||
serverVersion func(ctx context.Context) (types.Version, error)
|
||||
volumeListFunc func(ctx context.Context, options client.VolumeListOptions) (volume.ListResponse, error)
|
||||
@ -41,11 +41,11 @@ func (cli *fakeClient) ContainerList(ctx context.Context, options client.Contain
|
||||
return []container.Summary{}, nil
|
||||
}
|
||||
|
||||
func (cli *fakeClient) ContainersPrune(ctx context.Context, pruneFilters client.Filters) (container.PruneReport, error) {
|
||||
func (cli *fakeClient) ContainersPrune(ctx context.Context, opts client.ContainerPruneOptions) (client.ContainerPruneResult, error) {
|
||||
if cli.containerPruneFunc != nil {
|
||||
return cli.containerPruneFunc(ctx, pruneFilters)
|
||||
return cli.containerPruneFunc(ctx, opts)
|
||||
}
|
||||
return container.PruneReport{}, nil
|
||||
return client.ContainerPruneResult{}, nil
|
||||
}
|
||||
|
||||
func (cli *fakeClient) Events(ctx context.Context, opts client.EventsListOptions) (<-chan events.Message, <-chan error) {
|
||||
@ -73,11 +73,11 @@ func (cli *fakeClient) NetworkList(ctx context.Context, options client.NetworkLi
|
||||
return []network.Summary{}, nil
|
||||
}
|
||||
|
||||
func (cli *fakeClient) NetworksPrune(ctx context.Context, pruneFilter client.Filters) (network.PruneReport, error) {
|
||||
func (cli *fakeClient) NetworksPrune(ctx context.Context, opts client.NetworkPruneOptions) (client.NetworkPruneResult, error) {
|
||||
if cli.networkPruneFunc != nil {
|
||||
return cli.networkPruneFunc(ctx, pruneFilter)
|
||||
return cli.networkPruneFunc(ctx, opts)
|
||||
}
|
||||
return network.PruneReport{}, nil
|
||||
return client.NetworkPruneResult{}, nil
|
||||
}
|
||||
|
||||
func (cli *fakeClient) NodeList(ctx context.Context, options client.NodeListOptions) ([]swarm.Node, error) {
|
||||
|
||||
@ -239,7 +239,7 @@ func nodeNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []str
|
||||
// pluginNames contacts the API to get a list of plugin names.
|
||||
// In case of an error, an empty list is returned.
|
||||
func pluginNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []string {
|
||||
list, err := dockerCLI.Client().PluginList(cmd.Context(), nil)
|
||||
list, err := dockerCLI.Client().PluginList(cmd.Context(), client.PluginListOptions{})
|
||||
if err != nil {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
@ -8,8 +8,6 @@ import (
|
||||
|
||||
"github.com/docker/cli/cli/config/configfile"
|
||||
"github.com/docker/cli/internal/test"
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/network"
|
||||
"github.com/moby/moby/client"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
@ -56,11 +54,11 @@ func TestSystemPrunePromptTermination(t *testing.T) {
|
||||
t.Cleanup(cancel)
|
||||
|
||||
cli := test.NewFakeCli(&fakeClient{
|
||||
containerPruneFunc: func(ctx context.Context, pruneFilters client.Filters) (container.PruneReport, error) {
|
||||
return container.PruneReport{}, errors.New("fakeClient containerPruneFunc should not be called")
|
||||
containerPruneFunc: func(context.Context, client.ContainerPruneOptions) (client.ContainerPruneResult, error) {
|
||||
return client.ContainerPruneResult{}, errors.New("fakeClient containerPruneFunc should not be called")
|
||||
},
|
||||
networkPruneFunc: func(ctx context.Context, pruneFilters client.Filters) (network.PruneReport, error) {
|
||||
return network.PruneReport{}, errors.New("fakeClient networkPruneFunc should not be called")
|
||||
networkPruneFunc: func(context.Context, client.NetworkPruneOptions) (client.NetworkPruneResult, error) {
|
||||
return client.NetworkPruneResult{}, errors.New("fakeClient networkPruneFunc should not be called")
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ type fakeClient struct {
|
||||
volumeInspectFunc func(volumeID string) (volume.Volume, error)
|
||||
volumeListFunc func(filter client.Filters) (volume.ListResponse, error)
|
||||
volumeRemoveFunc func(volumeID string, force bool) error
|
||||
volumePruneFunc func(filter client.Filters) (volume.PruneReport, error)
|
||||
volumePruneFunc func(opts client.VolumePruneOptions) (client.VolumePruneResult, error)
|
||||
}
|
||||
|
||||
func (c *fakeClient) VolumeCreate(_ context.Context, options volume.CreateOptions) (volume.Volume, error) {
|
||||
@ -37,11 +37,11 @@ func (c *fakeClient) VolumeList(_ context.Context, options client.VolumeListOpti
|
||||
return volume.ListResponse{}, nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) VolumesPrune(_ context.Context, filter client.Filters) (volume.PruneReport, error) {
|
||||
func (c *fakeClient) VolumesPrune(_ context.Context, opts client.VolumePruneOptions) (client.VolumePruneResult, error) {
|
||||
if c.volumePruneFunc != nil {
|
||||
return c.volumePruneFunc(filter)
|
||||
return c.volumePruneFunc(opts)
|
||||
}
|
||||
return volume.PruneReport{}, nil
|
||||
return client.VolumePruneResult{}, nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) VolumeRemove(_ context.Context, volumeID string, force bool) error {
|
||||
|
||||
@ -11,6 +11,7 @@ import (
|
||||
"github.com/docker/cli/internal/prompt"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -88,17 +89,19 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||
}
|
||||
}
|
||||
|
||||
report, err := dockerCli.Client().VolumesPrune(ctx, pruneFilters)
|
||||
res, err := dockerCli.Client().VolumesPrune(ctx, client.VolumePruneOptions{
|
||||
Filters: pruneFilters,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, "", err
|
||||
}
|
||||
|
||||
if len(report.VolumesDeleted) > 0 {
|
||||
if len(res.Report.VolumesDeleted) > 0 {
|
||||
output = "Deleted Volumes:\n"
|
||||
for _, id := range report.VolumesDeleted {
|
||||
for _, id := range res.Report.VolumesDeleted {
|
||||
output += id + "\n"
|
||||
}
|
||||
spaceReclaimed = report.SpaceReclaimed
|
||||
spaceReclaimed = res.Report.SpaceReclaimed
|
||||
}
|
||||
|
||||
return spaceReclaimed, output, nil
|
||||
|
||||
@ -21,11 +21,11 @@ import (
|
||||
|
||||
func TestVolumePruneErrors(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
flags map[string]string
|
||||
volumePruneFunc func(args client.Filters) (volume.PruneReport, error)
|
||||
expectedError string
|
||||
name string
|
||||
args []string
|
||||
flags map[string]string
|
||||
pruneFunc func(client.VolumePruneOptions) (client.VolumePruneResult, error)
|
||||
expectedError string
|
||||
}{
|
||||
{
|
||||
name: "accepts no arguments",
|
||||
@ -37,8 +37,8 @@ func TestVolumePruneErrors(t *testing.T) {
|
||||
flags: map[string]string{
|
||||
"force": "true",
|
||||
},
|
||||
volumePruneFunc: func(args client.Filters) (volume.PruneReport, error) {
|
||||
return volume.PruneReport{}, errors.New("error pruning volumes")
|
||||
pruneFunc: func(opts client.VolumePruneOptions) (client.VolumePruneResult, error) {
|
||||
return client.VolumePruneResult{}, errors.New("error pruning volumes")
|
||||
},
|
||||
expectedError: "error pruning volumes",
|
||||
},
|
||||
@ -55,7 +55,7 @@ func TestVolumePruneErrors(t *testing.T) {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cmd := newPruneCommand(
|
||||
test.NewFakeCli(&fakeClient{
|
||||
volumePruneFunc: tc.volumePruneFunc,
|
||||
volumePruneFunc: tc.pruneFunc,
|
||||
}),
|
||||
)
|
||||
cmd.SetArgs(tc.args)
|
||||
@ -71,40 +71,40 @@ func TestVolumePruneErrors(t *testing.T) {
|
||||
|
||||
func TestVolumePruneSuccess(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
input string
|
||||
volumePruneFunc func(args client.Filters) (volume.PruneReport, error)
|
||||
name string
|
||||
args []string
|
||||
input string
|
||||
pruneFunc func(client.VolumePruneOptions) (client.VolumePruneResult, error)
|
||||
}{
|
||||
{
|
||||
name: "all",
|
||||
args: []string{"--all"},
|
||||
input: "y",
|
||||
volumePruneFunc: func(pruneFilter client.Filters) (volume.PruneReport, error) {
|
||||
assert.Check(t, is.DeepEqual(pruneFilter["all"], map[string]bool{"true": true}))
|
||||
return volume.PruneReport{}, nil
|
||||
pruneFunc: func(opts client.VolumePruneOptions) (client.VolumePruneResult, error) {
|
||||
assert.Check(t, is.DeepEqual(opts.Filters["all"], map[string]bool{"true": true}))
|
||||
return client.VolumePruneResult{}, nil
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "all-forced",
|
||||
args: []string{"--all", "--force"},
|
||||
volumePruneFunc: func(pruneFilter client.Filters) (volume.PruneReport, error) {
|
||||
return volume.PruneReport{}, nil
|
||||
pruneFunc: func(opts client.VolumePruneOptions) (client.VolumePruneResult, error) {
|
||||
return client.VolumePruneResult{}, nil
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "label-filter",
|
||||
args: []string{"--filter", "label=foobar"},
|
||||
input: "y",
|
||||
volumePruneFunc: func(pruneFilter client.Filters) (volume.PruneReport, error) {
|
||||
assert.Check(t, is.DeepEqual(pruneFilter["label"], map[string]bool{"foobar": true}))
|
||||
return volume.PruneReport{}, nil
|
||||
pruneFunc: func(opts client.VolumePruneOptions) (client.VolumePruneResult, error) {
|
||||
assert.Check(t, is.DeepEqual(opts.Filters["label"], map[string]bool{"foobar": true}))
|
||||
return client.VolumePruneResult{}, nil
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cli := test.NewFakeCli(&fakeClient{volumePruneFunc: tc.volumePruneFunc})
|
||||
cli := test.NewFakeCli(&fakeClient{volumePruneFunc: tc.pruneFunc})
|
||||
cmd := newPruneCommand(cli)
|
||||
if tc.input != "" {
|
||||
cli.SetIn(streams.NewIn(io.NopCloser(strings.NewReader(tc.input))))
|
||||
@ -121,7 +121,7 @@ func TestVolumePruneSuccess(t *testing.T) {
|
||||
func TestVolumePruneForce(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
volumePruneFunc func(args client.Filters) (volume.PruneReport, error)
|
||||
volumePruneFunc func(options client.VolumePruneOptions) (client.VolumePruneResult, error)
|
||||
}{
|
||||
{
|
||||
name: "empty",
|
||||
@ -180,12 +180,14 @@ func TestVolumePrunePromptNo(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func simplePruneFunc(client.Filters) (volume.PruneReport, error) {
|
||||
return volume.PruneReport{
|
||||
VolumesDeleted: []string{
|
||||
"foo", "bar", "baz",
|
||||
func simplePruneFunc(options client.VolumePruneOptions) (client.VolumePruneResult, error) {
|
||||
return client.VolumePruneResult{
|
||||
Report: volume.PruneReport{
|
||||
VolumesDeleted: []string{
|
||||
"foo", "bar", "baz",
|
||||
},
|
||||
SpaceReclaimed: 2000,
|
||||
},
|
||||
SpaceReclaimed: 2000,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -194,8 +196,8 @@ func TestVolumePrunePromptTerminate(t *testing.T) {
|
||||
t.Cleanup(cancel)
|
||||
|
||||
cli := test.NewFakeCli(&fakeClient{
|
||||
volumePruneFunc: func(filter client.Filters) (volume.PruneReport, error) {
|
||||
return volume.PruneReport{}, errors.New("fakeClient volumePruneFunc should not be called")
|
||||
volumePruneFunc: func(options client.VolumePruneOptions) (client.VolumePruneResult, error) {
|
||||
return client.VolumePruneResult{}, errors.New("fakeClient volumePruneFunc should not be called")
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/cli/command/completion"
|
||||
"github.com/moby/moby/api/types/volume"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
@ -60,7 +61,7 @@ func runUpdate(ctx context.Context, dockerCli command.Cli, volumeID, availabilit
|
||||
|
||||
return apiClient.VolumeUpdate(
|
||||
ctx, vol.ClusterVolume.ID, vol.ClusterVolume.Version,
|
||||
volume.UpdateOptions{
|
||||
client.VolumeUpdateOptions{
|
||||
Spec: &vol.ClusterVolume.Spec,
|
||||
},
|
||||
)
|
||||
|
||||
@ -28,8 +28,8 @@ require (
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/mattn/go-runewidth v0.0.17
|
||||
github.com/moby/go-archive v0.1.0
|
||||
github.com/moby/moby/api v1.52.0-beta.2
|
||||
github.com/moby/moby/client v0.1.0-beta.2
|
||||
github.com/moby/moby/api v1.52.0-beta.2.0.20251017201131-ec83dd46ed6c // master
|
||||
github.com/moby/moby/client v0.1.0-beta.2.0.20251017201131-ec83dd46ed6c // master
|
||||
github.com/moby/patternmatcher v0.6.0
|
||||
github.com/moby/swarmkit/v2 v2.1.0
|
||||
github.com/moby/sys/atomicwriter v0.1.0
|
||||
|
||||
@ -170,10 +170,10 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N
|
||||
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
||||
github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ=
|
||||
github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo=
|
||||
github.com/moby/moby/api v1.52.0-beta.2 h1:cuilbu4cLBZnlNpJXuv3QTleOxgo3kGqkNGt3ICe1yY=
|
||||
github.com/moby/moby/api v1.52.0-beta.2/go.mod h1:/ou52HkRydg4+odrUR3vFsGgjIyHvprrpEQEkweL10s=
|
||||
github.com/moby/moby/client v0.1.0-beta.2 h1:Uy7JhcAOvQAQriowODpHaAJokfw/AhUya0216sk1hAk=
|
||||
github.com/moby/moby/client v0.1.0-beta.2/go.mod h1:yYEv2G6pYi8u63ga0zlU9KsM7DpoGXubtMaZMJE7/dw=
|
||||
github.com/moby/moby/api v1.52.0-beta.2.0.20251017201131-ec83dd46ed6c h1:H7R4PXQj39EaRxCrBjN+DRDFdyy+53TdDgo5iWmhXKQ=
|
||||
github.com/moby/moby/api v1.52.0-beta.2.0.20251017201131-ec83dd46ed6c/go.mod h1:/ou52HkRydg4+odrUR3vFsGgjIyHvprrpEQEkweL10s=
|
||||
github.com/moby/moby/client v0.1.0-beta.2.0.20251017201131-ec83dd46ed6c h1:qFRyxx446aKHvUht2DUXzSPNwzZUgCaunUHH8TTTBgY=
|
||||
github.com/moby/moby/client v0.1.0-beta.2.0.20251017201131-ec83dd46ed6c/go.mod h1:sxVfwGqVgh7n+tdxA4gFToQ/lf+bM7zATnvQjVnsKT4=
|
||||
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
|
||||
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
|
||||
github.com/moby/swarmkit/v2 v2.1.0 h1:u+cJ5hSyF3HnzsyI+NtegYxdIPQIuibk7IbpXNxuISM=
|
||||
|
||||
4
vendor/github.com/moby/moby/api/types/build/cache.go
generated
vendored
4
vendor/github.com/moby/moby/api/types/build/cache.go
generated
vendored
@ -8,10 +8,6 @@ import (
|
||||
type CacheRecord struct {
|
||||
// ID is the unique ID of the build cache record.
|
||||
ID string
|
||||
// Parent is the ID of the parent build cache record.
|
||||
//
|
||||
// Deprecated: deprecated in API v1.42 and up, as it was deprecated in BuildKit; use Parents instead.
|
||||
Parent string `json:"Parent,omitempty"`
|
||||
// Parents is the list of parent build cache record IDs.
|
||||
Parents []string `json:" Parents,omitempty"`
|
||||
// Type is the cache record type.
|
||||
|
||||
2
vendor/github.com/moby/moby/api/types/container/config.go
generated
vendored
2
vendor/github.com/moby/moby/api/types/container/config.go
generated
vendored
@ -44,7 +44,7 @@ type Config struct {
|
||||
NetworkDisabled bool `json:",omitempty"` // Is network disabled
|
||||
// Mac Address of the container.
|
||||
//
|
||||
// Deprecated: this field is deprecated since API v1.44. Use EndpointSettings.MacAddress instead.
|
||||
// Deprecated: this field is deprecated since API v1.44 and obsolete since v1.52. Use EndpointSettings.MacAddress instead.
|
||||
MacAddress string `json:",omitempty"`
|
||||
OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile
|
||||
Labels map[string]string // List of labels set to this container
|
||||
|
||||
6
vendor/github.com/moby/moby/api/types/image/summary.go
generated
vendored
6
vendor/github.com/moby/moby/api/types/image/summary.go
generated
vendored
@ -3,7 +3,6 @@ package image
|
||||
import ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
type Summary struct {
|
||||
|
||||
// Number of containers using this image. Includes both stopped and running
|
||||
// containers.
|
||||
//
|
||||
@ -93,9 +92,4 @@ type Summary struct {
|
||||
//
|
||||
// Required: true
|
||||
Size int64 `json:"Size"`
|
||||
|
||||
// Total size of the image including all layers it is composed of.
|
||||
//
|
||||
// Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
|
||||
VirtualSize int64 `json:"VirtualSize,omitempty"`
|
||||
}
|
||||
|
||||
25
vendor/github.com/moby/moby/api/types/network/endpoint.go
generated
vendored
25
vendor/github.com/moby/moby/api/types/network/endpoint.go
generated
vendored
@ -8,14 +8,10 @@ import (
|
||||
|
||||
// EndpointSettings stores the network endpoint details
|
||||
type EndpointSettings struct {
|
||||
// Configurations
|
||||
// Configuration data
|
||||
IPAMConfig *EndpointIPAMConfig
|
||||
Links []string
|
||||
Aliases []string // Aliases holds the list of extra, user-specified DNS names for this endpoint.
|
||||
// MacAddress may be used to specify a MAC address when the container is created.
|
||||
// Once the container is running, it becomes operational data (it may contain a
|
||||
// generated address).
|
||||
MacAddress string
|
||||
DriverOpts map[string]string
|
||||
|
||||
// GwPriority determines which endpoint will provide the default gateway
|
||||
@ -23,17 +19,24 @@ type EndpointSettings struct {
|
||||
// If multiple endpoints have the same priority, they are lexicographically
|
||||
// sorted based on their network name, and the one that sorts first is picked.
|
||||
GwPriority int
|
||||
|
||||
// Operational data
|
||||
NetworkID string
|
||||
EndpointID string
|
||||
Gateway netip.Addr
|
||||
IPAddress netip.Addr
|
||||
|
||||
NetworkID string
|
||||
EndpointID string
|
||||
Gateway netip.Addr
|
||||
IPAddress netip.Addr
|
||||
|
||||
// MacAddress may be used to specify a MAC address when the container is created.
|
||||
// Once the container is running, it becomes operational data (it may contain a
|
||||
// generated address).
|
||||
MacAddress string
|
||||
IPPrefixLen int
|
||||
IPv6Gateway netip.Addr
|
||||
GlobalIPv6Address netip.Addr
|
||||
GlobalIPv6PrefixLen int
|
||||
// DNSNames holds all the (non fully qualified) DNS names associated to this endpoint. First entry is used to
|
||||
// generate PTR records.
|
||||
// DNSNames holds all the (non fully qualified) DNS names associated to this
|
||||
// endpoint. The first entry is used to generate PTR records.
|
||||
DNSNames []string
|
||||
}
|
||||
|
||||
|
||||
11
vendor/github.com/moby/moby/api/types/system/disk_usage.go
generated
vendored
11
vendor/github.com/moby/moby/api/types/system/disk_usage.go
generated
vendored
@ -24,10 +24,9 @@ const (
|
||||
// DiskUsage contains response of Engine API:
|
||||
// GET "/system/df"
|
||||
type DiskUsage struct {
|
||||
LayersSize int64
|
||||
Images []*image.Summary
|
||||
Containers []*container.Summary
|
||||
Volumes []*volume.Volume
|
||||
BuildCache []*build.CacheRecord
|
||||
BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
|
||||
LayersSize int64
|
||||
Images []*image.Summary
|
||||
Containers []*container.Summary
|
||||
Volumes []*volume.Volume
|
||||
BuildCache []*build.CacheRecord
|
||||
}
|
||||
|
||||
7
vendor/github.com/moby/moby/api/types/volume/volume_update.go
generated
vendored
7
vendor/github.com/moby/moby/api/types/volume/volume_update.go
generated
vendored
@ -1,7 +0,0 @@
|
||||
package volume
|
||||
|
||||
// UpdateOptions is configuration to update a Volume with.
|
||||
type UpdateOptions struct {
|
||||
// Spec is the ClusterVolumeSpec to update the volume to.
|
||||
Spec *ClusterVolumeSpec `json:"Spec,omitempty"`
|
||||
}
|
||||
12
vendor/github.com/moby/moby/client/client_interfaces.go
generated
vendored
12
vendor/github.com/moby/moby/client/client_interfaces.go
generated
vendored
@ -88,7 +88,7 @@ type ContainerAPIClient interface {
|
||||
ContainerWait(ctx context.Context, container string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
|
||||
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, container.PathStat, error)
|
||||
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options CopyToContainerOptions) error
|
||||
ContainersPrune(ctx context.Context, pruneFilters Filters) (container.PruneReport, error)
|
||||
ContainersPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error)
|
||||
}
|
||||
|
||||
type ExecAPIClient interface {
|
||||
@ -118,7 +118,7 @@ type ImageAPIClient interface {
|
||||
ImageRemove(ctx context.Context, image string, options ImageRemoveOptions) ([]image.DeleteResponse, error)
|
||||
ImageSearch(ctx context.Context, term string, options ImageSearchOptions) ([]registry.SearchResult, error)
|
||||
ImageTag(ctx context.Context, image, ref string) error
|
||||
ImagesPrune(ctx context.Context, pruneFilter Filters) (image.PruneReport, error)
|
||||
ImagesPrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error)
|
||||
|
||||
ImageInspect(ctx context.Context, image string, _ ...ImageInspectOption) (image.InspectResponse, error)
|
||||
ImageHistory(ctx context.Context, image string, _ ...ImageHistoryOption) ([]image.HistoryResponseItem, error)
|
||||
@ -135,7 +135,7 @@ type NetworkAPIClient interface {
|
||||
NetworkInspectWithRaw(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, []byte, error)
|
||||
NetworkList(ctx context.Context, options NetworkListOptions) ([]network.Summary, error)
|
||||
NetworkRemove(ctx context.Context, network string) error
|
||||
NetworksPrune(ctx context.Context, pruneFilter Filters) (network.PruneReport, error)
|
||||
NetworksPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error)
|
||||
}
|
||||
|
||||
// NodeAPIClient defines API client methods for the nodes
|
||||
@ -148,7 +148,7 @@ type NodeAPIClient interface {
|
||||
|
||||
// PluginAPIClient defines API client methods for the plugins
|
||||
type PluginAPIClient interface {
|
||||
PluginList(ctx context.Context, filter Filters) (plugin.ListResponse, error)
|
||||
PluginList(ctx context.Context, opts PluginListOptions) (plugin.ListResponse, error)
|
||||
PluginRemove(ctx context.Context, name string, options PluginRemoveOptions) error
|
||||
PluginEnable(ctx context.Context, name string, options PluginEnableOptions) error
|
||||
PluginDisable(ctx context.Context, name string, options PluginDisableOptions) error
|
||||
@ -200,8 +200,8 @@ type VolumeAPIClient interface {
|
||||
VolumeInspectWithRaw(ctx context.Context, volumeID string) (volume.Volume, []byte, error)
|
||||
VolumeList(ctx context.Context, options VolumeListOptions) (volume.ListResponse, error)
|
||||
VolumeRemove(ctx context.Context, volumeID string, force bool) error
|
||||
VolumesPrune(ctx context.Context, pruneFilter Filters) (volume.PruneReport, error)
|
||||
VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options volume.UpdateOptions) error
|
||||
VolumesPrune(ctx context.Context, opts VolumePruneOptions) (VolumePruneResult, error)
|
||||
VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options VolumeUpdateOptions) error
|
||||
}
|
||||
|
||||
// SecretAPIClient defines API client methods for secrets
|
||||
|
||||
20
vendor/github.com/moby/moby/client/container_prune.go
generated
vendored
20
vendor/github.com/moby/moby/client/container_prune.go
generated
vendored
@ -9,21 +9,31 @@ import (
|
||||
"github.com/moby/moby/api/types/container"
|
||||
)
|
||||
|
||||
// ContainerPruneOptions holds parameters to prune containers.
|
||||
type ContainerPruneOptions struct {
|
||||
Filters Filters
|
||||
}
|
||||
|
||||
// ContainerPruneResult holds the result from the [Client.ContainersPrune] method.
|
||||
type ContainerPruneResult struct {
|
||||
Report container.PruneReport
|
||||
}
|
||||
|
||||
// ContainersPrune requests the daemon to delete unused data
|
||||
func (cli *Client) ContainersPrune(ctx context.Context, pruneFilters Filters) (container.PruneReport, error) {
|
||||
func (cli *Client) ContainersPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) {
|
||||
query := url.Values{}
|
||||
pruneFilters.updateURLValues(query)
|
||||
opts.Filters.updateURLValues(query)
|
||||
|
||||
resp, err := cli.post(ctx, "/containers/prune", query, nil, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
if err != nil {
|
||||
return container.PruneReport{}, err
|
||||
return ContainerPruneResult{}, err
|
||||
}
|
||||
|
||||
var report container.PruneReport
|
||||
if err := json.NewDecoder(resp.Body).Decode(&report); err != nil {
|
||||
return container.PruneReport{}, fmt.Errorf("Error retrieving disk usage: %v", err)
|
||||
return ContainerPruneResult{}, fmt.Errorf("Error retrieving disk usage: %v", err)
|
||||
}
|
||||
|
||||
return report, nil
|
||||
return ContainerPruneResult{Report: report}, nil
|
||||
}
|
||||
|
||||
20
vendor/github.com/moby/moby/client/image_prune.go
generated
vendored
20
vendor/github.com/moby/moby/client/image_prune.go
generated
vendored
@ -9,21 +9,31 @@ import (
|
||||
"github.com/moby/moby/api/types/image"
|
||||
)
|
||||
|
||||
// ImagePruneOptions holds parameters to prune images.
|
||||
type ImagePruneOptions struct {
|
||||
Filters Filters
|
||||
}
|
||||
|
||||
// ImagePruneResult holds the result from the [Client.ImagesPrune] method.
|
||||
type ImagePruneResult struct {
|
||||
Report image.PruneReport
|
||||
}
|
||||
|
||||
// ImagesPrune requests the daemon to delete unused data
|
||||
func (cli *Client) ImagesPrune(ctx context.Context, pruneFilters Filters) (image.PruneReport, error) {
|
||||
func (cli *Client) ImagesPrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) {
|
||||
query := url.Values{}
|
||||
pruneFilters.updateURLValues(query)
|
||||
opts.Filters.updateURLValues(query)
|
||||
|
||||
resp, err := cli.post(ctx, "/images/prune", query, nil, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
if err != nil {
|
||||
return image.PruneReport{}, err
|
||||
return ImagePruneResult{}, err
|
||||
}
|
||||
|
||||
var report image.PruneReport
|
||||
if err := json.NewDecoder(resp.Body).Decode(&report); err != nil {
|
||||
return image.PruneReport{}, fmt.Errorf("Error retrieving disk usage: %v", err)
|
||||
return ImagePruneResult{}, fmt.Errorf("Error retrieving disk usage: %v", err)
|
||||
}
|
||||
|
||||
return report, nil
|
||||
return ImagePruneResult{Report: report}, nil
|
||||
}
|
||||
|
||||
20
vendor/github.com/moby/moby/client/network_prune.go
generated
vendored
20
vendor/github.com/moby/moby/client/network_prune.go
generated
vendored
@ -9,21 +9,31 @@ import (
|
||||
"github.com/moby/moby/api/types/network"
|
||||
)
|
||||
|
||||
// NetworkPruneOptions holds parameters to prune networks.
|
||||
type NetworkPruneOptions struct {
|
||||
Filters Filters
|
||||
}
|
||||
|
||||
// NetworkPruneResult holds the result from the [Client.NetworksPrune] method.
|
||||
type NetworkPruneResult struct {
|
||||
Report network.PruneReport
|
||||
}
|
||||
|
||||
// NetworksPrune requests the daemon to delete unused networks
|
||||
func (cli *Client) NetworksPrune(ctx context.Context, pruneFilters Filters) (network.PruneReport, error) {
|
||||
func (cli *Client) NetworksPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) {
|
||||
query := url.Values{}
|
||||
pruneFilters.updateURLValues(query)
|
||||
opts.Filters.updateURLValues(query)
|
||||
|
||||
resp, err := cli.post(ctx, "/networks/prune", query, nil, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
if err != nil {
|
||||
return network.PruneReport{}, err
|
||||
return NetworkPruneResult{}, err
|
||||
}
|
||||
|
||||
var report network.PruneReport
|
||||
if err := json.NewDecoder(resp.Body).Decode(&report); err != nil {
|
||||
return network.PruneReport{}, fmt.Errorf("Error retrieving network prune report: %v", err)
|
||||
return NetworkPruneResult{}, fmt.Errorf("Error retrieving network prune report: %v", err)
|
||||
}
|
||||
|
||||
return report, nil
|
||||
return NetworkPruneResult{Report: report}, nil
|
||||
}
|
||||
|
||||
9
vendor/github.com/moby/moby/client/plugin_list.go
generated
vendored
9
vendor/github.com/moby/moby/client/plugin_list.go
generated
vendored
@ -8,12 +8,17 @@ import (
|
||||
"github.com/moby/moby/api/types/plugin"
|
||||
)
|
||||
|
||||
// PluginListOptions holds parameters to list plugins.
|
||||
type PluginListOptions struct {
|
||||
Filters Filters
|
||||
}
|
||||
|
||||
// PluginList returns the installed plugins
|
||||
func (cli *Client) PluginList(ctx context.Context, filter Filters) (plugin.ListResponse, error) {
|
||||
func (cli *Client) PluginList(ctx context.Context, opts PluginListOptions) (plugin.ListResponse, error) {
|
||||
var plugins plugin.ListResponse
|
||||
query := url.Values{}
|
||||
|
||||
filter.updateURLValues(query)
|
||||
opts.Filters.updateURLValues(query)
|
||||
resp, err := cli.get(ctx, "/plugins", query, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
if err != nil {
|
||||
|
||||
20
vendor/github.com/moby/moby/client/volume_prune.go
generated
vendored
20
vendor/github.com/moby/moby/client/volume_prune.go
generated
vendored
@ -9,21 +9,31 @@ import (
|
||||
"github.com/moby/moby/api/types/volume"
|
||||
)
|
||||
|
||||
// VolumePruneOptions holds parameters to prune networks.
|
||||
type VolumePruneOptions struct {
|
||||
Filters Filters
|
||||
}
|
||||
|
||||
// VolumePruneResult holds the result from the [Client.VolumesPrune] method.
|
||||
type VolumePruneResult struct {
|
||||
Report volume.PruneReport
|
||||
}
|
||||
|
||||
// VolumesPrune requests the daemon to delete unused data
|
||||
func (cli *Client) VolumesPrune(ctx context.Context, pruneFilters Filters) (volume.PruneReport, error) {
|
||||
func (cli *Client) VolumesPrune(ctx context.Context, opts VolumePruneOptions) (VolumePruneResult, error) {
|
||||
query := url.Values{}
|
||||
pruneFilters.updateURLValues(query)
|
||||
opts.Filters.updateURLValues(query)
|
||||
|
||||
resp, err := cli.post(ctx, "/volumes/prune", query, nil, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
if err != nil {
|
||||
return volume.PruneReport{}, err
|
||||
return VolumePruneResult{}, err
|
||||
}
|
||||
|
||||
var report volume.PruneReport
|
||||
if err := json.NewDecoder(resp.Body).Decode(&report); err != nil {
|
||||
return volume.PruneReport{}, fmt.Errorf("Error retrieving volume prune report: %v", err)
|
||||
return VolumePruneResult{}, fmt.Errorf("Error retrieving volume prune report: %v", err)
|
||||
}
|
||||
|
||||
return report, nil
|
||||
return VolumePruneResult{Report: report}, nil
|
||||
}
|
||||
|
||||
7
vendor/github.com/moby/moby/client/volume_update.go
generated
vendored
7
vendor/github.com/moby/moby/client/volume_update.go
generated
vendored
@ -8,9 +8,14 @@ import (
|
||||
"github.com/moby/moby/api/types/volume"
|
||||
)
|
||||
|
||||
type VolumeUpdateOptions struct {
|
||||
// Spec is the ClusterVolumeSpec to update the volume to.
|
||||
Spec *volume.ClusterVolumeSpec `json:"Spec,omitempty"`
|
||||
}
|
||||
|
||||
// VolumeUpdate updates a volume. This only works for Cluster Volumes, and
|
||||
// only some fields can be updated.
|
||||
func (cli *Client) VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options volume.UpdateOptions) error {
|
||||
func (cli *Client) VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options VolumeUpdateOptions) error {
|
||||
volumeID, err := trimID("volume", volumeID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -168,7 +168,7 @@ github.com/moby/docker-image-spec/specs-go/v1
|
||||
github.com/moby/go-archive
|
||||
github.com/moby/go-archive/compression
|
||||
github.com/moby/go-archive/tarheader
|
||||
# github.com/moby/moby/api v1.52.0-beta.2
|
||||
# github.com/moby/moby/api v1.52.0-beta.2.0.20251017201131-ec83dd46ed6c
|
||||
## explicit; go 1.23.0
|
||||
github.com/moby/moby/api/pkg/authconfig
|
||||
github.com/moby/moby/api/pkg/progress
|
||||
@ -193,7 +193,7 @@ github.com/moby/moby/api/types/swarm
|
||||
github.com/moby/moby/api/types/system
|
||||
github.com/moby/moby/api/types/versions
|
||||
github.com/moby/moby/api/types/volume
|
||||
# github.com/moby/moby/client v0.1.0-beta.2
|
||||
# github.com/moby/moby/client v0.1.0-beta.2.0.20251017201131-ec83dd46ed6c
|
||||
## explicit; go 1.23.0
|
||||
github.com/moby/moby/client
|
||||
github.com/moby/moby/client/internal
|
||||
|
||||
Reference in New Issue
Block a user