Clean up Destroy API boundary
This commit is contained in:
parent
73d64dc686
commit
b7388fa99a
|
@ -3,6 +3,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/pulumi/pulumi-fabric/pkg/engine"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/pulumi/pulumi-fabric/pkg/util/cmdutil"
|
||||
|
@ -33,7 +34,12 @@ func newDestroyCmd() *cobra.Command {
|
|||
|
||||
if dryRun || yes ||
|
||||
confirmPrompt("This will permanently destroy all resources in the '%v' environment!", env) {
|
||||
return lumiEngine.Destroy(env, pkgargFromArgs(args), dryRun, debug, summary)
|
||||
return lumiEngine.Destroy(engine.DestroyOptions{
|
||||
Environment: env,
|
||||
Package: pkgargFromArgs(args),
|
||||
DryRun: dryRun,
|
||||
Debug: debug,
|
||||
Summary: summary})
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -2,16 +2,24 @@ package engine
|
|||
|
||||
import "github.com/pulumi/pulumi-fabric/pkg/tokens"
|
||||
|
||||
func (eng *Engine) Destroy(envName string, pkgarg string, dryRun bool, debug bool, summary bool) error {
|
||||
info, err := eng.initEnvCmdName(tokens.QName(envName), pkgarg)
|
||||
type DestroyOptions struct {
|
||||
Environment string
|
||||
Package string
|
||||
DryRun bool
|
||||
Debug bool
|
||||
Summary bool
|
||||
}
|
||||
|
||||
func (eng *Engine) Destroy(opts DestroyOptions) error {
|
||||
info, err := eng.initEnvCmdName(tokens.QName(opts.Environment), opts.Package)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return eng.deployLatest(info, deployOptions{
|
||||
Debug: debug,
|
||||
Debug: opts.Debug,
|
||||
Destroy: true,
|
||||
DryRun: dryRun,
|
||||
Summary: summary,
|
||||
DryRun: opts.DryRun,
|
||||
Summary: opts.Summary,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue