(spaceGUID string, labelSelector string, omitStats bool)
| 41 | } |
| 42 | |
| 43 | func (actor Actor) GetAppSummariesForSpace(spaceGUID string, labelSelector string, omitStats bool) ([]ApplicationSummary, Warnings, error) { |
| 44 | var allWarnings Warnings |
| 45 | var allSummaries []ApplicationSummary |
| 46 | |
| 47 | keys := []ccv3.Query{ |
| 48 | {Key: ccv3.SpaceGUIDFilter, Values: []string{spaceGUID}}, |
| 49 | {Key: ccv3.OrderBy, Values: []string{ccv3.NameOrder}}, |
| 50 | {Key: ccv3.PerPage, Values: []string{ccv3.MaxPerPage}}, |
| 51 | } |
| 52 | if len(labelSelector) > 0 { |
| 53 | keys = append(keys, ccv3.Query{Key: ccv3.LabelSelectorFilter, Values: []string{labelSelector}}) |
| 54 | } |
| 55 | apps, ccv3Warnings, err := actor.CloudControllerClient.GetApplications(keys...) |
| 56 | allWarnings = append(allWarnings, ccv3Warnings...) |
| 57 | if err != nil { |
| 58 | return nil, allWarnings, err |
| 59 | } |
| 60 | |
| 61 | var processSummariesByAppGUID map[string]ProcessSummaries |
| 62 | var warnings Warnings |
| 63 | |
| 64 | if !omitStats { |
| 65 | embeddedProcessInstancesAvailable, versionErr := versioncheck.IsMinimumAPIVersionMet(actor.Config.APIVersion(), ccversion.MinVersionEmbeddedProcessInstances) |
| 66 | if versionErr != nil { |
| 67 | return nil, allWarnings, versionErr |
| 68 | } |
| 69 | if embeddedProcessInstancesAvailable { |
| 70 | processSummariesByAppGUID, warnings, err = actor.getProcessSummariesForSpace(spaceGUID) |
| 71 | } else { |
| 72 | processSummariesByAppGUID, warnings, err = actor.getProcessSummariesForApps(apps) |
| 73 | } |
| 74 | allWarnings = append(allWarnings, warnings...) |
| 75 | if err != nil { |
| 76 | return nil, allWarnings, err |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | var routes []resources.Route |
| 81 | |
| 82 | ccv3Warnings, err = batcher.RequestByGUID(toAppGUIDs(apps), func(guids []string) (ccv3.Warnings, error) { |
| 83 | batch, warnings, err := actor.CloudControllerClient.GetRoutes(ccv3.Query{ |
| 84 | Key: ccv3.AppGUIDFilter, Values: guids, |
| 85 | }) |
| 86 | routes = append(routes, batch...) |
| 87 | return warnings, err |
| 88 | }) |
| 89 | allWarnings = append(allWarnings, ccv3Warnings...) |
| 90 | if err != nil { |
| 91 | return nil, allWarnings, err |
| 92 | } |
| 93 | |
| 94 | routesByAppGUID := make(map[string][]resources.Route) |
| 95 | |
| 96 | for _, route := range routes { |
| 97 | for _, dest := range route.Destinations { |
| 98 | routesByAppGUID[dest.App.GUID] = append(routesByAppGUID[dest.App.GUID], route) |
| 99 | } |
| 100 | } |
nothing calls this directly
no test coverage detected