-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Expand file tree
/
Copy pathvolume_inspect.go
More file actions
36 lines (29 loc) · 934 Bytes
/
volume_inspect.go
File metadata and controls
36 lines (29 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package client
import (
"context"
"encoding/json"
"github.com/moby/moby/api/types/volume"
)
// VolumeInspectOptions holds options for inspecting a volume.
type VolumeInspectOptions struct {
// Add future optional parameters here
}
// VolumeInspectResult holds the result from the [Client.VolumeInspect] method.
type VolumeInspectResult struct {
Volume volume.Volume
Raw json.RawMessage
}
// VolumeInspect returns the information about a specific volume in the docker host.
func (cli *Client) VolumeInspect(ctx context.Context, volumeID string, options VolumeInspectOptions) (VolumeInspectResult, error) {
volumeID, err := trimID("volume", volumeID)
if err != nil {
return VolumeInspectResult{}, err
}
resp, err := cli.get(ctx, "/volumes/"+volumeID, nil, nil)
if err != nil {
return VolumeInspectResult{}, err
}
var out VolumeInspectResult
out.Raw, err = decodeWithRaw(resp, &out.Volume)
return out, err
}