Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI:DOCS] apiv2 fix volumes not included field #7097

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/api/server/register_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error {
// The boolean `dangling` filter is not yet implemented for this endpoint.
// responses:
// '200':
// "$ref": "#/responses/DockerVolumeList"
// "$ref": "#/responses/VolumeListResponse"
// '500':
// "$ref": "#/responses/InternalError"
r.Handle(VersionedPath("/volumes"), s.APIHandler(compat.ListVolumes)).Methods(http.MethodGet)
Expand Down
56 changes: 50 additions & 6 deletions pkg/domain/entities/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,42 @@ type VolumeConfigResponse struct {
Anonymous bool `json:"Anonymous"`
}

// VolumeInfo Volume list response
// swagger:model VolumeInfo
type VolumeInfo struct {

// Date/Time the volume was created.
CreatedAt string `json:"CreatedAt,omitempty"`

// Name of the volume driver used by the volume. Only supports local driver
// Required: true
Driver string `json:"Driver"`
vrothberg marked this conversation as resolved.
Show resolved Hide resolved

// User-defined key/value metadata.
// Always included
Labels map[string]string `json:"Labels"`
vrothberg marked this conversation as resolved.
Show resolved Hide resolved

// Mount path of the volume on the host.
// Required: true
Mountpoint string `json:"Mountpoint"`

// Name of the volume.
// Required: true
Name string `json:"Name"`

// The driver specific options used when creating the volume.
// Required: true
Options map[string]string `json:"Options"`

// The level at which the volume exists.
// Libpod does not implement volume scoping, and this is provided solely for
// Docker compatibility. The value is only "local".
// Required: true
Scope string `json:"Scope"`

// TODO: We don't include the volume `Status` for now
}

type VolumeRmOptions struct {
All bool
Force bool
Expand Down Expand Up @@ -94,17 +130,25 @@ type VolumeListReport struct {
VolumeConfigResponse
}

/*
* Docker API compatibility types
*/
// swagger:response DockerVolumeList
type SwagDockerVolumeListResponse struct {
// VolumeListBody Volume list response
// swagger:model VolumeListBody
type VolumeListBody struct {
Volumes []*VolumeInfo
}

// Volume list response
// swagger:response VolumeListResponse
type SwagVolumeListResponse struct {
// in:body
Body struct {
docker_api_types_volume.VolumeListOKBody
VolumeListBody
}
}

/*
* Docker API compatibility types
*/

// swagger:model DockerVolumeCreate
type DockerVolumeCreate docker_api_types_volume.VolumeCreateBody

Expand Down