diff options
Diffstat (limited to 'pkg/bindings/play/play.go')
-rw-r--r-- | pkg/bindings/play/play.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/bindings/play/play.go b/pkg/bindings/play/play.go index 4b735c821..a45508fed 100644 --- a/pkg/bindings/play/play.go +++ b/pkg/bindings/play/play.go @@ -6,6 +6,8 @@ import ( "os" "strconv" + "github.com/sirupsen/logrus" + "github.com/containers/podman/v3/pkg/auth" "github.com/containers/podman/v3/pkg/bindings" "github.com/containers/podman/v3/pkg/domain/entities" @@ -54,3 +56,30 @@ func Kube(ctx context.Context, path string, options *KubeOptions) (*entities.Pla return &report, nil } + +func KubeDown(ctx context.Context, path string) (*entities.PlayKubeReport, error) { + var report entities.PlayKubeReport + conn, err := bindings.GetClient(ctx) + if err != nil { + return nil, err + } + + f, err := os.Open(path) + if err != nil { + return nil, err + } + defer func() { + if err := f.Close(); err != nil { + logrus.Warn(err) + } + }() + response, err := conn.DoRequest(f, http.MethodDelete, "/play/kube", nil, nil) + if err != nil { + return nil, err + } + if err := response.Process(&report); err != nil { + return nil, err + } + + return &report, nil +} |