Signed-off-by: Daniel Nephin <dnephin@docker.com>
| ... | ... |
@@ -63,7 +63,7 @@ func (s *imageRouter) postCommit(ctx context.Context, w http.ResponseWriter, r * |
| 63 | 63 |
return err |
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 |
- return httputils.WriteJSON(w, http.StatusCreated, &types.ContainerCommitResponse{
|
|
| 66 |
+ return httputils.WriteJSON(w, http.StatusCreated, &types.IDResponse{
|
|
| 67 | 67 |
ID: string(imgID), |
| 68 | 68 |
}) |
| 69 | 69 |
} |
| ... | ... |
@@ -4937,14 +4937,7 @@ paths: |
| 4937 | 4937 |
201: |
| 4938 | 4938 |
description: "no error" |
| 4939 | 4939 |
schema: |
| 4940 |
- type: "object" |
|
| 4941 |
- properties: |
|
| 4942 |
- Id: |
|
| 4943 |
- description: "The ID of the image created" |
|
| 4944 |
- type: "string" |
|
| 4945 |
- examples: |
|
| 4946 |
- application/json: |
|
| 4947 |
- Id: "596069db4bf5" |
|
| 4940 |
+ $ref: "#/definitions/IdResponse" |
|
| 4948 | 4941 |
404: |
| 4949 | 4942 |
description: "no such container" |
| 4950 | 4943 |
schema: |
| ... | ... |
@@ -38,12 +38,6 @@ type ContainerWaitResponse struct {
|
| 38 | 38 |
StatusCode int `json:"StatusCode"` |
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 |
-// ContainerCommitResponse contains response of Remote API: |
|
| 42 |
-// POST "/commit?container="+containerID |
|
| 43 |
-type ContainerCommitResponse struct {
|
|
| 44 |
- ID string `json:"Id"` |
|
| 45 |
-} |
|
| 46 |
- |
|
| 47 | 41 |
// ContainerChange contains response of Remote API: |
| 48 | 42 |
// GET "/containers/{name:.*}/changes"
|
| 49 | 43 |
type ContainerChange struct {
|
| ... | ... |
@@ -12,16 +12,16 @@ import ( |
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 | 14 |
// ContainerCommit applies changes into a container and creates a new tagged image. |
| 15 |
-func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.ContainerCommitResponse, error) {
|
|
| 15 |
+func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) {
|
|
| 16 | 16 |
var repository, tag string |
| 17 | 17 |
if options.Reference != "" {
|
| 18 | 18 |
distributionRef, err := distreference.ParseNamed(options.Reference) |
| 19 | 19 |
if err != nil {
|
| 20 |
- return types.ContainerCommitResponse{}, err
|
|
| 20 |
+ return types.IDResponse{}, err
|
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
if _, isCanonical := distributionRef.(distreference.Canonical); isCanonical {
|
| 24 |
- return types.ContainerCommitResponse{}, errors.New("refusing to create a tag with a digest reference")
|
|
| 24 |
+ return types.IDResponse{}, errors.New("refusing to create a tag with a digest reference")
|
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 | 27 |
tag = reference.GetTagFromNamedRef(distributionRef) |
| ... | ... |
@@ -41,7 +41,7 @@ func (cli *Client) ContainerCommit(ctx context.Context, container string, option |
| 41 | 41 |
query.Set("pause", "0")
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 |
- var response types.ContainerCommitResponse |
|
| 44 |
+ var response types.IDResponse |
|
| 45 | 45 |
resp, err := cli.post(ctx, "/commit", query, options.Config, nil) |
| 46 | 46 |
if err != nil {
|
| 47 | 47 |
return response, err |
| ... | ... |
@@ -67,7 +67,7 @@ func TestContainerCommit(t *testing.T) {
|
| 67 | 67 |
if len(changes) != len(expectedChanges) {
|
| 68 | 68 |
return nil, fmt.Errorf("expected container changes size to be '%d', got %d", len(expectedChanges), len(changes))
|
| 69 | 69 |
} |
| 70 |
- b, err := json.Marshal(types.ContainerCommitResponse{
|
|
| 70 |
+ b, err := json.Marshal(types.IDResponse{
|
|
| 71 | 71 |
ID: "new_container_id", |
| 72 | 72 |
}) |
| 73 | 73 |
if err != nil {
|
| ... | ... |
@@ -33,7 +33,7 @@ type CommonAPIClient interface {
|
| 33 | 33 |
// ContainerAPIClient defines API client methods for the containers |
| 34 | 34 |
type ContainerAPIClient interface {
|
| 35 | 35 |
ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) |
| 36 |
- ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.ContainerCommitResponse, error) |
|
| 36 |
+ ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) |
|
| 37 | 37 |
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) |
| 38 | 38 |
ContainerDiff(ctx context.Context, container string) ([]types.ContainerChange, error) |
| 39 | 39 |
ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) |