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

Method Execute

command/v7/org_quotas_command.go:15–46  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

13}
14
15func (cmd OrgQuotasCommand) Execute(args []string) error {
16 err := cmd.SharedActor.CheckTarget(false, false)
17 if err != nil {
18 return err
19 }
20
21 user, err := cmd.Actor.GetCurrentUser()
22 if err != nil {
23 return err
24 }
25
26 cmd.UI.DisplayTextWithFlavor("Getting org quotas as {{.Username}}...", map[string]interface{}{
27 "Username": user.Name,
28 })
29 cmd.UI.DisplayNewline()
30
31 orgQuotas, warnings, err := cmd.Actor.GetOrganizationQuotas()
32 cmd.UI.DisplayWarnings(warnings)
33 if err != nil {
34 return err
35 }
36
37 var quotas []resources.Quota
38 for _, orgQuota := range orgQuotas {
39 quotas = append(quotas, resources.Quota(orgQuota.Quota))
40 }
41
42 quotaDisplayer := shared.NewQuotaDisplayer(cmd.UI)
43 quotaDisplayer.DisplayQuotasTable(quotas, "No organization quotas found.")
44
45 return nil
46}

Callers

nothing calls this directly

Calls 9

DisplayQuotasTableMethod · 0.95
QuotaStruct · 0.92
NewQuotaDisplayerFunction · 0.92
CheckTargetMethod · 0.65
GetCurrentUserMethod · 0.65
DisplayTextWithFlavorMethod · 0.65
DisplayNewlineMethod · 0.65
GetOrganizationQuotasMethod · 0.65
DisplayWarningsMethod · 0.65

Tested by

no test coverage detected