MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / createRun

Function createRun

pkg/cmd/workerpool/static/create/create.go:74–101  ·  view source on GitHub ↗
(opts *CreateOptions)

Source from the content-addressed store, hash-verified

72}
73
74func createRun(opts *CreateOptions) error {
75 if !opts.NoPrompt {
76 if err := PromptMissing(opts); err != nil {
77 return err
78 }
79 }
80
81 workerPool := workerpools.NewStaticWorkerPool(opts.Name.Value)
82
83 if opts.Description.Value != "" {
84 workerPool.SetDescription(opts.Description.Value)
85 }
86
87 createdPool, err := opts.Client.WorkerPools.Add(workerPool)
88 if err != nil {
89 return err
90 }
91
92 fmt.Fprintf(opts.Out, "Successfully created worker pool '%s'\n", createdPool.GetName())
93 if !opts.NoPrompt {
94 autoCmd := flag.GenerateAutomationCmd(opts.CmdPath, opts.GetSpaceNameOrEmpty(), opts.Name, opts.Description)
95 fmt.Fprintf(opts.Out, "\nAutomation Command: %s\n", autoCmd)
96 }
97
98 machinescommon.DoWebForWorkerPools(createdPool, opts.Dependencies, opts.WebFlags)
99
100 return nil
101}
102
103func PromptMissing(opts *CreateOptions) error {
104 err := question.AskName(opts.Ask, "", "Static Worker Pool", &opts.Name.Value)

Callers 1

NewCmdCreateFunction · 0.70

Calls 5

GenerateAutomationCmdFunction · 0.92
DoWebForWorkerPoolsFunction · 0.92
GetSpaceNameOrEmptyMethod · 0.80
PromptMissingFunction · 0.70
GetNameMethod · 0.65

Tested by

no test coverage detected