(space models.Space)
| 150 | } |
| 151 | |
| 152 | func (cmd *ShowSpace) quotaString(space models.Space) (string, error) { |
| 153 | if space.SpaceQuotaGUID == "" { |
| 154 | return "", nil |
| 155 | } |
| 156 | |
| 157 | quota, err := cmd.quotaRepo.FindByGUID(space.SpaceQuotaGUID) |
| 158 | if err != nil { |
| 159 | return "", err |
| 160 | } |
| 161 | |
| 162 | spaceQuotaFields := []string{} |
| 163 | spaceQuotaFields = append(spaceQuotaFields, T("{{.MemoryLimit}} memory limit", map[string]interface{}{"MemoryLimit": quota.FormattedMemoryLimit()})) |
| 164 | spaceQuotaFields = append(spaceQuotaFields, T("{{.InstanceMemoryLimit}} instance memory limit", map[string]interface{}{"InstanceMemoryLimit": quota.FormattedInstanceMemoryLimit()})) |
| 165 | spaceQuotaFields = append(spaceQuotaFields, T("{{.RoutesLimit}} routes", map[string]interface{}{"RoutesLimit": quota.RoutesLimit})) |
| 166 | spaceQuotaFields = append(spaceQuotaFields, T("{{.ServicesLimit}} services", map[string]interface{}{"ServicesLimit": quota.ServicesLimit})) |
| 167 | spaceQuotaFields = append(spaceQuotaFields, T("paid services {{.NonBasicServicesAllowed}}", map[string]interface{}{"NonBasicServicesAllowed": formatters.Allowed(quota.NonBasicServicesAllowed)})) |
| 168 | spaceQuotaFields = append(spaceQuotaFields, T("{{.AppInstanceLimit}} app instance limit", map[string]interface{}{"AppInstanceLimit": quota.FormattedAppInstanceLimit()})) |
| 169 | |
| 170 | routePorts := quota.FormattedRoutePortsLimit() |
| 171 | if routePorts != "" { |
| 172 | spaceQuotaFields = append(spaceQuotaFields, T("{{.ReservedRoutePorts}} route ports", map[string]interface{}{"ReservedRoutePorts": routePorts})) |
| 173 | } |
| 174 | |
| 175 | spaceQuota := fmt.Sprintf("%s (%s)", quota.Name, strings.Join(spaceQuotaFields, ", ")) |
| 176 | |
| 177 | return spaceQuota, nil |
| 178 | } |
| 179 | |
| 180 | func (cmd *ShowSpace) populatePluginModel(space models.Space) { |
| 181 | cmd.pluginModel.Name = space.Name |
no test coverage detected