summaryrefslogtreecommitdiff
path: root/pkg/domain/entities
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-03-21 14:29:30 -0500
committerBrent Baude <bbaude@redhat.com>2020-03-24 16:03:49 -0500
commitae614920bfe2510ca6d1dd6cea02bbe17ddb245c (patch)
tree5edd6e5fd01f12154c82146ce6170aaf7d716e19 /pkg/domain/entities
parent0c084d9719772a9b68d5eb67114cf5bf001958b2 (diff)
downloadpodman-ae614920bfe2510ca6d1dd6cea02bbe17ddb245c.tar.gz
podman-ae614920bfe2510ca6d1dd6cea02bbe17ddb245c.tar.bz2
podman-ae614920bfe2510ca6d1dd6cea02bbe17ddb245c.zip
podmanv2 volumes
add volume commands: create, inspect, ls, prune, and rm Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/domain/entities')
-rw-r--r--pkg/domain/entities/engine_container.go9
-rw-r--r--pkg/domain/entities/types.go8
-rw-r--r--pkg/domain/entities/volumes.go89
3 files changed, 74 insertions, 32 deletions
diff --git a/pkg/domain/entities/engine_container.go b/pkg/domain/entities/engine_container.go
index 2887f0b51..2efdbd602 100644
--- a/pkg/domain/entities/engine_container.go
+++ b/pkg/domain/entities/engine_container.go
@@ -5,7 +5,6 @@ import (
)
type ContainerEngine interface {
- ContainerPrune(ctx context.Context) (*ContainerPruneReport, error)
ContainerExists(ctx context.Context, nameOrId string) (*BoolReport, error)
ContainerKill(ctx context.Context, namesOrIds []string, options KillOptions) ([]*KillReport, error)
ContainerPause(ctx context.Context, namesOrIds []string, options PauseUnPauseOptions) ([]*PauseUnpauseReport, error)
@@ -14,10 +13,10 @@ type ContainerEngine interface {
ContainerUnpause(ctx context.Context, namesOrIds []string, options PauseUnPauseOptions) ([]*PauseUnpauseReport, error)
ContainerStop(ctx context.Context, namesOrIds []string, options StopOptions) ([]*StopReport, error)
ContainerWait(ctx context.Context, namesOrIds []string, options WaitOptions) ([]WaitReport, error)
- PodDelete(ctx context.Context, opts PodPruneOptions) (*PodDeleteReport, error)
PodExists(ctx context.Context, nameOrId string) (*BoolReport, error)
- PodPrune(ctx context.Context) (*PodPruneReport, error)
VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*IdOrNameResponse, error)
- VolumeDelete(ctx context.Context, opts VolumeDeleteOptions) (*VolumeDeleteReport, error)
- VolumePrune(ctx context.Context) (*VolumePruneReport, error)
+ VolumeInspect(ctx context.Context, namesOrIds []string, opts VolumeInspectOptions) ([]*VolumeInspectReport, error)
+ VolumeRm(ctx context.Context, namesOrIds []string, opts VolumeRmOptions) ([]*VolumeRmReport, error)
+ VolumePrune(ctx context.Context, opts VolumePruneOptions) ([]*VolumePruneReport, error)
+ VolumeList(ctx context.Context, opts VolumeListOptions) ([]*VolumeListReport, error)
}
diff --git a/pkg/domain/entities/types.go b/pkg/domain/entities/types.go
index 6f947dc4d..e7757a74b 100644
--- a/pkg/domain/entities/types.go
+++ b/pkg/domain/entities/types.go
@@ -13,13 +13,5 @@ type Report struct {
Err map[string]error
}
-type ContainerDeleteOptions struct{}
-type ContainerDeleteReport struct{ Report }
-type ContainerPruneReport struct{ Report }
-
type PodDeleteReport struct{ Report }
type PodPruneOptions struct{}
-type PodPruneReport struct{ Report }
-type VolumeDeleteOptions struct{}
-type VolumeDeleteReport struct{ Report }
-type VolumePruneReport struct{ Report }
diff --git a/pkg/domain/entities/volumes.go b/pkg/domain/entities/volumes.go
index ad12d0d01..23c066083 100644
--- a/pkg/domain/entities/volumes.go
+++ b/pkg/domain/entities/volumes.go
@@ -1,6 +1,8 @@
package entities
-import "time"
+import (
+ "time"
+)
// swagger:model VolumeCreate
type VolumeCreateOptions struct {
@@ -20,22 +22,71 @@ type IdOrNameResponse struct {
}
type VolumeConfigResponse struct {
- // Name of the volume.
- Name string `json:"name"`
- Labels map[string]string `json:"labels"`
- // The volume driver. Empty string or local does not activate a volume
- // driver, all other volumes will.
- Driver string `json:"volumeDriver"`
- // The location the volume is mounted at.
- MountPoint string `json:"mountPoint"`
- // Time the volume was created.
- CreatedTime time.Time `json:"createdAt,omitempty"`
- // Options to pass to the volume driver. For the local driver, this is
- // a list of mount options. For other drivers, they are passed to the
- // volume driver handling the volume.
- Options map[string]string `json:"volumeOptions,omitempty"`
- // UID the volume will be created as.
- UID int `json:"uid"`
- // GID the volume will be created as.
- GID int `json:"gid"`
+ // Name is the name of the volume.
+ Name string `json:"Name"`
+ // Driver is the driver used to create the volume.
+ // This will be properly implemented in a future version.
+ Driver string `json:"Driver"`
+ // Mountpoint is the path on the host where the volume is mounted.
+ Mountpoint string `json:"Mountpoint"`
+ // CreatedAt is the date and time the volume was created at. This is not
+ // stored for older Libpod volumes; if so, it will be omitted.
+ CreatedAt time.Time `json:"CreatedAt,omitempty"`
+ // Status is presently unused and provided only for Docker compatibility.
+ // In the future it will be used to return information on the volume's
+ // current state.
+ Status map[string]string `json:"Status,omitempty"`
+ // Labels includes the volume's configured labels, key:value pairs that
+ // can be passed during volume creation to provide information for third
+ // party tools.
+ Labels map[string]string `json:"Labels"`
+ // Scope is unused and provided solely for Docker compatibility. It is
+ // unconditionally set to "local".
+ Scope string `json:"Scope"`
+ // Options is a set of options that were used when creating the volume.
+ // It is presently not used.
+ Options map[string]string `json:"Options"`
+ // UID is the UID that the volume was created with.
+ UID int `json:"UID,omitempty"`
+ // GID is the GID that the volume was created with.
+ GID int `json:"GID,omitempty"`
+ // Anonymous indicates that the volume was created as an anonymous
+ // volume for a specific container, and will be be removed when any
+ // container using it is removed.
+ Anonymous bool `json:"Anonymous,omitempty"`
+}
+
+type VolumeRmOptions struct {
+ All bool
+ Force bool
+}
+
+type VolumeRmReport struct {
+ Err error
+ Id string
+}
+
+type VolumeInspectOptions struct {
+ All bool
+}
+
+type VolumeInspectReport struct {
+ *VolumeConfigResponse
+}
+
+type VolumePruneOptions struct {
+ Force bool
+}
+
+type VolumePruneReport struct {
+ Err error
+ Id string
+}
+
+type VolumeListOptions struct {
+ Filter map[string][]string
+}
+
+type VolumeListReport struct {
+ VolumeConfigResponse
}