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

Method Execute

cf/commands/organization/org.go:69–148  ·  view source on GitHub ↗
(c flags.FlagContext)

Source from the content-addressed store, hash-verified

67}
68
69func (cmd *ShowOrg) Execute(c flags.FlagContext) error {
70 org := cmd.orgReq.GetOrganization()
71
72 if c.Bool("guid") {
73 cmd.ui.Say(org.GUID)
74 } else {
75 cmd.ui.Say(T("Getting info for org {{.OrgName}} as {{.Username}}...",
76 map[string]interface{}{
77 "OrgName": terminal.EntityNameColor(org.Name),
78 "Username": terminal.EntityNameColor(cmd.config.Username())}))
79 cmd.ui.Ok()
80 cmd.ui.Say("")
81
82 table := cmd.ui.Table([]string{terminal.EntityNameColor(org.Name) + ":", "", ""})
83
84 domains := []string{}
85 for _, domain := range org.Domains {
86 domains = append(domains, domain.Name)
87 }
88
89 spaces := []string{}
90 for _, space := range org.Spaces {
91 spaces = append(spaces, space.Name)
92 }
93
94 spaceQuotas := []string{}
95 for _, spaceQuota := range org.SpaceQuotas {
96 spaceQuotas = append(spaceQuotas, spaceQuota.Name)
97 }
98
99 quota := org.QuotaDefinition
100
101 var reservedPortLimit string
102 switch string(quota.ReservedRoutePorts) {
103 case "":
104 break
105 case resources.UnlimitedReservedRoutePorts:
106 reservedPortLimit = T("unlimited")
107 default:
108 if _, err := quota.ReservedRoutePorts.Int64(); err != nil {
109 return err
110 }
111 reservedPortLimit = string(quota.ReservedRoutePorts)
112 }
113
114 appInstanceLimit := strconv.Itoa(quota.AppInstanceLimit)
115 if quota.AppInstanceLimit == resources.UnlimitedAppInstances {
116 appInstanceLimit = T("unlimited")
117 }
118
119 orgQuotaFields := []string{}
120 orgQuotaFields = append(orgQuotaFields, T("{{.MemoryLimit}}M memory limit", map[string]interface{}{"MemoryLimit": quota.MemoryLimit}))
121 orgQuotaFields = append(orgQuotaFields, T("{{.InstanceMemoryLimit}} instance memory limit", map[string]interface{}{"InstanceMemoryLimit": formatters.InstanceMemoryLimit(quota.InstanceMemoryLimit)}))
122 orgQuotaFields = append(orgQuotaFields, T("{{.RoutesLimit}} routes", map[string]interface{}{"RoutesLimit": quota.RoutesLimit}))
123 orgQuotaFields = append(orgQuotaFields, T("{{.ServicesLimit}} services", map[string]interface{}{"ServicesLimit": quota.ServicesLimit}))
124 orgQuotaFields = append(orgQuotaFields, T("paid services {{.NonBasicServicesAllowed}}", map[string]interface{}{"NonBasicServicesAllowed": formatters.Allowed(quota.NonBasicServicesAllowed)}))
125 orgQuotaFields = append(orgQuotaFields, T("{{.AppInstanceLimit}} app instance limit", map[string]interface{}{"AppInstanceLimit": appInstanceLimit}))
126

Callers

nothing calls this directly

Calls 12

populatePluginModelMethod · 0.95
EntityNameColorFunction · 0.92
InstanceMemoryLimitFunction · 0.92
AllowedFunction · 0.92
GetOrganizationMethod · 0.65
BoolMethod · 0.65
SayMethod · 0.65
UsernameMethod · 0.65
OkMethod · 0.65
TableMethod · 0.65
AddMethod · 0.65
PrintMethod · 0.65

Tested by

no test coverage detected