Fix swagger volume type generation
This was broken by bf6a790f00
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
a79d04ae55
commit
b16b125bb4
14 changed files with 29 additions and 28 deletions
|
@ -22,7 +22,7 @@ func (v *volumeRouter) getVolumesList(ctx context.Context, w http.ResponseWriter
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return httputils.WriteJSON(w, http.StatusOK, &volumetypes.VolumesListOKBody{Volumes: volumes, Warnings: warnings})
|
||||
return httputils.WriteJSON(w, http.StatusOK, &volumetypes.VolumeListOKBody{Volumes: volumes, Warnings: warnings})
|
||||
}
|
||||
|
||||
func (v *volumeRouter) getVolumeByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
|
@ -46,7 +46,7 @@ func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWri
|
|||
return err
|
||||
}
|
||||
|
||||
var req volumetypes.VolumesCreateBody
|
||||
var req volumetypes.VolumeCreateBody
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
if err == io.EOF {
|
||||
return errdefs.InvalidParameter(errors.New("got EOF while reading request body"))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package volume // import "github.com/docker/docker/api/types/volume"
|
||||
package volume
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
@ -7,9 +7,9 @@ package volume // import "github.com/docker/docker/api/types/volume"
|
|||
// See hack/generate-swagger-api.sh
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// VolumesCreateBody volumes create body
|
||||
// swagger:model VolumesCreateBody
|
||||
type VolumesCreateBody struct {
|
||||
// VolumeCreateBody
|
||||
// swagger:model VolumeCreateBody
|
||||
type VolumeCreateBody struct {
|
||||
|
||||
// Name of the volume driver to use.
|
||||
// Required: true
|
|
@ -1,4 +1,4 @@
|
|||
package volume // import "github.com/docker/docker/api/types/volume"
|
||||
package volume
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
@ -9,9 +9,9 @@ package volume // import "github.com/docker/docker/api/types/volume"
|
|||
|
||||
import "github.com/docker/docker/api/types"
|
||||
|
||||
// VolumesListOKBody volumes list o k body
|
||||
// swagger:model VolumesListOKBody
|
||||
type VolumesListOKBody struct {
|
||||
// VolumeListOKBody
|
||||
// swagger:model VolumeListOKBody
|
||||
type VolumeListOKBody struct {
|
||||
|
||||
// List of volumes
|
||||
// Required: true
|
|
@ -168,10 +168,10 @@ type SystemAPIClient interface {
|
|||
|
||||
// VolumeAPIClient defines API client methods for the volumes
|
||||
type VolumeAPIClient interface {
|
||||
VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error)
|
||||
VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (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) (volumetypes.VolumesListOKBody, error)
|
||||
VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error)
|
||||
VolumeRemove(ctx context.Context, volumeID string, force bool) error
|
||||
VolumesPrune(ctx context.Context, pruneFilter filters.Args) (types.VolumesPruneReport, error)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
// VolumeCreate creates a volume in the docker host.
|
||||
func (cli *Client) VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error) {
|
||||
func (cli *Client) VolumeCreate(ctx context.Context, options volumetypes.VolumeCreateBody) (types.Volume, error) {
|
||||
var volume types.Volume
|
||||
resp, err := cli.post(ctx, "/volumes/create", nil, options, nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -19,7 +19,7 @@ func TestVolumeCreateError(t *testing.T) {
|
|||
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
|
||||
}
|
||||
|
||||
_, err := client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{})
|
||||
_, err := client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{})
|
||||
if err == nil || err.Error() != "Error response from daemon: Server error" {
|
||||
t.Fatalf("expected a Server Error, got %v", err)
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ func TestVolumeCreate(t *testing.T) {
|
|||
}),
|
||||
}
|
||||
|
||||
volume, err := client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{
|
||||
volume, err := client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{
|
||||
Name: "myvolume",
|
||||
Driver: "mydriver",
|
||||
DriverOpts: map[string]string{
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
)
|
||||
|
||||
// VolumeList returns the volumes configured in the docker host.
|
||||
func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumesListOKBody, error) {
|
||||
var volumes volumetypes.VolumesListOKBody
|
||||
func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumeListOKBody, error) {
|
||||
var volumes volumetypes.VolumeListOKBody
|
||||
query := url.Values{}
|
||||
|
||||
if filter.Len() > 0 {
|
||||
|
|
|
@ -69,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(volumetypes.VolumesListOKBody{
|
||||
content, err := json.Marshal(volumetypes.VolumeListOKBody{
|
||||
Volumes: []*types.Volume{
|
||||
{
|
||||
Name: "volume",
|
||||
|
|
|
@ -398,7 +398,7 @@ func (c *containerConfig) hostConfig() *enginecontainer.HostConfig {
|
|||
}
|
||||
|
||||
// This handles the case of volumes that are defined inside a service Mount
|
||||
func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.VolumesCreateBody {
|
||||
func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.VolumeCreateBody {
|
||||
var (
|
||||
driverName string
|
||||
driverOpts map[string]string
|
||||
|
@ -412,7 +412,7 @@ func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volumetypes.Vol
|
|||
}
|
||||
|
||||
if mount.VolumeOptions != nil {
|
||||
return &volumetypes.VolumesCreateBody{
|
||||
return &volumetypes.VolumeCreateBody{
|
||||
Name: mount.Source,
|
||||
Driver: driverName,
|
||||
DriverOpts: driverOpts,
|
||||
|
|
|
@ -23,5 +23,5 @@ swagger generate operation -f api/swagger.yaml \
|
|||
-n ContainerUpdate \
|
||||
-n ContainerWait \
|
||||
-n ImageHistory \
|
||||
-n VolumesCreate \
|
||||
-n VolumesList
|
||||
-n VolumeCreate \
|
||||
-n VolumeList
|
||||
|
|
|
@ -41,7 +41,7 @@ func createTar(data map[string][]byte) (io.Reader, error) {
|
|||
// which is attached to the container.
|
||||
func createVolumeWithData(cli *client.Client, volumeName string, data map[string][]byte, image string) error {
|
||||
_, err := cli.VolumeCreate(context.Background(),
|
||||
volume.VolumesCreateBody{
|
||||
volume.VolumeCreateBody{
|
||||
Driver: "local",
|
||||
Name: volumeName,
|
||||
})
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
".*\\.pb\\.go",
|
||||
"dockerversion/version_autogen.go",
|
||||
"api/types/container/container_.*",
|
||||
"api/types/volume/volume_.*",
|
||||
"integration-cli/"
|
||||
],
|
||||
"Skip": ["integration-cli/"],
|
||||
|
|
|
@ -77,7 +77,7 @@ func TestAuthZPluginV2Disable(t *testing.T) {
|
|||
d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag)
|
||||
d.LoadBusybox(t)
|
||||
|
||||
_, err = client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{Driver: "local"})
|
||||
_, err = client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
||||
assert.Assert(t, err != nil)
|
||||
assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag)))
|
||||
|
||||
|
@ -86,7 +86,7 @@ func TestAuthZPluginV2Disable(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
|
||||
// now test to see if the docker api works.
|
||||
_, err = client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{Driver: "local"})
|
||||
_, err = client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) {
|
|||
// restart the daemon with the plugin
|
||||
d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag)
|
||||
|
||||
_, err = client.VolumeCreate(context.Background(), volumetypes.VolumesCreateBody{Driver: "local"})
|
||||
_, err = client.VolumeCreate(context.Background(), volumetypes.VolumeCreateBody{Driver: "local"})
|
||||
assert.Assert(t, err != nil)
|
||||
assert.Assert(t, strings.Contains(err.Error(), fmt.Sprintf("Error response from daemon: plugin %s failed with error:", authzPluginNameWithTag)))
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ func TestVolumesCreateAndList(t *testing.T) {
|
|||
ctx := context.Background()
|
||||
|
||||
name := t.Name()
|
||||
vol, err := client.VolumeCreate(ctx, volumetypes.VolumesCreateBody{
|
||||
vol, err := client.VolumeCreate(ctx, volumetypes.VolumeCreateBody{
|
||||
Name: name,
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
|
@ -83,7 +83,7 @@ func TestVolumesInspect(t *testing.T) {
|
|||
now := time.Now().Truncate(time.Minute)
|
||||
|
||||
name := t.Name()
|
||||
_, err := client.VolumeCreate(ctx, volumetypes.VolumesCreateBody{
|
||||
_, err := client.VolumeCreate(ctx, volumetypes.VolumeCreateBody{
|
||||
Name: name,
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
|
|
Loading…
Add table
Reference in a new issue