-
Notifications
You must be signed in to change notification settings - Fork 510
/
results.go
90 lines (67 loc) · 3.04 KB
/
results.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package limits
import (
"github.com/gophercloud/gophercloud"
)
// Limits is a struct that contains the response of a limit query.
type Limits struct {
// Absolute contains the limits and usage information.
Absolute Absolute `json:"absolute"`
}
// Usage is a struct that contains the current resource usage and limits
// of a tenant.
type Absolute struct {
// MaxTotalCores is the number of cores available to a tenant.
MaxTotalCores int `json:"maxTotalCores"`
// MaxImageMeta is the amount of image metadata available to a tenant.
MaxImageMeta int `json:"maxImageMeta"`
// MaxServerMeta is the amount of server metadata available to a tenant.
MaxServerMeta int `json:"maxServerMeta"`
// MaxPersonality is the amount of personality/files available to a tenant.
MaxPersonality int `json:"maxPersonality"`
// MaxPersonalitySize is the personality file size available to a tenant.
MaxPersonalitySize int `json:"maxPersonalitySize"`
// MaxTotalKeypairs is the total keypairs available to a tenant.
MaxTotalKeypairs int `json:"maxTotalKeypairs"`
// MaxSecurityGroups is the number of security groups available to a tenant.
MaxSecurityGroups int `json:"maxSecurityGroups"`
// MaxSecurityGroupRules is the number of security group rules available to
// a tenant.
MaxSecurityGroupRules int `json:"maxSecurityGroupRules"`
// MaxServerGroups is the number of server groups available to a tenant.
MaxServerGroups int `json:"maxServerGroups"`
// MaxServerGroupMembers is the number of server group members available
// to a tenant.
MaxServerGroupMembers int `json:"maxServerGroupMembers"`
// MaxTotalFloatingIps is the number of floating IPs available to a tenant.
MaxTotalFloatingIps int `json:"maxTotalFloatingIps"`
// MaxTotalInstances is the number of instances/servers available to a tenant.
MaxTotalInstances int `json:"maxTotalInstances"`
// MaxTotalRAMSize is the total amount of RAM available to a tenant measured
// in megabytes (MB).
MaxTotalRAMSize int `json:"maxTotalRAMSize"`
// TotalCoresUsed is the number of cores currently in use.
TotalCoresUsed int `json:"totalCoresUsed"`
// TotalInstancesUsed is the number of instances/servers in use.
TotalInstancesUsed int `json:"totalInstancesUsed"`
// TotalFloatingIpsUsed is the number of floating IPs in use.
TotalFloatingIpsUsed int `json:"totalFloatingIpsUsed"`
// TotalRAMUsed is the total RAM/memory in use measured in megabytes (MB).
TotalRAMUsed int `json:"totalRAMUsed"`
// TotalSecurityGroupsUsed is the total number of security groups in use.
TotalSecurityGroupsUsed int `json:"totalSecurityGroupsUsed"`
// TotalServerGroupsUsed is the total number of server groups in use.
TotalServerGroupsUsed int `json:"totalServerGroupsUsed"`
}
// Extract interprets a limits result as a Limits.
func (r GetResult) Extract() (*Limits, error) {
var s struct {
Limits *Limits `json:"limits"`
}
err := r.ExtractInto(&s)
return s.Limits, err
}
// GetResult is the response from a Get operation. Call its Extract
// method to interpret it as an Absolute.
type GetResult struct {
gophercloud.Result
}