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

Method Execute

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

Source from the content-addressed store, hash-verified

13}
14
15func (cmd SpaceQuotasCommand) Execute(args []string) error {
16 err := cmd.SharedActor.CheckTarget(true, 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 space quotas for org {{.OrgName}} as {{.Username}}...", map[string]interface{}{
27 "OrgName": cmd.Config.TargetedOrganizationName(),
28 "Username": user.Name,
29 })
30 cmd.UI.DisplayNewline()
31
32 orgQuotas, warnings, err := cmd.Actor.GetSpaceQuotasByOrgGUID(cmd.Config.TargetedOrganization().GUID)
33 cmd.UI.DisplayWarnings(warnings)
34 if err != nil {
35 return err
36 }
37
38 var quotas []resources.Quota
39 for _, orgQuota := range orgQuotas {
40 quotas = append(quotas, resources.Quota(orgQuota.Quota))
41 }
42
43 quotaDisplayer := shared.NewQuotaDisplayer(cmd.UI)
44 quotaDisplayer.DisplayQuotasTable(quotas, "No space quotas found.")
45
46 return nil
47}

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected