(opts *CreateOptions)
| 104 | } |
| 105 | |
| 106 | func createRun(opts *CreateOptions) error { |
| 107 | |
| 108 | if !opts.NoPrompt { |
| 109 | err := PromptMissing(opts) |
| 110 | if err != nil { |
| 111 | return err |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | projectResource, err := projects.GetByName(opts.Client, opts.Space.ID, opts.Project.Value) |
| 116 | if err != nil { |
| 117 | return fmt.Errorf("failed to find project '%s': %w", opts.Project.Value, err) |
| 118 | } |
| 119 | projectId := projectResource.GetID() |
| 120 | |
| 121 | createEnv, err := ephemeralenvironments.Add(opts.Client, opts.Space.ID, projectId, opts.Name.Value) |
| 122 | if err != nil { |
| 123 | return err |
| 124 | } |
| 125 | |
| 126 | _, err = fmt.Fprintf(opts.Out, "\nSuccessfully created ephemeral environment '%s' with id '%s'.\n", opts.Name.Value, createEnv.Id) |
| 127 | if err != nil { |
| 128 | return err |
| 129 | } |
| 130 | |
| 131 | link := output.Bluef("%s/app#/%s/projects/%s/ephemeral-environments", opts.Host, opts.Space.GetID(), projectId) |
| 132 | fmt.Fprintf(opts.Out, "View this ephemeral environment for project `%s` on Octopus Deploy: %s\n", opts.Project.Value, link) |
| 133 | |
| 134 | if !opts.NoPrompt { |
| 135 | autoCmd := flag.GenerateAutomationCmd(opts.CmdPath, opts.GetSpaceNameOrEmpty(), opts.Name, opts.Project) |
| 136 | fmt.Fprintf(opts.Out, "%s\n", autoCmd) |
| 137 | } |
| 138 | |
| 139 | return nil |
| 140 | } |
| 141 | |
| 142 | func PromptMissing(opts *CreateOptions) error { |
| 143 |
no test coverage detected