client: Rename ContainerUnPause* to ContainerUnpause*

To better match the method name itself

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-10-29 11:32:32 +01:00
parent d3eb04fe59
commit fc97a2ff0d
8 changed files with 25 additions and 25 deletions

View File

@@ -74,7 +74,7 @@ type ContainerAPIClient interface {
ContainerStart(ctx context.Context, container string, options ContainerStartOptions) (ContainerStartResult, error)
ContainerStop(ctx context.Context, container string, options ContainerStopOptions) (ContainerStopResult, error)
ContainerTop(ctx context.Context, container string, options ContainerTopOptions) (ContainerTopResult, error)
ContainerUnpause(ctx context.Context, container string, options ContainerUnPauseOptions) (ContainerUnPauseResult, error)
ContainerUnpause(ctx context.Context, container string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error)
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.UpdateResponse, error)
ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, container.PathStat, error)

View File

@@ -2,27 +2,27 @@ package client
import "context"
// ContainerUnPauseOptions holds options for [Client.ContainerUnpause].
type ContainerUnPauseOptions struct {
// ContainerUnpauseOptions holds options for [Client.ContainerUnpause].
type ContainerUnpauseOptions struct {
// Add future optional parameters here.
}
// ContainerUnPauseResult holds the result of [Client.ContainerUnpause],
type ContainerUnPauseResult struct {
// ContainerUnpauseResult holds the result of [Client.ContainerUnpause],
type ContainerUnpauseResult struct {
// Add future fields here.
}
// ContainerUnpause resumes the process execution within a container.
func (cli *Client) ContainerUnpause(ctx context.Context, containerID string, options ContainerUnPauseOptions) (ContainerUnPauseResult, error) {
func (cli *Client) ContainerUnpause(ctx context.Context, containerID string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error) {
containerID, err := trimID("container", containerID)
if err != nil {
return ContainerUnPauseResult{}, err
return ContainerUnpauseResult{}, err
}
resp, err := cli.post(ctx, "/containers/"+containerID+"/unpause", nil, nil, nil)
defer ensureReaderClosed(resp)
if err != nil {
return ContainerUnPauseResult{}, err
return ContainerUnpauseResult{}, err
}
return ContainerUnPauseResult{}, nil
return ContainerUnpauseResult{}, nil
}

View File

@@ -12,14 +12,14 @@ import (
func TestContainerUnpauseError(t *testing.T) {
client, err := NewClientWithOpts(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))
assert.NilError(t, err)
_, err = client.ContainerUnpause(t.Context(), "nothing", ContainerUnPauseOptions{})
_, err = client.ContainerUnpause(t.Context(), "nothing", ContainerUnpauseOptions{})
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
_, err = client.ContainerUnpause(t.Context(), "", ContainerUnPauseOptions{})
_, err = client.ContainerUnpause(t.Context(), "", ContainerUnpauseOptions{})
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
assert.Check(t, is.ErrorContains(err, "value is empty"))
_, err = client.ContainerUnpause(t.Context(), " ", ContainerUnPauseOptions{})
_, err = client.ContainerUnpause(t.Context(), " ", ContainerUnpauseOptions{})
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
assert.Check(t, is.ErrorContains(err, "value is empty"))
}
@@ -33,6 +33,6 @@ func TestContainerUnpause(t *testing.T) {
return mockResponse(http.StatusOK, nil, "")(req)
}))
assert.NilError(t, err)
_, err = client.ContainerUnpause(t.Context(), "container_id", ContainerUnPauseOptions{})
_, err = client.ContainerUnpause(t.Context(), "container_id", ContainerUnpauseOptions{})
assert.NilError(t, err)
}

View File

@@ -375,7 +375,7 @@ func (s *DockerAPISuite) TestContainerAPIPause(c *testing.T) {
c.Fatalf("there should be one paused container and not %d", len(pausedContainers))
}
_, err = apiClient.ContainerUnpause(testutil.GetContext(c), ContainerID, client.ContainerUnPauseOptions{})
_, err = apiClient.ContainerUnpause(testutil.GetContext(c), ContainerID, client.ContainerUnpauseOptions{})
assert.NilError(c, err)
pausedContainers = getPaused(c)

View File

@@ -34,7 +34,7 @@ func TestPause(t *testing.T) {
assert.NilError(t, err)
assert.Check(t, is.Equal(true, inspect.Container.State.Paused))
_, err = apiClient.ContainerUnpause(ctx, cID, client.ContainerUnPauseOptions{})
_, err = apiClient.ContainerUnpause(ctx, cID, client.ContainerUnpauseOptions{})
assert.NilError(t, err)
until := request.DaemonUnixTime(ctx, t, apiClient, testEnv)

View File

@@ -43,7 +43,7 @@ func unpauseAllContainers(ctx context.Context, t testing.TB, apiClient client.Co
containers := getPausedContainers(ctx, t, apiClient)
if len(containers) > 0 {
for _, ctr := range containers {
_, err := apiClient.ContainerUnpause(ctx, ctr.ID, client.ContainerUnPauseOptions{})
_, err := apiClient.ContainerUnpause(ctx, ctr.ID, client.ContainerUnpauseOptions{})
assert.Check(t, err, "failed to unpause container %s", ctr.ID)
}
}

View File

@@ -74,7 +74,7 @@ type ContainerAPIClient interface {
ContainerStart(ctx context.Context, container string, options ContainerStartOptions) (ContainerStartResult, error)
ContainerStop(ctx context.Context, container string, options ContainerStopOptions) (ContainerStopResult, error)
ContainerTop(ctx context.Context, container string, options ContainerTopOptions) (ContainerTopResult, error)
ContainerUnpause(ctx context.Context, container string, options ContainerUnPauseOptions) (ContainerUnPauseResult, error)
ContainerUnpause(ctx context.Context, container string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error)
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.UpdateResponse, error)
ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, container.PathStat, error)

View File

@@ -2,27 +2,27 @@ package client
import "context"
// ContainerUnPauseOptions holds options for [Client.ContainerUnpause].
type ContainerUnPauseOptions struct {
// ContainerUnpauseOptions holds options for [Client.ContainerUnpause].
type ContainerUnpauseOptions struct {
// Add future optional parameters here.
}
// ContainerUnPauseResult holds the result of [Client.ContainerUnpause],
type ContainerUnPauseResult struct {
// ContainerUnpauseResult holds the result of [Client.ContainerUnpause],
type ContainerUnpauseResult struct {
// Add future fields here.
}
// ContainerUnpause resumes the process execution within a container.
func (cli *Client) ContainerUnpause(ctx context.Context, containerID string, options ContainerUnPauseOptions) (ContainerUnPauseResult, error) {
func (cli *Client) ContainerUnpause(ctx context.Context, containerID string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error) {
containerID, err := trimID("container", containerID)
if err != nil {
return ContainerUnPauseResult{}, err
return ContainerUnpauseResult{}, err
}
resp, err := cli.post(ctx, "/containers/"+containerID+"/unpause", nil, nil, nil)
defer ensureReaderClosed(resp)
if err != nil {
return ContainerUnPauseResult{}, err
return ContainerUnpauseResult{}, err
}
return ContainerUnPauseResult{}, nil
return ContainerUnpauseResult{}, nil
}