forked from huaweicloud/huaweicloud-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
results.go
56 lines (44 loc) · 1.16 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
package quotas
import (
"github.com/YoungPioneers/huaweicloud-sdk-go"
)
type commonResult struct {
gophercloud.Result
}
type Quota struct {
Resources []Resource `json:"resources"`
}
type Resource struct {
// Specifies the quota type.
Type string `json:"type"`
// Specifies the used amount of the quota.When type is set to
// scaling_Policy or scaling_Instance, this parameter is reserved, and the system
// returns -1 as the parameter value. You can query the used quota amount of AS policies
// and AS instances in a specified AS group. For details, see Querying Quotas for AS
// Policies and AS Instances.
Used int `json:"used"`
// Specifies the total amount of the quota.
Quota int `json:"quota"`
// Specifies the quota upper limit.
Max int `json:"max"`
}
type ListResult struct {
commonResult
}
func (r ListResult) Extract() (*Quota, error) {
var s struct {
Quotas Quota `json:"quotas"`
}
err := r.ExtractInto(&s)
return &s.Quotas, err
}
type ListWithInstancesResult struct {
commonResult
}
func (r ListWithInstancesResult) Extract() (*Quota, error) {
var s struct {
Quotas Quota `json:"quotas"`
}
err := r.ExtractInto(&s)
return &s.Quotas, err
}