From 57ce5483414bb206d2f6e83a5cd90c35dd22dfd0 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 4 Sep 2025 17:56:11 +0200 Subject: [PATCH] client: move container options together with their users Signed-off-by: Sebastiaan van Stijn --- client/container_attach.go | 10 +++ client/container_commit.go | 10 +++ client/container_list.go | 11 ++++ client/container_logs.go | 12 ++++ client/container_options.go | 62 ------------------- client/container_remove.go | 7 +++ client/container_start.go | 6 ++ .../moby/moby/client/container_attach.go | 10 +++ .../moby/moby/client/container_commit.go | 10 +++ .../moby/moby/client/container_list.go | 11 ++++ .../moby/moby/client/container_logs.go | 12 ++++ .../moby/moby/client/container_options.go | 62 ------------------- .../moby/moby/client/container_remove.go | 7 +++ .../moby/moby/client/container_start.go | 6 ++ 14 files changed, 112 insertions(+), 124 deletions(-) delete mode 100644 client/container_options.go delete mode 100644 vendor/github.com/moby/moby/client/container_options.go diff --git a/client/container_attach.go b/client/container_attach.go index 61c80e688b..a4ffb3e64d 100644 --- a/client/container_attach.go +++ b/client/container_attach.go @@ -6,6 +6,16 @@ import ( "net/url" ) +// ContainerAttachOptions holds parameters to attach to a container. +type ContainerAttachOptions struct { + Stream bool + Stdin bool + Stdout bool + Stderr bool + DetachKeys string + Logs bool +} + // ContainerAttach attaches a connection to a container in the server. // It returns a [HijackedResponse] with the hijacked connection // and a reader to get output. It's up to the called to close diff --git a/client/container_commit.go b/client/container_commit.go index 8ce4ce71b1..654de78b74 100644 --- a/client/container_commit.go +++ b/client/container_commit.go @@ -10,6 +10,16 @@ import ( "github.com/moby/moby/api/types/container" ) +// ContainerCommitOptions holds parameters to commit changes into a container. +type ContainerCommitOptions struct { + Reference string + Comment string + Author string + Changes []string + Pause bool + Config *container.Config +} + // ContainerCommit applies changes to a container and creates a new tagged image. func (cli *Client) ContainerCommit(ctx context.Context, containerID string, options ContainerCommitOptions) (container.CommitResponse, error) { containerID, err := trimID("container", containerID) diff --git a/client/container_list.go b/client/container_list.go index a9d53eda35..f30004f1af 100644 --- a/client/container_list.go +++ b/client/container_list.go @@ -11,6 +11,17 @@ import ( "github.com/moby/moby/api/types/versions" ) +// ContainerListOptions holds parameters to list containers with. +type ContainerListOptions struct { + Size bool + All bool + Latest bool + Since string + Before string + Limit int + Filters filters.Args +} + // ContainerList returns the list of containers in the docker host. func (cli *Client) ContainerList(ctx context.Context, options ContainerListOptions) ([]container.Summary, error) { query := url.Values{} diff --git a/client/container_logs.go b/client/container_logs.go index b8d4188c25..9acd93782a 100644 --- a/client/container_logs.go +++ b/client/container_logs.go @@ -10,6 +10,18 @@ import ( "github.com/moby/moby/client/internal/timestamp" ) +// ContainerLogsOptions holds parameters to filter logs with. +type ContainerLogsOptions struct { + ShowStdout bool + ShowStderr bool + Since string + Until string + Timestamps bool + Follow bool + Tail string + Details bool +} + // ContainerLogs returns the logs generated by a container in an [io.ReadCloser]. // It's up to the caller to close the stream. // diff --git a/client/container_options.go b/client/container_options.go deleted file mode 100644 index 8febd235e7..0000000000 --- a/client/container_options.go +++ /dev/null @@ -1,62 +0,0 @@ -package client - -import ( - "github.com/moby/moby/api/types/container" - "github.com/moby/moby/api/types/filters" -) - -// ContainerAttachOptions holds parameters to attach to a container. -type ContainerAttachOptions struct { - Stream bool - Stdin bool - Stdout bool - Stderr bool - DetachKeys string - Logs bool -} - -// ContainerCommitOptions holds parameters to commit changes into a container. -type ContainerCommitOptions struct { - Reference string - Comment string - Author string - Changes []string - Pause bool - Config *container.Config -} - -// ContainerRemoveOptions holds parameters to remove containers. -type ContainerRemoveOptions struct { - RemoveVolumes bool - RemoveLinks bool - Force bool -} - -// ContainerStartOptions holds parameters to start containers. -type ContainerStartOptions struct { - CheckpointID string - CheckpointDir string -} - -// ContainerListOptions holds parameters to list containers with. -type ContainerListOptions struct { - Size bool - All bool - Latest bool - Since string - Before string - Limit int - Filters filters.Args -} - -// ContainerLogsOptions holds parameters to filter logs with. -type ContainerLogsOptions struct { - ShowStdout bool - ShowStderr bool - Since string - Until string - Timestamps bool - Follow bool - Tail string - Details bool -} diff --git a/client/container_remove.go b/client/container_remove.go index 8ee05ec36b..e7f1794f86 100644 --- a/client/container_remove.go +++ b/client/container_remove.go @@ -5,6 +5,13 @@ import ( "net/url" ) +// ContainerRemoveOptions holds parameters to remove containers. +type ContainerRemoveOptions struct { + RemoveVolumes bool + RemoveLinks bool + Force bool +} + // ContainerRemove kills and removes a container from the docker host. func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options ContainerRemoveOptions) error { containerID, err := trimID("container", containerID) diff --git a/client/container_start.go b/client/container_start.go index 2ca0b7ea8a..7715900890 100644 --- a/client/container_start.go +++ b/client/container_start.go @@ -5,6 +5,12 @@ import ( "net/url" ) +// ContainerStartOptions holds parameters to start containers. +type ContainerStartOptions struct { + CheckpointID string + CheckpointDir string +} + // ContainerStart sends a request to the docker daemon to start a container. func (cli *Client) ContainerStart(ctx context.Context, containerID string, options ContainerStartOptions) error { containerID, err := trimID("container", containerID) diff --git a/vendor/github.com/moby/moby/client/container_attach.go b/vendor/github.com/moby/moby/client/container_attach.go index 61c80e688b..a4ffb3e64d 100644 --- a/vendor/github.com/moby/moby/client/container_attach.go +++ b/vendor/github.com/moby/moby/client/container_attach.go @@ -6,6 +6,16 @@ import ( "net/url" ) +// ContainerAttachOptions holds parameters to attach to a container. +type ContainerAttachOptions struct { + Stream bool + Stdin bool + Stdout bool + Stderr bool + DetachKeys string + Logs bool +} + // ContainerAttach attaches a connection to a container in the server. // It returns a [HijackedResponse] with the hijacked connection // and a reader to get output. It's up to the called to close diff --git a/vendor/github.com/moby/moby/client/container_commit.go b/vendor/github.com/moby/moby/client/container_commit.go index 8ce4ce71b1..654de78b74 100644 --- a/vendor/github.com/moby/moby/client/container_commit.go +++ b/vendor/github.com/moby/moby/client/container_commit.go @@ -10,6 +10,16 @@ import ( "github.com/moby/moby/api/types/container" ) +// ContainerCommitOptions holds parameters to commit changes into a container. +type ContainerCommitOptions struct { + Reference string + Comment string + Author string + Changes []string + Pause bool + Config *container.Config +} + // ContainerCommit applies changes to a container and creates a new tagged image. func (cli *Client) ContainerCommit(ctx context.Context, containerID string, options ContainerCommitOptions) (container.CommitResponse, error) { containerID, err := trimID("container", containerID) diff --git a/vendor/github.com/moby/moby/client/container_list.go b/vendor/github.com/moby/moby/client/container_list.go index a9d53eda35..f30004f1af 100644 --- a/vendor/github.com/moby/moby/client/container_list.go +++ b/vendor/github.com/moby/moby/client/container_list.go @@ -11,6 +11,17 @@ import ( "github.com/moby/moby/api/types/versions" ) +// ContainerListOptions holds parameters to list containers with. +type ContainerListOptions struct { + Size bool + All bool + Latest bool + Since string + Before string + Limit int + Filters filters.Args +} + // ContainerList returns the list of containers in the docker host. func (cli *Client) ContainerList(ctx context.Context, options ContainerListOptions) ([]container.Summary, error) { query := url.Values{} diff --git a/vendor/github.com/moby/moby/client/container_logs.go b/vendor/github.com/moby/moby/client/container_logs.go index b8d4188c25..9acd93782a 100644 --- a/vendor/github.com/moby/moby/client/container_logs.go +++ b/vendor/github.com/moby/moby/client/container_logs.go @@ -10,6 +10,18 @@ import ( "github.com/moby/moby/client/internal/timestamp" ) +// ContainerLogsOptions holds parameters to filter logs with. +type ContainerLogsOptions struct { + ShowStdout bool + ShowStderr bool + Since string + Until string + Timestamps bool + Follow bool + Tail string + Details bool +} + // ContainerLogs returns the logs generated by a container in an [io.ReadCloser]. // It's up to the caller to close the stream. // diff --git a/vendor/github.com/moby/moby/client/container_options.go b/vendor/github.com/moby/moby/client/container_options.go deleted file mode 100644 index 8febd235e7..0000000000 --- a/vendor/github.com/moby/moby/client/container_options.go +++ /dev/null @@ -1,62 +0,0 @@ -package client - -import ( - "github.com/moby/moby/api/types/container" - "github.com/moby/moby/api/types/filters" -) - -// ContainerAttachOptions holds parameters to attach to a container. -type ContainerAttachOptions struct { - Stream bool - Stdin bool - Stdout bool - Stderr bool - DetachKeys string - Logs bool -} - -// ContainerCommitOptions holds parameters to commit changes into a container. -type ContainerCommitOptions struct { - Reference string - Comment string - Author string - Changes []string - Pause bool - Config *container.Config -} - -// ContainerRemoveOptions holds parameters to remove containers. -type ContainerRemoveOptions struct { - RemoveVolumes bool - RemoveLinks bool - Force bool -} - -// ContainerStartOptions holds parameters to start containers. -type ContainerStartOptions struct { - CheckpointID string - CheckpointDir string -} - -// ContainerListOptions holds parameters to list containers with. -type ContainerListOptions struct { - Size bool - All bool - Latest bool - Since string - Before string - Limit int - Filters filters.Args -} - -// ContainerLogsOptions holds parameters to filter logs with. -type ContainerLogsOptions struct { - ShowStdout bool - ShowStderr bool - Since string - Until string - Timestamps bool - Follow bool - Tail string - Details bool -} diff --git a/vendor/github.com/moby/moby/client/container_remove.go b/vendor/github.com/moby/moby/client/container_remove.go index 8ee05ec36b..e7f1794f86 100644 --- a/vendor/github.com/moby/moby/client/container_remove.go +++ b/vendor/github.com/moby/moby/client/container_remove.go @@ -5,6 +5,13 @@ import ( "net/url" ) +// ContainerRemoveOptions holds parameters to remove containers. +type ContainerRemoveOptions struct { + RemoveVolumes bool + RemoveLinks bool + Force bool +} + // ContainerRemove kills and removes a container from the docker host. func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options ContainerRemoveOptions) error { containerID, err := trimID("container", containerID) diff --git a/vendor/github.com/moby/moby/client/container_start.go b/vendor/github.com/moby/moby/client/container_start.go index 2ca0b7ea8a..7715900890 100644 --- a/vendor/github.com/moby/moby/client/container_start.go +++ b/vendor/github.com/moby/moby/client/container_start.go @@ -5,6 +5,12 @@ import ( "net/url" ) +// ContainerStartOptions holds parameters to start containers. +type ContainerStartOptions struct { + CheckpointID string + CheckpointDir string +} + // ContainerStart sends a request to the docker daemon to start a container. func (cli *Client) ContainerStart(ctx context.Context, containerID string, options ContainerStartOptions) error { containerID, err := trimID("container", containerID)