forked from yunify/qingcloud-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.go
149 lines (123 loc) · 4.38 KB
/
misc.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// +-------------------------------------------------------------------------
// | Copyright (C) 2016 Yunify, Inc.
// +-------------------------------------------------------------------------
// | Licensed under the Apache License, Version 2.0 (the "License");
// | you may not use this work except in compliance with the License.
// | You may obtain a copy of the License in the LICENSE file, or at:
// |
// | http://www.apache.org/licenses/LICENSE-2.0
// |
// | Unless required by applicable law or agreed to in writing, software
// | distributed under the License is distributed on an "AS IS" BASIS,
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// | See the License for the specific language governing permissions and
// | limitations under the License.
// +-------------------------------------------------------------------------
package service
import (
"fmt"
"time"
"github.com/yunify/qingcloud-sdk-go/config"
"github.com/yunify/qingcloud-sdk-go/request"
"github.com/yunify/qingcloud-sdk-go/request/data"
"github.com/yunify/qingcloud-sdk-go/request/errors"
)
var _ fmt.State
var _ time.Time
type MiscService struct {
Config *config.Config
Properties *MiscServiceProperties
}
type MiscServiceProperties struct {
}
func (s *QingCloudService) Misc() (*MiscService, error) {
properties := &MiscServiceProperties{}
return &MiscService{Config: s.Config, Properties: properties}, nil
}
// Documentation URL: https://docs.qingcloud.com/product/api/action/misc/get_quota_left.html
func (s *MiscService) GetQuotaLeft(i *GetQuotaLeftInput) (*GetQuotaLeftOutput, error) {
if i == nil {
i = &GetQuotaLeftInput{}
}
o := &data.Operation{
Config: s.Config,
Properties: s.Properties,
APIName: "GetQuotaLeft",
RequestMethod: "GET",
}
x := &GetQuotaLeftOutput{}
r, err := request.New(o, i, x)
if err != nil {
return nil, err
}
err = r.Send()
if err != nil {
return nil, err
}
return x, err
}
type GetQuotaLeftInput struct {
ResourceTypes []*string `json:"resource_types" name:"resource_types" location:"params"`
Zone *string `json:"zone" name:"zone" location:"params"` // Required
}
func (v *GetQuotaLeftInput) Validate() error {
if v.Zone == nil {
return errors.ParameterRequiredError{
ParameterName: "Zone",
ParentName: "GetQuotaLeftInput",
}
}
return nil
}
type GetQuotaLeftOutput struct {
Message *string `json:"message" name:"message"`
Action *string `json:"action" name:"action" location:"elements"`
QuotaLeftSet []*QuotaLeft `json:"quota_left_set" name:"quota_left_set" location:"elements"`
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
}
// Documentation URL: https://docs.qingcloud.com/product/api/action/misc
func (s *MiscService) GetResourceLimit(i *GetResourceLimitInput) (*GetResourceLimitOutput, error) {
if i == nil {
i = &GetResourceLimitInput{}
}
o := &data.Operation{
Config: s.Config,
Properties: s.Properties,
APIName: "GetResourceLimit",
RequestMethod: "GET",
}
x := &GetResourceLimitOutput{}
r, err := request.New(o, i, x)
if err != nil {
return nil, err
}
err = r.Send()
if err != nil {
return nil, err
}
return x, err
}
type GetResourceLimitInput struct {
VolumeType *int `json:"volume_type" name:"volume_type" location:"params"`
Zone *string `json:"zone" name:"zone" location:"params"` // Required
}
func (v *GetResourceLimitInput) Validate() error {
if v.Zone == nil {
return errors.ParameterRequiredError{
ParameterName: "Zone",
ParentName: "GetResourceLimitInput",
}
}
return nil
}
type GetResourceLimitOutput struct {
Message *string `json:"message" name:"message"`
Action *string `json:"action" name:"action" location:"elements"`
MaxSize *int `json:"max-size" name:"max-size" location:"elements"`
MinSize *int `json:"min-size" name:"min-size" location:"elements"`
ResourceLimits *ResourceLimits `json:"resource_limits" name:"resource_limits" location:"elements"`
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
Step *int `json:"step" name:"step" location:"elements"`
VxNetSubnets []*string `json:"vxnet_subnets" name:"vxnet_subnets" location:"elements"`
VxNetVersion *int `json:"vxnet_version" name:"vxnet_version" location:"elements"`
}