forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
application_with_process_summary.go
46 lines (38 loc) · 1.27 KB
/
application_with_process_summary.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package v3action
import (
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
)
type ApplicationWithProcessSummary struct {
Application
ProcessSummaries ProcessSummaries
}
func (actor Actor) GetApplicationsWithProcessesBySpace(spaceGUID string) ([]ApplicationWithProcessSummary, Warnings, error) {
var allWarnings Warnings
apps, warnings, err := actor.CloudControllerClient.GetApplications(
ccv3.Query{Key: ccv3.SpaceGUIDFilter, Values: []string{spaceGUID}},
ccv3.Query{Key: ccv3.OrderBy, Values: []string{ccv3.NameOrder}},
)
allWarnings = Warnings(warnings)
if err != nil {
return nil, allWarnings, err
}
var appSummaries []ApplicationWithProcessSummary
for _, app := range apps {
processSummaries, processWarnings, err := actor.getProcessSummariesForApp(app.GUID)
allWarnings = append(allWarnings, processWarnings...)
if err != nil {
return nil, allWarnings, err
}
appSummaries = append(appSummaries, ApplicationWithProcessSummary{
Application: Application{
Name: app.Name,
GUID: app.GUID,
State: app.State,
LifecycleType: app.LifecycleType,
LifecycleBuildpacks: app.LifecycleBuildpacks,
},
ProcessSummaries: processSummaries,
})
}
return appSummaries, allWarnings, nil
}