1
0
mirror of https://github.com/docker/cli.git synced 2025-08-30 12:01:10 +03:00
Files
cli/internal/test/builders/volume.go
Vincent Demeester 581b8d9d72 Add unit tests to docker container ls
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-02-19 11:22:36 +01:00

44 lines
963 B
Go

package builders
import (
"github.com/docker/docker/api/types"
)
// Volume creates a volume with default values.
// Any number of volume function builder can be passed to augment it.
func Volume(builders ...func(volume *types.Volume)) *types.Volume {
volume := &types.Volume{
Name: "volume",
Driver: "local",
Mountpoint: "/data/volume",
Scope: "local",
}
for _, builder := range builders {
builder(volume)
}
return volume
}
// VolumeLabels sets the volume labels
func VolumeLabels(labels map[string]string) func(volume *types.Volume) {
return func(volume *types.Volume) {
volume.Labels = labels
}
}
// VolumeName sets the volume labels
func VolumeName(name string) func(volume *types.Volume) {
return func(volume *types.Volume) {
volume.Name = name
}
}
// VolumeDriver sets the volume driver
func VolumeDriver(name string) func(volume *types.Volume) {
return func(volume *types.Volume) {
volume.Driver = name
}
}