-
Notifications
You must be signed in to change notification settings - Fork 0
/
space_quotas.go
37 lines (31 loc) · 1021 Bytes
/
space_quotas.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package resources
import "code.cloudfoundry.org/cli/cf/models"
type PaginatedSpaceQuotaResources struct {
Resources []SpaceQuotaResource
}
type SpaceQuotaResource struct {
Resource
Entity models.SpaceQuotaResponse
}
func (resource SpaceQuotaResource) ToModel() models.SpaceQuota {
entity := resource.Entity
appInstanceLimit := UnlimitedAppInstances
if entity.AppInstanceLimit != "" {
i, err := entity.AppInstanceLimit.Int64()
if err == nil {
appInstanceLimit = int(i)
}
}
return models.SpaceQuota{
GUID: resource.Metadata.GUID,
Name: entity.Name,
MemoryLimit: entity.MemoryLimit,
InstanceMemoryLimit: entity.InstanceMemoryLimit,
RoutesLimit: entity.RoutesLimit,
ServicesLimit: entity.ServicesLimit,
NonBasicServicesAllowed: entity.NonBasicServicesAllowed,
OrgGUID: entity.OrgGUID,
AppInstanceLimit: appInstanceLimit,
ReservedRoutePortsLimit: entity.ReservedRoutePortsLimit,
}
}