MCPcopy
hub / github.com/cloudfoundry/cli / getProcessSummariesForApps

Method getProcessSummariesForApps

actor/v7action/application_summary.go:147–191  ·  view source on GitHub ↗
(apps []resources.Application)

Source from the content-addressed store, hash-verified

145}
146
147func (actor Actor) getProcessSummariesForApps(apps []resources.Application) (map[string]ProcessSummaries, Warnings, error) {
148 processSummariesByAppGUID := make(map[string]ProcessSummaries)
149 var allWarnings Warnings
150 var processes []resources.Process
151
152 warnings, err := batcher.RequestByGUID(toAppGUIDs(apps), func(guids []string) (ccv3.Warnings, error) {
153 batch, warnings, err := actor.CloudControllerClient.GetProcesses(ccv3.Query{
154 Key: ccv3.AppGUIDFilter, Values: guids,
155 })
156 processes = append(processes, batch...)
157 return warnings, err
158 })
159 allWarnings = append(allWarnings, warnings...)
160 if err != nil {
161 return nil, allWarnings, err
162 }
163
164 for _, process := range processes {
165 instances, warnings, err := actor.CloudControllerClient.GetProcessInstances(process.GUID)
166 allWarnings = append(allWarnings, Warnings(warnings)...)
167
168 if err != nil {
169 switch err.(type) {
170 case ccerror.ProcessNotFoundError, ccerror.InstanceNotFoundError:
171 continue
172 default:
173 return nil, allWarnings, err
174 }
175 }
176
177 var instanceDetails []ProcessInstance
178 for _, instance := range instances {
179 instanceDetails = append(instanceDetails, ProcessInstance(instance))
180 }
181
182 processSummary := ProcessSummary{
183 Process: resources.Process(process),
184 InstanceDetails: instanceDetails,
185 }
186
187 processSummariesByAppGUID[process.AppGUID] = append(processSummariesByAppGUID[process.AppGUID], processSummary)
188 }
189
190 return processSummariesByAppGUID, allWarnings, nil
191}
192
193func (actor Actor) getProcessSummariesForSpace(spaceGUID string) (map[string]ProcessSummaries, Warnings, error) {
194 processSummariesByAppGUID := make(map[string]ProcessSummaries)

Callers 1

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls 7

RequestByGUIDFunction · 0.92
ProcessStruct · 0.92
toAppGUIDsFunction · 0.85
WarningsTypeAlias · 0.70
ProcessInstanceTypeAlias · 0.70
GetProcessesMethod · 0.65
GetProcessInstancesMethod · 0.65

Tested by

no test coverage detected