(opts *CloneOptions)
| 83 | } |
| 84 | |
| 85 | func cloneRun(opts *CloneOptions) error { |
| 86 | if !opts.NoPrompt { |
| 87 | if err := PromptMissing(opts); err != nil { |
| 88 | return err |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | tenant, err := opts.GetTenantCallback(opts.SourceTenant.Value) |
| 93 | if err != nil { |
| 94 | return err |
| 95 | } |
| 96 | |
| 97 | clonedTenant, err := opts.Client.Tenants.Clone(tenant, tenants.TenantCloneRequest{Name: opts.Name.Value, Description: opts.Description.Value}) |
| 98 | if err != nil { |
| 99 | return err |
| 100 | } |
| 101 | |
| 102 | fmt.Fprintf(opts.Out, "Successfully cloned tenant '%s' to '%s'.\n", tenant.Name, clonedTenant.Name) |
| 103 | if !opts.NoPrompt { |
| 104 | autoCmd := flag.GenerateAutomationCmd(opts.CmdPath, opts.GetSpaceNameOrEmpty(), opts.SourceTenant, opts.Name, opts.Description) |
| 105 | fmt.Fprintf(opts.Out, "\nAutomation Command: %s\n", autoCmd) |
| 106 | } |
| 107 | |
| 108 | link := output.Bluef("%s/app#/%s/tenants/%s/overview", opts.Host, opts.Space.GetID(), clonedTenant.GetID()) |
| 109 | fmt.Fprintf(opts.Out, "View this tenant on Octopus Deploy: %s\n", link) |
| 110 | |
| 111 | return nil |
| 112 | } |
| 113 | |
| 114 | func PromptMissing(opts *CloneOptions) error { |
| 115 | err := question.AskName(opts.Ask, "", "Tenant", &opts.Name.Value) |
no test coverage detected