-
Notifications
You must be signed in to change notification settings - Fork 0
/
application_summary.go
40 lines (34 loc) · 1.29 KB
/
application_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
package v3action
import "code.cloudfoundry.org/cli/actor/actionerror"
// ApplicationSummary represents an application with its processes and droplet.
type ApplicationSummary struct {
Application
ProcessSummaries ProcessSummaries
CurrentDroplet Droplet
}
// GetApplicationSummaryByNameAndSpace returns an application with process and
// instance stats.
func (actor Actor) GetApplicationSummaryByNameAndSpace(appName string, spaceGUID string, withObfuscatedValues bool) (ApplicationSummary, Warnings, error) {
app, allWarnings, err := actor.GetApplicationByNameAndSpace(appName, spaceGUID)
if err != nil {
return ApplicationSummary{}, allWarnings, err
}
processSummaries, processWarnings, err := actor.getProcessSummariesForApp(app.GUID, withObfuscatedValues)
allWarnings = append(allWarnings, processWarnings...)
if err != nil {
return ApplicationSummary{}, allWarnings, err
}
droplet, warnings, err := actor.GetCurrentDropletByApplication(app.GUID)
allWarnings = append(allWarnings, Warnings(warnings)...)
if err != nil {
if _, ok := err.(actionerror.DropletNotFoundError); !ok {
return ApplicationSummary{}, allWarnings, err
}
}
summary := ApplicationSummary{
Application: app,
ProcessSummaries: processSummaries,
CurrentDroplet: droplet,
}
return summary, allWarnings, nil
}