forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quotas.go
34 lines (29 loc) · 1004 Bytes
/
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
package resources
import "code.cloudfoundry.org/cli/cf/models"
type PaginatedQuotaResources struct {
Resources []QuotaResource
}
type QuotaResource struct {
Resource
Entity models.QuotaResponse
}
func (resource QuotaResource) ToFields() models.QuotaFields {
appInstanceLimit := UnlimitedAppInstances
if resource.Entity.AppInstanceLimit != "" {
i, err := resource.Entity.AppInstanceLimit.Int64()
if err == nil {
appInstanceLimit = int(i)
}
}
return models.QuotaFields{
GUID: resource.Metadata.GUID,
Name: resource.Entity.Name,
MemoryLimit: resource.Entity.MemoryLimit,
InstanceMemoryLimit: resource.Entity.InstanceMemoryLimit,
RoutesLimit: resource.Entity.RoutesLimit,
ServicesLimit: resource.Entity.ServicesLimit,
NonBasicServicesAllowed: resource.Entity.NonBasicServicesAllowed,
AppInstanceLimit: appInstanceLimit,
ReservedRoutePorts: resource.Entity.ReservedRoutePorts,
}
}