2021-05-14 13:38:50 -04:00
|
|
|
package client // import "github.com/docker/docker/client"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types/swarm"
|
|
|
|
"github.com/docker/docker/api/types/volume"
|
|
|
|
)
|
|
|
|
|
|
|
|
// VolumeUpdate updates a volume. This only works for Cluster Volumes, and
|
|
|
|
// only some fields can be updated.
|
|
|
|
func (cli *Client) VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options volume.UpdateOptions) error {
|
|
|
|
if err := cli.NewVersionError("1.42", "volume update"); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
query := url.Values{}
|
2022-05-10 16:35:09 -04:00
|
|
|
query.Set("version", version.String())
|
2021-05-14 13:38:50 -04:00
|
|
|
|
|
|
|
resp, err := cli.put(ctx, "/volumes/"+volumeID, query, options, nil)
|
|
|
|
ensureReaderClosed(resp)
|
|
|
|
return err
|
|
|
|
}
|