-
Notifications
You must be signed in to change notification settings - Fork 161
/
create_env.go
28 lines (20 loc) · 934 Bytes
/
create_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
27
28
package cmd
import (
"github.com/cppforlife/go-patch/patch"
. "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"
)
type CreateEnvCmd struct {
ui boshui.UI
envProvider EnvProviderFunction
}
type EnvProviderFunction func(string, string, boshtpl.Variables, patch.Op) DeploymentPreparer
func NewCreateEnvCmd(ui boshui.UI, envProvider EnvProviderFunction) *CreateEnvCmd {
return &CreateEnvCmd{ui: ui, envProvider: envProvider}
}
func (c *CreateEnvCmd) Run(stage boshui.Stage, opts CreateEnvOpts) error {
c.ui.BeginLinef("Deployment manifest: '%s'\n", opts.Args.Manifest.Path)
depPreparer := c.envProvider(opts.Args.Manifest.Path, opts.StatePath, opts.VarFlags.AsVariables(), opts.OpsFlags.AsOp())
return depPreparer.PrepareDeployment(stage, opts.Recreate, opts.RecreatePersistentDisks, opts.SkipDrain)
}