Skip to content

Commit f4dc38c

Browse files
committed
api/types/container: rename ContainerUpdateOKBody to UpdateResponse
Deprecate ContainerUpdateOKBody, but keep an alias. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 7adac77 commit f4dc38c

10 files changed

Lines changed: 47 additions & 36 deletions

File tree

api/server/router/container/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type stateBackend interface {
4040
ContainerStart(ctx context.Context, name string, checkpoint string, checkpointDir string) error
4141
ContainerStop(ctx context.Context, name string, options container.StopOptions) error
4242
ContainerUnpause(name string) error
43-
ContainerUpdate(name string, hostConfig *container.HostConfig) (container.ContainerUpdateOKBody, error)
43+
ContainerUpdate(name string, hostConfig *container.HostConfig) (container.UpdateResponse, error)
4444
ContainerWait(ctx context.Context, name string, condition containerpkg.WaitCondition) (<-chan containerpkg.StateStatus, error)
4545
}
4646

api/swagger.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5326,6 +5326,21 @@ definitions:
53265326
type: "string"
53275327
example: []
53285328

5329+
ContainerUpdateResponse:
5330+
type: "object"
5331+
title: "ContainerUpdateResponse"
5332+
x-go-name: "UpdateResponse"
5333+
description: |-
5334+
Response for a successful container-update.
5335+
properties:
5336+
Warnings:
5337+
type: "array"
5338+
description: |-
5339+
Warnings encountered when updating the container.
5340+
items:
5341+
type: "string"
5342+
example: ["Published ports are discarded when using host network mode"]
5343+
53295344
ContainerStatsResponse:
53305345
description: |
53315346
Statistics sample for a container.
@@ -8560,14 +8575,7 @@ paths:
85608575
200:
85618576
description: "The container has been updated."
85628577
schema:
8563-
type: "object"
8564-
title: "ContainerUpdateResponse"
8565-
description: "OK response to ContainerUpdate operation"
8566-
properties:
8567-
Warnings:
8568-
type: "array"
8569-
items:
8570-
type: "string"
8578+
$ref: "#/definitions/ContainerUpdateResponse"
85718579
404:
85728580
description: "no such container"
85738581
schema:

api/types/container/container.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import (
1010
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
1111
)
1212

13+
// ContainerUpdateOKBody OK response to ContainerUpdate operation
14+
//
15+
// Deprecated: use [UpdateResponse]. This alias will be removed in the next release.
16+
type ContainerUpdateOKBody = UpdateResponse
17+
1318
// PruneReport contains the response for Engine API:
1419
// POST "/containers/prune"
1520
type PruneReport struct {

api/types/container/container_update.go

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package container
2+
3+
// This file was generated by the swagger tool.
4+
// Editing this file might prove futile when you re-run the swagger generate command
5+
6+
// UpdateResponse ContainerUpdateResponse
7+
//
8+
// Response for a successful container-update.
9+
// swagger:model UpdateResponse
10+
type UpdateResponse struct {
11+
12+
// Warnings encountered when updating the container.
13+
Warnings []string `json:"Warnings"`
14+
}

client/client_interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type ContainerAPIClient interface {
9595
ContainerStop(ctx context.Context, container string, options container.StopOptions) error
9696
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
9797
ContainerUnpause(ctx context.Context, container string) error
98-
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
98+
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.UpdateResponse, error)
9999
ContainerWait(ctx context.Context, container string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
100100
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, container.PathStat, error)
101101
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options container.CopyToContainerOptions) error

client/container_update.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import (
88
)
99

1010
// ContainerUpdate updates the resources of a container.
11-
func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error) {
11+
func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) (container.UpdateResponse, error) {
1212
containerID, err := trimID("container", containerID)
1313
if err != nil {
14-
return container.ContainerUpdateOKBody{}, err
14+
return container.UpdateResponse{}, err
1515
}
1616

1717
serverResp, err := cli.post(ctx, "/containers/"+containerID+"/update", nil, updateConfig, nil)
1818
defer ensureReaderClosed(serverResp)
1919
if err != nil {
20-
return container.ContainerUpdateOKBody{}, err
20+
return container.UpdateResponse{}, err
2121
}
2222

23-
var response container.ContainerUpdateOKBody
23+
var response container.UpdateResponse
2424
err = json.NewDecoder(serverResp.body).Decode(&response)
2525
return response, err
2626
}

client/container_update_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestContainerUpdate(t *testing.T) {
4141
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
4242
}
4343

44-
b, err := json.Marshal(container.ContainerUpdateOKBody{})
44+
b, err := json.Marshal(container.UpdateResponse{})
4545
if err != nil {
4646
return nil, err
4747
}

daemon/update.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ import (
1111
)
1212

1313
// ContainerUpdate updates configuration of the container
14-
func (daemon *Daemon) ContainerUpdate(name string, hostConfig *container.HostConfig) (container.ContainerUpdateOKBody, error) {
14+
func (daemon *Daemon) ContainerUpdate(name string, hostConfig *container.HostConfig) (container.UpdateResponse, error) {
1515
var warnings []string
1616

1717
daemonCfg := daemon.config()
1818
warnings, err := daemon.verifyContainerSettings(daemonCfg, hostConfig, nil, true)
1919
if err != nil {
20-
return container.ContainerUpdateOKBody{Warnings: warnings}, errdefs.InvalidParameter(err)
20+
return container.UpdateResponse{Warnings: warnings}, errdefs.InvalidParameter(err)
2121
}
2222

2323
if err := daemon.update(name, hostConfig); err != nil {
24-
return container.ContainerUpdateOKBody{Warnings: warnings}, err
24+
return container.UpdateResponse{Warnings: warnings}, err
2525
}
2626

27-
return container.ContainerUpdateOKBody{Warnings: warnings}, nil
27+
return container.UpdateResponse{Warnings: warnings}, nil
2828
}
2929

3030
func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) error {

hack/generate-swagger-api.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ swagger generate model -f api/swagger.yaml \
1818
swagger generate model -f api/swagger.yaml \
1919
-t api -m types/container --skip-validator -C api/swagger-gen.yaml \
2020
-n ContainerCreateResponse \
21+
-n ContainerUpdateResponse \
2122
-n ContainerWaitResponse \
2223
-n ContainerWaitExitError \
2324
-n ChangeType \
@@ -45,7 +46,6 @@ swagger generate operation -f api/swagger.yaml \
4546
-T api/templates --skip-responses --skip-parameters --skip-validator \
4647
-n Authenticate \
4748
-n ContainerTop \
48-
-n ContainerUpdate \
4949
-n ImageHistory
5050

5151
swagger generate model -f api/swagger.yaml \

0 commit comments

Comments
 (0)