forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_env.go
26 lines (19 loc) · 823 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
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 CreateEnvCmd struct {
ui boshui.UI
envProvider func(string, string, boshtpl.Variables, patch.Op) DeploymentPreparer
}
func NewCreateEnvCmd(ui boshui.UI, envProvider func(string, string, boshtpl.Variables, patch.Op) DeploymentPreparer) *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)
}