forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_env.go
26 lines (19 loc) · 834 Bytes
/
delete_env.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package cmd
import (
"github.com/cppforlife/go-patch/patch"
boshtpl "github.com/cloudfoundry/bosh-cli/director/template"
boshui "github.com/cloudfoundry/bosh-cli/ui"
)
type DeleteEnvCmd struct {
ui boshui.UI
envProvider func(string, string, boshtpl.Variables, patch.Op) DeploymentDeleter
}
func NewDeleteEnvCmd(ui boshui.UI, envProvider func(string, string, boshtpl.Variables, patch.Op) DeploymentDeleter) *DeleteEnvCmd {
return &DeleteEnvCmd{ui: ui, envProvider: envProvider}
}
func (c *DeleteEnvCmd) Run(stage boshui.Stage, opts DeleteEnvOpts) error {
c.ui.BeginLinef("Deployment manifest: '%s'\n", opts.Args.Manifest.Path)
depDeleter := c.envProvider(
opts.Args.Manifest.Path, opts.StatePath, opts.VarFlags.AsVariables(), opts.OpsFlags.AsOp())
return depDeleter.DeleteDeployment(opts.SkipDrain, stage)
}