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

Function GetProjectMap

pkg/cmd/tenant/shared/shared.go:74–93  ·  view source on GitHub ↗
(client *client.Client, tenants []*tenants.Tenant)

Source from the content-addressed store, hash-verified

72}
73
74func GetProjectMap(client *client.Client, tenants []*tenants.Tenant) (map[string]string, error) {
75 var projectIds []string
76 for _, t := range tenants {
77 for p := range t.ProjectEnvironments {
78 projectIds = append(projectIds, p)
79 }
80 }
81 projectIds = util.SliceDistinct(projectIds)
82
83 projectMap := make(map[string]string)
84 queryResult, err := client.Projects.Get(projects.ProjectsQuery{IDs: projectIds})
85 allProjects, err := queryResult.GetAllPages(client.Projects.GetClient())
86 if err != nil {
87 return nil, err
88 }
89 for _, e := range allProjects {
90 projectMap[e.GetID()] = e.GetName()
91 }
92 return projectMap, nil
93}
94
95func GetAllTeams(client client.Client) ([]*teams.Team, error) {
96 res, err := client.Teams.Get(teams.TeamsQuery{IncludeSystem: true})

Callers 2

viewRunFunction · 0.92
listRunFunction · 0.92

Calls 3

SliceDistinctFunction · 0.92
GetMethod · 0.65
GetNameMethod · 0.65

Tested by

no test coverage detected