github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/pkg/domain/entities/volumes.go (about)

     1  package entities
     2  
     3  import (
     4  	"time"
     5  
     6  	docker_api_types "github.com/docker/docker/api/types"
     7  	docker_api_types_volume "github.com/docker/docker/api/types/volume"
     8  )
     9  
    10  // swagger:model VolumeCreate
    11  type VolumeCreateOptions struct {
    12  	// New volume's name. Can be left blank
    13  	Name string `schema:"name"`
    14  	// Volume driver to use
    15  	Driver string `schema:"driver"`
    16  	// User-defined key/value metadata.
    17  	Label map[string]string `schema:"label"`
    18  	// Mapping of driver options and values.
    19  	Options map[string]string `schema:"opts"`
    20  }
    21  
    22  type IDOrNameResponse struct {
    23  	// The Id or Name of an object
    24  	IDOrName string
    25  }
    26  
    27  type VolumeConfigResponse struct {
    28  	// Name is the name of the volume.
    29  	Name string `json:"Name"`
    30  	// Driver is the driver used to create the volume.
    31  	// This will be properly implemented in a future version.
    32  	Driver string `json:"Driver"`
    33  	// Mountpoint is the path on the host where the volume is mounted.
    34  	Mountpoint string `json:"Mountpoint"`
    35  	// CreatedAt is the date and time the volume was created at. This is not
    36  	// stored for older Libpod volumes; if so, it will be omitted.
    37  	CreatedAt time.Time `json:"CreatedAt,omitempty"`
    38  	// Status is presently unused and provided only for Docker compatibility.
    39  	// In the future it will be used to return information on the volume's
    40  	// current state.
    41  	Status map[string]string `json:"Status,omitempty"`
    42  	// Labels includes the volume's configured labels, key:value pairs that
    43  	// can be passed during volume creation to provide information for third
    44  	// party tools.
    45  	Labels map[string]string `json:"Labels"`
    46  	// Scope is unused and provided solely for Docker compatibility. It is
    47  	// unconditionally set to "local".
    48  	Scope string `json:"Scope"`
    49  	// Options is a set of options that were used when creating the volume.
    50  	// It is presently not used.
    51  	Options map[string]string `json:"Options"`
    52  	// UID is the UID that the volume was created with.
    53  	UID int `json:"UID"`
    54  	// GID is the GID that the volume was created with.
    55  	GID int `json:"GID"`
    56  	// Anonymous indicates that the volume was created as an anonymous
    57  	// volume for a specific container, and will be be removed when any
    58  	// container using it is removed.
    59  	Anonymous bool `json:"Anonymous"`
    60  }
    61  
    62  // VolumeInfo Volume list response
    63  // swagger:model VolumeInfo
    64  type VolumeInfo struct {
    65  
    66  	// Date/Time the volume was created.
    67  	CreatedAt string `json:"CreatedAt,omitempty"`
    68  
    69  	// Name of the volume driver used by the volume. Only supports local driver
    70  	// Required: true
    71  	Driver string `json:"Driver"`
    72  
    73  	// User-defined key/value metadata.
    74  	// Always included
    75  	Labels map[string]string `json:"Labels"`
    76  
    77  	// Mount path of the volume on the host.
    78  	// Required: true
    79  	Mountpoint string `json:"Mountpoint"`
    80  
    81  	// Name of the volume.
    82  	// Required: true
    83  	Name string `json:"Name"`
    84  
    85  	// The driver specific options used when creating the volume.
    86  	// Required: true
    87  	Options map[string]string `json:"Options"`
    88  
    89  	// The level at which the volume exists.
    90  	// Libpod does not implement volume scoping, and this is provided solely for
    91  	// Docker compatibility. The value is only "local".
    92  	// Required: true
    93  	Scope string `json:"Scope"`
    94  
    95  	// TODO: We don't include the volume `Status` for now
    96  }
    97  
    98  type VolumeRmOptions struct {
    99  	All   bool
   100  	Force bool
   101  }
   102  
   103  type VolumeRmReport struct {
   104  	Err error
   105  	Id  string //nolint
   106  }
   107  
   108  type VolumeInspectReport struct {
   109  	*VolumeConfigResponse
   110  }
   111  
   112  type VolumePruneReport struct {
   113  	Err error
   114  	Id  string //nolint
   115  }
   116  
   117  type VolumeListOptions struct {
   118  	Filter map[string][]string
   119  }
   120  
   121  type VolumeListReport struct {
   122  	VolumeConfigResponse
   123  }
   124  
   125  // VolumeListBody Volume list response
   126  // swagger:model VolumeListBody
   127  type VolumeListBody struct {
   128  	Volumes []*VolumeInfo
   129  }
   130  
   131  // Volume list response
   132  // swagger:response VolumeListResponse
   133  type SwagVolumeListResponse struct {
   134  	// in:body
   135  	Body struct {
   136  		VolumeListBody
   137  	}
   138  }
   139  
   140  /*
   141   * Docker API compatibility types
   142   */
   143  
   144  // swagger:model DockerVolumeCreate
   145  type DockerVolumeCreate docker_api_types_volume.VolumeCreateBody
   146  
   147  // This response definition is used for both the create and inspect endpoints
   148  // swagger:response DockerVolumeInfoResponse
   149  type SwagDockerVolumeInfoResponse struct {
   150  	// in:body
   151  	Body struct {
   152  		docker_api_types.Volume
   153  	}
   154  }
   155  
   156  // Volume prune response
   157  // swagger:response DockerVolumePruneResponse
   158  type SwagDockerVolumePruneResponse struct {
   159  	// in:body
   160  	Body struct {
   161  		docker_api_types.VolumesPruneReport
   162  	}
   163  }