summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/tunnel/volumes.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-24 23:20:25 +0100
committerGitHub <noreply@github.com>2020-03-24 23:20:25 +0100
commitb4520649af59780df494d75f50d0b5081eafff04 (patch)
tree5edd6e5fd01f12154c82146ce6170aaf7d716e19 /pkg/domain/infra/tunnel/volumes.go
parent0c084d9719772a9b68d5eb67114cf5bf001958b2 (diff)
parentae614920bfe2510ca6d1dd6cea02bbe17ddb245c (diff)
downloadpodman-b4520649af59780df494d75f50d0b5081eafff04.tar.gz
podman-b4520649af59780df494d75f50d0b5081eafff04.tar.bz2
podman-b4520649af59780df494d75f50d0b5081eafff04.zip
Merge pull request #5593 from baude/v2volumes
podmanv2 volumes
Diffstat (limited to 'pkg/domain/infra/tunnel/volumes.go')
-rw-r--r--pkg/domain/infra/tunnel/volumes.go54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkg/domain/infra/tunnel/volumes.go b/pkg/domain/infra/tunnel/volumes.go
index 49cf6a2f6..e48a7fa7c 100644
--- a/pkg/domain/infra/tunnel/volumes.go
+++ b/pkg/domain/infra/tunnel/volumes.go
@@ -14,3 +14,57 @@ func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.Volum
}
return &entities.IdOrNameResponse{IdOrName: response.Name}, nil
}
+
+func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, opts entities.VolumeRmOptions) ([]*entities.VolumeRmReport, error) {
+ var (
+ reports []*entities.VolumeRmReport
+ )
+
+ if opts.All {
+ vols, err := volumes.List(ic.ClientCxt, nil)
+ if err != nil {
+ return nil, err
+ }
+ for _, v := range vols {
+ namesOrIds = append(namesOrIds, v.Name)
+ }
+ }
+ for _, id := range namesOrIds {
+ reports = append(reports, &entities.VolumeRmReport{
+ Err: volumes.Remove(ic.ClientCxt, id, &opts.Force),
+ Id: id,
+ })
+ }
+ return reports, nil
+}
+
+func (ic *ContainerEngine) VolumeInspect(ctx context.Context, namesOrIds []string, opts entities.VolumeInspectOptions) ([]*entities.VolumeInspectReport, error) {
+ var (
+ reports []*entities.VolumeInspectReport
+ )
+ if opts.All {
+ vols, err := volumes.List(ic.ClientCxt, nil)
+ if err != nil {
+ return nil, err
+ }
+ for _, v := range vols {
+ namesOrIds = append(namesOrIds, v.Name)
+ }
+ }
+ for _, id := range namesOrIds {
+ data, err := volumes.Inspect(ic.ClientCxt, id)
+ if err != nil {
+ return nil, err
+ }
+ reports = append(reports, &entities.VolumeInspectReport{VolumeConfigResponse: data})
+ }
+ return reports, nil
+}
+
+func (ic *ContainerEngine) VolumePrune(ctx context.Context, opts entities.VolumePruneOptions) ([]*entities.VolumePruneReport, error) {
+ return volumes.Prune(ic.ClientCxt)
+}
+
+func (ic *ContainerEngine) VolumeList(ctx context.Context, opts entities.VolumeListOptions) ([]*entities.VolumeListReport, error) {
+ return volumes.List(ic.ClientCxt, opts.Filter)
+}