(f factory.Factory)
| 61 | } |
| 62 | |
| 63 | func NewCmdCreate(f factory.Factory) *cobra.Command { |
| 64 | createFlags := NewCreateFlags() |
| 65 | |
| 66 | cmd := &cobra.Command{ |
| 67 | Use: "create", |
| 68 | Short: "Create a dynamic worker pool", |
| 69 | Long: "Create a dynamic worker pool in Octopus Deploy", |
| 70 | Example: heredoc.Docf(` |
| 71 | %s worker-pool dynamic create |
| 72 | `, constants.ExecutableName), |
| 73 | RunE: func(c *cobra.Command, _ []string) error { |
| 74 | opts := NewCreateOptions(createFlags, cmd.NewDependencies(f, c)) |
| 75 | |
| 76 | return createRun(opts) |
| 77 | }, |
| 78 | } |
| 79 | |
| 80 | flags := cmd.Flags() |
| 81 | flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "A short, memorable, unique name for this worker pool.") |
| 82 | flags.StringVar(&createFlags.Type.Value, createFlags.Type.Name, "", "The worker type to use for all leased workers.") |
| 83 | flags.StringVar(&createFlags.Description.Value, createFlags.Description.Name, "", "Description of the worker pool.") |
| 84 | |
| 85 | machinescommon.RegisterWebFlag(cmd, createFlags.WebFlags) |
| 86 | |
| 87 | return cmd |
| 88 | } |
| 89 | |
| 90 | func createRun(opts *CreateOptions) error { |
| 91 | if !opts.NoPrompt { |
nothing calls this directly
no test coverage detected