diff options
author | baude <bbaude@redhat.com> | 2020-12-14 11:33:25 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2020-12-17 09:40:51 -0600 |
commit | 86335aa4ae01dadecd36468409d742e68b76925d (patch) | |
tree | fd6e5bfeb924db9020073685d0133b2fa38622c1 /pkg/bindings/play/play.go | |
parent | c38ae47a1adf3235d8b01d724e7327e608dd8078 (diff) | |
download | podman-86335aa4ae01dadecd36468409d742e68b76925d.tar.gz podman-86335aa4ae01dadecd36468409d742e68b76925d.tar.bz2 podman-86335aa4ae01dadecd36468409d742e68b76925d.zip |
misc bindings to podman v3
manifest, system, info, volumes, play, and generate bindings are
updated to always have binding options.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/bindings/play/play.go')
-rw-r--r-- | pkg/bindings/play/play.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/pkg/bindings/play/play.go b/pkg/bindings/play/play.go index cfb40d74b..9ee02a093 100644 --- a/pkg/bindings/play/play.go +++ b/pkg/bindings/play/play.go @@ -3,18 +3,19 @@ package play import ( "context" "net/http" - "net/url" "os" "strconv" - "github.com/containers/image/v5/types" "github.com/containers/podman/v2/pkg/auth" "github.com/containers/podman/v2/pkg/bindings" "github.com/containers/podman/v2/pkg/domain/entities" ) -func Kube(ctx context.Context, path string, options entities.PlayKubeOptions) (*entities.PlayKubeReport, error) { +func Kube(ctx context.Context, path string, options *KubeOptions) (*entities.PlayKubeReport, error) { var report entities.PlayKubeReport + if options == nil { + options = new(KubeOptions) + } conn, err := bindings.GetClient(ctx) if err != nil { return nil, err @@ -26,18 +27,19 @@ func Kube(ctx context.Context, path string, options entities.PlayKubeOptions) (* } defer f.Close() - params := url.Values{} - params.Set("network", options.Network) - params.Set("logDriver", options.LogDriver) - if options.SkipTLSVerify != types.OptionalBoolUndefined { - params.Set("tlsVerify", strconv.FormatBool(options.SkipTLSVerify != types.OptionalBoolTrue)) + params, err := options.ToParams() + if err != nil { + return nil, err + } + if options.SkipTLSVerify != nil { + params.Set("tlsVerify", strconv.FormatBool(options.GetSkipTLSVerify())) } - if options.Start != types.OptionalBoolUndefined { - params.Set("start", strconv.FormatBool(options.Start == types.OptionalBoolTrue)) + if options.Start != nil { + params.Set("start", strconv.FormatBool(options.GetStart())) } // TODO: have a global system context we can pass around (1st argument) - header, err := auth.Header(nil, auth.XRegistryAuthHeader, options.Authfile, options.Username, options.Password) + header, err := auth.Header(nil, auth.XRegistryAuthHeader, options.GetAuthfile(), options.GetUsername(), options.GetPassword()) if err != nil { return nil, err } |