diff --git a/api/server/router/volume/volume_routes.go b/api/server/router/volume/volume_routes.go index 6b179d0b42..6e79b04228 100644 --- a/api/server/router/volume/volume_routes.go +++ b/api/server/router/volume/volume_routes.go @@ -44,7 +44,7 @@ func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWri return err } - var req volumetypes.VolumeCreateBody + var req volume.CreateOptions if err := httputils.ReadJSON(r, &req); err != nil { return err } diff --git a/api/swagger.yaml b/api/swagger.yaml index 82a2159f9e..70526ca663 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -2036,7 +2036,7 @@ definitions: description: "Volume configuration" type: "object" title: "VolumeConfig" - x-go-name: "VolumeCreateBody" + x-go-name: "CreateOptions" properties: Name: description: | diff --git a/api/types/volume/volume_create_body.go b/api/types/volume/create_options.go similarity index 86% rename from api/types/volume/volume_create_body.go rename to api/types/volume/create_options.go index f40fe1377f..df7a252cf9 100644 --- a/api/types/volume/volume_create_body.go +++ b/api/types/volume/create_options.go @@ -3,11 +3,11 @@ package volume // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command -// VolumeCreateBody VolumeConfig +// CreateOptions VolumeConfig // // Volume configuration -// swagger:model VolumeCreateBody -type VolumeCreateBody struct { +// swagger:model CreateOptions +type CreateOptions struct { // Name of the volume driver to use. Driver string `json:"Driver,omitempty"` diff --git a/api/types/volume/deprecated.go b/api/types/volume/deprecated.go index 933f559291..ab622d8ccb 100644 --- a/api/types/volume/deprecated.go +++ b/api/types/volume/deprecated.go @@ -1,5 +1,10 @@ package volume // import "github.com/docker/docker/api/types/volume" +// VolumeCreateBody Volume configuration +// +// Deprecated: use CreateOptions +type VolumeCreateBody = CreateOptions + // VolumeListOKBody Volume list response // // Deprecated: use ListResponse diff --git a/client/interface.go b/client/interface.go index 3502c43474..76a008fcbd 100644 --- a/client/interface.go +++ b/client/interface.go @@ -173,7 +173,7 @@ type SystemAPIClient interface { // VolumeAPIClient defines API client methods for the volumes type VolumeAPIClient interface { - VolumeCreate(ctx context.Context, options volume.VolumeCreateBody) (volume.Volume, error) + VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error) VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error) VolumeInspectWithRaw(ctx context.Context, volumeID string) (volume.Volume, []byte, error) VolumeList(ctx context.Context, filter filters.Args) (volume.ListResponse, error) diff --git a/client/volume_create.go b/client/volume_create.go index 49e9db1441..b3b182437b 100644 --- a/client/volume_create.go +++ b/client/volume_create.go @@ -8,7 +8,7 @@ import ( ) // VolumeCreate creates a volume in the docker host. -func (cli *Client) VolumeCreate(ctx context.Context, options volume.VolumeCreateBody) (volume.Volume, error) { +func (cli *Client) VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error) { var vol volume.Volume resp, err := cli.post(ctx, "/volumes/create", nil, options, nil) defer ensureReaderClosed(resp) diff --git a/client/volume_create_test.go b/client/volume_create_test.go index 3eb52279cc..e338740781 100644 --- a/client/volume_create_test.go +++ b/client/volume_create_test.go @@ -19,7 +19,7 @@ func TestVolumeCreateError(t *testing.T) { client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), } - _, err := client.VolumeCreate(context.Background(), volume.VolumeCreateBody{}) + _, err := client.VolumeCreate(context.Background(), volume.CreateOptions{}) if !errdefs.IsSystem(err) { t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) } @@ -53,7 +53,7 @@ func TestVolumeCreate(t *testing.T) { }), } - vol, err := client.VolumeCreate(context.Background(), volume.VolumeCreateBody{ + vol, err := client.VolumeCreate(context.Background(), volume.CreateOptions{ Name: "myvolume", Driver: "mydriver", DriverOpts: map[string]string{ diff --git a/daemon/cluster/executor/container/container.go b/daemon/cluster/executor/container/container.go index 2c8c63d028..c83d8fb482 100644 --- a/daemon/cluster/executor/container/container.go +++ b/daemon/cluster/executor/container/container.go @@ -405,7 +405,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) *volume.VolumeCreateBody { +func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.CreateOptions { var ( driverName string driverOpts map[string]string @@ -419,7 +419,7 @@ func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.VolumeCr } if mount.VolumeOptions != nil { - return &volume.VolumeCreateBody{ + return &volume.CreateOptions{ Name: mount.Source, Driver: driverName, DriverOpts: driverOpts, diff --git a/integration/plugin/authz/authz_plugin_v2_test.go b/integration/plugin/authz/authz_plugin_v2_test.go index 17f1b2964d..bcbaa1d051 100644 --- a/integration/plugin/authz/authz_plugin_v2_test.go +++ b/integration/plugin/authz/authz_plugin_v2_test.go @@ -75,7 +75,7 @@ func TestAuthZPluginV2Disable(t *testing.T) { d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag) d.LoadBusybox(t) - _, err = c.VolumeCreate(context.Background(), volume.VolumeCreateBody{Driver: "local"}) + _, err = c.VolumeCreate(context.Background(), volume.CreateOptions{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))) @@ -84,7 +84,7 @@ func TestAuthZPluginV2Disable(t *testing.T) { assert.NilError(t, err) // now test to see if the docker api works. - _, err = c.VolumeCreate(context.Background(), volume.VolumeCreateBody{Driver: "local"}) + _, err = c.VolumeCreate(context.Background(), volume.CreateOptions{Driver: "local"}) assert.NilError(t, err) } @@ -101,7 +101,7 @@ func TestAuthZPluginV2RejectVolumeRequests(t *testing.T) { // restart the daemon with the plugin d.Restart(t, "--authorization-plugin="+authzPluginNameWithTag) - _, err = c.VolumeCreate(context.Background(), volume.VolumeCreateBody{Driver: "local"}) + _, err = c.VolumeCreate(context.Background(), volume.CreateOptions{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))) diff --git a/integration/system/event_test.go b/integration/system/event_test.go index 592f4432ef..c41ad91e3a 100644 --- a/integration/system/event_test.go +++ b/integration/system/event_test.go @@ -158,7 +158,7 @@ func TestEventsVolumeCreate(t *testing.T) { } } - _, err := client.VolumeCreate(ctx, volume.VolumeCreateBody{Name: volName}) + _, err := client.VolumeCreate(ctx, volume.CreateOptions{Name: volName}) assert.NilError(t, err) filter := filters.NewArgs( diff --git a/integration/volume/volume_test.go b/integration/volume/volume_test.go index 3063bc4acc..278c2eb93b 100644 --- a/integration/volume/volume_test.go +++ b/integration/volume/volume_test.go @@ -28,7 +28,7 @@ func TestVolumesCreateAndList(t *testing.T) { if testEnv.OSType == "windows" { name = strings.ToLower(name) } - vol, err := client.VolumeCreate(ctx, volume.VolumeCreateBody{ + vol, err := client.VolumeCreate(ctx, volume.CreateOptions{ Name: name, }) assert.NilError(t, err) @@ -90,7 +90,7 @@ func TestVolumesInspect(t *testing.T) { ctx := context.Background() now := time.Now() - vol, err := client.VolumeCreate(ctx, volume.VolumeCreateBody{}) + vol, err := client.VolumeCreate(ctx, volume.CreateOptions{}) assert.NilError(t, err) inspected, err := client.VolumeInspect(ctx, vol.Name)