qingcloud-sdk 0.4.1 → 2.0.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +201 -21
- data/README.md +141 -61
- data/bin/console +3 -3
- data/lib/qingcloud/sdk.rb +16 -14
- data/lib/qingcloud/sdk/general/config.rb +70 -0
- data/lib/qingcloud/sdk/general/contract.rb +28 -17
- data/lib/qingcloud/sdk/general/default/config.yaml +13 -0
- data/lib/qingcloud/sdk/general/error.rb +41 -32
- data/lib/qingcloud/sdk/general/logger.rb +54 -0
- data/lib/qingcloud/sdk/request/preprocessor.rb +81 -0
- data/lib/qingcloud/sdk/request/request.rb +80 -0
- data/lib/qingcloud/sdk/request/signer.rb +53 -0
- data/lib/qingcloud/sdk/service/cache.rb +1005 -0
- data/lib/qingcloud/sdk/service/dns_alias.rb +150 -0
- data/lib/qingcloud/sdk/service/eip.rb +389 -0
- data/lib/qingcloud/sdk/service/image.rb +304 -0
- data/lib/qingcloud/sdk/service/instance.rb +585 -0
- data/lib/qingcloud/sdk/service/job.rb +71 -0
- data/lib/qingcloud/sdk/service/key_pair.rb +257 -0
- data/lib/qingcloud/sdk/service/load_balancer.rb +1119 -0
- data/lib/qingcloud/sdk/service/mongo.rb +566 -0
- data/lib/qingcloud/sdk/service/qingcloud.rb +185 -0
- data/lib/qingcloud/sdk/service/rdb.rb +751 -0
- data/lib/qingcloud/sdk/service/router.rb +778 -0
- data/lib/qingcloud/sdk/service/security_group.rb +645 -0
- data/lib/qingcloud/sdk/service/shared_storage.rb +666 -0
- data/lib/qingcloud/sdk/service/snapshot.rb +283 -0
- data/lib/qingcloud/sdk/service/tag.rb +227 -0
- data/lib/qingcloud/sdk/service/user_data.rb +61 -0
- data/lib/qingcloud/sdk/service/volume.rb +296 -0
- data/lib/qingcloud/sdk/service/vxnet.rb +295 -0
- data/lib/qingcloud/sdk/version.rb +19 -5
- metadata +98 -29
- data/.gitignore +0 -13
- data/.rspec +0 -2
- data/.travis.yml +0 -3
- data/Rakefile +0 -6
- data/lib/qingcloud/sdk/iaas/connector.rb +0 -99
- data/lib/qingcloud/sdk/iaas/foundation.rb +0 -73
- data/lib/qingcloud/sdk/iaas/service.rb +0 -1274
- data/lib/qingcloud/sdk/template/config.json +0 -4
- data/lib/qingcloud/sdk/utility/file_manager.rb +0 -43
- data/lib/qingcloud/sdk/utility/json_parser.rb +0 -41
- data/lib/qingcloud/sdk/utility/logger.rb +0 -19
- data/qingcloud-sdk.gemspec +0 -31
@@ -0,0 +1,71 @@
|
|
1
|
+
# +-------------------------------------------------------------------------
|
2
|
+
# | Copyright (C) 2016 Yunify, Inc.
|
3
|
+
# +-------------------------------------------------------------------------
|
4
|
+
# | Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# | you may not use this work except in compliance with the License.
|
6
|
+
# | You may obtain a copy of the License in the LICENSE file, or at:
|
7
|
+
# |
|
8
|
+
# | http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
# |
|
10
|
+
# | Unless required by applicable law or agreed to in writing, software
|
11
|
+
# | distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# | See the License for the specific language governing permissions and
|
14
|
+
# | limitations under the License.
|
15
|
+
# +-------------------------------------------------------------------------
|
16
|
+
|
17
|
+
require 'active_support/core_ext/hash/keys'
|
18
|
+
|
19
|
+
module QingCloud
|
20
|
+
module SDK
|
21
|
+
class JobService
|
22
|
+
attr_accessor :config, :properties
|
23
|
+
|
24
|
+
def initialize(config, properties)
|
25
|
+
self.config = config
|
26
|
+
self.properties = properties.deep_symbolize_keys
|
27
|
+
end
|
28
|
+
|
29
|
+
# Documentation URL: https://docs.qingcloud.com/api/job/describe_jobs.html
|
30
|
+
def describe_jobs(jobs: [], limit: nil, offset: nil, status: [], verbose: nil)
|
31
|
+
input = {
|
32
|
+
config: config,
|
33
|
+
properties: properties,
|
34
|
+
api_name: 'DescribeJobs',
|
35
|
+
request_method: 'GET',
|
36
|
+
request_params: {
|
37
|
+
'jobs' => jobs,
|
38
|
+
'limit' => limit,
|
39
|
+
'offset' => offset,
|
40
|
+
'status' => status,
|
41
|
+
'verbose' => verbose, # verbose's available values: 0
|
42
|
+
},
|
43
|
+
}
|
44
|
+
|
45
|
+
describe_jobs_input_validate input
|
46
|
+
|
47
|
+
request = Request.new input
|
48
|
+
request.send
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def describe_jobs_input_validate(input)
|
54
|
+
input.deep_stringify_keys!
|
55
|
+
|
56
|
+
if input['request_params']['verbose'] && !input['request_params']['verbose'].to_s.empty?
|
57
|
+
verbose_valid_values = ['0']
|
58
|
+
unless verbose_valid_values.include? input['request_params']['verbose'].to_s
|
59
|
+
raise ParameterValueNotAllowedError.new(
|
60
|
+
'verbose',
|
61
|
+
input['request_params']['verbose'],
|
62
|
+
verbose_valid_values,
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
public
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
# +-------------------------------------------------------------------------
|
2
|
+
# | Copyright (C) 2016 Yunify, Inc.
|
3
|
+
# +-------------------------------------------------------------------------
|
4
|
+
# | Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# | you may not use this work except in compliance with the License.
|
6
|
+
# | You may obtain a copy of the License in the LICENSE file, or at:
|
7
|
+
# |
|
8
|
+
# | http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
# |
|
10
|
+
# | Unless required by applicable law or agreed to in writing, software
|
11
|
+
# | distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# | See the License for the specific language governing permissions and
|
14
|
+
# | limitations under the License.
|
15
|
+
# +-------------------------------------------------------------------------
|
16
|
+
|
17
|
+
require 'active_support/core_ext/hash/keys'
|
18
|
+
|
19
|
+
module QingCloud
|
20
|
+
module SDK
|
21
|
+
class KeyPairService
|
22
|
+
attr_accessor :config, :properties
|
23
|
+
|
24
|
+
def initialize(config, properties)
|
25
|
+
self.config = config
|
26
|
+
self.properties = properties.deep_symbolize_keys
|
27
|
+
end
|
28
|
+
|
29
|
+
# Documentation URL: https://docs.qingcloud.com/api/keypair/attach_key_pairs.html
|
30
|
+
def attach_key_pairs(instances: [], keypairs: [])
|
31
|
+
input = {
|
32
|
+
config: config,
|
33
|
+
properties: properties,
|
34
|
+
api_name: 'AttachKeyPairs',
|
35
|
+
request_method: 'GET',
|
36
|
+
request_params: {
|
37
|
+
'instances' => instances,
|
38
|
+
'keypairs' => keypairs,
|
39
|
+
},
|
40
|
+
}
|
41
|
+
|
42
|
+
attach_key_pairs_input_validate input
|
43
|
+
|
44
|
+
request = Request.new input
|
45
|
+
request.send
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def attach_key_pairs_input_validate(input)
|
51
|
+
input.deep_stringify_keys!
|
52
|
+
|
53
|
+
unless !input['request_params']['instances'].nil? && !input['request_params']['instances'].to_s.empty?
|
54
|
+
raise ParameterRequiredError.new('instances', 'AttachKeyPairsInput')
|
55
|
+
end
|
56
|
+
|
57
|
+
unless !input['request_params']['keypairs'].nil? && !input['request_params']['keypairs'].to_s.empty?
|
58
|
+
raise ParameterRequiredError.new('keypairs', 'AttachKeyPairsInput')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
public
|
63
|
+
|
64
|
+
# Documentation URL: https://docs.qingcloud.com/api/keypair/create_key_pairs.html
|
65
|
+
def create_key_pair(encrypt_method: '', keypair_name: '', mode: '', public_key: '')
|
66
|
+
input = {
|
67
|
+
config: config,
|
68
|
+
properties: properties,
|
69
|
+
api_name: 'CreateKeyPair',
|
70
|
+
request_method: 'GET',
|
71
|
+
request_params: {
|
72
|
+
'encrypt_method' => encrypt_method, # encrypt_method's available values: ssh-rsa, ssh-dss
|
73
|
+
'keypair_name' => keypair_name,
|
74
|
+
'mode' => mode, # mode's available values: system, user
|
75
|
+
'public_key' => public_key,
|
76
|
+
},
|
77
|
+
}
|
78
|
+
|
79
|
+
create_key_pair_input_validate input
|
80
|
+
|
81
|
+
request = Request.new input
|
82
|
+
request.send
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def create_key_pair_input_validate(input)
|
88
|
+
input.deep_stringify_keys!
|
89
|
+
|
90
|
+
if input['request_params']['encrypt_method'] && !input['request_params']['encrypt_method'].to_s.empty?
|
91
|
+
encrypt_method_valid_values = ['ssh-rsa', 'ssh-dss']
|
92
|
+
unless encrypt_method_valid_values.include? input['request_params']['encrypt_method'].to_s
|
93
|
+
raise ParameterValueNotAllowedError.new(
|
94
|
+
'encrypt_method',
|
95
|
+
input['request_params']['encrypt_method'],
|
96
|
+
encrypt_method_valid_values,
|
97
|
+
)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
if input['request_params']['mode'] && !input['request_params']['mode'].to_s.empty?
|
102
|
+
mode_valid_values = %w(system user)
|
103
|
+
unless mode_valid_values.include? input['request_params']['mode'].to_s
|
104
|
+
raise ParameterValueNotAllowedError.new(
|
105
|
+
'mode',
|
106
|
+
input['request_params']['mode'],
|
107
|
+
mode_valid_values,
|
108
|
+
)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
public
|
114
|
+
|
115
|
+
# Documentation URL: https://docs.qingcloud.com/api/keypair/delete_key_pairs.html
|
116
|
+
def delete_key_pairs(keypairs: [])
|
117
|
+
input = {
|
118
|
+
config: config,
|
119
|
+
properties: properties,
|
120
|
+
api_name: 'DeleteKeyPairs',
|
121
|
+
request_method: 'GET',
|
122
|
+
request_params: {
|
123
|
+
'keypairs' => keypairs,
|
124
|
+
},
|
125
|
+
}
|
126
|
+
|
127
|
+
delete_key_pairs_input_validate input
|
128
|
+
|
129
|
+
request = Request.new input
|
130
|
+
request.send
|
131
|
+
end
|
132
|
+
|
133
|
+
private
|
134
|
+
|
135
|
+
def delete_key_pairs_input_validate(input)
|
136
|
+
input.deep_stringify_keys!
|
137
|
+
|
138
|
+
unless !input['request_params']['keypairs'].nil? && !input['request_params']['keypairs'].to_s.empty?
|
139
|
+
raise ParameterRequiredError.new('keypairs', 'DeleteKeyPairsInput')
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
public
|
144
|
+
|
145
|
+
# Documentation URL: https://docs.qingcloud.com/api/keypair/describe_key_pairs.html
|
146
|
+
def describe_key_pairs(encrypt_method: '', instance_id: '', keypairs: [], limit: nil, offset: nil, search_word: '', tags: [], verbose: nil)
|
147
|
+
input = {
|
148
|
+
config: config,
|
149
|
+
properties: properties,
|
150
|
+
api_name: 'DescribeKeyPairs',
|
151
|
+
request_method: 'GET',
|
152
|
+
request_params: {
|
153
|
+
'encrypt_method' => encrypt_method, # encrypt_method's available values: ssh-rsa, ssh-dss
|
154
|
+
'instance_id' => instance_id,
|
155
|
+
'keypairs' => keypairs,
|
156
|
+
'limit' => limit,
|
157
|
+
'offset' => offset,
|
158
|
+
'search_word' => search_word,
|
159
|
+
'tags' => tags,
|
160
|
+
'verbose' => verbose,
|
161
|
+
},
|
162
|
+
}
|
163
|
+
|
164
|
+
describe_key_pairs_input_validate input
|
165
|
+
|
166
|
+
request = Request.new input
|
167
|
+
request.send
|
168
|
+
end
|
169
|
+
|
170
|
+
private
|
171
|
+
|
172
|
+
def describe_key_pairs_input_validate(input)
|
173
|
+
input.deep_stringify_keys!
|
174
|
+
|
175
|
+
if input['request_params']['encrypt_method'] && !input['request_params']['encrypt_method'].to_s.empty?
|
176
|
+
encrypt_method_valid_values = ['ssh-rsa', 'ssh-dss']
|
177
|
+
unless encrypt_method_valid_values.include? input['request_params']['encrypt_method'].to_s
|
178
|
+
raise ParameterValueNotAllowedError.new(
|
179
|
+
'encrypt_method',
|
180
|
+
input['request_params']['encrypt_method'],
|
181
|
+
encrypt_method_valid_values,
|
182
|
+
)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
public
|
188
|
+
|
189
|
+
# Documentation URL: https://docs.qingcloud.com/api/keypair/detach_key_pairs.html
|
190
|
+
def detach_key_pairs(instances: [], keypairs: [])
|
191
|
+
input = {
|
192
|
+
config: config,
|
193
|
+
properties: properties,
|
194
|
+
api_name: 'DetachKeyPairs',
|
195
|
+
request_method: 'GET',
|
196
|
+
request_params: {
|
197
|
+
'instances' => instances,
|
198
|
+
'keypairs' => keypairs,
|
199
|
+
},
|
200
|
+
}
|
201
|
+
|
202
|
+
detach_key_pairs_input_validate input
|
203
|
+
|
204
|
+
request = Request.new input
|
205
|
+
request.send
|
206
|
+
end
|
207
|
+
|
208
|
+
private
|
209
|
+
|
210
|
+
def detach_key_pairs_input_validate(input)
|
211
|
+
input.deep_stringify_keys!
|
212
|
+
|
213
|
+
unless !input['request_params']['instances'].nil? && !input['request_params']['instances'].to_s.empty?
|
214
|
+
raise ParameterRequiredError.new('instances', 'DetachKeyPairsInput')
|
215
|
+
end
|
216
|
+
|
217
|
+
unless !input['request_params']['keypairs'].nil? && !input['request_params']['keypairs'].to_s.empty?
|
218
|
+
raise ParameterRequiredError.new('keypairs', 'DetachKeyPairsInput')
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
public
|
223
|
+
|
224
|
+
# Documentation URL: https://docs.qingcloud.com/api/keypair/modify_key_pair_attributes.html
|
225
|
+
def modify_key_pair_attributes(description: '', keypair: '', keypair_name: '')
|
226
|
+
input = {
|
227
|
+
config: config,
|
228
|
+
properties: properties,
|
229
|
+
api_name: 'ModifyKeyPairAttributes',
|
230
|
+
request_method: 'GET',
|
231
|
+
request_params: {
|
232
|
+
'description' => description,
|
233
|
+
'keypair' => keypair,
|
234
|
+
'keypair_name' => keypair_name,
|
235
|
+
},
|
236
|
+
}
|
237
|
+
|
238
|
+
modify_key_pair_attributes_input_validate input
|
239
|
+
|
240
|
+
request = Request.new input
|
241
|
+
request.send
|
242
|
+
end
|
243
|
+
|
244
|
+
private
|
245
|
+
|
246
|
+
def modify_key_pair_attributes_input_validate(input)
|
247
|
+
input.deep_stringify_keys!
|
248
|
+
|
249
|
+
unless !input['request_params']['keypair'].nil? && !input['request_params']['keypair'].to_s.empty?
|
250
|
+
raise ParameterRequiredError.new('keypair', 'ModifyKeyPairAttributesInput')
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
public
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
@@ -0,0 +1,1119 @@
|
|
1
|
+
# +-------------------------------------------------------------------------
|
2
|
+
# | Copyright (C) 2016 Yunify, Inc.
|
3
|
+
# +-------------------------------------------------------------------------
|
4
|
+
# | Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# | you may not use this work except in compliance with the License.
|
6
|
+
# | You may obtain a copy of the License in the LICENSE file, or at:
|
7
|
+
# |
|
8
|
+
# | http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
# |
|
10
|
+
# | Unless required by applicable law or agreed to in writing, software
|
11
|
+
# | distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# | See the License for the specific language governing permissions and
|
14
|
+
# | limitations under the License.
|
15
|
+
# +-------------------------------------------------------------------------
|
16
|
+
|
17
|
+
require 'active_support/core_ext/hash/keys'
|
18
|
+
|
19
|
+
module QingCloud
|
20
|
+
module SDK
|
21
|
+
class LoadBalancerService
|
22
|
+
attr_accessor :config, :properties
|
23
|
+
|
24
|
+
def initialize(config, properties)
|
25
|
+
self.config = config
|
26
|
+
self.properties = properties.deep_symbolize_keys
|
27
|
+
end
|
28
|
+
|
29
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/add_loadbalancer_backends.html
|
30
|
+
def add_load_balancer_backends(backends: [], loadbalancer_listener: '')
|
31
|
+
input = {
|
32
|
+
config: config,
|
33
|
+
properties: properties,
|
34
|
+
api_name: 'AddLoadBalancerBackends',
|
35
|
+
request_method: 'GET',
|
36
|
+
request_params: {
|
37
|
+
'backends' => backends,
|
38
|
+
'loadbalancer_listener' => loadbalancer_listener,
|
39
|
+
},
|
40
|
+
}
|
41
|
+
|
42
|
+
add_load_balancer_backends_input_validate input
|
43
|
+
|
44
|
+
request = Request.new input
|
45
|
+
request.send
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def add_load_balancer_backends_input_validate(input)
|
51
|
+
input.deep_stringify_keys!
|
52
|
+
|
53
|
+
unless !input['request_params']['backends'].nil? && !input['request_params']['backends'].to_s.empty?
|
54
|
+
raise ParameterRequiredError.new('backends', 'AddLoadBalancerBackendsInput')
|
55
|
+
end
|
56
|
+
|
57
|
+
input['request_params']['backends'].map do |x|
|
58
|
+
end
|
59
|
+
|
60
|
+
unless !input['request_params']['loadbalancer_listener'].nil? && !input['request_params']['loadbalancer_listener'].to_s.empty?
|
61
|
+
raise ParameterRequiredError.new('loadbalancer_listener', 'AddLoadBalancerBackendsInput')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
public
|
66
|
+
|
67
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/add_loadbalancer_listeners.html
|
68
|
+
def add_load_balancer_listeners(listeners: [], loadbalancer: '')
|
69
|
+
input = {
|
70
|
+
config: config,
|
71
|
+
properties: properties,
|
72
|
+
api_name: 'AddLoadBalancerListeners',
|
73
|
+
request_method: 'GET',
|
74
|
+
request_params: {
|
75
|
+
'listeners' => listeners,
|
76
|
+
'loadbalancer' => loadbalancer,
|
77
|
+
},
|
78
|
+
}
|
79
|
+
|
80
|
+
add_load_balancer_listeners_input_validate input
|
81
|
+
|
82
|
+
request = Request.new input
|
83
|
+
request.send
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def add_load_balancer_listeners_input_validate(input)
|
89
|
+
input.deep_stringify_keys!
|
90
|
+
|
91
|
+
input['request_params']['listeners'].map do |x|
|
92
|
+
x['backends'].map do |x|
|
93
|
+
end
|
94
|
+
|
95
|
+
next unless x['balance_mode'] && !x['balance_mode'].to_s.empty?
|
96
|
+
balance_mode_valid_values = %w(roundrobin leastconn source)
|
97
|
+
next if balance_mode_valid_values.include? x['balance_mode'].to_s
|
98
|
+
raise ParameterValueNotAllowedError.new(
|
99
|
+
'balance_mode',
|
100
|
+
x['balance_mode'],
|
101
|
+
balance_mode_valid_values,
|
102
|
+
)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
public
|
107
|
+
|
108
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/add_loadbalancer_policy_rules.html
|
109
|
+
def add_load_balancer_policy_rules(loadbalancer_policy: '', rules: [])
|
110
|
+
input = {
|
111
|
+
config: config,
|
112
|
+
properties: properties,
|
113
|
+
api_name: 'AddLoadBalancerPolicyRules',
|
114
|
+
request_method: 'GET',
|
115
|
+
request_params: {
|
116
|
+
'loadbalancer_policy' => loadbalancer_policy,
|
117
|
+
'rules' => rules,
|
118
|
+
},
|
119
|
+
}
|
120
|
+
|
121
|
+
add_load_balancer_policy_rules_input_validate input
|
122
|
+
|
123
|
+
request = Request.new input
|
124
|
+
request.send
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
def add_load_balancer_policy_rules_input_validate(input)
|
130
|
+
input.deep_stringify_keys!
|
131
|
+
|
132
|
+
input['request_params']['rules'].map do |x|
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
public
|
137
|
+
|
138
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/apply_loadbalancer_policy.html
|
139
|
+
def apply_load_balancer_policy(loadbalancer_policy: '')
|
140
|
+
input = {
|
141
|
+
config: config,
|
142
|
+
properties: properties,
|
143
|
+
api_name: 'ApplyLoadBalancerPolicy',
|
144
|
+
request_method: 'GET',
|
145
|
+
request_params: {
|
146
|
+
'loadbalancer_policy' => loadbalancer_policy,
|
147
|
+
},
|
148
|
+
}
|
149
|
+
|
150
|
+
apply_load_balancer_policy_input_validate input
|
151
|
+
|
152
|
+
request = Request.new input
|
153
|
+
request.send
|
154
|
+
end
|
155
|
+
|
156
|
+
private
|
157
|
+
|
158
|
+
def apply_load_balancer_policy_input_validate(input)
|
159
|
+
input.deep_stringify_keys!
|
160
|
+
|
161
|
+
unless !input['request_params']['loadbalancer_policy'].nil? && !input['request_params']['loadbalancer_policy'].to_s.empty?
|
162
|
+
raise ParameterRequiredError.new('loadbalancer_policy', 'ApplyLoadBalancerPolicyInput')
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
public
|
167
|
+
|
168
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/associate_eips_to_loadbalancer.html
|
169
|
+
def associate_eips_to_load_balancer(eips: [], loadbalancer: '')
|
170
|
+
input = {
|
171
|
+
config: config,
|
172
|
+
properties: properties,
|
173
|
+
api_name: 'AssociateEipsToLoadBalancer',
|
174
|
+
request_method: 'GET',
|
175
|
+
request_params: {
|
176
|
+
'eips' => eips,
|
177
|
+
'loadbalancer' => loadbalancer,
|
178
|
+
},
|
179
|
+
}
|
180
|
+
|
181
|
+
associate_eips_to_load_balancer_input_validate input
|
182
|
+
|
183
|
+
request = Request.new input
|
184
|
+
request.send
|
185
|
+
end
|
186
|
+
|
187
|
+
private
|
188
|
+
|
189
|
+
def associate_eips_to_load_balancer_input_validate(input)
|
190
|
+
input.deep_stringify_keys!
|
191
|
+
|
192
|
+
unless !input['request_params']['eips'].nil? && !input['request_params']['eips'].to_s.empty?
|
193
|
+
raise ParameterRequiredError.new('eips', 'AssociateEipsToLoadBalancerInput')
|
194
|
+
end
|
195
|
+
|
196
|
+
unless !input['request_params']['loadbalancer'].nil? && !input['request_params']['loadbalancer'].to_s.empty?
|
197
|
+
raise ParameterRequiredError.new('loadbalancer', 'AssociateEipsToLoadBalancerInput')
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
public
|
202
|
+
|
203
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/create_loadbalancer.html
|
204
|
+
def create_load_balancer(eips: [], loadbalancer_name: '', loadbalancer_type: nil, private_ip: '', security_group: '', vxnet: '')
|
205
|
+
input = {
|
206
|
+
config: config,
|
207
|
+
properties: properties,
|
208
|
+
api_name: 'CreateLoadBalancer',
|
209
|
+
request_method: 'GET',
|
210
|
+
request_params: {
|
211
|
+
'eips' => eips,
|
212
|
+
'loadbalancer_name' => loadbalancer_name,
|
213
|
+
'loadbalancer_type' => loadbalancer_type, # loadbalancer_type's available values: 0, 1, 2, 3, 4, 5
|
214
|
+
'private_ip' => private_ip,
|
215
|
+
'security_group' => security_group,
|
216
|
+
'vxnet' => vxnet,
|
217
|
+
},
|
218
|
+
}
|
219
|
+
|
220
|
+
create_load_balancer_input_validate input
|
221
|
+
|
222
|
+
request = Request.new input
|
223
|
+
request.send
|
224
|
+
end
|
225
|
+
|
226
|
+
private
|
227
|
+
|
228
|
+
def create_load_balancer_input_validate(input)
|
229
|
+
input.deep_stringify_keys!
|
230
|
+
|
231
|
+
if input['request_params']['loadbalancer_type'] && !input['request_params']['loadbalancer_type'].to_s.empty?
|
232
|
+
loadbalancer_type_valid_values = %w(0 1 2 3 4 5)
|
233
|
+
unless loadbalancer_type_valid_values.include? input['request_params']['loadbalancer_type'].to_s
|
234
|
+
raise ParameterValueNotAllowedError.new(
|
235
|
+
'loadbalancer_type',
|
236
|
+
input['request_params']['loadbalancer_type'],
|
237
|
+
loadbalancer_type_valid_values,
|
238
|
+
)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
public
|
244
|
+
|
245
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/create_loadbalancer_policy.html
|
246
|
+
def create_load_balancer_policy(loadbalancer_policy_name: '', operator: '')
|
247
|
+
input = {
|
248
|
+
config: config,
|
249
|
+
properties: properties,
|
250
|
+
api_name: 'CreateLoadBalancerPolicy',
|
251
|
+
request_method: 'GET',
|
252
|
+
request_params: {
|
253
|
+
'loadbalancer_policy_name' => loadbalancer_policy_name,
|
254
|
+
'operator' => operator, # operator's available values: or, and
|
255
|
+
},
|
256
|
+
}
|
257
|
+
|
258
|
+
create_load_balancer_policy_input_validate input
|
259
|
+
|
260
|
+
request = Request.new input
|
261
|
+
request.send
|
262
|
+
end
|
263
|
+
|
264
|
+
private
|
265
|
+
|
266
|
+
def create_load_balancer_policy_input_validate(input)
|
267
|
+
input.deep_stringify_keys!
|
268
|
+
|
269
|
+
unless !input['request_params']['loadbalancer_policy_name'].nil? && !input['request_params']['loadbalancer_policy_name'].to_s.empty?
|
270
|
+
raise ParameterRequiredError.new('loadbalancer_policy_name', 'CreateLoadBalancerPolicyInput')
|
271
|
+
end
|
272
|
+
|
273
|
+
if input['request_params']['operator'] && !input['request_params']['operator'].to_s.empty?
|
274
|
+
operator_valid_values = %w(or and)
|
275
|
+
unless operator_valid_values.include? input['request_params']['operator'].to_s
|
276
|
+
raise ParameterValueNotAllowedError.new(
|
277
|
+
'operator',
|
278
|
+
input['request_params']['operator'],
|
279
|
+
operator_valid_values,
|
280
|
+
)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
public
|
286
|
+
|
287
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/create_server_certificate.html
|
288
|
+
def create_server_certificate(certificate_content: '', private_key: '', server_certificate_name: '')
|
289
|
+
input = {
|
290
|
+
config: config,
|
291
|
+
properties: properties,
|
292
|
+
api_name: 'CreateServerCertificate',
|
293
|
+
request_method: 'GET',
|
294
|
+
request_params: {
|
295
|
+
'certificate_content' => certificate_content,
|
296
|
+
'private_key' => private_key,
|
297
|
+
'server_certificate_name' => server_certificate_name,
|
298
|
+
},
|
299
|
+
}
|
300
|
+
|
301
|
+
create_server_certificate_input_validate input
|
302
|
+
|
303
|
+
request = Request.new input
|
304
|
+
request.send
|
305
|
+
end
|
306
|
+
|
307
|
+
private
|
308
|
+
|
309
|
+
def create_server_certificate_input_validate(input)
|
310
|
+
input.deep_stringify_keys!
|
311
|
+
|
312
|
+
unless !input['request_params']['certificate_content'].nil? && !input['request_params']['certificate_content'].to_s.empty?
|
313
|
+
raise ParameterRequiredError.new('certificate_content', 'CreateServerCertificateInput')
|
314
|
+
end
|
315
|
+
|
316
|
+
unless !input['request_params']['private_key'].nil? && !input['request_params']['private_key'].to_s.empty?
|
317
|
+
raise ParameterRequiredError.new('private_key', 'CreateServerCertificateInput')
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
public
|
322
|
+
|
323
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/delete_loadbalancer_backends.html
|
324
|
+
def delete_load_balancer_backends(loadbalancer_backends: [])
|
325
|
+
input = {
|
326
|
+
config: config,
|
327
|
+
properties: properties,
|
328
|
+
api_name: 'DeleteLoadBalancerBackends',
|
329
|
+
request_method: 'GET',
|
330
|
+
request_params: {
|
331
|
+
'loadbalancer_backends' => loadbalancer_backends,
|
332
|
+
},
|
333
|
+
}
|
334
|
+
|
335
|
+
delete_load_balancer_backends_input_validate input
|
336
|
+
|
337
|
+
request = Request.new input
|
338
|
+
request.send
|
339
|
+
end
|
340
|
+
|
341
|
+
private
|
342
|
+
|
343
|
+
def delete_load_balancer_backends_input_validate(input)
|
344
|
+
input.deep_stringify_keys!
|
345
|
+
|
346
|
+
unless !input['request_params']['loadbalancer_backends'].nil? && !input['request_params']['loadbalancer_backends'].to_s.empty?
|
347
|
+
raise ParameterRequiredError.new('loadbalancer_backends', 'DeleteLoadBalancerBackendsInput')
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
public
|
352
|
+
|
353
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/delete_loadbalancer_listeners.html
|
354
|
+
def delete_load_balancer_listeners(loadbalancer_listeners: [])
|
355
|
+
input = {
|
356
|
+
config: config,
|
357
|
+
properties: properties,
|
358
|
+
api_name: 'DeleteLoadBalancerListeners',
|
359
|
+
request_method: 'GET',
|
360
|
+
request_params: {
|
361
|
+
'loadbalancer_listeners' => loadbalancer_listeners,
|
362
|
+
},
|
363
|
+
}
|
364
|
+
|
365
|
+
delete_load_balancer_listeners_input_validate input
|
366
|
+
|
367
|
+
request = Request.new input
|
368
|
+
request.send
|
369
|
+
end
|
370
|
+
|
371
|
+
private
|
372
|
+
|
373
|
+
def delete_load_balancer_listeners_input_validate(input)
|
374
|
+
input.deep_stringify_keys!
|
375
|
+
|
376
|
+
unless !input['request_params']['loadbalancer_listeners'].nil? && !input['request_params']['loadbalancer_listeners'].to_s.empty?
|
377
|
+
raise ParameterRequiredError.new('loadbalancer_listeners', 'DeleteLoadBalancerListenersInput')
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
public
|
382
|
+
|
383
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/delete_loadbalancer_policies.html
|
384
|
+
def delete_load_balancer_policies(loadbalancer_policies: [])
|
385
|
+
input = {
|
386
|
+
config: config,
|
387
|
+
properties: properties,
|
388
|
+
api_name: 'DeleteLoadBalancerPolicies',
|
389
|
+
request_method: 'GET',
|
390
|
+
request_params: {
|
391
|
+
'loadbalancer_policies' => loadbalancer_policies,
|
392
|
+
},
|
393
|
+
}
|
394
|
+
|
395
|
+
delete_load_balancer_policies_input_validate input
|
396
|
+
|
397
|
+
request = Request.new input
|
398
|
+
request.send
|
399
|
+
end
|
400
|
+
|
401
|
+
private
|
402
|
+
|
403
|
+
def delete_load_balancer_policies_input_validate(input)
|
404
|
+
input.deep_stringify_keys!
|
405
|
+
|
406
|
+
unless !input['request_params']['loadbalancer_policies'].nil? && !input['request_params']['loadbalancer_policies'].to_s.empty?
|
407
|
+
raise ParameterRequiredError.new('loadbalancer_policies', 'DeleteLoadBalancerPoliciesInput')
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
public
|
412
|
+
|
413
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/delete_loadbalancer_policy_rules.html
|
414
|
+
def delete_load_balancer_policy_rules(loadbalancer_policy_rules: [])
|
415
|
+
input = {
|
416
|
+
config: config,
|
417
|
+
properties: properties,
|
418
|
+
api_name: 'DeleteLoadBalancerPolicyRules',
|
419
|
+
request_method: 'GET',
|
420
|
+
request_params: {
|
421
|
+
'loadbalancer_policy_rules' => loadbalancer_policy_rules,
|
422
|
+
},
|
423
|
+
}
|
424
|
+
|
425
|
+
delete_load_balancer_policy_rules_input_validate input
|
426
|
+
|
427
|
+
request = Request.new input
|
428
|
+
request.send
|
429
|
+
end
|
430
|
+
|
431
|
+
private
|
432
|
+
|
433
|
+
def delete_load_balancer_policy_rules_input_validate(input)
|
434
|
+
input.deep_stringify_keys!
|
435
|
+
|
436
|
+
unless !input['request_params']['loadbalancer_policy_rules'].nil? && !input['request_params']['loadbalancer_policy_rules'].to_s.empty?
|
437
|
+
raise ParameterRequiredError.new('loadbalancer_policy_rules', 'DeleteLoadBalancerPolicyRulesInput')
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
public
|
442
|
+
|
443
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/delete_loadbalancers.html
|
444
|
+
def delete_load_balancers(loadbalancers: [])
|
445
|
+
input = {
|
446
|
+
config: config,
|
447
|
+
properties: properties,
|
448
|
+
api_name: 'DeleteLoadBalancers',
|
449
|
+
request_method: 'GET',
|
450
|
+
request_params: {
|
451
|
+
'loadbalancers' => loadbalancers,
|
452
|
+
},
|
453
|
+
}
|
454
|
+
|
455
|
+
delete_load_balancers_input_validate input
|
456
|
+
|
457
|
+
request = Request.new input
|
458
|
+
request.send
|
459
|
+
end
|
460
|
+
|
461
|
+
private
|
462
|
+
|
463
|
+
def delete_load_balancers_input_validate(input)
|
464
|
+
input.deep_stringify_keys!
|
465
|
+
|
466
|
+
unless !input['request_params']['loadbalancers'].nil? && !input['request_params']['loadbalancers'].to_s.empty?
|
467
|
+
raise ParameterRequiredError.new('loadbalancers', 'DeleteLoadBalancersInput')
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
public
|
472
|
+
|
473
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/delete_server_certificates.html
|
474
|
+
def delete_server_certificates(server_certificates: [])
|
475
|
+
input = {
|
476
|
+
config: config,
|
477
|
+
properties: properties,
|
478
|
+
api_name: 'DeleteServerCertificates',
|
479
|
+
request_method: 'GET',
|
480
|
+
request_params: {
|
481
|
+
'server_certificates' => server_certificates,
|
482
|
+
},
|
483
|
+
}
|
484
|
+
|
485
|
+
delete_server_certificates_input_validate input
|
486
|
+
|
487
|
+
request = Request.new input
|
488
|
+
request.send
|
489
|
+
end
|
490
|
+
|
491
|
+
private
|
492
|
+
|
493
|
+
def delete_server_certificates_input_validate(input)
|
494
|
+
input.deep_stringify_keys!
|
495
|
+
|
496
|
+
unless !input['request_params']['server_certificates'].nil? && !input['request_params']['server_certificates'].to_s.empty?
|
497
|
+
raise ParameterRequiredError.new('server_certificates', 'DeleteServerCertificatesInput')
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
public
|
502
|
+
|
503
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/describe_loadbalancer_backends.html
|
504
|
+
def describe_load_balancer_backends(limit: nil, loadbalancer: '', loadbalancer_backends: '', loadbalancer_listener: '', offset: nil, verbose: nil)
|
505
|
+
input = {
|
506
|
+
config: config,
|
507
|
+
properties: properties,
|
508
|
+
api_name: 'DescribeLoadBalancerBackends',
|
509
|
+
request_method: 'GET',
|
510
|
+
request_params: {
|
511
|
+
'limit' => limit,
|
512
|
+
'loadbalancer' => loadbalancer,
|
513
|
+
'loadbalancer_backends' => loadbalancer_backends,
|
514
|
+
'loadbalancer_listener' => loadbalancer_listener,
|
515
|
+
'offset' => offset,
|
516
|
+
'verbose' => verbose,
|
517
|
+
},
|
518
|
+
}
|
519
|
+
|
520
|
+
describe_load_balancer_backends_input_validate input
|
521
|
+
|
522
|
+
request = Request.new input
|
523
|
+
request.send
|
524
|
+
end
|
525
|
+
|
526
|
+
private
|
527
|
+
|
528
|
+
def describe_load_balancer_backends_input_validate(input)
|
529
|
+
input.deep_stringify_keys!
|
530
|
+
end
|
531
|
+
|
532
|
+
public
|
533
|
+
|
534
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/describe_loadbalancer_listeners.html
|
535
|
+
def describe_load_balancer_listeners(limit: nil, loadbalancer: '', loadbalancer_listeners: [], offset: nil, verbose: nil)
|
536
|
+
input = {
|
537
|
+
config: config,
|
538
|
+
properties: properties,
|
539
|
+
api_name: 'DescribeLoadBalancerListeners',
|
540
|
+
request_method: 'GET',
|
541
|
+
request_params: {
|
542
|
+
'limit' => limit,
|
543
|
+
'loadbalancer' => loadbalancer,
|
544
|
+
'loadbalancer_listeners' => loadbalancer_listeners,
|
545
|
+
'offset' => offset,
|
546
|
+
'verbose' => verbose,
|
547
|
+
},
|
548
|
+
}
|
549
|
+
|
550
|
+
describe_load_balancer_listeners_input_validate input
|
551
|
+
|
552
|
+
request = Request.new input
|
553
|
+
request.send
|
554
|
+
end
|
555
|
+
|
556
|
+
private
|
557
|
+
|
558
|
+
def describe_load_balancer_listeners_input_validate(input)
|
559
|
+
input.deep_stringify_keys!
|
560
|
+
end
|
561
|
+
|
562
|
+
public
|
563
|
+
|
564
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/describe_loadbalancer_policies.html
|
565
|
+
def describe_load_balancer_policies(limit: nil, loadbalancer_policies: [], offset: nil, verbose: nil)
|
566
|
+
input = {
|
567
|
+
config: config,
|
568
|
+
properties: properties,
|
569
|
+
api_name: 'DescribeLoadBalancerPolicies',
|
570
|
+
request_method: 'GET',
|
571
|
+
request_params: {
|
572
|
+
'limit' => limit,
|
573
|
+
'loadbalancer_policies' => loadbalancer_policies,
|
574
|
+
'offset' => offset,
|
575
|
+
'verbose' => verbose,
|
576
|
+
},
|
577
|
+
}
|
578
|
+
|
579
|
+
describe_load_balancer_policies_input_validate input
|
580
|
+
|
581
|
+
request = Request.new input
|
582
|
+
request.send
|
583
|
+
end
|
584
|
+
|
585
|
+
private
|
586
|
+
|
587
|
+
def describe_load_balancer_policies_input_validate(input)
|
588
|
+
input.deep_stringify_keys!
|
589
|
+
end
|
590
|
+
|
591
|
+
public
|
592
|
+
|
593
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/describe_loadbalancer_policy_rules.html
|
594
|
+
def describe_load_balancer_policy_rules(limit: nil, loadbalancer_policy: '', loadbalancer_policy_rules: [], offset: nil)
|
595
|
+
input = {
|
596
|
+
config: config,
|
597
|
+
properties: properties,
|
598
|
+
api_name: 'DescribeLoadBalancerPolicyRules',
|
599
|
+
request_method: 'GET',
|
600
|
+
request_params: {
|
601
|
+
'limit' => limit,
|
602
|
+
'loadbalancer_policy' => loadbalancer_policy,
|
603
|
+
'loadbalancer_policy_rules' => loadbalancer_policy_rules,
|
604
|
+
'offset' => offset,
|
605
|
+
},
|
606
|
+
}
|
607
|
+
|
608
|
+
describe_load_balancer_policy_rules_input_validate input
|
609
|
+
|
610
|
+
request = Request.new input
|
611
|
+
request.send
|
612
|
+
end
|
613
|
+
|
614
|
+
private
|
615
|
+
|
616
|
+
def describe_load_balancer_policy_rules_input_validate(input)
|
617
|
+
input.deep_stringify_keys!
|
618
|
+
end
|
619
|
+
|
620
|
+
public
|
621
|
+
|
622
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/describe_loadbalancers.html
|
623
|
+
def describe_load_balancers(limit: nil, loadbalancers: [], offset: nil, search_word: '', status: [], tags: [], verbose: nil)
|
624
|
+
input = {
|
625
|
+
config: config,
|
626
|
+
properties: properties,
|
627
|
+
api_name: 'DescribeLoadBalancers',
|
628
|
+
request_method: 'GET',
|
629
|
+
request_params: {
|
630
|
+
'limit' => limit,
|
631
|
+
'loadbalancers' => loadbalancers,
|
632
|
+
'offset' => offset,
|
633
|
+
'search_word' => search_word,
|
634
|
+
'status' => status,
|
635
|
+
'tags' => tags,
|
636
|
+
'verbose' => verbose,
|
637
|
+
},
|
638
|
+
}
|
639
|
+
|
640
|
+
describe_load_balancers_input_validate input
|
641
|
+
|
642
|
+
request = Request.new input
|
643
|
+
request.send
|
644
|
+
end
|
645
|
+
|
646
|
+
private
|
647
|
+
|
648
|
+
def describe_load_balancers_input_validate(input)
|
649
|
+
input.deep_stringify_keys!
|
650
|
+
end
|
651
|
+
|
652
|
+
public
|
653
|
+
|
654
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/describe_server_certificates.html
|
655
|
+
def describe_server_certificates(limit: nil, offset: nil, search_word: '', server_certificates: '', verbose: nil)
|
656
|
+
input = {
|
657
|
+
config: config,
|
658
|
+
properties: properties,
|
659
|
+
api_name: 'DescribeServerCertificates',
|
660
|
+
request_method: 'GET',
|
661
|
+
request_params: {
|
662
|
+
'limit' => limit,
|
663
|
+
'offset' => offset,
|
664
|
+
'search_word' => search_word,
|
665
|
+
'server_certificates' => server_certificates,
|
666
|
+
'verbose' => verbose,
|
667
|
+
},
|
668
|
+
}
|
669
|
+
|
670
|
+
describe_server_certificates_input_validate input
|
671
|
+
|
672
|
+
request = Request.new input
|
673
|
+
request.send
|
674
|
+
end
|
675
|
+
|
676
|
+
private
|
677
|
+
|
678
|
+
def describe_server_certificates_input_validate(input)
|
679
|
+
input.deep_stringify_keys!
|
680
|
+
end
|
681
|
+
|
682
|
+
public
|
683
|
+
|
684
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/dissociate_eips_from_loadbalancer.html
|
685
|
+
def dissociate_eips_from_load_balancer(eips: [], loadbalancer: '')
|
686
|
+
input = {
|
687
|
+
config: config,
|
688
|
+
properties: properties,
|
689
|
+
api_name: 'DissociateEipsFromLoadBalancer',
|
690
|
+
request_method: 'GET',
|
691
|
+
request_params: {
|
692
|
+
'eips' => eips,
|
693
|
+
'loadbalancer' => loadbalancer,
|
694
|
+
},
|
695
|
+
}
|
696
|
+
|
697
|
+
dissociate_eips_from_load_balancer_input_validate input
|
698
|
+
|
699
|
+
request = Request.new input
|
700
|
+
request.send
|
701
|
+
end
|
702
|
+
|
703
|
+
private
|
704
|
+
|
705
|
+
def dissociate_eips_from_load_balancer_input_validate(input)
|
706
|
+
input.deep_stringify_keys!
|
707
|
+
|
708
|
+
unless !input['request_params']['eips'].nil? && !input['request_params']['eips'].to_s.empty?
|
709
|
+
raise ParameterRequiredError.new('eips', 'DissociateEipsFromLoadBalancerInput')
|
710
|
+
end
|
711
|
+
|
712
|
+
unless !input['request_params']['loadbalancer'].nil? && !input['request_params']['loadbalancer'].to_s.empty?
|
713
|
+
raise ParameterRequiredError.new('loadbalancer', 'DissociateEipsFromLoadBalancerInput')
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
public
|
718
|
+
|
719
|
+
# Documentation URL: https://docs.qingcloud.com/api/monitor/get_loadbalancer_monitor.html
|
720
|
+
def get_load_balancer_monitor(end_time: '', meters: [], resource: '', resource_type: '', start_time: '', step: '')
|
721
|
+
input = {
|
722
|
+
config: config,
|
723
|
+
properties: properties,
|
724
|
+
api_name: 'GetLoadBalancerMonitor',
|
725
|
+
request_method: 'GET',
|
726
|
+
request_params: {
|
727
|
+
'end_time' => end_time,
|
728
|
+
'meters' => meters,
|
729
|
+
'resource' => resource,
|
730
|
+
'resource_type' => resource_type,
|
731
|
+
'start_time' => start_time,
|
732
|
+
'step' => step, # step's available values: 5m, 15m, 2h, 1d
|
733
|
+
},
|
734
|
+
}
|
735
|
+
|
736
|
+
get_load_balancer_monitor_input_validate input
|
737
|
+
|
738
|
+
request = Request.new input
|
739
|
+
request.send
|
740
|
+
end
|
741
|
+
|
742
|
+
private
|
743
|
+
|
744
|
+
def get_load_balancer_monitor_input_validate(input)
|
745
|
+
input.deep_stringify_keys!
|
746
|
+
|
747
|
+
unless !input['request_params']['end_time'].nil? && !input['request_params']['end_time'].to_s.empty?
|
748
|
+
raise ParameterRequiredError.new('end_time', 'GetLoadBalancerMonitorInput')
|
749
|
+
end
|
750
|
+
|
751
|
+
unless !input['request_params']['meters'].nil? && !input['request_params']['meters'].to_s.empty?
|
752
|
+
raise ParameterRequiredError.new('meters', 'GetLoadBalancerMonitorInput')
|
753
|
+
end
|
754
|
+
|
755
|
+
unless !input['request_params']['resource'].nil? && !input['request_params']['resource'].to_s.empty?
|
756
|
+
raise ParameterRequiredError.new('resource', 'GetLoadBalancerMonitorInput')
|
757
|
+
end
|
758
|
+
|
759
|
+
unless !input['request_params']['start_time'].nil? && !input['request_params']['start_time'].to_s.empty?
|
760
|
+
raise ParameterRequiredError.new('start_time', 'GetLoadBalancerMonitorInput')
|
761
|
+
end
|
762
|
+
|
763
|
+
unless !input['request_params']['step'].nil? && !input['request_params']['step'].to_s.empty?
|
764
|
+
raise ParameterRequiredError.new('step', 'GetLoadBalancerMonitorInput')
|
765
|
+
end
|
766
|
+
|
767
|
+
if input['request_params']['step'] && !input['request_params']['step'].to_s.empty?
|
768
|
+
step_valid_values = %w(5m 15m 2h 1d)
|
769
|
+
unless step_valid_values.include? input['request_params']['step'].to_s
|
770
|
+
raise ParameterValueNotAllowedError.new(
|
771
|
+
'step',
|
772
|
+
input['request_params']['step'],
|
773
|
+
step_valid_values,
|
774
|
+
)
|
775
|
+
end
|
776
|
+
end
|
777
|
+
end
|
778
|
+
|
779
|
+
public
|
780
|
+
|
781
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/modify_loadbalancer_attributes.html
|
782
|
+
def modify_load_balancer_attributes(description: '', loadbalancer: '', loadbalancer_name: '', private_ip: '', security_group: '')
|
783
|
+
input = {
|
784
|
+
config: config,
|
785
|
+
properties: properties,
|
786
|
+
api_name: 'ModifyLoadBalancerAttributes',
|
787
|
+
request_method: 'GET',
|
788
|
+
request_params: {
|
789
|
+
'description' => description,
|
790
|
+
'loadbalancer' => loadbalancer,
|
791
|
+
'loadbalancer_name' => loadbalancer_name,
|
792
|
+
'private_ip' => private_ip,
|
793
|
+
'security_group' => security_group,
|
794
|
+
},
|
795
|
+
}
|
796
|
+
|
797
|
+
modify_load_balancer_attributes_input_validate input
|
798
|
+
|
799
|
+
request = Request.new input
|
800
|
+
request.send
|
801
|
+
end
|
802
|
+
|
803
|
+
private
|
804
|
+
|
805
|
+
def modify_load_balancer_attributes_input_validate(input)
|
806
|
+
input.deep_stringify_keys!
|
807
|
+
|
808
|
+
unless !input['request_params']['loadbalancer'].nil? && !input['request_params']['loadbalancer'].to_s.empty?
|
809
|
+
raise ParameterRequiredError.new('loadbalancer', 'ModifyLoadBalancerAttributesInput')
|
810
|
+
end
|
811
|
+
end
|
812
|
+
|
813
|
+
public
|
814
|
+
|
815
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/modify_loadbalancer_backend_attributes.html
|
816
|
+
def modify_load_balancer_backend_attributes(disabled: nil, loadbalancer_backend: '', loadbalancer_backend_name: '', loadbalancer_policy_id: '', port: '', weight: '')
|
817
|
+
input = {
|
818
|
+
config: config,
|
819
|
+
properties: properties,
|
820
|
+
api_name: 'ModifyLoadBalancerBackendAttributes',
|
821
|
+
request_method: 'GET',
|
822
|
+
request_params: {
|
823
|
+
'disabled' => disabled, # disabled's available values: 0, 1
|
824
|
+
'loadbalancer_backend' => loadbalancer_backend,
|
825
|
+
'loadbalancer_backend_name' => loadbalancer_backend_name,
|
826
|
+
'loadbalancer_policy_id' => loadbalancer_policy_id,
|
827
|
+
'port' => port,
|
828
|
+
'weight' => weight,
|
829
|
+
},
|
830
|
+
}
|
831
|
+
|
832
|
+
modify_load_balancer_backend_attributes_input_validate input
|
833
|
+
|
834
|
+
request = Request.new input
|
835
|
+
request.send
|
836
|
+
end
|
837
|
+
|
838
|
+
private
|
839
|
+
|
840
|
+
def modify_load_balancer_backend_attributes_input_validate(input)
|
841
|
+
input.deep_stringify_keys!
|
842
|
+
|
843
|
+
if input['request_params']['disabled'] && !input['request_params']['disabled'].to_s.empty?
|
844
|
+
disabled_valid_values = %w(0 1)
|
845
|
+
unless disabled_valid_values.include? input['request_params']['disabled'].to_s
|
846
|
+
raise ParameterValueNotAllowedError.new(
|
847
|
+
'disabled',
|
848
|
+
input['request_params']['disabled'],
|
849
|
+
disabled_valid_values,
|
850
|
+
)
|
851
|
+
end
|
852
|
+
end
|
853
|
+
end
|
854
|
+
|
855
|
+
public
|
856
|
+
|
857
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/modify_loadbalancer_listener_attributes.html
|
858
|
+
def modify_load_balancer_listener_attributes(balance_mode: '', forwardfor: nil, healthy_check_method: '', healthy_check_option: '', loadbalancer_listener: '', loadbalancer_listener_name: '', server_certificate_id: '', session_sticky: '')
|
859
|
+
input = {
|
860
|
+
config: config,
|
861
|
+
properties: properties,
|
862
|
+
api_name: 'ModifyLoadBalancerListenerAttributes',
|
863
|
+
request_method: 'GET',
|
864
|
+
request_params: {
|
865
|
+
'balance_mode' => balance_mode,
|
866
|
+
'forwardfor' => forwardfor,
|
867
|
+
'healthy_check_method' => healthy_check_method,
|
868
|
+
'healthy_check_option' => healthy_check_option,
|
869
|
+
'loadbalancer_listener' => loadbalancer_listener,
|
870
|
+
'loadbalancer_listener_name' => loadbalancer_listener_name,
|
871
|
+
'server_certificate_id' => server_certificate_id,
|
872
|
+
'session_sticky' => session_sticky,
|
873
|
+
},
|
874
|
+
}
|
875
|
+
|
876
|
+
modify_load_balancer_listener_attributes_input_validate input
|
877
|
+
|
878
|
+
request = Request.new input
|
879
|
+
request.send
|
880
|
+
end
|
881
|
+
|
882
|
+
private
|
883
|
+
|
884
|
+
def modify_load_balancer_listener_attributes_input_validate(input)
|
885
|
+
input.deep_stringify_keys!
|
886
|
+
|
887
|
+
unless !input['request_params']['loadbalancer_listener'].nil? && !input['request_params']['loadbalancer_listener'].to_s.empty?
|
888
|
+
raise ParameterRequiredError.new('loadbalancer_listener', 'ModifyLoadBalancerListenerAttributesInput')
|
889
|
+
end
|
890
|
+
end
|
891
|
+
|
892
|
+
public
|
893
|
+
|
894
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/modify_loadbalancer_policy_attributes.html
|
895
|
+
def modify_load_balancer_policy_attributes(loadbalancer_policy: '', loadbalancer_policy_name: '', operator: '')
|
896
|
+
input = {
|
897
|
+
config: config,
|
898
|
+
properties: properties,
|
899
|
+
api_name: 'ModifyLoadBalancerPolicyAttributes',
|
900
|
+
request_method: 'GET',
|
901
|
+
request_params: {
|
902
|
+
'loadbalancer_policy' => loadbalancer_policy,
|
903
|
+
'loadbalancer_policy_name' => loadbalancer_policy_name,
|
904
|
+
'operator' => operator,
|
905
|
+
},
|
906
|
+
}
|
907
|
+
|
908
|
+
modify_load_balancer_policy_attributes_input_validate input
|
909
|
+
|
910
|
+
request = Request.new input
|
911
|
+
request.send
|
912
|
+
end
|
913
|
+
|
914
|
+
private
|
915
|
+
|
916
|
+
def modify_load_balancer_policy_attributes_input_validate(input)
|
917
|
+
input.deep_stringify_keys!
|
918
|
+
|
919
|
+
unless !input['request_params']['loadbalancer_policy'].nil? && !input['request_params']['loadbalancer_policy'].to_s.empty?
|
920
|
+
raise ParameterRequiredError.new('loadbalancer_policy', 'ModifyLoadBalancerPolicyAttributesInput')
|
921
|
+
end
|
922
|
+
end
|
923
|
+
|
924
|
+
public
|
925
|
+
|
926
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/modify_loadbalancer_policy_rule_attributes.html
|
927
|
+
def modify_load_balancer_policy_rule_attributes(loadbalancer_policy_rule: '', loadbalancer_policy_rule_name: '', val: '')
|
928
|
+
input = {
|
929
|
+
config: config,
|
930
|
+
properties: properties,
|
931
|
+
api_name: 'ModifyLoadBalancerPolicyRuleAttributes',
|
932
|
+
request_method: 'GET',
|
933
|
+
request_params: {
|
934
|
+
'loadbalancer_policy_rule' => loadbalancer_policy_rule,
|
935
|
+
'loadbalancer_policy_rule_name' => loadbalancer_policy_rule_name,
|
936
|
+
'val' => val,
|
937
|
+
},
|
938
|
+
}
|
939
|
+
|
940
|
+
modify_load_balancer_policy_rule_attributes_input_validate input
|
941
|
+
|
942
|
+
request = Request.new input
|
943
|
+
request.send
|
944
|
+
end
|
945
|
+
|
946
|
+
private
|
947
|
+
|
948
|
+
def modify_load_balancer_policy_rule_attributes_input_validate(input)
|
949
|
+
input.deep_stringify_keys!
|
950
|
+
|
951
|
+
unless !input['request_params']['loadbalancer_policy_rule'].nil? && !input['request_params']['loadbalancer_policy_rule'].to_s.empty?
|
952
|
+
raise ParameterRequiredError.new('loadbalancer_policy_rule', 'ModifyLoadBalancerPolicyRuleAttributesInput')
|
953
|
+
end
|
954
|
+
end
|
955
|
+
|
956
|
+
public
|
957
|
+
|
958
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/modify_server_certificate_attributes.html
|
959
|
+
def modify_server_certificate_attributes(description: '', server_certificate: '', server_certificate_name: '')
|
960
|
+
input = {
|
961
|
+
config: config,
|
962
|
+
properties: properties,
|
963
|
+
api_name: 'ModifyServerCertificateAttributes',
|
964
|
+
request_method: 'GET',
|
965
|
+
request_params: {
|
966
|
+
'description' => description,
|
967
|
+
'server_certificate' => server_certificate,
|
968
|
+
'server_certificate_name' => server_certificate_name,
|
969
|
+
},
|
970
|
+
}
|
971
|
+
|
972
|
+
modify_server_certificate_attributes_input_validate input
|
973
|
+
|
974
|
+
request = Request.new input
|
975
|
+
request.send
|
976
|
+
end
|
977
|
+
|
978
|
+
private
|
979
|
+
|
980
|
+
def modify_server_certificate_attributes_input_validate(input)
|
981
|
+
input.deep_stringify_keys!
|
982
|
+
|
983
|
+
unless !input['request_params']['server_certificate'].nil? && !input['request_params']['server_certificate'].to_s.empty?
|
984
|
+
raise ParameterRequiredError.new('server_certificate', 'ModifyServerCertificateAttributesInput')
|
985
|
+
end
|
986
|
+
end
|
987
|
+
|
988
|
+
public
|
989
|
+
|
990
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/resize_loadbalancers.html
|
991
|
+
def resize_load_balancers(loadbalancer_type: nil, loadbalancers: [])
|
992
|
+
input = {
|
993
|
+
config: config,
|
994
|
+
properties: properties,
|
995
|
+
api_name: 'ResizeLoadBalancers',
|
996
|
+
request_method: 'GET',
|
997
|
+
request_params: {
|
998
|
+
'loadbalancer_type' => loadbalancer_type, # loadbalancer_type's available values: 0, 1, 2, 3, 4, 5
|
999
|
+
'loadbalancers' => loadbalancers,
|
1000
|
+
},
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
resize_load_balancers_input_validate input
|
1004
|
+
|
1005
|
+
request = Request.new input
|
1006
|
+
request.send
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
private
|
1010
|
+
|
1011
|
+
def resize_load_balancers_input_validate(input)
|
1012
|
+
input.deep_stringify_keys!
|
1013
|
+
|
1014
|
+
if input['request_params']['loadbalancer_type'] && !input['request_params']['loadbalancer_type'].to_s.empty?
|
1015
|
+
loadbalancer_type_valid_values = %w(0 1 2 3 4 5)
|
1016
|
+
unless loadbalancer_type_valid_values.include? input['request_params']['loadbalancer_type'].to_s
|
1017
|
+
raise ParameterValueNotAllowedError.new(
|
1018
|
+
'loadbalancer_type',
|
1019
|
+
input['request_params']['loadbalancer_type'],
|
1020
|
+
loadbalancer_type_valid_values,
|
1021
|
+
)
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
public
|
1027
|
+
|
1028
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/start_loadbalancers.html
|
1029
|
+
def start_load_balancers(loadbalancers: [])
|
1030
|
+
input = {
|
1031
|
+
config: config,
|
1032
|
+
properties: properties,
|
1033
|
+
api_name: 'StartLoadBalancers',
|
1034
|
+
request_method: 'GET',
|
1035
|
+
request_params: {
|
1036
|
+
'loadbalancers' => loadbalancers,
|
1037
|
+
},
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
start_load_balancers_input_validate input
|
1041
|
+
|
1042
|
+
request = Request.new input
|
1043
|
+
request.send
|
1044
|
+
end
|
1045
|
+
|
1046
|
+
private
|
1047
|
+
|
1048
|
+
def start_load_balancers_input_validate(input)
|
1049
|
+
input.deep_stringify_keys!
|
1050
|
+
|
1051
|
+
unless !input['request_params']['loadbalancers'].nil? && !input['request_params']['loadbalancers'].to_s.empty?
|
1052
|
+
raise ParameterRequiredError.new('loadbalancers', 'StartLoadBalancersInput')
|
1053
|
+
end
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
public
|
1057
|
+
|
1058
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/stop_loadbalancers.html
|
1059
|
+
def stop_load_balancers(loadbalancers: '')
|
1060
|
+
input = {
|
1061
|
+
config: config,
|
1062
|
+
properties: properties,
|
1063
|
+
api_name: 'StopLoadBalancers',
|
1064
|
+
request_method: 'GET',
|
1065
|
+
request_params: {
|
1066
|
+
'loadbalancers' => loadbalancers,
|
1067
|
+
},
|
1068
|
+
}
|
1069
|
+
|
1070
|
+
stop_load_balancers_input_validate input
|
1071
|
+
|
1072
|
+
request = Request.new input
|
1073
|
+
request.send
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
private
|
1077
|
+
|
1078
|
+
def stop_load_balancers_input_validate(input)
|
1079
|
+
input.deep_stringify_keys!
|
1080
|
+
|
1081
|
+
unless !input['request_params']['loadbalancers'].nil? && !input['request_params']['loadbalancers'].to_s.empty?
|
1082
|
+
raise ParameterRequiredError.new('loadbalancers', 'StopLoadBalancersInput')
|
1083
|
+
end
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
public
|
1087
|
+
|
1088
|
+
# Documentation URL: https://docs.qingcloud.com/api/lb/update_loadbalancers.html
|
1089
|
+
def update_load_balancers(loadbalancers: [])
|
1090
|
+
input = {
|
1091
|
+
config: config,
|
1092
|
+
properties: properties,
|
1093
|
+
api_name: 'UpdateLoadBalancers',
|
1094
|
+
request_method: 'GET',
|
1095
|
+
request_params: {
|
1096
|
+
'loadbalancers' => loadbalancers,
|
1097
|
+
},
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
update_load_balancers_input_validate input
|
1101
|
+
|
1102
|
+
request = Request.new input
|
1103
|
+
request.send
|
1104
|
+
end
|
1105
|
+
|
1106
|
+
private
|
1107
|
+
|
1108
|
+
def update_load_balancers_input_validate(input)
|
1109
|
+
input.deep_stringify_keys!
|
1110
|
+
|
1111
|
+
unless !input['request_params']['loadbalancers'].nil? && !input['request_params']['loadbalancers'].to_s.empty?
|
1112
|
+
raise ParameterRequiredError.new('loadbalancers', 'UpdateLoadBalancersInput')
|
1113
|
+
end
|
1114
|
+
end
|
1115
|
+
|
1116
|
+
public
|
1117
|
+
end
|
1118
|
+
end
|
1119
|
+
end
|