diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-12-06 08:59:13 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-06 08:59:13 -0800 |
commit | 5c6e02b55be974f08e3b1e895046a3cf167fd3f7 (patch) | |
tree | 7d0e2a5a0ec706e5f4dc6b12ddbb8a1002232b24 /libpod/volume.go | |
parent | 3e60de629d5feaff1ac15173b4ff1e5325dfa5dc (diff) | |
parent | 375831e97693af4d894cf647af4dad57ef21948d (diff) | |
download | podman-5c6e02b55be974f08e3b1e895046a3cf167fd3f7.tar.gz podman-5c6e02b55be974f08e3b1e895046a3cf167fd3f7.tar.bz2 podman-5c6e02b55be974f08e3b1e895046a3cf167fd3f7.zip |
Merge pull request #1904 from umohnani8/volume
Add "podman volume" command
Diffstat (limited to 'libpod/volume.go')
-rw-r--r-- | libpod/volume.go | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/libpod/volume.go b/libpod/volume.go new file mode 100644 index 000000000..b732e8aa7 --- /dev/null +++ b/libpod/volume.go @@ -0,0 +1,63 @@ +package libpod + +import "github.com/containers/storage" + +// Volume is the type used to create named volumes +// TODO: all volumes should be created using this and the Volume API +type Volume struct { + config *VolumeConfig + + valid bool + runtime *Runtime + lock storage.Locker +} + +// VolumeConfig holds the volume's config information +//easyjson:json +type VolumeConfig struct { + Name string `json:"name"` + Labels map[string]string `json:"labels"` + MountPoint string `json:"mountPoint"` + Driver string `json:"driver"` + Options map[string]string `json:"options"` + Scope string `json:"scope"` +} + +// Name retrieves the volume's name +func (v *Volume) Name() string { + return v.config.Name +} + +// Labels returns the volume's labels +func (v *Volume) Labels() map[string]string { + labels := make(map[string]string) + for key, value := range v.config.Labels { + labels[key] = value + } + return labels +} + +// MountPoint returns the volume's mountpoint on the host +func (v *Volume) MountPoint() string { + return v.config.MountPoint +} + +// Driver returns the volume's driver +func (v *Volume) Driver() string { + return v.config.Driver +} + +// Options return the volume's options +func (v *Volume) Options() map[string]string { + options := make(map[string]string) + for key, value := range v.config.Options { + options[key] = value + } + + return options +} + +// Scope returns the scope of the volume +func (v *Volume) Scope() string { + return v.config.Scope +} |