mirror of https://github.com/docker/cli.git
Generate VolumeList response from the swagger spec
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
e9089b55ee
commit
3e13296c4e
|
@ -4,6 +4,7 @@ import (
|
|||
"io"
|
||||
"time"
|
||||
|
||||
volumetypes "github.com/docker/docker/api/server/types/volume"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
|
@ -136,7 +137,7 @@ type VolumeAPIClient interface {
|
|||
VolumeCreate(ctx context.Context, options types.VolumeCreateRequest) (types.Volume, error)
|
||||
VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error)
|
||||
VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error)
|
||||
VolumeList(ctx context.Context, filter filters.Args) (types.VolumesListResponse, error)
|
||||
VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumesListOKBody, error)
|
||||
VolumeRemove(ctx context.Context, volumeID string, force bool) error
|
||||
VolumesPrune(ctx context.Context, cfg types.VolumesPruneConfig) (types.VolumesPruneReport, error)
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ import (
|
|||
"encoding/json"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
volumetypes "github.com/docker/docker/api/server/types/volume"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// VolumeList returns the volumes configured in the docker host.
|
||||
func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (types.VolumesListResponse, error) {
|
||||
var volumes types.VolumesListResponse
|
||||
func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumesListOKBody, error) {
|
||||
var volumes volumetypes.VolumesListOKBody
|
||||
query := url.Values{}
|
||||
|
||||
if filter.Len() > 0 {
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
volumetypes "github.com/docker/docker/api/server/types/volume"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"golang.org/x/net/context"
|
||||
|
@ -68,7 +69,7 @@ func TestVolumeList(t *testing.T) {
|
|||
if actualFilters != listCase.expectedFilters {
|
||||
return nil, fmt.Errorf("filters not set in URL query properly. Expected '%s', got %s", listCase.expectedFilters, actualFilters)
|
||||
}
|
||||
content, err := json.Marshal(types.VolumesListResponse{
|
||||
content, err := json.Marshal(volumetypes.VolumesListOKBody{
|
||||
Volumes: []*types.Volume{
|
||||
{
|
||||
Name: "volume",
|
||||
|
|
Loading…
Reference in New Issue