pulumi/pkg/engine/destroy.go
Matt Ellis 93ab134bbb Have the CLI keep track of the current environment
Previously, the engine was concered with maintaing information about
the currently active environment. Now, the CLI is in charge of
this. As part of this change, the engine can now assume that every
environment has a non empty name (and I've added asserts on the
entrypoints of the engine API to ensure that any consumer of the
engine passes a non empty environment name)
2017-10-02 16:57:41 -07:00

34 lines
698 B
Go

// Copyright 2017, Pulumi Corporation. All rights reserved.
package engine
import (
"github.com/pulumi/pulumi/pkg/tokens"
"github.com/pulumi/pulumi/pkg/util/contract"
)
type DestroyOptions struct {
Package string
DryRun bool
Debug bool
Parallel int
Summary bool
}
func (eng *Engine) Destroy(environment tokens.QName, opts DestroyOptions) error {
contract.Require(environment != tokens.QName(""), "environment")
info, err := eng.initEnvCmdName(environment, opts.Package)
if err != nil {
return err
}
return eng.deployLatest(info, deployOptions{
Debug: opts.Debug,
Destroy: true,
DryRun: opts.DryRun,
Parallel: opts.Parallel,
Summary: opts.Summary,
})
}