diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-12-07 16:16:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 16:16:15 -0500 |
commit | bfbeece27bc370d33042ab3c4bf36b9288c85b7c (patch) | |
tree | c5a4b837b1f5c794e5f3a54cc2e36e31da4d8742 /pkg/bindings/generate/generate.go | |
parent | a5ca03915e7ad8b9db81d22a256013ce5ae3cc87 (diff) | |
parent | 749ee2a10ed689a06da699659c59872c0ed770d7 (diff) | |
download | podman-bfbeece27bc370d33042ab3c4bf36b9288c85b7c.tar.gz podman-bfbeece27bc370d33042ab3c4bf36b9288c85b7c.tar.bz2 podman-bfbeece27bc370d33042ab3c4bf36b9288c85b7c.zip |
Merge pull request #8581 from baude/kubegen
generate kube on multiple containers
Diffstat (limited to 'pkg/bindings/generate/generate.go')
-rw-r--r-- | pkg/bindings/generate/generate.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pkg/bindings/generate/generate.go b/pkg/bindings/generate/generate.go index dde1cc29c..8d0146ec1 100644 --- a/pkg/bindings/generate/generate.go +++ b/pkg/bindings/generate/generate.go @@ -2,6 +2,7 @@ package generate import ( "context" + "errors" "net/http" "net/url" "strconv" @@ -37,15 +38,21 @@ func Systemd(ctx context.Context, nameOrID string, options entities.GenerateSyst return report, response.Process(&report.Units) } -func Kube(ctx context.Context, nameOrID string, options entities.GenerateKubeOptions) (*entities.GenerateKubeReport, error) { +func Kube(ctx context.Context, nameOrIDs []string, options entities.GenerateKubeOptions) (*entities.GenerateKubeReport, error) { conn, err := bindings.GetClient(ctx) if err != nil { return nil, err } + if len(nameOrIDs) < 1 { + return nil, errors.New("must provide the name or ID of one container or pod") + } params := url.Values{} + for _, name := range nameOrIDs { + params.Add("names", name) + } params.Set("service", strconv.FormatBool(options.Service)) - response, err := conn.DoRequest(nil, http.MethodGet, "/generate/%s/kube", params, nil, nameOrID) + response, err := conn.DoRequest(nil, http.MethodGet, "/generate/kube", params, nil) if err != nil { return nil, err } |