From 4b450f113b73ca70f117dd922c1bff2c88b10b53 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 10 Nov 2025 16:09:04 +0100 Subject: [PATCH] vendor: github.com/moby/moby/api, moby/client master Signed-off-by: Sebastiaan van Stijn --- cli/command/checkpoint/client_test.go | 12 +++--- cli/command/checkpoint/create.go | 2 +- cli/command/checkpoint/create_test.go | 10 ++--- cli/command/checkpoint/list.go | 2 +- cli/command/checkpoint/list_test.go | 4 +- cli/command/checkpoint/remove.go | 16 +++----- cli/command/checkpoint/remove_test.go | 12 +++--- cli/command/formatter/container.go | 2 +- cli/command/formatter/container_test.go | 2 +- cli/command/plugin/formatter.go | 2 +- cli/command/plugin/formatter_test.go | 6 +-- cli/command/plugin/list_test.go | 4 +- vendor.mod | 4 +- vendor.sum | 8 ++-- .../moby/moby/api/types/container/health.go | 9 ++-- .../moby/moby/api/types/container/state.go | 14 ++++--- .../moby/api/types/plugin/plugin_responses.go | 2 +- .../moby/moby/api/types/system/disk_usage.go | 19 --------- .../moby/api/types/volume/list_response.go | 2 +- .../github.com/moby/moby/client/checkpoint.go | 16 -------- .../moby/moby/client/checkpoint_create.go | 11 +++-- .../moby/moby/client/checkpoint_delete.go | 29 ------------- .../moby/moby/client/checkpoint_list.go | 4 +- .../moby/moby/client/checkpoint_remove.go | 34 +++++++++++++++ .../moby/moby/client/client_interfaces.go | 11 +++++ .../moby/moby/client/plugin_list.go | 2 +- .../moby/moby/client/system_disk_usage.go | 41 ++++++++++++------- .../moby/moby/client/volume_list.go | 17 ++------ vendor/modules.txt | 4 +- 29 files changed, 146 insertions(+), 155 deletions(-) delete mode 100644 vendor/github.com/moby/moby/client/checkpoint.go delete mode 100644 vendor/github.com/moby/moby/client/checkpoint_delete.go create mode 100644 vendor/github.com/moby/moby/client/checkpoint_remove.go diff --git a/cli/command/checkpoint/client_test.go b/cli/command/checkpoint/client_test.go index 0c76c0a6dcc4..2be1189fd832 100644 --- a/cli/command/checkpoint/client_test.go +++ b/cli/command/checkpoint/client_test.go @@ -8,23 +8,23 @@ import ( type fakeClient struct { client.Client - checkpointCreateFunc func(container string, options client.CheckpointCreateOptions) error - checkpointDeleteFunc func(container string, options client.CheckpointDeleteOptions) error + checkpointCreateFunc func(container string, options client.CheckpointCreateOptions) (client.CheckpointCreateResult, error) + checkpointDeleteFunc func(container string, options client.CheckpointRemoveOptions) (client.CheckpointRemoveResult, error) checkpointListFunc func(container string, options client.CheckpointListOptions) (client.CheckpointListResult, error) } -func (cli *fakeClient) CheckpointCreate(_ context.Context, container string, options client.CheckpointCreateOptions) error { +func (cli *fakeClient) CheckpointCreate(_ context.Context, container string, options client.CheckpointCreateOptions) (client.CheckpointCreateResult, error) { if cli.checkpointCreateFunc != nil { return cli.checkpointCreateFunc(container, options) } - return nil + return client.CheckpointCreateResult{}, nil } -func (cli *fakeClient) CheckpointDelete(_ context.Context, container string, options client.CheckpointDeleteOptions) error { +func (cli *fakeClient) CheckpointRemove(_ context.Context, container string, options client.CheckpointRemoveOptions) (client.CheckpointRemoveResult, error) { if cli.checkpointDeleteFunc != nil { return cli.checkpointDeleteFunc(container, options) } - return nil + return client.CheckpointRemoveResult{}, nil } func (cli *fakeClient) CheckpointList(_ context.Context, container string, options client.CheckpointListOptions) (client.CheckpointListResult, error) { diff --git a/cli/command/checkpoint/create.go b/cli/command/checkpoint/create.go index fabb96a7ca94..d361d78aa0fa 100644 --- a/cli/command/checkpoint/create.go +++ b/cli/command/checkpoint/create.go @@ -41,7 +41,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command { } func runCreate(ctx context.Context, dockerCLI command.Cli, opts createOptions) error { - err := dockerCLI.Client().CheckpointCreate(ctx, opts.container, client.CheckpointCreateOptions{ + _, err := dockerCLI.Client().CheckpointCreate(ctx, opts.container, client.CheckpointCreateOptions{ CheckpointID: opts.checkpoint, CheckpointDir: opts.checkpointDir, Exit: !opts.leaveRunning, diff --git a/cli/command/checkpoint/create_test.go b/cli/command/checkpoint/create_test.go index 4fb80a4ed89d..5f91c0493a5d 100644 --- a/cli/command/checkpoint/create_test.go +++ b/cli/command/checkpoint/create_test.go @@ -16,7 +16,7 @@ import ( func TestCheckpointCreateErrors(t *testing.T) { testCases := []struct { args []string - checkpointCreateFunc func(container string, options client.CheckpointCreateOptions) error + checkpointCreateFunc func(container string, options client.CheckpointCreateOptions) (client.CheckpointCreateResult, error) expectedError string }{ { @@ -29,8 +29,8 @@ func TestCheckpointCreateErrors(t *testing.T) { }, { args: []string{"foo", "bar"}, - checkpointCreateFunc: func(container string, options client.CheckpointCreateOptions) error { - return errors.New("error creating checkpoint for container foo") + checkpointCreateFunc: func(container string, options client.CheckpointCreateOptions) (client.CheckpointCreateResult, error) { + return client.CheckpointCreateResult{}, errors.New("error creating checkpoint for container foo") }, expectedError: "error creating checkpoint for container foo", }, @@ -61,10 +61,10 @@ func TestCheckpointCreateWithOptions(t *testing.T) { var actualContainerName string var actualOptions client.CheckpointCreateOptions cli := test.NewFakeCli(&fakeClient{ - checkpointCreateFunc: func(container string, options client.CheckpointCreateOptions) error { + checkpointCreateFunc: func(container string, options client.CheckpointCreateOptions) (client.CheckpointCreateResult, error) { actualContainerName = container actualOptions = options - return nil + return client.CheckpointCreateResult{}, nil }, }) cmd := newCreateCommand(cli) diff --git a/cli/command/checkpoint/list.go b/cli/command/checkpoint/list.go index 9eb3a4f75a09..6ee0ed8f738b 100644 --- a/cli/command/checkpoint/list.go +++ b/cli/command/checkpoint/list.go @@ -48,5 +48,5 @@ func runList(ctx context.Context, dockerCLI command.Cli, container string, opts Output: dockerCLI.Out(), Format: newFormat(formatter.TableFormatKey), } - return formatWrite(cpCtx, checkpoints.Checkpoints) + return formatWrite(cpCtx, checkpoints.Items) } diff --git a/cli/command/checkpoint/list_test.go b/cli/command/checkpoint/list_test.go index 411022b117de..26e9e5511984 100644 --- a/cli/command/checkpoint/list_test.go +++ b/cli/command/checkpoint/list_test.go @@ -55,7 +55,7 @@ func TestCheckpointListWithOptions(t *testing.T) { containerID = container checkpointDir = options.CheckpointDir return client.CheckpointListResult{ - Checkpoints: []checkpoint.Summary{ + Items: []checkpoint.Summary{ {Name: "checkpoint-foo"}, }, }, nil @@ -63,7 +63,7 @@ func TestCheckpointListWithOptions(t *testing.T) { }) cmd := newListCommand(cli) cmd.SetArgs([]string{"container-foo"}) - cmd.Flags().Set("checkpoint-dir", "/dir/foo") + assert.Check(t, cmd.Flags().Set("checkpoint-dir", "/dir/foo")) assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("container-foo", containerID)) assert.Check(t, is.Equal("/dir/foo", checkpointDir)) diff --git a/cli/command/checkpoint/remove.go b/cli/command/checkpoint/remove.go index bb317e76287d..773a69407fcb 100644 --- a/cli/command/checkpoint/remove.go +++ b/cli/command/checkpoint/remove.go @@ -1,8 +1,6 @@ package checkpoint import ( - "context" - "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/moby/moby/client" @@ -22,7 +20,12 @@ func newRemoveCommand(dockerCLI command.Cli) *cobra.Command { Short: "Remove a checkpoint", Args: cli.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - return runRemove(cmd.Context(), dockerCLI, args[0], args[1], opts) + containerID, checkpointID := args[0], args[1] + _, err := dockerCLI.Client().CheckpointRemove(cmd.Context(), containerID, client.CheckpointRemoveOptions{ + CheckpointID: checkpointID, + CheckpointDir: opts.checkpointDir, + }) + return err }, DisableFlagsInUseLine: true, } @@ -32,10 +35,3 @@ func newRemoveCommand(dockerCLI command.Cli) *cobra.Command { return cmd } - -func runRemove(ctx context.Context, dockerCli command.Cli, container string, checkpointID string, opts removeOptions) error { - return dockerCli.Client().CheckpointDelete(ctx, container, client.CheckpointDeleteOptions{ - CheckpointID: checkpointID, - CheckpointDir: opts.checkpointDir, - }) -} diff --git a/cli/command/checkpoint/remove_test.go b/cli/command/checkpoint/remove_test.go index ee4b5bb120b0..30777da8cff9 100644 --- a/cli/command/checkpoint/remove_test.go +++ b/cli/command/checkpoint/remove_test.go @@ -14,7 +14,7 @@ import ( func TestCheckpointRemoveErrors(t *testing.T) { testCases := []struct { args []string - checkpointDeleteFunc func(container string, options client.CheckpointDeleteOptions) error + checkpointDeleteFunc func(container string, options client.CheckpointRemoveOptions) (client.CheckpointRemoveResult, error) expectedError string }{ { @@ -27,8 +27,8 @@ func TestCheckpointRemoveErrors(t *testing.T) { }, { args: []string{"foo", "bar"}, - checkpointDeleteFunc: func(container string, options client.CheckpointDeleteOptions) error { - return errors.New("error deleting checkpoint") + checkpointDeleteFunc: func(container string, options client.CheckpointRemoveOptions) (client.CheckpointRemoveResult, error) { + return client.CheckpointRemoveResult{}, errors.New("error deleting checkpoint") }, expectedError: "error deleting checkpoint", }, @@ -49,16 +49,16 @@ func TestCheckpointRemoveErrors(t *testing.T) { func TestCheckpointRemoveWithOptions(t *testing.T) { var containerID, checkpointID, checkpointDir string cli := test.NewFakeCli(&fakeClient{ - checkpointDeleteFunc: func(container string, options client.CheckpointDeleteOptions) error { + checkpointDeleteFunc: func(container string, options client.CheckpointRemoveOptions) (client.CheckpointRemoveResult, error) { containerID = container checkpointID = options.CheckpointID checkpointDir = options.CheckpointDir - return nil + return client.CheckpointRemoveResult{}, nil }, }) cmd := newRemoveCommand(cli) cmd.SetArgs([]string{"container-foo", "checkpoint-bar"}) - cmd.Flags().Set("checkpoint-dir", "/dir/foo") + assert.Check(t, cmd.Flags().Set("checkpoint-dir", "/dir/foo")) assert.NilError(t, cmd.Execute()) assert.Check(t, is.Equal("container-foo", containerID)) assert.Check(t, is.Equal("checkpoint-bar", checkpointID)) diff --git a/cli/command/formatter/container.go b/cli/command/formatter/container.go index db2e430824b9..979d3eb82d60 100644 --- a/cli/command/formatter/container.go +++ b/cli/command/formatter/container.go @@ -247,7 +247,7 @@ func (c *ContainerContext) Ports() string { // State returns the container's current state (e.g. "running" or "paused"). // Refer to [container.ContainerState] for possible states. func (c *ContainerContext) State() string { - return c.c.State + return string(c.c.State) } // Status returns the container's status in a human readable form (for example, diff --git a/cli/command/formatter/container_test.go b/cli/command/formatter/container_test.go index 75940520f5d1..a38e75e87d53 100644 --- a/cli/command/formatter/container_test.go +++ b/cli/command/formatter/container_test.go @@ -152,7 +152,7 @@ func TestContainerPsContext(t *testing.T) { { container: container.Summary{State: container.StateRunning}, trunc: true, - expValue: container.StateRunning, + expValue: string(container.StateRunning), call: ctx.State, }, { diff --git a/cli/command/plugin/formatter.go b/cli/command/plugin/formatter.go index 79d56d05e604..283f3df283ff 100644 --- a/cli/command/plugin/formatter.go +++ b/cli/command/plugin/formatter.go @@ -55,7 +55,7 @@ func formatWrite(fmtCtx formatter.Context, plugins client.PluginListResult) erro for _, p := range plugins.Items { if err := format(&pluginContext{ trunc: fmtCtx.Trunc, - p: *p, + p: p, }); err != nil { return err } diff --git a/cli/command/plugin/formatter_test.go b/cli/command/plugin/formatter_test.go index daf8684e45d1..08f6d98fc6d8 100644 --- a/cli/command/plugin/formatter_test.go +++ b/cli/command/plugin/formatter_test.go @@ -148,7 +148,7 @@ foobar_bar } plugins := client.PluginListResult{ - Items: []*plugin.Plugin{ + Items: []plugin.Plugin{ {ID: "pluginID1", Name: "foobar_baz", Config: plugin.Config{Description: "description 1"}, Enabled: true}, {ID: "pluginID2", Name: "foobar_bar", Config: plugin.Config{Description: "description 2"}, Enabled: false}, }, @@ -171,7 +171,7 @@ foobar_bar func TestPluginContextWriteJSON(t *testing.T) { plugins := client.PluginListResult{ - Items: []*plugin.Plugin{ + Items: []plugin.Plugin{ {ID: "pluginID1", Name: "foobar_baz"}, {ID: "pluginID2", Name: "foobar_bar"}, }, @@ -197,7 +197,7 @@ func TestPluginContextWriteJSON(t *testing.T) { func TestPluginContextWriteJSONField(t *testing.T) { plugins := client.PluginListResult{ - Items: []*plugin.Plugin{ + Items: []plugin.Plugin{ {ID: "pluginID1", Name: "foobar_baz"}, {ID: "pluginID2", Name: "foobar_bar"}, }, diff --git a/cli/command/plugin/list_test.go b/cli/command/plugin/list_test.go index b8bfd36312d5..cad31ad80dd8 100644 --- a/cli/command/plugin/list_test.go +++ b/cli/command/plugin/list_test.go @@ -119,7 +119,7 @@ func TestList(t *testing.T) { golden: "plugin-list-with-no-trunc-option.golden", listFunc: func(opts client.PluginListOptions) (client.PluginListResult, error) { return client.PluginListResult{ - Items: []*plugin.Plugin{{ + Items: []plugin.Plugin{{ ID: "xyg4z2hiSLO5yTnBJfg4OYia9gKA6Qjd", Name: "name-foo", Enabled: true, @@ -148,7 +148,7 @@ func TestList(t *testing.T) { golden: "plugin-list-sort.golden", listFunc: func(client.PluginListOptions) (client.PluginListResult, error) { return client.PluginListResult{ - Items: []*plugin.Plugin{ + Items: []plugin.Plugin{ { ID: "id-1", Name: "plugin-1-foo", diff --git a/vendor.mod b/vendor.mod index 48105bac987a..b9cceb8561c5 100644 --- a/vendor.mod +++ b/vendor.mod @@ -28,8 +28,8 @@ require ( github.com/google/uuid v1.6.0 github.com/mattn/go-runewidth v0.0.19 github.com/moby/go-archive v0.1.0 - github.com/moby/moby/api v1.52.0-rc.1 - github.com/moby/moby/client v0.1.0-rc.1 + github.com/moby/moby/api v1.52.0-rc.1.0.20251110152122-7cff366d4383 // master + github.com/moby/moby/client v0.1.0-rc.1.0.20251110152122-7cff366d4383 // master github.com/moby/patternmatcher v0.6.0 github.com/moby/swarmkit/v2 v2.1.1 github.com/moby/sys/atomicwriter v0.1.0 diff --git a/vendor.sum b/vendor.sum index 4ca0b168394d..00a133cec6a9 100644 --- a/vendor.sum +++ b/vendor.sum @@ -113,10 +113,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-rc.1 h1:yiNz/QzD4Jr1gyKl2iMo7OCZwwY+Xb3BltKv1xipwXo= -github.com/moby/moby/api v1.52.0-rc.1/go.mod h1:v0K/motq8oWmx+rtApG1rBTIpQ8KUONUjpf+U73gags= -github.com/moby/moby/client v0.1.0-rc.1 h1:NfuQec3HvQkPf4EvVkoFGPsBvlAc8CCyQN1m1kGSEX8= -github.com/moby/moby/client v0.1.0-rc.1/go.mod h1:qYzoKHz8qu4Ie1j41CWYhfNRHo8uhs5ay7cfx309Aqc= +github.com/moby/moby/api v1.52.0-rc.1.0.20251110152122-7cff366d4383 h1:EtwsCC5qh3+Q08G4m2X+mvkl4iXaVwbLjib4UgZmtY0= +github.com/moby/moby/api v1.52.0-rc.1.0.20251110152122-7cff366d4383/go.mod h1:v0K/motq8oWmx+rtApG1rBTIpQ8KUONUjpf+U73gags= +github.com/moby/moby/client v0.1.0-rc.1.0.20251110152122-7cff366d4383 h1:OBG6NXd/rSJDsfjwe2y7W2swcqiW8/wGrdKB46QgN+A= +github.com/moby/moby/client v0.1.0-rc.1.0.20251110152122-7cff366d4383/go.mod h1:DYvby7ZKcDKbvuhs4/gBptKp+fqMLz0RhVIPUMy+H/Q= 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.1 h1:yvTJ8MMCc3f0qTA44J6R59EZ5yZawdYopkpuLk4+ICU= diff --git a/vendor/github.com/moby/moby/api/types/container/health.go b/vendor/github.com/moby/moby/api/types/container/health.go index b7fe592cc25b..1a1ba84b40d1 100644 --- a/vendor/github.com/moby/moby/api/types/container/health.go +++ b/vendor/github.com/moby/moby/api/types/container/health.go @@ -7,9 +7,7 @@ import ( ) // HealthStatus is a string representation of the container's health. -// -// It currently is an alias for string, but may become a distinct type in future. -type HealthStatus = string +type HealthStatus string // Health states const ( @@ -41,7 +39,10 @@ type HealthcheckResult struct { } var validHealths = []string{ - NoHealthcheck, Starting, Healthy, Unhealthy, + string(NoHealthcheck), + string(Starting), + string(Healthy), + string(Unhealthy), } // ValidateHealthStatus checks if the provided string is a valid diff --git a/vendor/github.com/moby/moby/api/types/container/state.go b/vendor/github.com/moby/moby/api/types/container/state.go index 6de2df66abb5..47c6d1249027 100644 --- a/vendor/github.com/moby/moby/api/types/container/state.go +++ b/vendor/github.com/moby/moby/api/types/container/state.go @@ -6,9 +6,7 @@ import ( ) // ContainerState is a string representation of the container's current state. -// -// It currently is an alias for string, but may become a distinct type in the future. -type ContainerState = string +type ContainerState string const ( StateCreated ContainerState = "created" // StateCreated indicates the container is created, but not (yet) started. @@ -20,8 +18,14 @@ const ( StateDead ContainerState = "dead" // StateDead indicates that the container failed to be deleted. Containers in this state are attempted to be cleaned up when the daemon restarts. ) -var validStates = []ContainerState{ - StateCreated, StateRunning, StatePaused, StateRestarting, StateRemoving, StateExited, StateDead, +var validStates = []string{ + string(StateCreated), + string(StateRunning), + string(StatePaused), + string(StateRestarting), + string(StateRemoving), + string(StateExited), + string(StateDead), } // ValidateContainerState checks if the provided string is a valid diff --git a/vendor/github.com/moby/moby/api/types/plugin/plugin_responses.go b/vendor/github.com/moby/moby/api/types/plugin/plugin_responses.go index 939e4f59fb26..91b327eb473f 100644 --- a/vendor/github.com/moby/moby/api/types/plugin/plugin_responses.go +++ b/vendor/github.com/moby/moby/api/types/plugin/plugin_responses.go @@ -5,7 +5,7 @@ import ( ) // ListResponse contains the response for the Engine API -type ListResponse []*Plugin +type ListResponse []Plugin // Privilege describes a permission the user has to accept // upon installing a plugin. diff --git a/vendor/github.com/moby/moby/api/types/system/disk_usage.go b/vendor/github.com/moby/moby/api/types/system/disk_usage.go index 53d7a499d8ae..33230aed231d 100644 --- a/vendor/github.com/moby/moby/api/types/system/disk_usage.go +++ b/vendor/github.com/moby/moby/api/types/system/disk_usage.go @@ -24,27 +24,8 @@ const ( // DiskUsage contains response of Engine API: // GET "/system/df" type DiskUsage struct { - LegacyDiskUsage - ImageUsage *image.DiskUsage `json:"ImageUsage,omitempty"` ContainerUsage *container.DiskUsage `json:"ContainerUsage,omitempty"` VolumeUsage *volume.DiskUsage `json:"VolumeUsage,omitempty"` BuildCacheUsage *build.DiskUsage `json:"BuildCacheUsage,omitempty"` } - -type LegacyDiskUsage struct { - // Deprecated: kept to maintain backwards compatibility with API < v1.52, use [ImagesDiskUsage.TotalSize] instead. - LayersSize int64 `json:"LayersSize,omitempty"` - - // Deprecated: kept to maintain backwards compatibility with API < v1.52, use [ImagesDiskUsage.Items] instead. - Images []image.Summary `json:"Images,omitzero"` - - // Deprecated: kept to maintain backwards compatibility with API < v1.52, use [ContainersDiskUsage.Items] instead. - Containers []container.Summary `json:"Containers,omitzero"` - - // Deprecated: kept to maintain backwards compatibility with API < v1.52, use [VolumesDiskUsage.Items] instead. - Volumes []volume.Volume `json:"Volumes,omitzero"` - - // Deprecated: kept to maintain backwards compatibility with API < v1.52, use [BuildCacheDiskUsage.Items] instead. - BuildCache []build.CacheRecord `json:"BuildCache,omitzero"` -} diff --git a/vendor/github.com/moby/moby/api/types/volume/list_response.go b/vendor/github.com/moby/moby/api/types/volume/list_response.go index b725b6f12128..f257762f09d7 100644 --- a/vendor/github.com/moby/moby/api/types/volume/list_response.go +++ b/vendor/github.com/moby/moby/api/types/volume/list_response.go @@ -13,7 +13,7 @@ package volume type ListResponse struct { // List of volumes - Volumes []*Volume `json:"Volumes"` + Volumes []Volume `json:"Volumes"` // Warnings that occurred when fetching the list of volumes. // diff --git a/vendor/github.com/moby/moby/client/checkpoint.go b/vendor/github.com/moby/moby/client/checkpoint.go deleted file mode 100644 index 46e0c7dd4d6c..000000000000 --- a/vendor/github.com/moby/moby/client/checkpoint.go +++ /dev/null @@ -1,16 +0,0 @@ -package client - -import ( - "context" -) - -// CheckpointAPIClient defines API client methods for the checkpoints. -// -// Experimental: checkpoint and restore is still an experimental feature, -// and only available if the daemon is running with experimental features -// enabled. -type CheckpointAPIClient interface { - CheckpointCreate(ctx context.Context, container string, options CheckpointCreateOptions) error - CheckpointDelete(ctx context.Context, container string, options CheckpointDeleteOptions) error - CheckpointList(ctx context.Context, container string, options CheckpointListOptions) (CheckpointListResult, error) -} diff --git a/vendor/github.com/moby/moby/client/checkpoint_create.go b/vendor/github.com/moby/moby/client/checkpoint_create.go index dea2595b1a87..b3ba5459d00a 100644 --- a/vendor/github.com/moby/moby/client/checkpoint_create.go +++ b/vendor/github.com/moby/moby/client/checkpoint_create.go @@ -13,11 +13,16 @@ type CheckpointCreateOptions struct { Exit bool } +// CheckpointCreateResult holds the result from [client.CheckpointCreate]. +type CheckpointCreateResult struct { + // Add future fields here +} + // CheckpointCreate creates a checkpoint from the given container. -func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, options CheckpointCreateOptions) error { +func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, options CheckpointCreateOptions) (CheckpointCreateResult, error) { containerID, err := trimID("container", containerID) if err != nil { - return err + return CheckpointCreateResult{}, err } requestBody := checkpoint.CreateRequest{ CheckpointID: options.CheckpointID, @@ -27,5 +32,5 @@ func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, opt resp, err := cli.post(ctx, "/containers/"+containerID+"/checkpoints", nil, requestBody, nil) defer ensureReaderClosed(resp) - return err + return CheckpointCreateResult{}, err } diff --git a/vendor/github.com/moby/moby/client/checkpoint_delete.go b/vendor/github.com/moby/moby/client/checkpoint_delete.go deleted file mode 100644 index df1a44ce5025..000000000000 --- a/vendor/github.com/moby/moby/client/checkpoint_delete.go +++ /dev/null @@ -1,29 +0,0 @@ -package client - -import ( - "context" - "net/url" -) - -// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container. -type CheckpointDeleteOptions struct { - CheckpointID string - CheckpointDir string -} - -// CheckpointDelete deletes the checkpoint with the given name from the given container. -func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options CheckpointDeleteOptions) error { - containerID, err := trimID("container", containerID) - if err != nil { - return err - } - - query := url.Values{} - if options.CheckpointDir != "" { - query.Set("dir", options.CheckpointDir) - } - - resp, err := cli.delete(ctx, "/containers/"+containerID+"/checkpoints/"+options.CheckpointID, query, nil) - defer ensureReaderClosed(resp) - return err -} diff --git a/vendor/github.com/moby/moby/client/checkpoint_list.go b/vendor/github.com/moby/moby/client/checkpoint_list.go index 65a864aab28a..5815f836a16e 100644 --- a/vendor/github.com/moby/moby/client/checkpoint_list.go +++ b/vendor/github.com/moby/moby/client/checkpoint_list.go @@ -15,7 +15,7 @@ type CheckpointListOptions struct { // CheckpointListResult holds the result from the CheckpointList method. type CheckpointListResult struct { - Checkpoints []checkpoint.Summary + Items []checkpoint.Summary } // CheckpointList returns the checkpoints of the given container in the docker host. @@ -33,6 +33,6 @@ func (cli *Client) CheckpointList(ctx context.Context, container string, options return out, err } - err = json.NewDecoder(resp.Body).Decode(&out.Checkpoints) + err = json.NewDecoder(resp.Body).Decode(&out.Items) return out, err } diff --git a/vendor/github.com/moby/moby/client/checkpoint_remove.go b/vendor/github.com/moby/moby/client/checkpoint_remove.go new file mode 100644 index 000000000000..8042c5088226 --- /dev/null +++ b/vendor/github.com/moby/moby/client/checkpoint_remove.go @@ -0,0 +1,34 @@ +package client + +import ( + "context" + "net/url" +) + +// CheckpointRemoveOptions holds parameters to delete a checkpoint from a container. +type CheckpointRemoveOptions struct { + CheckpointID string + CheckpointDir string +} + +// CheckpointRemoveResult represents the result of [Client.CheckpointRemove]. +type CheckpointRemoveResult struct { + // No fields currently; placeholder for future use. +} + +// CheckpointRemove deletes the checkpoint with the given name from the given container. +func (cli *Client) CheckpointRemove(ctx context.Context, containerID string, options CheckpointRemoveOptions) (CheckpointRemoveResult, error) { + containerID, err := trimID("container", containerID) + if err != nil { + return CheckpointRemoveResult{}, err + } + + query := url.Values{} + if options.CheckpointDir != "" { + query.Set("dir", options.CheckpointDir) + } + + resp, err := cli.delete(ctx, "/containers/"+containerID+"/checkpoints/"+options.CheckpointID, query, nil) + defer ensureReaderClosed(resp) + return CheckpointRemoveResult{}, err +} diff --git a/vendor/github.com/moby/moby/client/client_interfaces.go b/vendor/github.com/moby/moby/client/client_interfaces.go index 363f4aa83094..4bbd45a6e59f 100644 --- a/vendor/github.com/moby/moby/client/client_interfaces.go +++ b/vendor/github.com/moby/moby/client/client_interfaces.go @@ -49,6 +49,17 @@ type HijackDialer interface { DialHijack(ctx context.Context, url, proto string, meta map[string][]string) (net.Conn, error) } +// CheckpointAPIClient defines API client methods for the checkpoints. +// +// Experimental: checkpoint and restore is still an experimental feature, +// and only available if the daemon is running with experimental features +// enabled. +type CheckpointAPIClient interface { + CheckpointCreate(ctx context.Context, container string, options CheckpointCreateOptions) (CheckpointCreateResult, error) + CheckpointRemove(ctx context.Context, container string, options CheckpointRemoveOptions) (CheckpointRemoveResult, error) + CheckpointList(ctx context.Context, container string, options CheckpointListOptions) (CheckpointListResult, error) +} + // ContainerAPIClient defines API client methods for the containers type ContainerAPIClient interface { ContainerCreate(ctx context.Context, options ContainerCreateOptions) (ContainerCreateResult, error) diff --git a/vendor/github.com/moby/moby/client/plugin_list.go b/vendor/github.com/moby/moby/client/plugin_list.go index d613b8845355..cbd90b407a4b 100644 --- a/vendor/github.com/moby/moby/client/plugin_list.go +++ b/vendor/github.com/moby/moby/client/plugin_list.go @@ -15,7 +15,7 @@ type PluginListOptions struct { // PluginListResult represents the result of a plugin list operation. type PluginListResult struct { - Items []*plugin.Plugin + Items []plugin.Plugin } // PluginList returns the installed plugins diff --git a/vendor/github.com/moby/moby/client/system_disk_usage.go b/vendor/github.com/moby/moby/client/system_disk_usage.go index 0fa6a94ed776..64a369df8f92 100644 --- a/vendor/github.com/moby/moby/client/system_disk_usage.go +++ b/vendor/github.com/moby/moby/client/system_disk_usage.go @@ -6,7 +6,6 @@ import ( "fmt" "net/url" "slices" - "strings" "github.com/moby/moby/api/types/build" "github.com/moby/moby/api/types/container" @@ -149,16 +148,21 @@ func (cli *Client) DiskUsage(ctx context.Context, options DiskUsageOptions) (Dis return DiskUsageResult{}, err } - var du system.DiskUsage - if err := json.NewDecoder(resp.Body).Decode(&du); err != nil { - return DiskUsageResult{}, fmt.Errorf("Error retrieving disk usage: %v", err) - } - - // Generate result from a legacy response. if versions.LessThan(cli.version, "1.52") { + // Generate result from a legacy response. + var du legacyDiskUsage + if err := json.NewDecoder(resp.Body).Decode(&du); err != nil { + return DiskUsageResult{}, fmt.Errorf("retrieving disk usage: %v", err) + } + return diskUsageResultFromLegacyAPI(&du), nil } + var du system.DiskUsage + if err := json.NewDecoder(resp.Body).Decode(&du); err != nil { + return DiskUsageResult{}, fmt.Errorf("retrieving disk usage: %v", err) + } + var r DiskUsageResult if idu := du.ImageUsage; idu != nil { r.Images = ImagesDiskUsage{ @@ -215,7 +219,16 @@ func (cli *Client) DiskUsage(ctx context.Context, options DiskUsageOptions) (Dis return r, nil } -func diskUsageResultFromLegacyAPI(du *system.DiskUsage) DiskUsageResult { +// legacyDiskUsage is the response as was used by API < v1.52. +type legacyDiskUsage struct { + LayersSize int64 `json:"LayersSize,omitempty"` + Images []image.Summary `json:"Images,omitzero"` + Containers []container.Summary `json:"Containers,omitzero"` + Volumes []volume.Volume `json:"Volumes,omitzero"` + BuildCache []build.CacheRecord `json:"BuildCache,omitzero"` +} + +func diskUsageResultFromLegacyAPI(du *legacyDiskUsage) DiskUsageResult { return DiskUsageResult{ Images: imageDiskUsageFromLegacyAPI(du), Containers: containerDiskUsageFromLegacyAPI(du), @@ -224,7 +237,7 @@ func diskUsageResultFromLegacyAPI(du *system.DiskUsage) DiskUsageResult { } } -func imageDiskUsageFromLegacyAPI(du *system.DiskUsage) ImagesDiskUsage { +func imageDiskUsageFromLegacyAPI(du *legacyDiskUsage) ImagesDiskUsage { idu := ImagesDiskUsage{ TotalSize: du.LayersSize, TotalCount: int64(len(du.Images)), @@ -250,7 +263,7 @@ func imageDiskUsageFromLegacyAPI(du *system.DiskUsage) ImagesDiskUsage { return idu } -func containerDiskUsageFromLegacyAPI(du *system.DiskUsage) ContainersDiskUsage { +func containerDiskUsageFromLegacyAPI(du *legacyDiskUsage) ContainersDiskUsage { cdu := ContainersDiskUsage{ TotalCount: int64(len(du.Containers)), Items: du.Containers, @@ -259,8 +272,8 @@ func containerDiskUsageFromLegacyAPI(du *system.DiskUsage) ContainersDiskUsage { var used int64 for _, c := range cdu.Items { cdu.TotalSize += c.SizeRw - switch strings.ToLower(c.State) { - case "running", "paused", "restarting": + switch c.State { + case container.StateRunning, container.StatePaused, container.StateRestarting: cdu.ActiveCount++ used += c.SizeRw } @@ -270,7 +283,7 @@ func containerDiskUsageFromLegacyAPI(du *system.DiskUsage) ContainersDiskUsage { return cdu } -func buildCacheDiskUsageFromLegacyAPI(du *system.DiskUsage) BuildCacheDiskUsage { +func buildCacheDiskUsageFromLegacyAPI(du *legacyDiskUsage) BuildCacheDiskUsage { bdu := BuildCacheDiskUsage{ TotalCount: int64(len(du.BuildCache)), Items: du.BuildCache, @@ -294,7 +307,7 @@ func buildCacheDiskUsageFromLegacyAPI(du *system.DiskUsage) BuildCacheDiskUsage return bdu } -func volumeDiskUsageFromLegacyAPI(du *system.DiskUsage) VolumesDiskUsage { +func volumeDiskUsageFromLegacyAPI(du *legacyDiskUsage) VolumesDiskUsage { vdu := VolumesDiskUsage{ TotalCount: int64(len(du.Volumes)), Items: du.Volumes, diff --git a/vendor/github.com/moby/moby/client/volume_list.go b/vendor/github.com/moby/moby/client/volume_list.go index 802f104eaf69..989a0292ec29 100644 --- a/vendor/github.com/moby/moby/client/volume_list.go +++ b/vendor/github.com/moby/moby/client/volume_list.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "net/url" - "slices" "github.com/moby/moby/api/types/volume" ) @@ -40,16 +39,8 @@ func (cli *Client) VolumeList(ctx context.Context, options VolumeListOptions) (V return VolumeListResult{}, err } - res := VolumeListResult{ - Items: make([]volume.Volume, 0, len(apiResp.Volumes)), - Warnings: slices.Clone(apiResp.Warnings), - } - - for _, vol := range apiResp.Volumes { - if vol != nil { - res.Items = append(res.Items, *vol) - } - } - - return res, nil + return VolumeListResult{ + Items: apiResp.Volumes, + Warnings: apiResp.Warnings, + }, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a1c78b77b34..999bd8e77ecd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -167,7 +167,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-rc.1 +# github.com/moby/moby/api v1.52.0-rc.1.0.20251110152122-7cff366d4383 ## explicit; go 1.23.0 github.com/moby/moby/api/pkg/authconfig github.com/moby/moby/api/pkg/stdcopy @@ -189,7 +189,7 @@ github.com/moby/moby/api/types/storage github.com/moby/moby/api/types/swarm github.com/moby/moby/api/types/system github.com/moby/moby/api/types/volume -# github.com/moby/moby/client v0.1.0-rc.1 +# github.com/moby/moby/client v0.1.0-rc.1.0.20251110152122-7cff366d4383 ## explicit; go 1.23.0 github.com/moby/moby/client github.com/moby/moby/client/internal