Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
| ... | ... |
@@ -2184,11 +2184,11 @@ definitions: |
| 2184 | 2184 |
is set to `-1` if the reference-count is not available. |
| 2185 | 2185 |
x-nullable: false |
| 2186 | 2186 |
|
| 2187 |
- VolumeCreateOptions: |
|
| 2187 |
+ VolumeCreateRequest: |
|
| 2188 | 2188 |
description: "Volume configuration" |
| 2189 | 2189 |
type: "object" |
| 2190 | 2190 |
title: "VolumeConfig" |
| 2191 |
- x-go-name: "CreateOptions" |
|
| 2191 |
+ x-go-name: "CreateRequest" |
|
| 2192 | 2192 |
properties: |
| 2193 | 2193 |
Name: |
| 2194 | 2194 |
description: | |
| ... | ... |
@@ -10855,7 +10855,7 @@ paths: |
| 10855 | 10855 |
required: true |
| 10856 | 10856 |
description: "Volume configuration" |
| 10857 | 10857 |
schema: |
| 10858 |
- $ref: "#/definitions/VolumeCreateOptions" |
|
| 10858 |
+ $ref: "#/definitions/VolumeCreateRequest" |
|
| 10859 | 10859 |
tags: ["Volume"] |
| 10860 | 10860 |
|
| 10861 | 10861 |
/volumes/{name}:
|
| ... | ... |
@@ -2184,11 +2184,11 @@ definitions: |
| 2184 | 2184 |
is set to `-1` if the reference-count is not available. |
| 2185 | 2185 |
x-nullable: false |
| 2186 | 2186 |
|
| 2187 |
- VolumeCreateOptions: |
|
| 2187 |
+ VolumeCreateRequest: |
|
| 2188 | 2188 |
description: "Volume configuration" |
| 2189 | 2189 |
type: "object" |
| 2190 | 2190 |
title: "VolumeConfig" |
| 2191 |
- x-go-name: "CreateOptions" |
|
| 2191 |
+ x-go-name: "CreateRequest" |
|
| 2192 | 2192 |
properties: |
| 2193 | 2193 |
Name: |
| 2194 | 2194 |
description: | |
| ... | ... |
@@ -10855,7 +10855,7 @@ paths: |
| 10855 | 10855 |
required: true |
| 10856 | 10856 |
description: "Volume configuration" |
| 10857 | 10857 |
schema: |
| 10858 |
- $ref: "#/definitions/VolumeCreateOptions" |
|
| 10858 |
+ $ref: "#/definitions/VolumeCreateRequest" |
|
| 10859 | 10859 |
tags: ["Volume"] |
| 10860 | 10860 |
|
| 10861 | 10861 |
/volumes/{name}:
|
| 10862 | 10862 |
deleted file mode 100644 |
| ... | ... |
@@ -1,36 +0,0 @@ |
| 1 |
-// Code generated by go-swagger; DO NOT EDIT. |
|
| 2 |
- |
|
| 3 |
-package volume |
|
| 4 |
- |
|
| 5 |
-// This file was generated by the swagger tool. |
|
| 6 |
-// Editing this file might prove futile when you re-run the swagger generate command |
|
| 7 |
- |
|
| 8 |
-// CreateOptions VolumeConfig |
|
| 9 |
-// |
|
| 10 |
-// # Volume configuration |
|
| 11 |
-// |
|
| 12 |
-// swagger:model CreateOptions |
|
| 13 |
-type CreateOptions struct {
|
|
| 14 |
- |
|
| 15 |
- // cluster volume spec |
|
| 16 |
- ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"` |
|
| 17 |
- |
|
| 18 |
- // Name of the volume driver to use. |
|
| 19 |
- // Example: custom |
|
| 20 |
- Driver string `json:"Driver,omitempty"` |
|
| 21 |
- |
|
| 22 |
- // A mapping of driver options and values. These options are |
|
| 23 |
- // passed directly to the driver and are driver specific. |
|
| 24 |
- // |
|
| 25 |
- // Example: {"device":"tmpfs","o":"size=100m,uid=1000","type":"tmpfs"}
|
|
| 26 |
- DriverOpts map[string]string `json:"DriverOpts,omitempty"` |
|
| 27 |
- |
|
| 28 |
- // User-defined key/value metadata. |
|
| 29 |
- // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"}
|
|
| 30 |
- Labels map[string]string `json:"Labels,omitempty"` |
|
| 31 |
- |
|
| 32 |
- // The new volume's name. If not specified, Docker generates a name. |
|
| 33 |
- // |
|
| 34 |
- // Example: tardis |
|
| 35 |
- Name string `json:"Name,omitempty"` |
|
| 36 |
-} |
| 37 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,36 @@ |
| 0 |
+// Code generated by go-swagger; DO NOT EDIT. |
|
| 1 |
+ |
|
| 2 |
+package volume |
|
| 3 |
+ |
|
| 4 |
+// This file was generated by the swagger tool. |
|
| 5 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 6 |
+ |
|
| 7 |
+// CreateRequest VolumeConfig |
|
| 8 |
+// |
|
| 9 |
+// # Volume configuration |
|
| 10 |
+// |
|
| 11 |
+// swagger:model CreateRequest |
|
| 12 |
+type CreateRequest struct {
|
|
| 13 |
+ |
|
| 14 |
+ // cluster volume spec |
|
| 15 |
+ ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"` |
|
| 16 |
+ |
|
| 17 |
+ // Name of the volume driver to use. |
|
| 18 |
+ // Example: custom |
|
| 19 |
+ Driver string `json:"Driver,omitempty"` |
|
| 20 |
+ |
|
| 21 |
+ // A mapping of driver options and values. These options are |
|
| 22 |
+ // passed directly to the driver and are driver specific. |
|
| 23 |
+ // |
|
| 24 |
+ // Example: {"device":"tmpfs","o":"size=100m,uid=1000","type":"tmpfs"}
|
|
| 25 |
+ DriverOpts map[string]string `json:"DriverOpts,omitempty"` |
|
| 26 |
+ |
|
| 27 |
+ // User-defined key/value metadata. |
|
| 28 |
+ // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"}
|
|
| 29 |
+ Labels map[string]string `json:"Labels,omitempty"` |
|
| 30 |
+ |
|
| 31 |
+ // The new volume's name. If not specified, Docker generates a name. |
|
| 32 |
+ // |
|
| 33 |
+ // Example: tardis |
|
| 34 |
+ Name string `json:"Name,omitempty"` |
|
| 35 |
+} |
| ... | ... |
@@ -23,7 +23,7 @@ type VolumeCreateResult struct {
|
| 23 | 23 |
|
| 24 | 24 |
// VolumeCreate creates a volume in the docker host. |
| 25 | 25 |
func (cli *Client) VolumeCreate(ctx context.Context, options VolumeCreateOptions) (VolumeCreateResult, error) {
|
| 26 |
- createRequest := volume.CreateOptions{
|
|
| 26 |
+ createRequest := volume.CreateRequest{
|
|
| 27 | 27 |
Name: options.Name, |
| 28 | 28 |
Driver: options.Driver, |
| 29 | 29 |
DriverOpts: options.DriverOpts, |
| ... | ... |
@@ -134,7 +134,7 @@ func volumeSpecToGRPC(spec volumetypes.ClusterVolumeSpec) *swarmapi.VolumeSpec {
|
| 134 | 134 |
|
| 135 | 135 |
// VolumeCreateToGRPC takes a VolumeCreateBody and outputs the matching |
| 136 | 136 |
// swarmapi VolumeSpec. |
| 137 |
-func VolumeCreateToGRPC(volume *volumetypes.CreateOptions) *swarmapi.VolumeSpec {
|
|
| 137 |
+func VolumeCreateToGRPC(volume *volumetypes.CreateRequest) *swarmapi.VolumeSpec {
|
|
| 138 | 138 |
var swarmSpec *swarmapi.VolumeSpec |
| 139 | 139 |
if volume != nil && volume.ClusterVolumeSpec != nil {
|
| 140 | 140 |
swarmSpec = volumeSpecToGRPC(*volume.ClusterVolumeSpec) |
| ... | ... |
@@ -123,7 +123,7 @@ func TestAccessModeFromGRPC(t *testing.T) {
|
| 123 | 123 |
// TestVolumeCreateToGRPC tests that a docker-typed VolumeCreateBody is |
| 124 | 124 |
// correctly converted to a swarm-typed VolumeSpec. |
| 125 | 125 |
func TestVolumeCreateToGRPC(t *testing.T) {
|
| 126 |
- volume := &volumetypes.CreateOptions{
|
|
| 126 |
+ volume := &volumetypes.CreateRequest{
|
|
| 127 | 127 |
Driver: "plug1", |
| 128 | 128 |
DriverOpts: map[string]string{"options": "yeah"},
|
| 129 | 129 |
Labels: map[string]string{"labeled": "yeah"},
|
| ... | ... |
@@ -474,7 +474,7 @@ func (c *containerConfig) hostConfig(deps exec.VolumeGetter) *container.HostConf |
| 474 | 474 |
} |
| 475 | 475 |
|
| 476 | 476 |
// This handles the case of volumes that are defined inside a service Mount |
| 477 |
-func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.CreateOptions {
|
|
| 477 |
+func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.CreateRequest {
|
|
| 478 | 478 |
var ( |
| 479 | 479 |
driverName string |
| 480 | 480 |
driverOpts map[string]string |
| ... | ... |
@@ -488,7 +488,7 @@ func (c *containerConfig) volumeCreateRequest(mount *api.Mount) *volume.CreateOp |
| 488 | 488 |
} |
| 489 | 489 |
|
| 490 | 490 |
if mount.VolumeOptions != nil {
|
| 491 |
- return &volume.CreateOptions{
|
|
| 491 |
+ return &volume.CreateRequest{
|
|
| 492 | 492 |
Name: mount.Source, |
| 493 | 493 |
Driver: driverName, |
| 494 | 494 |
DriverOpts: driverOpts, |
| ... | ... |
@@ -59,7 +59,7 @@ func (c *Cluster) GetVolumes(options volumebackend.ListOptions) ([]*volumetypes. |
| 59 | 59 |
// CreateVolume creates a new cluster volume in the swarm cluster. |
| 60 | 60 |
// |
| 61 | 61 |
// Returns the volume ID if creation is successful, or an error if not. |
| 62 |
-func (c *Cluster) CreateVolume(v volumetypes.CreateOptions) (*volumetypes.Volume, error) {
|
|
| 62 |
+func (c *Cluster) CreateVolume(v volumetypes.CreateRequest) (*volumetypes.Volume, error) {
|
|
| 63 | 63 |
var resp *swarmapi.CreateVolumeResponse |
| 64 | 64 |
if err := c.lockedManagerAction(context.TODO(), func(ctx context.Context, state nodeState) error {
|
| 65 | 65 |
volumeSpec := convert.VolumeCreateToGRPC(&v) |
| ... | ... |
@@ -26,7 +26,7 @@ type Backend interface {
|
| 26 | 26 |
type ClusterBackend interface {
|
| 27 | 27 |
GetVolume(nameOrID string) (volume.Volume, error) |
| 28 | 28 |
GetVolumes(options volumebackend.ListOptions) ([]*volume.Volume, error) |
| 29 |
- CreateVolume(volume volume.CreateOptions) (*volume.Volume, error) |
|
| 29 |
+ CreateVolume(volume volume.CreateRequest) (*volume.Volume, error) |
|
| 30 | 30 |
RemoveVolume(nameOrID string, force bool) error |
| 31 | 31 |
UpdateVolume(nameOrID string, version uint64, volume volumebackend.UpdateOptions) error |
| 32 | 32 |
IsManager() bool |
| ... | ... |
@@ -187,7 +187,7 @@ func TestCreateRegularVolume(t *testing.T) {
|
| 187 | 187 |
cluster: c, |
| 188 | 188 |
} |
| 189 | 189 |
|
| 190 |
- volumeCreate := volume.CreateOptions{
|
|
| 190 |
+ volumeCreate := volume.CreateRequest{
|
|
| 191 | 191 |
Name: "vol1", |
| 192 | 192 |
Driver: "foodriver", |
| 193 | 193 |
} |
| ... | ... |
@@ -224,7 +224,7 @@ func TestCreateSwarmVolumeNoSwarm(t *testing.T) {
|
| 224 | 224 |
cluster: c, |
| 225 | 225 |
} |
| 226 | 226 |
|
| 227 |
- volumeCreate := volume.CreateOptions{
|
|
| 227 |
+ volumeCreate := volume.CreateRequest{
|
|
| 228 | 228 |
ClusterVolumeSpec: &volume.ClusterVolumeSpec{},
|
| 229 | 229 |
Name: "volCluster", |
| 230 | 230 |
Driver: "someCSI", |
| ... | ... |
@@ -253,7 +253,7 @@ func TestCreateSwarmVolumeNotManager(t *testing.T) {
|
| 253 | 253 |
cluster: c, |
| 254 | 254 |
} |
| 255 | 255 |
|
| 256 |
- volumeCreate := volume.CreateOptions{
|
|
| 256 |
+ volumeCreate := volume.CreateRequest{
|
|
| 257 | 257 |
ClusterVolumeSpec: &volume.ClusterVolumeSpec{},
|
| 258 | 258 |
Name: "volCluster", |
| 259 | 259 |
Driver: "someCSI", |
| ... | ... |
@@ -285,7 +285,7 @@ func TestCreateVolumeCluster(t *testing.T) {
|
| 285 | 285 |
cluster: c, |
| 286 | 286 |
} |
| 287 | 287 |
|
| 288 |
- volumeCreate := volume.CreateOptions{
|
|
| 288 |
+ volumeCreate := volume.CreateRequest{
|
|
| 289 | 289 |
ClusterVolumeSpec: &volume.ClusterVolumeSpec{},
|
| 290 | 290 |
Name: "volCluster", |
| 291 | 291 |
Driver: "someCSI", |
| ... | ... |
@@ -692,7 +692,7 @@ func (c *fakeClusterBackend) GetVolumes(_ volumebackend.ListOptions) ([]*volume. |
| 692 | 692 |
return volumes, nil |
| 693 | 693 |
} |
| 694 | 694 |
|
| 695 |
-func (c *fakeClusterBackend) CreateVolume(volumeCreate volume.CreateOptions) (*volume.Volume, error) {
|
|
| 695 |
+func (c *fakeClusterBackend) CreateVolume(volumeCreate volume.CreateRequest) (*volume.Volume, error) {
|
|
| 696 | 696 |
if err := c.checkSwarm(); err != nil {
|
| 697 | 697 |
return nil, err |
| 698 | 698 |
} |
| ... | ... |
@@ -585,7 +585,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
|
| 585 | 585 |
// Addresses https://github.com/moby/moby/issues/44422 |
| 586 | 586 |
t.Run("local volume with mount options", func(t *testing.T) {
|
| 587 | 587 |
ctx := testutil.StartSpan(ctx, t) |
| 588 |
- res, err := c.VolumeCreate(ctx, client.VolumeCreateOptions{
|
|
| 588 |
+ created, err := c.VolumeCreate(ctx, client.VolumeCreateOptions{
|
|
| 589 | 589 |
Driver: "local", |
| 590 | 590 |
Name: "test-live-restore-volume-references-local", |
| 591 | 591 |
DriverOpts: map[string]string{
|
| ... | ... |
@@ -594,7 +594,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
|
| 594 | 594 |
}, |
| 595 | 595 |
}) |
| 596 | 596 |
assert.NilError(t, err) |
| 597 |
- v := res.Volume |
|
| 597 |
+ v := created.Volume |
|
| 598 | 598 |
m := mount.Mount{
|
| 599 | 599 |
Type: mount.TypeVolume, |
| 600 | 600 |
Source: v.Name, |
| ... | ... |
@@ -32,11 +32,11 @@ func TestVolumesCreateAndList(t *testing.T) {
|
| 32 | 32 |
if testEnv.DaemonInfo.OSType == "windows" {
|
| 33 | 33 |
name = strings.ToLower(name) |
| 34 | 34 |
} |
| 35 |
- create, err := apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{
|
|
| 35 |
+ created, err := apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{
|
|
| 36 | 36 |
Name: name, |
| 37 | 37 |
}) |
| 38 | 38 |
assert.NilError(t, err) |
| 39 |
- namedV := create.Volume |
|
| 39 |
+ namedV := created.Volume |
|
| 40 | 40 |
|
| 41 | 41 |
expected := volume.Volume{
|
| 42 | 42 |
// Ignore timestamp of CreatedAt |
| ... | ... |
@@ -161,9 +161,9 @@ func TestVolumesInspect(t *testing.T) {
|
| 161 | 161 |
apiClient := testEnv.APIClient() |
| 162 | 162 |
|
| 163 | 163 |
now := time.Now() |
| 164 |
- create, err := apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{})
|
|
| 164 |
+ created, err := apiClient.VolumeCreate(ctx, client.VolumeCreateOptions{})
|
|
| 165 | 165 |
assert.NilError(t, err) |
| 166 |
- v := create.Volume |
|
| 166 |
+ v := created.Volume |
|
| 167 | 167 |
|
| 168 | 168 |
inspected, err := apiClient.VolumeInspect(ctx, v.Name) |
| 169 | 169 |
assert.NilError(t, err) |
| 170 | 170 |
deleted file mode 100644 |
| ... | ... |
@@ -1,36 +0,0 @@ |
| 1 |
-// Code generated by go-swagger; DO NOT EDIT. |
|
| 2 |
- |
|
| 3 |
-package volume |
|
| 4 |
- |
|
| 5 |
-// This file was generated by the swagger tool. |
|
| 6 |
-// Editing this file might prove futile when you re-run the swagger generate command |
|
| 7 |
- |
|
| 8 |
-// CreateOptions VolumeConfig |
|
| 9 |
-// |
|
| 10 |
-// # Volume configuration |
|
| 11 |
-// |
|
| 12 |
-// swagger:model CreateOptions |
|
| 13 |
-type CreateOptions struct {
|
|
| 14 |
- |
|
| 15 |
- // cluster volume spec |
|
| 16 |
- ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"` |
|
| 17 |
- |
|
| 18 |
- // Name of the volume driver to use. |
|
| 19 |
- // Example: custom |
|
| 20 |
- Driver string `json:"Driver,omitempty"` |
|
| 21 |
- |
|
| 22 |
- // A mapping of driver options and values. These options are |
|
| 23 |
- // passed directly to the driver and are driver specific. |
|
| 24 |
- // |
|
| 25 |
- // Example: {"device":"tmpfs","o":"size=100m,uid=1000","type":"tmpfs"}
|
|
| 26 |
- DriverOpts map[string]string `json:"DriverOpts,omitempty"` |
|
| 27 |
- |
|
| 28 |
- // User-defined key/value metadata. |
|
| 29 |
- // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"}
|
|
| 30 |
- Labels map[string]string `json:"Labels,omitempty"` |
|
| 31 |
- |
|
| 32 |
- // The new volume's name. If not specified, Docker generates a name. |
|
| 33 |
- // |
|
| 34 |
- // Example: tardis |
|
| 35 |
- Name string `json:"Name,omitempty"` |
|
| 36 |
-} |
| 37 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,36 @@ |
| 0 |
+// Code generated by go-swagger; DO NOT EDIT. |
|
| 1 |
+ |
|
| 2 |
+package volume |
|
| 3 |
+ |
|
| 4 |
+// This file was generated by the swagger tool. |
|
| 5 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 6 |
+ |
|
| 7 |
+// CreateRequest VolumeConfig |
|
| 8 |
+// |
|
| 9 |
+// # Volume configuration |
|
| 10 |
+// |
|
| 11 |
+// swagger:model CreateRequest |
|
| 12 |
+type CreateRequest struct {
|
|
| 13 |
+ |
|
| 14 |
+ // cluster volume spec |
|
| 15 |
+ ClusterVolumeSpec *ClusterVolumeSpec `json:"ClusterVolumeSpec,omitempty"` |
|
| 16 |
+ |
|
| 17 |
+ // Name of the volume driver to use. |
|
| 18 |
+ // Example: custom |
|
| 19 |
+ Driver string `json:"Driver,omitempty"` |
|
| 20 |
+ |
|
| 21 |
+ // A mapping of driver options and values. These options are |
|
| 22 |
+ // passed directly to the driver and are driver specific. |
|
| 23 |
+ // |
|
| 24 |
+ // Example: {"device":"tmpfs","o":"size=100m,uid=1000","type":"tmpfs"}
|
|
| 25 |
+ DriverOpts map[string]string `json:"DriverOpts,omitempty"` |
|
| 26 |
+ |
|
| 27 |
+ // User-defined key/value metadata. |
|
| 28 |
+ // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"}
|
|
| 29 |
+ Labels map[string]string `json:"Labels,omitempty"` |
|
| 30 |
+ |
|
| 31 |
+ // The new volume's name. If not specified, Docker generates a name. |
|
| 32 |
+ // |
|
| 33 |
+ // Example: tardis |
|
| 34 |
+ Name string `json:"Name,omitempty"` |
|
| 35 |
+} |
| ... | ... |
@@ -23,7 +23,7 @@ type VolumeCreateResult struct {
|
| 23 | 23 |
|
| 24 | 24 |
// VolumeCreate creates a volume in the docker host. |
| 25 | 25 |
func (cli *Client) VolumeCreate(ctx context.Context, options VolumeCreateOptions) (VolumeCreateResult, error) {
|
| 26 |
- createRequest := volume.CreateOptions{
|
|
| 26 |
+ createRequest := volume.CreateRequest{
|
|
| 27 | 27 |
Name: options.Name, |
| 28 | 28 |
Driver: options.Driver, |
| 29 | 29 |
DriverOpts: options.DriverOpts, |