From 4a62b2cc8edb102c143c15a71c292bcbea458cac Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 18 Oct 2016 17:35:45 -0700 Subject: [PATCH] Generate container update response from swagger spec. Signed-off-by: Daniel Nephin Upstream-commit: 598e3a4874e28ecdc53b0993011125dde1052ace Component: cli --- components/cli/container_update.go | 5 ++--- components/cli/container_update_test.go | 3 +-- components/cli/interface.go | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/cli/container_update.go b/components/cli/container_update.go index 48b75bee30..5082f22dfa 100644 --- a/components/cli/container_update.go +++ b/components/cli/container_update.go @@ -3,14 +3,13 @@ package client import ( "encoding/json" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "golang.org/x/net/context" ) // ContainerUpdate updates resources of a container -func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) (types.ContainerUpdateResponse, error) { - var response types.ContainerUpdateResponse +func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error) { + var response container.ContainerUpdateOKBody serverResp, err := cli.post(ctx, "/containers/"+containerID+"/update", nil, updateConfig, nil) if err != nil { return response, err diff --git a/components/cli/container_update_test.go b/components/cli/container_update_test.go index e151637a2b..715bb7ca23 100644 --- a/components/cli/container_update_test.go +++ b/components/cli/container_update_test.go @@ -9,7 +9,6 @@ import ( "strings" "testing" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "golang.org/x/net/context" ) @@ -33,7 +32,7 @@ func TestContainerUpdate(t *testing.T) { return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL) } - b, err := json.Marshal(types.ContainerUpdateResponse{}) + b, err := json.Marshal(container.ContainerUpdateOKBody{}) if err != nil { return nil, err } diff --git a/components/cli/interface.go b/components/cli/interface.go index 2a355fa8ad..b303d2fde8 100644 --- a/components/cli/interface.go +++ b/components/cli/interface.go @@ -58,7 +58,7 @@ type ContainerAPIClient interface { ContainerStop(ctx context.Context, container string, timeout *time.Duration) error ContainerTop(ctx context.Context, container string, arguments []string) (types.ContainerProcessList, error) ContainerUnpause(ctx context.Context, container string) error - ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (types.ContainerUpdateResponse, error) + ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error) ContainerWait(ctx context.Context, container string) (int, error) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error