mirror of
https://github.com/containers/podman.git
synced 2025-07-30 11:52:47 +08:00
bindings: volumes uses entities/types
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
pkg
@ -6,15 +6,15 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/podman/v4/pkg/bindings"
|
"github.com/containers/podman/v4/pkg/bindings"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities/reports"
|
"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"
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create creates a volume given its configuration.
|
// 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 (
|
var (
|
||||||
v entities.VolumeConfigResponse
|
v entitiesTypes.VolumeConfigResponse
|
||||||
)
|
)
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(CreateOptions)
|
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.
|
// 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 (
|
var (
|
||||||
inspect entities.VolumeConfigResponse
|
inspect entitiesTypes.VolumeConfigResponse
|
||||||
)
|
)
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(InspectOptions)
|
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
|
// List returns the configurations for existing volumes in the form of a slice. Optionally, filters
|
||||||
// can be used to refine the list of volumes.
|
// 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 (
|
var (
|
||||||
vols []*entities.VolumeListReport
|
vols []*entitiesTypes.VolumeListReport
|
||||||
)
|
)
|
||||||
conn, err := bindings.GetClient(ctx)
|
conn, err := bindings.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -4,6 +4,22 @@ import (
|
|||||||
"github.com/containers/podman/v4/libpod/define"
|
"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 {
|
type VolumeRmReport struct {
|
||||||
Err error
|
Err error
|
||||||
Id string //nolint:revive,stylecheck
|
Id string //nolint:revive,stylecheck
|
||||||
|
@ -8,20 +8,7 @@ import (
|
|||||||
|
|
||||||
// VolumeCreateOptions provides details for creating volumes
|
// VolumeCreateOptions provides details for creating volumes
|
||||||
// swagger:model
|
// swagger:model
|
||||||
type VolumeCreateOptions struct {
|
type VolumeCreateOptions = types.VolumeCreateOptions
|
||||||
// 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 VolumeConfigResponse = types.VolumeConfigResponse
|
type VolumeConfigResponse = types.VolumeConfigResponse
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user