summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat/secrets.go
diff options
context:
space:
mode:
authorAshley Cui <acui@redhat.com>2022-09-12 15:52:54 -0400
committerAshley Cui <acui@redhat.com>2022-09-20 16:28:00 -0400
commit9bb51e8e96f98ab74d416a9af9bd708c7c503bdf (patch)
tree602c43271772dd72cd52dca3bfb397f65ee3515e /pkg/api/handlers/compat/secrets.go
parent8216d0ef4e8212413a650a55ce8fd02f2ca8d181 (diff)
downloadpodman-9bb51e8e96f98ab74d416a9af9bd708c7c503bdf.tar.gz
podman-9bb51e8e96f98ab74d416a9af9bd708c7c503bdf.tar.bz2
podman-9bb51e8e96f98ab74d416a9af9bd708c7c503bdf.zip
Add labels to secrets
Add --label/-l label flag to secret create, and show labels when inspecting secrets. Also allow labeling secrets via libpod/compat API. Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat/secrets.go')
-rw-r--r--pkg/api/handlers/compat/secrets.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/pkg/api/handlers/compat/secrets.go b/pkg/api/handlers/compat/secrets.go
index 13b3c4e24..847f05f27 100644
--- a/pkg/api/handlers/compat/secrets.go
+++ b/pkg/api/handlers/compat/secrets.go
@@ -111,14 +111,11 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) {
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("Decode(): %w", err))
return
}
- if len(createParams.Labels) > 0 {
- utils.Error(w, http.StatusBadRequest, fmt.Errorf("labels not supported: %w", errors.New("bad parameter")))
- return
- }
decoded, _ := base64.StdEncoding.DecodeString(createParams.Data)
reader := bytes.NewReader(decoded)
opts.Driver = createParams.Driver.Name
+ opts.Labels = createParams.Labels
ic := abi.ContainerEngine{Libpod: runtime}
report, err := ic.SecretCreate(r.Context(), createParams.Name, reader, opts)