From d4d914bd5226b2c9933da7c3881716e1a9e9003a Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 18 Oct 2016 15:56:45 -0700 Subject: [PATCH] Add an IDResponse type Generated from a swagger spec and use it for container exec response Signed-off-by: Daniel Nephin --- container_exec.go | 4 ++-- container_exec_test.go | 2 +- interface.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/container_exec.go b/container_exec.go index 34173d3194..f6df722918 100644 --- a/container_exec.go +++ b/container_exec.go @@ -8,8 +8,8 @@ import ( ) // ContainerExecCreate creates a new exec configuration to run an exec process. -func (cli *Client) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.ContainerExecCreateResponse, error) { - var response types.ContainerExecCreateResponse +func (cli *Client) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) { + var response types.IDResponse resp, err := cli.post(ctx, "/containers/"+container+"/exec", nil, config, nil) if err != nil { return response, err diff --git a/container_exec_test.go b/container_exec_test.go index 42146ae8a5..0e296a50ad 100644 --- a/container_exec_test.go +++ b/container_exec_test.go @@ -45,7 +45,7 @@ func TestContainerExecCreate(t *testing.T) { if execConfig.User != "user" { return nil, fmt.Errorf("expected an execConfig with User == 'user', got %v", execConfig) } - b, err := json.Marshal(types.ContainerExecCreateResponse{ + b, err := json.Marshal(types.IDResponse{ ID: "exec_id", }) if err != nil { diff --git a/interface.go b/interface.go index 8f8bbaf55f..0575ce5c3b 100644 --- a/interface.go +++ b/interface.go @@ -37,7 +37,7 @@ type ContainerAPIClient interface { ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) ContainerDiff(ctx context.Context, container string) ([]types.ContainerChange, error) ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) - ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.ContainerExecCreateResponse, error) + ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error