2017-08-30 03:24:12 +02:00
|
|
|
// Copyright 2017, Pulumi Corporation. All rights reserved.
|
|
|
|
|
2017-08-23 01:56:15 +02:00
|
|
|
package engine
|
|
|
|
|
2017-10-02 20:14:27 +02:00
|
|
|
import (
|
|
|
|
"github.com/pulumi/pulumi/pkg/tokens"
|
2017-10-03 01:37:12 +02:00
|
|
|
"github.com/pulumi/pulumi/pkg/util/contract"
|
2017-10-02 20:14:27 +02:00
|
|
|
)
|
2017-08-23 01:56:15 +02:00
|
|
|
|
2017-08-24 01:50:20 +02:00
|
|
|
type DestroyOptions struct {
|
2017-10-02 20:14:27 +02:00
|
|
|
Package string
|
|
|
|
DryRun bool
|
|
|
|
Debug bool
|
|
|
|
Parallel int
|
|
|
|
Summary bool
|
2017-08-24 01:50:20 +02:00
|
|
|
}
|
|
|
|
|
2017-10-03 00:14:55 +02:00
|
|
|
func (eng *Engine) Destroy(environment tokens.QName, opts DestroyOptions) error {
|
2017-10-03 01:37:12 +02:00
|
|
|
contract.Require(environment != tokens.QName(""), "environment")
|
|
|
|
|
2017-10-03 00:14:55 +02:00
|
|
|
info, err := eng.initEnvCmdName(environment, opts.Package)
|
2017-08-23 01:56:15 +02:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-08-23 19:58:35 +02:00
|
|
|
return eng.deployLatest(info, deployOptions{
|
2017-09-17 17:10:46 +02:00
|
|
|
Debug: opts.Debug,
|
|
|
|
Destroy: true,
|
|
|
|
DryRun: opts.DryRun,
|
|
|
|
Parallel: opts.Parallel,
|
|
|
|
Summary: opts.Summary,
|
2017-08-23 01:56:15 +02:00
|
|
|
})
|
|
|
|
}
|