Initial QSfera import
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// VolumeRemoveOptions holds options for [Client.VolumeRemove].
|
||||
type VolumeRemoveOptions struct {
|
||||
// Force the removal of the volume
|
||||
Force bool
|
||||
}
|
||||
|
||||
// VolumeRemoveResult holds the result of [Client.VolumeRemove],
|
||||
type VolumeRemoveResult struct {
|
||||
// Add future fields here.
|
||||
}
|
||||
|
||||
// VolumeRemove removes a volume from the docker host.
|
||||
func (cli *Client) VolumeRemove(ctx context.Context, volumeID string, options VolumeRemoveOptions) (VolumeRemoveResult, error) {
|
||||
volumeID, err := trimID("volume", volumeID)
|
||||
if err != nil {
|
||||
return VolumeRemoveResult{}, err
|
||||
}
|
||||
|
||||
query := url.Values{}
|
||||
if options.Force {
|
||||
query.Set("force", "1")
|
||||
}
|
||||
resp, err := cli.delete(ctx, "/volumes/"+volumeID, query, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
if err != nil {
|
||||
return VolumeRemoveResult{}, err
|
||||
}
|
||||
return VolumeRemoveResult{}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user