blob: 95b794dbecb2e6a4ebdbcfc6e2ee24a3c520475f [file] [log] [blame]
Joe Topjiana08c1d22016-11-04 10:33:00 -06001package limits
2
3import (
4 "github.com/gophercloud/gophercloud"
5)
6
7// Limits is a struct that contains the response of a limit query.
8type Limits struct {
9 // Absolute contains the limits and usage information.
10 Absolute Absolute `json:"absolute"`
11}
12
13// Usage is a struct that contains the current resource usage and limits
14// of a tenant.
15type Absolute struct {
16 // MaxTotalCores is the number of cores available to a tenant.
17 MaxTotalCores int `json:"maxTotalCores"`
18
19 // MaxImageMeta is the amount of image metadata available to a tenant.
20 MaxImageMeta int `json:"maxImageMeta"`
21
22 // MaxServerMeta is the amount of server metadata available to a tenant.
23 MaxServerMeta int `json:"maxServerMeta"`
24
25 // MaxPersonality is the amount of personality/files available to a tenant.
26 MaxPersonality int `json:"maxPersonality"`
27
28 // MaxPersonalitySize is the personality file size available to a tenant.
29 MaxPersonalitySize int `json:"maxPersonalitySize"`
30
31 // MaxTotalKeypairs is the total keypairs available to a tenant.
32 MaxTotalKeypairs int `json:maxTotalKeypairs"`
33
34 // MaxSecurityGroups is the number of security groups available to a tenant.
35 MaxSecurityGroups int `json:"maxSecurityGroups"`
36
37 // MaxSecurityGroupRules is the number of security group rules available to
38 // a tenant.
39 MaxSecurityGroupRules int `json:"maxSecurityGroupRules"`
40
41 // MaxServerGroups is the number of server groups available to a tenant.
42 MaxServerGroups int `json:"maxServerGroups"`
43
44 // MaxServerGroupMembers is the number of server group members available
45 // to a tenant.
46 MaxServerGroupMembers int `json:"maxServerGroupMembers"`
47
48 // MaxTotalFloatingIps is the number of floating IPs available to a tenant.
49 MaxTotalFloatingIps int `json:"maxTotalFloatingIps"`
50
51 // MaxTotalInstances is the number of instances/servers available to a tenant.
52 MaxTotalInstances int `json:"maxTotalInstances"`
53
54 // MaxTotalRAMSize is the total amount of RAM available to a tenant measured
55 // in megabytes (MB).
56 MaxTotalRAMSize int `json:"maxTotalRAMSize"`
57
58 // TotalCoresUsed is the number of cores currently in use.
59 TotalCoresUsed int `json:"totalCoresUsed"`
60
61 // TotalInstancesUsed is the number of instances/servers in use.
62 TotalInstancesUsed int `json:"totalInstancesUsed"`
63
64 // TotalFloatingIpsUsed is the number of floating IPs in use.
65 TotalFloatingIpsUsed int `json:"totalFloatingIpsUsed"`
66
67 // TotalRAMUsed is the total RAM/memory in use measured in megabytes (MB).
68 TotalRAMUsed int `json:"totalRAMUsed"`
69
70 // TotalSecurityGroupsUsed is the total number of security groups in use.
71 TotalSecurityGroupsUsed int `json:"totalSecurityGroupsUsed"`
72
73 // TotalServerGroupsUsed is the total number of server groups in use.
74 TotalServerGroupsUsed int `json:"totalServerGroupsUsed"`
75}
76
77// Extract interprets a limits result as a Limits.
78func (r GetResult) Extract() (*Limits, error) {
79 var s struct {
80 Limits *Limits `json:"limits"`
81 }
82 err := r.ExtractInto(&s)
83 return s.Limits, err
84}
85
86// GetResult is the response from a Get operation. Call its ExtractAbsolute
87// method to interpret it as an Absolute.
88type GetResult struct {
89 gophercloud.Result
90}