(opts *CreateOptions)
| 72 | } |
| 73 | |
| 74 | func 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 | |
| 103 | func PromptMissing(opts *CreateOptions) error { |
| 104 | err := question.AskName(opts.Ask, "", "Static Worker Pool", &opts.Name.Value) |
no test coverage detected