Skip to content

Commit 70c75bc

Browse files
Merge pull request containers#7097 from QiWang19/usagedate
[CI:DOCS] apiv2 fix volumes not included field
2 parents af3676f + 4dbfac6 commit 70c75bc

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

pkg/api/server/register_volumes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error {
128128
// The boolean `dangling` filter is not yet implemented for this endpoint.
129129
// responses:
130130
// '200':
131-
// "$ref": "#/responses/DockerVolumeList"
131+
// "$ref": "#/responses/VolumeListResponse"
132132
// '500':
133133
// "$ref": "#/responses/InternalError"
134134
r.Handle(VersionedPath("/volumes"), s.APIHandler(compat.ListVolumes)).Methods(http.MethodGet)

pkg/domain/entities/volumes.go

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,42 @@ type VolumeConfigResponse struct {
5959
Anonymous bool `json:"Anonymous"`
6060
}
6161

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+
6298
type VolumeRmOptions struct {
6399
All bool
64100
Force bool
@@ -94,17 +130,25 @@ type VolumeListReport struct {
94130
VolumeConfigResponse
95131
}
96132

97-
/*
98-
* Docker API compatibility types
99-
*/
100-
// swagger:response DockerVolumeList
101-
type SwagDockerVolumeListResponse struct {
133+
// VolumeListBody Volume list response
134+
// swagger:model VolumeListBody
135+
type VolumeListBody struct {
136+
Volumes []*VolumeInfo
137+
}
138+
139+
// Volume list response
140+
// swagger:response VolumeListResponse
141+
type SwagVolumeListResponse struct {
102142
// in:body
103143
Body struct {
104-
docker_api_types_volume.VolumeListOKBody
144+
VolumeListBody
105145
}
106146
}
107147

148+
/*
149+
* Docker API compatibility types
150+
*/
151+
108152
// swagger:model DockerVolumeCreate
109153
type DockerVolumeCreate docker_api_types_volume.VolumeCreateBody
110154

0 commit comments

Comments
 (0)