diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-21 14:46:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-21 14:46:39 +0100 |
commit | 195a82ffbc435716ef5bb69f6eefa333abe3f840 (patch) | |
tree | 5d37dc8abce399a4bad65eb7eb81614ce63a63cc /pkg/api/handlers/libpod/volumes.go | |
parent | e1f2851976fb66b92779fcb45a2ae2117923ca4e (diff) | |
parent | c3a9ff11743c1ee25515ced348ec635fb7703aa0 (diff) | |
download | podman-195a82ffbc435716ef5bb69f6eefa333abe3f840.tar.gz podman-195a82ffbc435716ef5bb69f6eefa333abe3f840.tar.bz2 podman-195a82ffbc435716ef5bb69f6eefa333abe3f840.zip |
Merge pull request #5577 from baude/v2volumecreate
podmanv2 volume create
Diffstat (limited to 'pkg/api/handlers/libpod/volumes.go')
-rw-r--r-- | pkg/api/handlers/libpod/volumes.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/pkg/api/handlers/libpod/volumes.go b/pkg/api/handlers/libpod/volumes.go index 9b10ee890..06ca1d225 100644 --- a/pkg/api/handlers/libpod/volumes.go +++ b/pkg/api/handlers/libpod/volumes.go @@ -8,8 +8,8 @@ import ( "github.com/containers/libpod/cmd/podman/shared" "github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod/define" - "github.com/containers/libpod/pkg/api/handlers" "github.com/containers/libpod/pkg/api/handlers/utils" + "github.com/containers/libpod/pkg/domain/entities" "github.com/gorilla/schema" "github.com/pkg/errors" log "github.com/sirupsen/logrus" @@ -25,7 +25,7 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) { }{ // override any golang type defaults } - input := handlers.VolumeCreateConfig{} + input := entities.VolumeCreateOptions{} if err := decoder.Decode(&query, r.URL.Query()); err != nil { utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String())) @@ -46,8 +46,8 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) { if len(input.Label) > 0 { volumeOptions = append(volumeOptions, libpod.WithVolumeLabels(input.Label)) } - if len(input.Opts) > 0 { - parsedOptions, err := shared.ParseVolumeOptions(input.Opts) + if len(input.Options) > 0 { + parsedOptions, err := shared.ParseVolumeOptions(input.Options) if err != nil { utils.InternalServerError(w, err) return @@ -64,7 +64,17 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) { utils.InternalServerError(w, err) return } - utils.WriteResponse(w, http.StatusOK, config) + volResponse := entities.VolumeConfigResponse{ + Name: config.Name, + Labels: config.Labels, + Driver: config.Driver, + MountPoint: config.MountPoint, + CreatedTime: config.CreatedTime, + Options: config.Options, + UID: config.UID, + GID: config.GID, + } + utils.WriteResponse(w, http.StatusOK, volResponse) } func InspectVolume(w http.ResponseWriter, r *http.Request) { |