moby/client/volume_update.go
Sebastiaan van Stijn d9524d92a9
api/types/swarm: Version: implement stringer interface
makes the code a bit more DRY.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-05-13 02:40:14 +02:00

24 lines
687 B
Go

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{}
query.Set("version", version.String())
resp, err := cli.put(ctx, "/volumes/"+volumeID, query, options, nil)
ensureReaderClosed(resp)
return err
}