1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

api: rename volume.VolumeCreateBody to volume.CreateOptions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-03-05 23:25:55 +01:00
parent 18281c92fa
commit 64e96932bd
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
11 changed files with 22 additions and 17 deletions

View file

@ -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
}

View file

@ -2036,7 +2036,7 @@ definitions:
description: "Volume configuration"
type: "object"
title: "VolumeConfig"
x-go-name: "VolumeCreateBody"
x-go-name: "CreateOptions"
properties:
Name:
description: |

View file

@ -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"`

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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{

View file

@ -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,

View file

@ -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)))

View file

@ -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(

View file

@ -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)