mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
api: rename volumes.CreateOptions to volumes.CreateRequest
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
This commit is contained in:
@@ -2184,11 +2184,11 @@ definitions:
|
||||
is set to `-1` if the reference-count is not available.
|
||||
x-nullable: false
|
||||
|
||||
VolumeCreateOptions:
|
||||
VolumeCreateRequest:
|
||||
description: "Volume configuration"
|
||||
type: "object"
|
||||
title: "VolumeConfig"
|
||||
x-go-name: "CreateOptions"
|
||||
x-go-name: "CreateRequest"
|
||||
properties:
|
||||
Name:
|
||||
description: |
|
||||
@@ -10855,7 +10855,7 @@ paths:
|
||||
required: true
|
||||
description: "Volume configuration"
|
||||
schema:
|
||||
$ref: "#/definitions/VolumeCreateOptions"
|
||||
$ref: "#/definitions/VolumeCreateRequest"
|
||||
tags: ["Volume"]
|
||||
|
||||
/volumes/{name}:
|
||||
|
||||
@@ -2184,11 +2184,11 @@ definitions:
|
||||
is set to `-1` if the reference-count is not available.
|
||||
x-nullable: false
|
||||
|
||||
VolumeCreateOptions:
|
||||
VolumeCreateRequest:
|
||||
description: "Volume configuration"
|
||||
type: "object"
|
||||
title: "VolumeConfig"
|
||||
x-go-name: "CreateOptions"
|
||||
x-go-name: "CreateRequest"
|
||||
properties:
|
||||
Name:
|
||||
description: |
|
||||
@@ -10855,7 +10855,7 @@ paths:
|
||||
required: true
|
||||
description: "Volume configuration"
|
||||
schema:
|
||||
$ref: "#/definitions/VolumeCreateOptions"
|
||||
$ref: "#/definitions/VolumeCreateRequest"
|
||||
tags: ["Volume"]
|
||||
|
||||
/volumes/{name}:
|
||||
|
||||
@@ -5,12 +5,12 @@ package volume
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// CreateOptions VolumeConfig
|
||||
// CreateRequest VolumeConfig
|
||||
//
|
||||
// # Volume configuration
|
||||
//
|
||||
// swagger:model CreateOptions
|
||||
type CreateOptions struct {
|
||||
// swagger:model CreateRequest
|
||||
type CreateRequest struct {
|
||||
|
||||
// cluster volume spec
|
||||
ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"`
|
||||
@@ -23,7 +23,7 @@ type VolumeCreateResult struct {
|
||||
|
||||
// VolumeCreate creates a volume in the docker host.
|
||||
func (cli *Client) VolumeCreate(ctx context.Context, options VolumeCreateOptions) (VolumeCreateResult, error) {
|
||||
createRequest := volume.CreateOptions{
|
||||
createRequest := volume.CreateRequest{
|
||||
Name: options.Name,
|
||||
Driver: options.Driver,
|
||||
DriverOpts: options.DriverOpts,
|
||||
|
||||
@@ -134,7 +134,7 @@ func volumeSpecToGRPC(spec volumetypes.ClusterVolumeSpec) *swarmapi.VolumeSpec {
|
||||
|
||||
// VolumeCreateToGRPC takes a VolumeCreateBody and outputs the matching
|
||||
// swarmapi VolumeSpec.
|
||||
func VolumeCreateToGRPC(volume *volumetypes.CreateOptions) *swarmapi.VolumeSpec {
|
||||
func VolumeCreateToGRPC(volume *volumetypes.CreateRequest) *swarmapi.VolumeSpec {
|
||||
var swarmSpec *swarmapi.VolumeSpec
|
||||
if volume != nil && volume.ClusterVolumeSpec != nil {
|
||||
swarmSpec = volumeSpecToGRPC(*volume.ClusterVolumeSpec)
|
||||
|
||||
@@ -123,7 +123,7 @@ func TestAccessModeFromGRPC(t *testing.T) {
|
||||
// TestVolumeCreateToGRPC tests that a docker-typed VolumeCreateBody is
|
||||
// correctly converted to a swarm-typed VolumeSpec.
|
||||
func TestVolumeCreateToGRPC(t *testing.T) {
|
||||
volume := &volumetypes.CreateOptions{
|
||||
volume := &volumetypes.CreateRequest{
|
||||
Driver: "plug1",
|
||||
DriverOpts: map[string]string{"options": "yeah"},
|
||||
Labels: map[string]string{"labeled": "yeah"},
|
||||
|
||||
@@ -474,7 +474,7 @@ func (c *containerConfig) hostConfig(deps exec.VolumeGetter) *container.HostConf
|
||||
}
|
||||
|
||||
// This handles the case of volumes that are defined inside a service Mount
|
||||
func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.CreateOptions {
|
||||
func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.CreateRequest {
|
||||
var (
|
||||
driverName string
|
||||
driverOpts map[string]string
|
||||
@@ -488,7 +488,7 @@ func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.CreateOp
|
||||
}
|
||||
|
||||
if mount.VolumeOptions != nil {
|
||||
return &volume.CreateOptions{
|
||||
return &volume.CreateRequest{
|
||||
Name: mount.Source,
|
||||
Driver: driverName,
|
||||
DriverOpts: driverOpts,
|
||||
|
||||
@@ -59,7 +59,7 @@ func (c *Cluster) GetVolumes(options volumebackend.ListOptions) ([]*volumetypes.
|
||||
// CreateVolume creates a new cluster volume in the swarm cluster.
|
||||
//
|
||||
// Returns the volume ID if creation is successful, or an error if not.
|
||||
func (c *Cluster) CreateVolume(v volumetypes.CreateOptions) (*volumetypes.Volume, error) {
|
||||
func (c *Cluster) CreateVolume(v volumetypes.CreateRequest) (*volumetypes.Volume, error) {
|
||||
var resp *swarmapi.CreateVolumeResponse
|
||||
if err := c.lockedManagerAction(context.TODO(), func(ctx context.Context, state nodeState) error {
|
||||
volumeSpec := convert.VolumeCreateToGRPC(&v)
|
||||
|
||||
@@ -26,7 +26,7 @@ type Backend interface {
|
||||
type ClusterBackend interface {
|
||||
GetVolume(nameOrID string) (volume.Volume, error)
|
||||
GetVolumes(options volumebackend.ListOptions) ([]*volume.Volume, error)
|
||||
CreateVolume(volume volume.CreateOptions) (*volume.Volume, error)
|
||||
CreateVolume(volume volume.CreateRequest) (*volume.Volume, error)
|
||||
RemoveVolume(nameOrID string, force bool) error
|
||||
UpdateVolume(nameOrID string, version uint64, volume volumebackend.UpdateOptions) error
|
||||
IsManager() bool
|
||||
|
||||
@@ -94,7 +94,7 @@ func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWri
|
||||
return err
|
||||
}
|
||||
|
||||
var req volume.CreateOptions
|
||||
var req volume.CreateRequest
|
||||
if err := httputils.ReadJSON(r, &req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ func TestCreateRegularVolume(t *testing.T) {
|
||||
cluster: c,
|
||||
}
|
||||
|
||||
volumeCreate := volume.CreateOptions{
|
||||
volumeCreate := volume.CreateRequest{
|
||||
Name: "vol1",
|
||||
Driver: "foodriver",
|
||||
}
|
||||
@@ -224,7 +224,7 @@ func TestCreateSwarmVolumeNoSwarm(t *testing.T) {
|
||||
cluster: c,
|
||||
}
|
||||
|
||||
volumeCreate := volume.CreateOptions{
|
||||
volumeCreate := volume.CreateRequest{
|
||||
ClusterVolumeSpec: &volume.ClusterVolumeSpec{},
|
||||
Name: "volCluster",
|
||||
Driver: "someCSI",
|
||||
@@ -253,7 +253,7 @@ func TestCreateSwarmVolumeNotManager(t *testing.T) {
|
||||
cluster: c,
|
||||
}
|
||||
|
||||
volumeCreate := volume.CreateOptions{
|
||||
volumeCreate := volume.CreateRequest{
|
||||
ClusterVolumeSpec: &volume.ClusterVolumeSpec{},
|
||||
Name: "volCluster",
|
||||
Driver: "someCSI",
|
||||
@@ -285,7 +285,7 @@ func TestCreateVolumeCluster(t *testing.T) {
|
||||
cluster: c,
|
||||
}
|
||||
|
||||
volumeCreate := volume.CreateOptions{
|
||||
volumeCreate := volume.CreateRequest{
|
||||
ClusterVolumeSpec: &volume.ClusterVolumeSpec{},
|
||||
Name: "volCluster",
|
||||
Driver: "someCSI",
|
||||
@@ -692,7 +692,7 @@ func (c *fakeClusterBackend) GetVolumes(_ volumebackend.ListOptions) ([]*volume.
|
||||
return volumes, nil
|
||||
}
|
||||
|
||||
func (c *fakeClusterBackend) CreateVolume(volumeCreate volume.CreateOptions) (*volume.Volume, error) {
|
||||
func (c *fakeClusterBackend) CreateVolume(volumeCreate volume.CreateRequest) (*volume.Volume, error) {
|
||||
if err := c.checkSwarm(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ EOT
|
||||
|
||||
generate_model types/volume <<- 'EOT'
|
||||
Volume
|
||||
VolumeCreateOptions
|
||||
VolumeCreateRequest
|
||||
VolumeListResponse
|
||||
EOT
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
|
||||
// Addresses https://github.com/moby/moby/issues/44422
|
||||
t.Run("local volume with mount options", func(t *testing.T) {
|
||||
ctx := testutil.StartSpan(ctx, t)
|
||||
res, err := c.VolumeCreate(ctx, client.VolumeCreateOptions{
|
||||
created, err := c.VolumeCreate(ctx, client.VolumeCreateOptions{
|
||||
Driver: "local",
|
||||
Name: "test-live-restore-volume-references-local",
|
||||
DriverOpts: map[string]string{
|
||||
@@ -594,7 +594,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
|
||||
},
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
v := res.Volume
|
||||
v := created.Volume
|
||||
m := mount.Mount{
|
||||
Type: mount.TypeVolume,
|
||||
Source: v.Name,
|
||||
|
||||
@@ -32,11 +32,11 @@ func TestVolumesCreateAndList(t *testing.T) {
|
||||
if testEnv.DaemonInfo.OSType == "windows" {
|
||||
name = strings.ToLower(name)
|
||||
}
|
||||
create, err := apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{
|
||||
created, err := apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{
|
||||
Name: name,
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
namedV := create.Volume
|
||||
namedV := created.Volume
|
||||
|
||||
expected := volume.Volume{
|
||||
// Ignore timestamp of CreatedAt
|
||||
@@ -161,9 +161,9 @@ func TestVolumesInspect(t *testing.T) {
|
||||
apiClient := testEnv.APIClient()
|
||||
|
||||
now := time.Now()
|
||||
create, err := apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{})
|
||||
created, err := apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{})
|
||||
assert.NilError(t, err)
|
||||
v := create.Volume
|
||||
v := created.Volume
|
||||
|
||||
inspected, err := apiClient.VolumeInspect(ctx, v.Name)
|
||||
assert.NilError(t, err)
|
||||
|
||||
@@ -5,12 +5,12 @@ package volume
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// CreateOptions VolumeConfig
|
||||
// CreateRequest VolumeConfig
|
||||
//
|
||||
// # Volume configuration
|
||||
//
|
||||
// swagger:model CreateOptions
|
||||
type CreateOptions struct {
|
||||
// swagger:model CreateRequest
|
||||
type CreateRequest struct {
|
||||
|
||||
// cluster volume spec
|
||||
ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"`
|
||||
2
vendor/github.com/moby/moby/client/volume_create.go
generated
vendored
2
vendor/github.com/moby/moby/client/volume_create.go
generated
vendored
@@ -23,7 +23,7 @@ type VolumeCreateResult struct {
|
||||
|
||||
// VolumeCreate creates a volume in the docker host.
|
||||
func (cli *Client) VolumeCreate(ctx context.Context, options VolumeCreateOptions) (VolumeCreateResult, error) {
|
||||
createRequest := volume.CreateOptions{
|
||||
createRequest := volume.CreateRequest{
|
||||
Name: options.Name,
|
||||
Driver: options.Driver,
|
||||
DriverOpts: options.DriverOpts,
|
||||
|
||||
Reference in New Issue
Block a user