-
Notifications
You must be signed in to change notification settings - Fork 26
/
quota.go
66 lines (61 loc) · 3.1 KB
/
quota.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package civogo
import (
"bytes"
"encoding/json"
)
// Quota represents the available limits and usage for an account's Civo quota
type Quota struct {
ID string `json:"id"`
DefaultUserID string `json:"default_user_id"`
DefaultUserEmailAddress string `json:"default_user_email_address"`
InstanceCountLimit int `json:"instance_count_limit"`
InstanceCountUsage int `json:"instance_count_usage"`
CPUCoreLimit int `json:"cpu_core_limit"`
CPUCoreUsage int `json:"cpu_core_usage"`
RAMMegabytesLimit int `json:"ram_mb_limit"`
RAMMegabytesUsage int `json:"ram_mb_usage"`
DiskGigabytesLimit int `json:"disk_gb_limit"`
DiskGigabytesUsage int `json:"disk_gb_usage"`
DiskVolumeCountLimit int `json:"disk_volume_count_limit"`
DiskVolumeCountUsage int `json:"disk_volume_count_usage"`
DiskSnapshotCountLimit int `json:"disk_snapshot_count_limit"`
DiskSnapshotCountUsage int `json:"disk_snapshot_count_usage"`
PublicIPAddressLimit int `json:"public_ip_address_limit"`
PublicIPAddressUsage int `json:"public_ip_address_usage"`
SubnetCountLimit int `json:"subnet_count_limit"`
SubnetCountUsage int `json:"subnet_count_usage"`
NetworkCountLimit int `json:"network_count_limit"`
NetworkCountUsage int `json:"network_count_usage"`
SecurityGroupLimit int `json:"security_group_limit"`
SecurityGroupUsage int `json:"security_group_usage"`
SecurityGroupRuleLimit int `json:"security_group_rule_limit"`
SecurityGroupRuleUsage int `json:"security_group_rule_usage"`
PortCountLimit int `json:"port_count_limit"`
PortCountUsage int `json:"port_count_usage"`
LoadBalancerCountLimit int `json:"loadbalancer_count_limit"`
LoadBalancerCountUsage int `json:"loadbalancer_count_usage"`
ObjectStoreGigabytesLimit int `json:"objectstore_gb_limit"`
ObjectStoreGigabytesUsage int `json:"objectstore_gb_usage"`
DatabaseCountLimit int `json:"database_count_limit"`
DatabaseCountUsage int `json:"database_count_usage"`
DatabaseSnapshotCountLimit int `json:"database_snapshot_count_limit"`
DatabaseSnapshotCountUsage int `json:"database_snapshot_count_usage"`
DatabaseCPUCoreLimit int `json:"database_cpu_core_limit"`
DatabaseCPUCoreUsage int `json:"database_cpu_core_usage"`
DatabaseRAMMegabytesLimit int `json:"database_ram_mb_limit"`
DatabaseRAMMegabytesUsage int `json:"database_ram_mb_usage"`
DatabaseDiskGigabytesLimit int `json:"database_disk_gb_limit"`
DatabaseDiskGigabytesUsage int `json:"database_disk_gb_usage"`
}
// GetQuota returns all load balancers owned by the calling API account
func (c *Client) GetQuota() (*Quota, error) {
resp, err := c.SendGetRequest("/v2/quota")
if err != nil {
return nil, decodeError(err)
}
var quota Quota
if err := json.NewDecoder(bytes.NewReader(resp)).Decode("a); err != nil {
return nil, err
}
return "a, nil
}