(opts *CreateOptions)
| 88 | } |
| 89 | |
| 90 | func createRun(opts *CreateOptions) error { |
| 91 | if !opts.NoPrompt { |
| 92 | if err := PromptMissing(opts); err != nil { |
| 93 | return err |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | workerPool := workerpools.NewDynamicWorkerPool(opts.Name.Value, opts.Type.Value) |
| 98 | |
| 99 | if opts.Description.Value != "" { |
| 100 | workerPool.SetDescription(opts.Description.Value) |
| 101 | } |
| 102 | |
| 103 | createdPool, err := opts.Client.WorkerPools.Add(workerPool) |
| 104 | if err != nil { |
| 105 | return err |
| 106 | } |
| 107 | |
| 108 | fmt.Fprintf(opts.Out, "Successfully created worker pool '%s'\n", createdPool.GetName()) |
| 109 | if !opts.NoPrompt { |
| 110 | autoCmd := flag.GenerateAutomationCmd(opts.CmdPath, opts.GetSpaceNameOrEmpty(), opts.Name, opts.Description, opts.Type) |
| 111 | fmt.Fprintf(opts.Out, "\nAutomation Command: %s\n", autoCmd) |
| 112 | } |
| 113 | |
| 114 | machinescommon.DoWebForWorkerPools(createdPool, opts.Dependencies, opts.WebFlags) |
| 115 | |
| 116 | return nil |
| 117 | } |
| 118 | |
| 119 | func PromptMissing(opts *CreateOptions) error { |
| 120 | err := question.AskName(opts.Ask, "", "Dynamic Worker Pool", &opts.Name.Value) |
no test coverage detected