api: rename ContainerWaitOKBody to container.WaitResponse
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b3332b851a
commit
7293857456
|
@ -397,12 +397,12 @@ func (s *containerRouter) postContainersWait(ctx context.Context, w http.Respons
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var waitError *container.ContainerWaitOKBodyError
|
var waitError *container.WaitExitError
|
||||||
if status.Err() != nil {
|
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()),
|
StatusCode: int64(status.ExitCode()),
|
||||||
Error: waitError,
|
Error: waitError,
|
||||||
})
|
})
|
||||||
|
|
|
@ -4619,7 +4619,7 @@ definitions:
|
||||||
ContainerWaitResponse:
|
ContainerWaitResponse:
|
||||||
description: "OK response to ContainerWait operation"
|
description: "OK response to ContainerWait operation"
|
||||||
type: "object"
|
type: "object"
|
||||||
x-go-name: "ContainerWaitOKBody"
|
x-go-name: "WaitResponse"
|
||||||
title: "ContainerWaitResponse"
|
title: "ContainerWaitResponse"
|
||||||
required: [StatusCode, Error]
|
required: [StatusCode, Error]
|
||||||
properties:
|
properties:
|
||||||
|
@ -4633,7 +4633,7 @@ definitions:
|
||||||
ContainerWaitExitError:
|
ContainerWaitExitError:
|
||||||
description: "container waiting error, if any"
|
description: "container waiting error, if any"
|
||||||
type: "object"
|
type: "object"
|
||||||
x-go-name: "ContainerWaitOKBodyError"
|
x-go-name: "WaitExitError"
|
||||||
properties:
|
properties:
|
||||||
Message:
|
Message:
|
||||||
description: "Details of an error"
|
description: "Details of an error"
|
||||||
|
|
|
@ -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
|
|
@ -3,9 +3,9 @@ package container
|
||||||
// This file was generated by the swagger tool.
|
// This file was generated by the swagger tool.
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
// ContainerWaitOKBodyError container waiting error, if any
|
// WaitExitError container waiting error, if any
|
||||||
// swagger:model ContainerWaitOKBodyError
|
// swagger:model WaitExitError
|
||||||
type ContainerWaitOKBodyError struct {
|
type WaitExitError struct {
|
||||||
|
|
||||||
// Details of an error
|
// Details of an error
|
||||||
Message string `json:"Message,omitempty"`
|
Message string `json:"Message,omitempty"`
|
|
@ -3,15 +3,15 @@ package container
|
||||||
// This file was generated by the swagger tool.
|
// This file was generated by the swagger tool.
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
// ContainerWaitOKBody ContainerWaitResponse
|
// WaitResponse ContainerWaitResponse
|
||||||
//
|
//
|
||||||
// OK response to ContainerWait operation
|
// OK response to ContainerWait operation
|
||||||
// swagger:model ContainerWaitOKBody
|
// swagger:model WaitResponse
|
||||||
type ContainerWaitOKBody struct {
|
type WaitResponse struct {
|
||||||
|
|
||||||
// error
|
// error
|
||||||
// Required: true
|
// Required: true
|
||||||
Error *ContainerWaitOKBodyError `json:"Error"`
|
Error *WaitExitError `json:"Error"`
|
||||||
|
|
||||||
// Exit code of the container
|
// Exit code of the container
|
||||||
// Required: true
|
// Required: true
|
|
@ -24,12 +24,12 @@ import (
|
||||||
// wait request or in getting the response. This allows the caller to
|
// wait request or in getting the response. This allows the caller to
|
||||||
// synchronize ContainerWait with other calls, such as specifying a
|
// synchronize ContainerWait with other calls, such as specifying a
|
||||||
// "next-exit" condition before issuing a ContainerStart request.
|
// "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") {
|
if versions.LessThan(cli.ClientVersion(), "1.30") {
|
||||||
return cli.legacyContainerWait(ctx, containerID)
|
return cli.legacyContainerWait(ctx, containerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
resultC := make(chan container.ContainerWaitOKBody)
|
resultC := make(chan container.WaitResponse)
|
||||||
errC := make(chan error, 1)
|
errC := make(chan error, 1)
|
||||||
|
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
@ -46,7 +46,7 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
var res container.ContainerWaitOKBody
|
var res container.WaitResponse
|
||||||
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
|
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
|
||||||
errC <- err
|
errC <- err
|
||||||
return
|
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
|
// legacyContainerWait returns immediately and doesn't have an option to wait
|
||||||
// until the container is removed.
|
// until the container is removed.
|
||||||
func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) (<-chan container.ContainerWaitOKBody, <-chan error) {
|
func (cli *Client) legacyContainerWait(ctx context.Context, containerID string) (<-chan container.WaitResponse, <-chan error) {
|
||||||
resultC := make(chan container.ContainerWaitOKBody)
|
resultC := make(chan container.WaitResponse)
|
||||||
errC := make(chan error)
|
errC := make(chan error)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -72,7 +72,7 @@ func (cli *Client) legacyContainerWait(ctx context.Context, containerID string)
|
||||||
}
|
}
|
||||||
defer ensureReaderClosed(resp)
|
defer ensureReaderClosed(resp)
|
||||||
|
|
||||||
var res container.ContainerWaitOKBody
|
var res container.WaitResponse
|
||||||
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
|
if err := json.NewDecoder(resp.body).Decode(&res); err != nil {
|
||||||
errC <- err
|
errC <- err
|
||||||
return
|
return
|
||||||
|
|
|
@ -38,7 +38,7 @@ func TestContainerWait(t *testing.T) {
|
||||||
if !strings.HasPrefix(req.URL.Path, expectedURL) {
|
if !strings.HasPrefix(req.URL.Path, expectedURL) {
|
||||||
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
|
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,
|
StatusCode: 15,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -73,7 +73,7 @@ type ContainerAPIClient interface {
|
||||||
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
|
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
|
||||||
ContainerUnpause(ctx context.Context, container string) error
|
ContainerUnpause(ctx context.Context, container string) error
|
||||||
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, 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)
|
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
|
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
|
||||||
ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error)
|
ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error)
|
||||||
|
|
Loading…
Reference in New Issue