Deprecate ContainerUpdateOKBody, but keep an alias.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -40,7 +40,7 @@ type stateBackend interface {
|
| 40 | 40 |
ContainerStart(ctx context.Context, name string, checkpoint string, checkpointDir string) error |
| 41 | 41 |
ContainerStop(ctx context.Context, name string, options container.StopOptions) error |
| 42 | 42 |
ContainerUnpause(name string) error |
| 43 |
- ContainerUpdate(name string, hostConfig *container.HostConfig) (container.ContainerUpdateOKBody, error) |
|
| 43 |
+ ContainerUpdate(name string, hostConfig *container.HostConfig) (container.UpdateResponse, error) |
|
| 44 | 44 |
ContainerWait(ctx context.Context, name string, condition containerpkg.WaitCondition) (<-chan containerpkg.StateStatus, error) |
| 45 | 45 |
} |
| 46 | 46 |
|
| ... | ... |
@@ -5326,6 +5326,21 @@ definitions: |
| 5326 | 5326 |
type: "string" |
| 5327 | 5327 |
example: [] |
| 5328 | 5328 |
|
| 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 |
+ |
|
| 5329 | 5344 |
ContainerStatsResponse: |
| 5330 | 5345 |
description: | |
| 5331 | 5346 |
Statistics sample for a container. |
| ... | ... |
@@ -8560,14 +8575,7 @@ paths: |
| 8560 | 8560 |
200: |
| 8561 | 8561 |
description: "The container has been updated." |
| 8562 | 8562 |
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" |
|
| 8563 |
+ $ref: "#/definitions/ContainerUpdateResponse" |
|
| 8571 | 8564 |
404: |
| 8572 | 8565 |
description: "no such container" |
| 8573 | 8566 |
schema: |
| ... | ... |
@@ -10,6 +10,11 @@ import ( |
| 10 | 10 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 11 | 11 |
) |
| 12 | 12 |
|
| 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 |
+ |
|
| 13 | 18 |
// PruneReport contains the response for Engine API: |
| 14 | 19 |
// POST "/containers/prune" |
| 15 | 20 |
type PruneReport struct {
|
| 16 | 21 |
deleted file mode 100644 |
| ... | ... |
@@ -1,16 +0,0 @@ |
| 1 |
-package container // import "github.com/docker/docker/api/types/container" |
|
| 2 |
- |
|
| 3 |
-// ---------------------------------------------------------------------------- |
|
| 4 |
-// Code generated by `swagger generate operation`. DO NOT EDIT. |
|
| 5 |
-// |
|
| 6 |
-// See hack/generate-swagger-api.sh |
|
| 7 |
-// ---------------------------------------------------------------------------- |
|
| 8 |
- |
|
| 9 |
-// ContainerUpdateOKBody OK response to ContainerUpdate operation |
|
| 10 |
-// swagger:model ContainerUpdateOKBody |
|
| 11 |
-type ContainerUpdateOKBody struct {
|
|
| 12 |
- |
|
| 13 |
- // warnings |
|
| 14 |
- // Required: true |
|
| 15 |
- Warnings []string `json:"Warnings"` |
|
| 16 |
-} |
| 17 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,14 @@ |
| 0 |
+package container |
|
| 1 |
+ |
|
| 2 |
+// This file was generated by the swagger tool. |
|
| 3 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 4 |
+ |
|
| 5 |
+// UpdateResponse ContainerUpdateResponse |
|
| 6 |
+// |
|
| 7 |
+// Response for a successful container-update. |
|
| 8 |
+// swagger:model UpdateResponse |
|
| 9 |
+type UpdateResponse struct {
|
|
| 10 |
+ |
|
| 11 |
+ // Warnings encountered when updating the container. |
|
| 12 |
+ Warnings []string `json:"Warnings"` |
|
| 13 |
+} |
| ... | ... |
@@ -95,7 +95,7 @@ type ContainerAPIClient interface {
|
| 95 | 95 |
ContainerStop(ctx context.Context, container string, options container.StopOptions) error |
| 96 | 96 |
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error) |
| 97 | 97 |
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) |
|
| 99 | 99 |
ContainerWait(ctx context.Context, container string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error) |
| 100 | 100 |
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, container.PathStat, error) |
| 101 | 101 |
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options container.CopyToContainerOptions) error |
| ... | ... |
@@ -8,19 +8,19 @@ import ( |
| 8 | 8 |
) |
| 9 | 9 |
|
| 10 | 10 |
// 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) {
|
|
| 12 | 12 |
containerID, err := trimID("container", containerID)
|
| 13 | 13 |
if err != nil {
|
| 14 |
- return container.ContainerUpdateOKBody{}, err
|
|
| 14 |
+ return container.UpdateResponse{}, err
|
|
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 | 17 |
serverResp, err := cli.post(ctx, "/containers/"+containerID+"/update", nil, updateConfig, nil) |
| 18 | 18 |
defer ensureReaderClosed(serverResp) |
| 19 | 19 |
if err != nil {
|
| 20 |
- return container.ContainerUpdateOKBody{}, err
|
|
| 20 |
+ return container.UpdateResponse{}, err
|
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
- var response container.ContainerUpdateOKBody |
|
| 23 |
+ var response container.UpdateResponse |
|
| 24 | 24 |
err = json.NewDecoder(serverResp.body).Decode(&response) |
| 25 | 25 |
return response, err |
| 26 | 26 |
} |
| ... | ... |
@@ -41,7 +41,7 @@ func TestContainerUpdate(t *testing.T) {
|
| 41 | 41 |
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 |
- b, err := json.Marshal(container.ContainerUpdateOKBody{})
|
|
| 44 |
+ b, err := json.Marshal(container.UpdateResponse{})
|
|
| 45 | 45 |
if err != nil {
|
| 46 | 46 |
return nil, err |
| 47 | 47 |
} |
| ... | ... |
@@ -11,20 +11,20 @@ import ( |
| 11 | 11 |
) |
| 12 | 12 |
|
| 13 | 13 |
// 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) {
|
|
| 15 | 15 |
var warnings []string |
| 16 | 16 |
|
| 17 | 17 |
daemonCfg := daemon.config() |
| 18 | 18 |
warnings, err := daemon.verifyContainerSettings(daemonCfg, hostConfig, nil, true) |
| 19 | 19 |
if err != nil {
|
| 20 |
- return container.ContainerUpdateOKBody{Warnings: warnings}, errdefs.InvalidParameter(err)
|
|
| 20 |
+ return container.UpdateResponse{Warnings: warnings}, errdefs.InvalidParameter(err)
|
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
if err := daemon.update(name, hostConfig); err != nil {
|
| 24 |
- return container.ContainerUpdateOKBody{Warnings: warnings}, err
|
|
| 24 |
+ return container.UpdateResponse{Warnings: warnings}, err
|
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 |
- return container.ContainerUpdateOKBody{Warnings: warnings}, nil
|
|
| 27 |
+ return container.UpdateResponse{Warnings: warnings}, nil
|
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
func (daemon *Daemon) update(name string, hostConfig *container.HostConfig) error {
|
| ... | ... |
@@ -18,6 +18,7 @@ swagger generate model -f api/swagger.yaml \ |
| 18 | 18 |
swagger generate model -f api/swagger.yaml \ |
| 19 | 19 |
-t api -m types/container --skip-validator -C api/swagger-gen.yaml \ |
| 20 | 20 |
-n ContainerCreateResponse \ |
| 21 |
+ -n ContainerUpdateResponse \ |
|
| 21 | 22 |
-n ContainerWaitResponse \ |
| 22 | 23 |
-n ContainerWaitExitError \ |
| 23 | 24 |
-n ChangeType \ |
| ... | ... |
@@ -45,7 +46,6 @@ swagger generate operation -f api/swagger.yaml \ |
| 45 | 45 |
-T api/templates --skip-responses --skip-parameters --skip-validator \ |
| 46 | 46 |
-n Authenticate \ |
| 47 | 47 |
-n ContainerTop \ |
| 48 |
- -n ContainerUpdate \ |
|
| 49 | 48 |
-n ImageHistory |
| 50 | 49 |
|
| 51 | 50 |
swagger generate model -f api/swagger.yaml \ |