api: rename ContainerWaitOKBody to container.WaitResponse

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-03-05 17:13:15 +01:00
parent b3332b851a
commit 7293857456
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
8 changed files with 31 additions and 20 deletions

View File

@ -397,12 +397,12 @@ func (s *containerRouter) postContainersWait(ctx context.Context, w http.Respons
return nil
}
var waitError *container.ContainerWaitOKBodyError
var waitError *container.WaitExitError
if status.Err() != nil {
waitError = &container.ContainerWaitOKBodyError{Message: status.Err().Error()}
waitError = &container.WaitExitError{Message: status.Err().Error()}
}
return json.NewEncoder(w).Encode(&container.ContainerWaitOKBody{
return json.NewEncoder(w).Encode(&container.WaitResponse{
StatusCode: int64(status.ExitCode()),
Error: waitError,
})

View File

@ -4619,7 +4619,7 @@ definitions:
ContainerWaitResponse:
description: "OK response to ContainerWait operation"
type: "object"
x-go-name: "ContainerWaitOKBody"
x-go-name: "WaitResponse"
title: "ContainerWaitResponse"
required: [StatusCode, Error]
properties:
@ -4633,7 +4633,7 @@ definitions:
ContainerWaitExitError:
description: "container waiting error, if any"
type: "object"
x-go-name: "ContainerWaitOKBodyError"
x-go-name: "WaitExitError"
properties:
Message:
description: "Details of an error"

View File

@ -0,0 +1,11 @@
package container // import "github.com/docker/docker/api/types/container"
// ContainerWaitOKBody OK response to ContainerWait operation
//
// Deprecated: use WaitResponse
type ContainerWaitOKBody = WaitResponse
// ContainerWaitOKBodyError container waiting error, if any
//
// Deprecated: use WaitExitError
type ContainerWaitOKBodyError = WaitExitError

View File

@ -3,9 +3,9 @@ package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ContainerWaitOKBodyError container waiting error, if any
// swagger:model ContainerWaitOKBodyError
type ContainerWaitOKBodyError struct {
// WaitExitError container waiting error, if any
// swagger:model WaitExitError
type WaitExitError struct {
// Details of an error
Message string `json:"Message,omitempty"`

View File

@ -3,15 +3,15 @@ package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ContainerWaitOKBody ContainerWaitResponse
// WaitResponse ContainerWaitResponse
//
// OK response to ContainerWait operation
// swagger:model ContainerWaitOKBody
type ContainerWaitOKBody struct {
// swagger:model WaitResponse
type WaitResponse struct {
// error
// Required: true
Error *ContainerWaitOKBodyError `json:"Error"`
Error *WaitExitError `json:"Error"`
// Exit code of the container
// Required: true

View File

@ -24,12 +24,12 @@ import (
// wait request or in getting the response. This allows the caller to
// synchronize ContainerWait with other calls, such as specifying a
// "next-exit" condition before issuing a ContainerStart request.
func (cli *Client) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error) {
func (cli *Client) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error) {
if versions.LessThan(cli.ClientVersion(), "1.30") {
return cli.legacyContainerWait(ctx, containerID)
}
resultC := make(chan container.ContainerWaitOKBody)
resultC := make(chan container.WaitResponse)
errC := make(chan error, 1)
query := url.Values{}
@ -46,7 +46,7 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit
go func() {
defer ensureReaderClosed(resp)
var res container.ContainerWaitOKBody
var res container.WaitResponse
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
errC <- err
return
@ -60,8 +60,8 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit
// legacyContainerWait returns immediately and doesn't have an option to wait
// until the container is removed.
func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) (<-chan container.ContainerWaitOKBody, <-chan error) {
resultC := make(chan container.ContainerWaitOKBody)
func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) (<-chan container.WaitResponse, <-chan error) {
resultC := make(chan container.WaitResponse)
errC := make(chan error)
go func() {
@ -72,7 +72,7 @@ func (cli *Client) legacyContainerWait(ctx context.Context, containerID string)
}
defer ensureReaderClosed(resp)
var res container.ContainerWaitOKBody
var res container.WaitResponse
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
errC <- err
return

View File

@ -38,7 +38,7 @@ func TestContainerWait(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(container.ContainerWaitOKBody{
b, err := json.Marshal(container.WaitResponse{
StatusCode: 15,
})
if err != nil {

View File

@ -73,7 +73,7 @@ type ContainerAPIClient interface {
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
ContainerUnpause(ctx context.Context, container string) error
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
ContainerWait(ctx context.Context, container string, condition container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error)
ContainerWait(ctx context.Context, container string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error)