diff --git a/api/swagger.yaml b/api/swagger.yaml index 161d4ae58e..3406f1ef7f 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -3266,32 +3266,34 @@ paths: get: summary: "Get changes on a container’s filesystem" description: | - Returns which files in a container's filesystem have been added, deleted, or modified. The `Kind` of modification can be one of: + Returns which files in a container's filesystem have been added, deleted, + or modified. The `Kind` of modification can be one of: - `0`: Modified - `1`: Added - `2`: Deleted operationId: "ContainerChanges" - produces: - - "application/json" + produces: ["application/json"] responses: 200: - description: "no error" + description: "The list of changes" schema: type: "array" items: type: "object" + x-go-name: "ContainerChangeResponseItem" + required: [Path, Kind] properties: Path: description: "Path to file that has changed" type: "string" + x-nullable: false Kind: description: "Kind of change" type: "integer" - enum: - - 0 - - 1 - - 2 + format: "uint8" + enum: [0, 1, 2] + x-nullable: false examples: application/json: - Path: "/dev" diff --git a/api/types/container/container_changes.go b/api/types/container/container_changes.go new file mode 100644 index 0000000000..617d488d66 --- /dev/null +++ b/api/types/container/container_changes.go @@ -0,0 +1,21 @@ +package container + +// ---------------------------------------------------------------------------- +// DO NOT EDIT THIS FILE +// This file was generated by `swagger generate operation` +// +// See hack/swagger-gen.sh +// ---------------------------------------------------------------------------- + +// ContainerChangeResponseItem container change response item +// swagger:model ContainerChangeResponseItem +type ContainerChangeResponseItem struct { + + // Kind of change + // Required: true + Kind uint8 `json:"Kind"` + + // Path to file that has changed + // Required: true + Path string `json:"Path"` +} diff --git a/api/types/types.go b/api/types/types.go index e97df9bc9c..e0efc8021f 100644 --- a/api/types/types.go +++ b/api/types/types.go @@ -17,12 +17,6 @@ import ( "github.com/docker/go-connections/nat" ) -// ContainerChange contains response of Engine API: -// GET "/containers/{name:.*}/changes" -type ContainerChange struct { - Kind int - Path string -} // ImageHistory contains response of Engine API: // GET "/images/{name:.*}/history" diff --git a/client/container_diff.go b/client/container_diff.go index 1e3e554fc5..884dc9feef 100644 --- a/client/container_diff.go +++ b/client/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/client/container_diff_test.go b/client/container_diff_test.go index 1ce1117684..57dd73e66d 100644 --- a/client/container_diff_test.go +++ b/client/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/client/interface.go b/client/interface.go index 00b9adea32..5e1b63b39d 100644 --- a/client/interface.go +++ b/client/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) diff --git a/hack/generate-swagger-api.sh b/hack/generate-swagger-api.sh index a8e9f818a7..47f6bcfeb8 100755 --- a/hack/generate-swagger-api.sh +++ b/hack/generate-swagger-api.sh @@ -16,6 +16,7 @@ swagger generate operation -f api/swagger.yaml \ -T api/templates --skip-responses --skip-parameters --skip-validator \ -n VolumesList \ -n VolumesCreate \ + -n ContainerChanges \ -n ContainerCreate \ -n ContainerUpdate \ -n Authenticate \