mirror of https://github.com/docker/docs.git
return VolumesListResponse in /volumes API
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
13c9e87a9f
commit
9663b5e46f
|
@ -310,18 +310,18 @@ func getVolume(c *context, w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// GET /volumes
|
||||
func getVolumes(c *context, w http.ResponseWriter, r *http.Request) {
|
||||
volumes := struct{ Volumes []*apitypes.Volume }{}
|
||||
volumesListResponse := apitypes.VolumesListResponse{}
|
||||
|
||||
for _, volume := range c.cluster.Volumes() {
|
||||
tmp := (*volume).Volume
|
||||
if tmp.Driver == "local" {
|
||||
tmp.Name = volume.Engine.Name + "/" + volume.Name
|
||||
}
|
||||
volumes.Volumes = append(volumes.Volumes, &tmp)
|
||||
volumesListResponse.Volumes = append(volumesListResponse.Volumes, &tmp)
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(volumes)
|
||||
json.NewEncoder(w).Encode(volumesListResponse)
|
||||
}
|
||||
|
||||
// GET /containers/ps
|
||||
|
|
Loading…
Reference in New Issue