| 1112 | } |
| 1113 | |
| 1114 | func findAccount(opts *UpdateOptions, accountType accounts.AccountType) (string, error) { |
| 1115 | accounts, err := opts.GetAccountsByType(accountType) |
| 1116 | if err != nil { |
| 1117 | return "", err |
| 1118 | } |
| 1119 | for _, a := range accounts { |
| 1120 | if strings.EqualFold(a.GetName(), opts.Value.Value) || strings.EqualFold(a.GetID(), opts.Value.Value) || strings.EqualFold(a.GetSlug(), opts.Value.Value) { |
| 1121 | return a.GetID(), nil |
| 1122 | } |
| 1123 | } |
| 1124 | |
| 1125 | return "", fmt.Errorf("cannot find %s account with called '%s'", accountType, opts.Value.Value) |
| 1126 | } |
| 1127 | |
| 1128 | func getEnvironmentMap(getAllEnvironments selectors.GetAllEnvironmentsCallback) (map[string]string, error) { |
| 1129 | environmentMap := make(map[string]string) |