From 0a623b251f1c6a0b07d3b5f6d1f0e5c47c5400c5 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 9 Nov 2016 16:15:32 -0500 Subject: [PATCH] Generate ContainerChanges from swagger spec. Signed-off-by: Daniel Nephin --- container_diff.go | 6 +++--- container_diff_test.go | 4 ++-- interface.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/container_diff.go b/container_diff.go index 1e3e554fc5..884dc9feef 100644 --- a/container_diff.go +++ b/container_diff.go @@ -4,13 +4,13 @@ import ( "encoding/json" "net/url" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "golang.org/x/net/context" ) // ContainerDiff shows differences in a container filesystem since it was started. -func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]types.ContainerChange, error) { - var changes []types.ContainerChange +func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]container.ContainerChangeResponseItem, error) { + var changes []container.ContainerChangeResponseItem serverResp, err := cli.get(ctx, "/containers/"+containerID+"/changes", url.Values{}, nil) if err != nil { diff --git a/container_diff_test.go b/container_diff_test.go index 1ce1117684..57dd73e66d 100644 --- a/container_diff_test.go +++ b/container_diff_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "golang.org/x/net/context" ) @@ -31,7 +31,7 @@ func TestContainerDiff(t *testing.T) { if !strings.HasPrefix(req.URL.Path, expectedURL) { return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL) } - b, err := json.Marshal([]types.ContainerChange{ + b, err := json.Marshal([]container.ContainerChangeResponseItem{ { Kind: 0, Path: "/path/1", diff --git a/interface.go b/interface.go index 00b9adea32..5e1b63b39d 100644 --- a/interface.go +++ b/interface.go @@ -37,7 +37,7 @@ type ContainerAPIClient interface { ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) 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) + ContainerDiff(ctx context.Context, container string) ([]container.ContainerChangeResponseItem, error) ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)