diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-07-15 14:55:20 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-08-02 15:08:30 -0400 |
commit | 8b72a72ca2171a8545023ee45ab42de9a78ae5f4 (patch) | |
tree | a3088463cf5c93883a1bf09498e927a35ae70793 /libpod/options.go | |
parent | 3cc9ab8992833ddf952df479ffb239c61845fa2e (diff) | |
download | podman-8b72a72ca2171a8545023ee45ab42de9a78ae5f4.tar.gz podman-8b72a72ca2171a8545023ee45ab42de9a78ae5f4.tar.bz2 podman-8b72a72ca2171a8545023ee45ab42de9a78ae5f4.zip |
Implement backend for 'volume inspect'
Begin to separate the internal structures and frontend for
inspect on volumes. We can't rely on keeping internal data
structures for external presentation - separating presentation
and internal data format is good practice.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/libpod/options.go b/libpod/options.go index 7fbd0016a..3a123a2a6 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1362,6 +1362,17 @@ func WithNamedVolumes(volumes []*ContainerNamedVolume) CtrCreateOption { } } +// WithHealthCheck adds the healthcheck to the container config +func WithHealthCheck(healthCheck *manifest.Schema2HealthConfig) CtrCreateOption { + return func(ctr *Container) error { + if ctr.valid { + return define.ErrCtrFinalized + } + ctr.config.HealthCheckConfig = healthCheck + return nil + } +} + // Volume Creation Options // WithVolumeName sets the name of the volume. @@ -1381,30 +1392,30 @@ func WithVolumeName(name string) VolumeCreateOption { } } -// WithVolumeLabels sets the labels of the volume. -func WithVolumeLabels(labels map[string]string) VolumeCreateOption { +// WithVolumeDriver sets the volume's driver. +// It is presently not implemented, but will be supported in a future Podman +// release. +func WithVolumeDriver(driver string) VolumeCreateOption { return func(volume *Volume) error { if volume.valid { return define.ErrVolumeFinalized } - volume.config.Labels = make(map[string]string) - for key, value := range labels { - volume.config.Labels[key] = value - } - - return nil + return define.ErrNotImplemented } } -// WithVolumeDriver sets the driver of the volume. -func WithVolumeDriver(driver string) VolumeCreateOption { +// WithVolumeLabels sets the labels of the volume. +func WithVolumeLabels(labels map[string]string) VolumeCreateOption { return func(volume *Volume) error { if volume.valid { return define.ErrVolumeFinalized } - volume.config.Driver = driver + volume.config.Labels = make(map[string]string) + for key, value := range labels { + volume.config.Labels[key] = value + } return nil } @@ -1673,14 +1684,3 @@ func WithInfraContainerPorts(bindings []ocicni.PortMapping) PodCreateOption { return nil } } - -// WithHealthCheck adds the healthcheck to the container config -func WithHealthCheck(healthCheck *manifest.Schema2HealthConfig) CtrCreateOption { - return func(ctr *Container) error { - if ctr.valid { - return define.ErrCtrFinalized - } - ctr.config.HealthCheckConfig = healthCheck - return nil - } -} |