forked from huaweicloud/huaweicloud-sdk-go
/
results.go
50 lines (39 loc) · 1.48 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
package quotas
import (
"github.com/gophercloud/gophercloud"
)
type commonResult struct {
gophercloud.Result
}
type Quota struct {
// Specifies the resource list objects.
Resources []Resource `json:"resources"`
}
type Resource struct {
// Specifies the resource type. The value can be vpc, subnet,
// securityGroup, securityGroupRule, publicIp, vpn, physicalConnect, virtualInterface,
// vpcPeer, loadbalancer, listener, firewall, or shareBandwidthIP.
Type string `json:"type"`
// Specifies the number of created network resources. The value
// ranges from 0 to the value of quota.
Used int `json:"used"`
// Specifies the maximum quota values for the resources. The
// quotas can be changed only in the FusionSphere OpenStack system. If it is left blank,
// -1 is displayed and the resources cannot be created. The default quotas for different
// resources are as follows: VPC: 2 Subnet: 100 Security group: 100 Security group
// rule: 5000 Elastic IP address: 10 VPN: 5 Physical connection: 10 Virtual interface:
// 50 Load balancer: 10 Listener: 10 VPC peering connection: 50 Firewall: 200 IP address
// with shared bandwidth: 20 The value ranges from the default quota value to the
// maximum quota value.
Quota int `json:"quota"`
// Specifies the minimum quota value allowed.
Min int `json:"min"`
}
type ListResult struct {
commonResult
}
func (r ListResult) Extract() (*Quota, error) {
var entity Quota
err := r.ExtractIntoStructPtr(&entity, "quotas")
return &entity, err
}