mirror of
https://github.com/containers/podman.git
synced 2025-06-24 11:28:24 +08:00
bindings: volumes uses entities/types
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -6,15 +6,15 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/containers/podman/v4/pkg/bindings"
|
||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
||||
"github.com/containers/podman/v4/pkg/domain/entities/reports"
|
||||
entitiesTypes "github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
// Create creates a volume given its configuration.
|
||||
func Create(ctx context.Context, config entities.VolumeCreateOptions, options *CreateOptions) (*entities.VolumeConfigResponse, error) {
|
||||
func Create(ctx context.Context, config entitiesTypes.VolumeCreateOptions, options *CreateOptions) (*entitiesTypes.VolumeConfigResponse, error) {
|
||||
var (
|
||||
v entities.VolumeConfigResponse
|
||||
v entitiesTypes.VolumeConfigResponse
|
||||
)
|
||||
if options == nil {
|
||||
options = new(CreateOptions)
|
||||
@ -39,9 +39,9 @@ func Create(ctx context.Context, config entities.VolumeCreateOptions, options *C
|
||||
}
|
||||
|
||||
// Inspect returns low-level information about a volume.
|
||||
func Inspect(ctx context.Context, nameOrID string, options *InspectOptions) (*entities.VolumeConfigResponse, error) {
|
||||
func Inspect(ctx context.Context, nameOrID string, options *InspectOptions) (*entitiesTypes.VolumeConfigResponse, error) {
|
||||
var (
|
||||
inspect entities.VolumeConfigResponse
|
||||
inspect entitiesTypes.VolumeConfigResponse
|
||||
)
|
||||
if options == nil {
|
||||
options = new(InspectOptions)
|
||||
@ -62,9 +62,9 @@ func Inspect(ctx context.Context, nameOrID string, options *InspectOptions) (*en
|
||||
|
||||
// List returns the configurations for existing volumes in the form of a slice. Optionally, filters
|
||||
// can be used to refine the list of volumes.
|
||||
func List(ctx context.Context, options *ListOptions) ([]*entities.VolumeListReport, error) {
|
||||
func List(ctx context.Context, options *ListOptions) ([]*entitiesTypes.VolumeListReport, error) {
|
||||
var (
|
||||
vols []*entities.VolumeListReport
|
||||
vols []*entitiesTypes.VolumeListReport
|
||||
)
|
||||
conn, err := bindings.GetClient(ctx)
|
||||
if err != nil {
|
||||
|
@ -4,6 +4,22 @@ import (
|
||||
"github.com/containers/podman/v4/libpod/define"
|
||||
)
|
||||
|
||||
// swagger:model
|
||||
type VolumeCreateOptions struct {
|
||||
// New volume's name. Can be left blank
|
||||
Name string `schema:"name"`
|
||||
// Volume driver to use
|
||||
Driver string `schema:"driver"`
|
||||
// User-defined key/value metadata. Provided for compatibility
|
||||
Label map[string]string `schema:"label"`
|
||||
// User-defined key/value metadata. Preferred field, will override Label
|
||||
Labels map[string]string `schema:"labels"`
|
||||
// Mapping of driver options and values.
|
||||
Options map[string]string `schema:"opts"`
|
||||
// Ignore existing volumes
|
||||
IgnoreIfExists bool `schema:"ignoreIfExist"`
|
||||
}
|
||||
|
||||
type VolumeRmReport struct {
|
||||
Err error
|
||||
Id string //nolint:revive,stylecheck
|
||||
|
@ -8,20 +8,7 @@ import (
|
||||
|
||||
// VolumeCreateOptions provides details for creating volumes
|
||||
// swagger:model
|
||||
type VolumeCreateOptions struct {
|
||||
// New volume's name. Can be left blank
|
||||
Name string `schema:"name"`
|
||||
// Volume driver to use
|
||||
Driver string `schema:"driver"`
|
||||
// User-defined key/value metadata. Provided for compatibility
|
||||
Label map[string]string `schema:"label"`
|
||||
// User-defined key/value metadata. Preferred field, will override Label
|
||||
Labels map[string]string `schema:"labels"`
|
||||
// Mapping of driver options and values.
|
||||
Options map[string]string `schema:"opts"`
|
||||
// Ignore existing volumes
|
||||
IgnoreIfExists bool `schema:"ignoreIfExist"`
|
||||
}
|
||||
type VolumeCreateOptions = types.VolumeCreateOptions
|
||||
|
||||
type VolumeConfigResponse = types.VolumeConfigResponse
|
||||
|
||||
|
Reference in New Issue
Block a user