MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / findAccount

Function findAccount

pkg/cmd/tenant/variables/update/update.go:1114–1126  ·  view source on GitHub ↗
(opts *UpdateOptions, accountType accounts.AccountType)

Source from the content-addressed store, hash-verified

1112}
1113
1114func 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
1128func getEnvironmentMap(getAllEnvironments selectors.GetAllEnvironmentsCallback) (map[string]string, error) {
1129 environmentMap := make(map[string]string)

Callers 1

convertValueFunction · 0.85

Calls 1

GetNameMethod · 0.65

Tested by

no test coverage detected