summaryrefslogtreecommitdiff
path: root/pkg/bindings
diff options
context:
space:
mode:
authorTino Rusch <tino.rusch@gmail.com>2021-06-20 16:11:54 +0200
committerTino Rusch <tino.rusch@gmail.com>2021-06-24 12:31:14 +0200
commitb56b4b53744c59cad942278ff34a0b0616a7aa60 (patch)
tree77bb7ead8c1f2ccedc31eaa5dc1cc06483555947 /pkg/bindings
parentda33fc45b6628c1ac1a16e49790be2b4fbf502a5 (diff)
downloadpodman-b56b4b53744c59cad942278ff34a0b0616a7aa60.tar.gz
podman-b56b4b53744c59cad942278ff34a0b0616a7aa60.tar.bz2
podman-b56b4b53744c59cad942278ff34a0b0616a7aa60.zip
read secret config from config file if no user data.
feat: read secret config from config file if the user hasn't entered explicit config values feat: allow to specify `--driver-opts opt1=val1,opt2=val2` in the secret create command to allow overriding the default values fix: show driver options in `podman secret inspect` Signed-off-by: Tino Rusch <tino.rusch@gmail.com>
Diffstat (limited to 'pkg/bindings')
-rw-r--r--pkg/bindings/internal/util/util.go4
-rw-r--r--pkg/bindings/secrets/types.go5
-rw-r--r--pkg/bindings/secrets/types_create_options.go36
3 files changed, 31 insertions, 14 deletions
diff --git a/pkg/bindings/internal/util/util.go b/pkg/bindings/internal/util/util.go
index c1961308e..ef93d6e25 100644
--- a/pkg/bindings/internal/util/util.go
+++ b/pkg/bindings/internal/util/util.go
@@ -85,10 +85,10 @@ func ToParams(o interface{}) (url.Values, error) {
}
}
case f.Kind() == reflect.Map:
- lowerCaseKeys := make(map[string][]string)
+ lowerCaseKeys := make(map[string]interface{})
iter := f.MapRange()
for iter.Next() {
- lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface()
}
s, err := json.MarshalToString(lowerCaseKeys)
if err != nil {
diff --git a/pkg/bindings/secrets/types.go b/pkg/bindings/secrets/types.go
index a98e894dc..a64dea1b4 100644
--- a/pkg/bindings/secrets/types.go
+++ b/pkg/bindings/secrets/types.go
@@ -18,6 +18,7 @@ type RemoveOptions struct {
//go:generate go run ../generator/generator.go CreateOptions
// CreateOptions are optional options for Creating secrets
type CreateOptions struct {
- Driver *string
- Name *string
+ Name *string
+ Driver *string
+ DriverOpts map[string]string
}
diff --git a/pkg/bindings/secrets/types_create_options.go b/pkg/bindings/secrets/types_create_options.go
index ea5bd3039..28d0c4e83 100644
--- a/pkg/bindings/secrets/types_create_options.go
+++ b/pkg/bindings/secrets/types_create_options.go
@@ -20,6 +20,22 @@ func (o *CreateOptions) ToParams() (url.Values, error) {
return util.ToParams(o)
}
+// WithName
+func (o *CreateOptions) WithName(value string) *CreateOptions {
+ v := &value
+ o.Name = v
+ return o
+}
+
+// GetName
+func (o *CreateOptions) GetName() string {
+ var name string
+ if o.Name == nil {
+ return name
+ }
+ return *o.Name
+}
+
// WithDriver
func (o *CreateOptions) WithDriver(value string) *CreateOptions {
v := &value
@@ -36,18 +52,18 @@ func (o *CreateOptions) GetDriver() string {
return *o.Driver
}
-// WithName
-func (o *CreateOptions) WithName(value string) *CreateOptions {
- v := &value
- o.Name = v
+// WithDriverOpts
+func (o *CreateOptions) WithDriverOpts(value map[string]string) *CreateOptions {
+ v := value
+ o.DriverOpts = v
return o
}
-// GetName
-func (o *CreateOptions) GetName() string {
- var name string
- if o.Name == nil {
- return name
+// GetDriverOpts
+func (o *CreateOptions) GetDriverOpts() map[string]string {
+ var driverOpts map[string]string
+ if o.DriverOpts == nil {
+ return driverOpts
}
- return *o.Name
+ return o.DriverOpts
}