-
Notifications
You must be signed in to change notification settings - Fork 161
/
stop_env.go
26 lines (20 loc) · 895 Bytes
/
stop_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/cloudfoundry/bosh-cli/v7/cmd/opts"
boshtpl "github.com/cloudfoundry/bosh-cli/v7/director/template"
boshui "github.com/cloudfoundry/bosh-cli/v7/ui"
"github.com/cppforlife/go-patch/patch"
)
type StopEnvCmd struct {
ui boshui.UI
envProvider func(string, string, boshtpl.Variables, patch.Op) DeploymentStateManager
}
func NewStopEnvCmd(ui boshui.UI, envProvider func(string, string, boshtpl.Variables, patch.Op) DeploymentStateManager) *StopEnvCmd {
return &StopEnvCmd{ui: ui, envProvider: envProvider}
}
func (c *StopEnvCmd) Run(stage boshui.Stage, opts StopEnvOpts) error {
c.ui.BeginLinef("Deployment manifest: '%s'\n", opts.Args.Manifest.Path)
depStateManager := c.envProvider(
opts.Args.Manifest.Path, opts.StatePath, opts.VarFlags.AsVariables(), opts.OpsFlags.AsOp())
return depStateManager.StopDeployment(opts.SkipDrain, stage)
}