qingcloud-sdk 0.4.1 → 2.0.0.pre.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,778 @@
|
|
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 RouterService
|
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/router/add_router_static_entries.html
|
30
|
+
def add_router_static_entries(entries: [], router_static: '')
|
31
|
+
input = {
|
32
|
+
config: config,
|
33
|
+
properties: properties,
|
34
|
+
api_name: 'AddRouterStaticEntries',
|
35
|
+
request_method: 'GET',
|
36
|
+
request_params: {
|
37
|
+
'entries' => entries,
|
38
|
+
'router_static' => router_static,
|
39
|
+
},
|
40
|
+
}
|
41
|
+
|
42
|
+
add_router_static_entries_input_validate input
|
43
|
+
|
44
|
+
request = Request.new input
|
45
|
+
request.send
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def add_router_static_entries_input_validate(input)
|
51
|
+
input.deep_stringify_keys!
|
52
|
+
|
53
|
+
input['request_params']['entries'].map do |x|
|
54
|
+
end
|
55
|
+
|
56
|
+
unless !input['request_params']['router_static'].nil? && !input['request_params']['router_static'].to_s.empty?
|
57
|
+
raise ParameterRequiredError.new('router_static', 'AddRouterStaticEntriesInput')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
public
|
62
|
+
|
63
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/add_router_statics.html
|
64
|
+
def add_router_statics(router: '', statics: [], vxnet: '')
|
65
|
+
input = {
|
66
|
+
config: config,
|
67
|
+
properties: properties,
|
68
|
+
api_name: 'AddRouterStatics',
|
69
|
+
request_method: 'GET',
|
70
|
+
request_params: {
|
71
|
+
'router' => router,
|
72
|
+
'statics' => statics,
|
73
|
+
'vxnet' => vxnet,
|
74
|
+
},
|
75
|
+
}
|
76
|
+
|
77
|
+
add_router_statics_input_validate input
|
78
|
+
|
79
|
+
request = Request.new input
|
80
|
+
request.send
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def add_router_statics_input_validate(input)
|
86
|
+
input.deep_stringify_keys!
|
87
|
+
|
88
|
+
unless !input['request_params']['router'].nil? && !input['request_params']['router'].to_s.empty?
|
89
|
+
raise ParameterRequiredError.new('router', 'AddRouterStaticsInput')
|
90
|
+
end
|
91
|
+
|
92
|
+
unless !input['request_params']['statics'].nil? && !input['request_params']['statics'].to_s.empty?
|
93
|
+
raise ParameterRequiredError.new('statics', 'AddRouterStaticsInput')
|
94
|
+
end
|
95
|
+
|
96
|
+
input['request_params']['statics'].map do |x|
|
97
|
+
next unless x['static_type'] && !x['static_type'].to_s.empty?
|
98
|
+
static_type_valid_values = %w(1 2 3 4 5 6 7 8)
|
99
|
+
next if static_type_valid_values.include? x['static_type'].to_s
|
100
|
+
raise ParameterValueNotAllowedError.new(
|
101
|
+
'static_type',
|
102
|
+
x['static_type'],
|
103
|
+
static_type_valid_values,
|
104
|
+
)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
public
|
109
|
+
|
110
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/create_routers.html
|
111
|
+
def create_routers(count: nil, router_name: '', router_type: nil, security_group: '', vpc_network: '')
|
112
|
+
input = {
|
113
|
+
config: config,
|
114
|
+
properties: properties,
|
115
|
+
api_name: 'CreateRouters',
|
116
|
+
request_method: 'GET',
|
117
|
+
request_params: {
|
118
|
+
'count' => count,
|
119
|
+
'router_name' => router_name,
|
120
|
+
'router_type' => router_type, # router_type's available values: 0, 1, 2, 3
|
121
|
+
'security_group' => security_group,
|
122
|
+
'vpc_network' => vpc_network,
|
123
|
+
},
|
124
|
+
}
|
125
|
+
|
126
|
+
create_routers_input_validate input
|
127
|
+
|
128
|
+
request = Request.new input
|
129
|
+
request.send
|
130
|
+
end
|
131
|
+
|
132
|
+
private
|
133
|
+
|
134
|
+
def create_routers_input_validate(input)
|
135
|
+
input.deep_stringify_keys!
|
136
|
+
|
137
|
+
if input['request_params']['router_type'] && !input['request_params']['router_type'].to_s.empty?
|
138
|
+
router_type_valid_values = %w(0 1 2 3)
|
139
|
+
unless router_type_valid_values.include? input['request_params']['router_type'].to_s
|
140
|
+
raise ParameterValueNotAllowedError.new(
|
141
|
+
'router_type',
|
142
|
+
input['request_params']['router_type'],
|
143
|
+
router_type_valid_values,
|
144
|
+
)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
public
|
150
|
+
|
151
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/delete_router_static_entries.html
|
152
|
+
def delete_router_static_entries(router_static_entries: [])
|
153
|
+
input = {
|
154
|
+
config: config,
|
155
|
+
properties: properties,
|
156
|
+
api_name: 'DeleteRouterStaticEntries',
|
157
|
+
request_method: 'GET',
|
158
|
+
request_params: {
|
159
|
+
'router_static_entries' => router_static_entries,
|
160
|
+
},
|
161
|
+
}
|
162
|
+
|
163
|
+
delete_router_static_entries_input_validate input
|
164
|
+
|
165
|
+
request = Request.new input
|
166
|
+
request.send
|
167
|
+
end
|
168
|
+
|
169
|
+
private
|
170
|
+
|
171
|
+
def delete_router_static_entries_input_validate(input)
|
172
|
+
input.deep_stringify_keys!
|
173
|
+
|
174
|
+
unless !input['request_params']['router_static_entries'].nil? && !input['request_params']['router_static_entries'].to_s.empty?
|
175
|
+
raise ParameterRequiredError.new('router_static_entries', 'DeleteRouterStaticEntriesInput')
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
public
|
180
|
+
|
181
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/delete_router_statics.html
|
182
|
+
def delete_router_statics(router_statics: [])
|
183
|
+
input = {
|
184
|
+
config: config,
|
185
|
+
properties: properties,
|
186
|
+
api_name: 'DeleteRouterStatics',
|
187
|
+
request_method: 'GET',
|
188
|
+
request_params: {
|
189
|
+
'router_statics' => router_statics,
|
190
|
+
},
|
191
|
+
}
|
192
|
+
|
193
|
+
delete_router_statics_input_validate input
|
194
|
+
|
195
|
+
request = Request.new input
|
196
|
+
request.send
|
197
|
+
end
|
198
|
+
|
199
|
+
private
|
200
|
+
|
201
|
+
def delete_router_statics_input_validate(input)
|
202
|
+
input.deep_stringify_keys!
|
203
|
+
|
204
|
+
unless !input['request_params']['router_statics'].nil? && !input['request_params']['router_statics'].to_s.empty?
|
205
|
+
raise ParameterRequiredError.new('router_statics', 'DeleteRouterStaticsInput')
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
public
|
210
|
+
|
211
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/delete_routers.html
|
212
|
+
def delete_routers(routers: [])
|
213
|
+
input = {
|
214
|
+
config: config,
|
215
|
+
properties: properties,
|
216
|
+
api_name: 'DeleteRouters',
|
217
|
+
request_method: 'GET',
|
218
|
+
request_params: {
|
219
|
+
'routers' => routers,
|
220
|
+
},
|
221
|
+
}
|
222
|
+
|
223
|
+
delete_routers_input_validate input
|
224
|
+
|
225
|
+
request = Request.new input
|
226
|
+
request.send
|
227
|
+
end
|
228
|
+
|
229
|
+
private
|
230
|
+
|
231
|
+
def delete_routers_input_validate(input)
|
232
|
+
input.deep_stringify_keys!
|
233
|
+
|
234
|
+
unless !input['request_params']['routers'].nil? && !input['request_params']['routers'].to_s.empty?
|
235
|
+
raise ParameterRequiredError.new('routers', 'DeleteRoutersInput')
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
public
|
240
|
+
|
241
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/describe_router_static_entries.html
|
242
|
+
def describe_router_static_entries(limit: nil, offset: nil, router_static: '', router_static_entry_id: '')
|
243
|
+
input = {
|
244
|
+
config: config,
|
245
|
+
properties: properties,
|
246
|
+
api_name: 'DescribeRouterStaticEntries',
|
247
|
+
request_method: 'GET',
|
248
|
+
request_params: {
|
249
|
+
'limit' => limit,
|
250
|
+
'offset' => offset,
|
251
|
+
'router_static' => router_static,
|
252
|
+
'router_static_entry_id' => router_static_entry_id,
|
253
|
+
},
|
254
|
+
}
|
255
|
+
|
256
|
+
describe_router_static_entries_input_validate input
|
257
|
+
|
258
|
+
request = Request.new input
|
259
|
+
request.send
|
260
|
+
end
|
261
|
+
|
262
|
+
private
|
263
|
+
|
264
|
+
def describe_router_static_entries_input_validate(input)
|
265
|
+
input.deep_stringify_keys!
|
266
|
+
end
|
267
|
+
|
268
|
+
public
|
269
|
+
|
270
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/describe_router_statics.html
|
271
|
+
def describe_router_statics(limit: nil, offset: nil, router: '', router_statics: [], static_type: nil, verbose: nil, vxnet: '')
|
272
|
+
input = {
|
273
|
+
config: config,
|
274
|
+
properties: properties,
|
275
|
+
api_name: 'DescribeRouterStatics',
|
276
|
+
request_method: 'GET',
|
277
|
+
request_params: {
|
278
|
+
'limit' => limit,
|
279
|
+
'offset' => offset,
|
280
|
+
'router' => router,
|
281
|
+
'router_statics' => router_statics,
|
282
|
+
'static_type' => static_type, # static_type's available values: 1, 2, 3, 4, 5, 6, 7, 8
|
283
|
+
'verbose' => verbose, # verbose's available values: 0, 1
|
284
|
+
'vxnet' => vxnet,
|
285
|
+
},
|
286
|
+
}
|
287
|
+
|
288
|
+
describe_router_statics_input_validate input
|
289
|
+
|
290
|
+
request = Request.new input
|
291
|
+
request.send
|
292
|
+
end
|
293
|
+
|
294
|
+
private
|
295
|
+
|
296
|
+
def describe_router_statics_input_validate(input)
|
297
|
+
input.deep_stringify_keys!
|
298
|
+
|
299
|
+
unless !input['request_params']['router'].nil? && !input['request_params']['router'].to_s.empty?
|
300
|
+
raise ParameterRequiredError.new('router', 'DescribeRouterStaticsInput')
|
301
|
+
end
|
302
|
+
|
303
|
+
if input['request_params']['static_type'] && !input['request_params']['static_type'].to_s.empty?
|
304
|
+
static_type_valid_values = %w(1 2 3 4 5 6 7 8)
|
305
|
+
unless static_type_valid_values.include? input['request_params']['static_type'].to_s
|
306
|
+
raise ParameterValueNotAllowedError.new(
|
307
|
+
'static_type',
|
308
|
+
input['request_params']['static_type'],
|
309
|
+
static_type_valid_values,
|
310
|
+
)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
if input['request_params']['verbose'] && !input['request_params']['verbose'].to_s.empty?
|
315
|
+
verbose_valid_values = %w(0 1)
|
316
|
+
unless verbose_valid_values.include? input['request_params']['verbose'].to_s
|
317
|
+
raise ParameterValueNotAllowedError.new(
|
318
|
+
'verbose',
|
319
|
+
input['request_params']['verbose'],
|
320
|
+
verbose_valid_values,
|
321
|
+
)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
public
|
327
|
+
|
328
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/describe_router_vxnets.html
|
329
|
+
def describe_router_vxnets(limit: nil, offset: nil, router: '', verbose: nil, vxnet: '')
|
330
|
+
input = {
|
331
|
+
config: config,
|
332
|
+
properties: properties,
|
333
|
+
api_name: 'DescribeRouterVxnets',
|
334
|
+
request_method: 'GET',
|
335
|
+
request_params: {
|
336
|
+
'limit' => limit,
|
337
|
+
'offset' => offset,
|
338
|
+
'router' => router,
|
339
|
+
'verbose' => verbose, # verbose's available values: 0, 1
|
340
|
+
'vxnet' => vxnet,
|
341
|
+
},
|
342
|
+
}
|
343
|
+
|
344
|
+
describe_router_vxnets_input_validate input
|
345
|
+
|
346
|
+
request = Request.new input
|
347
|
+
request.send
|
348
|
+
end
|
349
|
+
|
350
|
+
private
|
351
|
+
|
352
|
+
def describe_router_vxnets_input_validate(input)
|
353
|
+
input.deep_stringify_keys!
|
354
|
+
|
355
|
+
unless !input['request_params']['router'].nil? && !input['request_params']['router'].to_s.empty?
|
356
|
+
raise ParameterRequiredError.new('router', 'DescribeRouterVxnetsInput')
|
357
|
+
end
|
358
|
+
|
359
|
+
if input['request_params']['verbose'] && !input['request_params']['verbose'].to_s.empty?
|
360
|
+
verbose_valid_values = %w(0 1)
|
361
|
+
unless verbose_valid_values.include? input['request_params']['verbose'].to_s
|
362
|
+
raise ParameterValueNotAllowedError.new(
|
363
|
+
'verbose',
|
364
|
+
input['request_params']['verbose'],
|
365
|
+
verbose_valid_values,
|
366
|
+
)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
public
|
372
|
+
|
373
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/describe_routers.html
|
374
|
+
def describe_routers(limit: nil, offset: nil, routers: [], search_word: '', status: [], tags: [], verbose: nil, vxnet: '')
|
375
|
+
input = {
|
376
|
+
config: config,
|
377
|
+
properties: properties,
|
378
|
+
api_name: 'DescribeRouters',
|
379
|
+
request_method: 'GET',
|
380
|
+
request_params: {
|
381
|
+
'limit' => limit,
|
382
|
+
'offset' => offset,
|
383
|
+
'routers' => routers,
|
384
|
+
'search_word' => search_word,
|
385
|
+
'status' => status,
|
386
|
+
'tags' => tags,
|
387
|
+
'verbose' => verbose, # verbose's available values: 0, 1
|
388
|
+
'vxnet' => vxnet,
|
389
|
+
},
|
390
|
+
}
|
391
|
+
|
392
|
+
describe_routers_input_validate input
|
393
|
+
|
394
|
+
request = Request.new input
|
395
|
+
request.send
|
396
|
+
end
|
397
|
+
|
398
|
+
private
|
399
|
+
|
400
|
+
def describe_routers_input_validate(input)
|
401
|
+
input.deep_stringify_keys!
|
402
|
+
|
403
|
+
if input['request_params']['verbose'] && !input['request_params']['verbose'].to_s.empty?
|
404
|
+
verbose_valid_values = %w(0 1)
|
405
|
+
unless verbose_valid_values.include? input['request_params']['verbose'].to_s
|
406
|
+
raise ParameterValueNotAllowedError.new(
|
407
|
+
'verbose',
|
408
|
+
input['request_params']['verbose'],
|
409
|
+
verbose_valid_values,
|
410
|
+
)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
public
|
416
|
+
|
417
|
+
# Documentation URL: https://docs.qingcloud.com/api/monitor/get_monitor.html
|
418
|
+
def get_router_monitor(end_time: '', meters: [], resource: '', start_time: '', step: '')
|
419
|
+
input = {
|
420
|
+
config: config,
|
421
|
+
properties: properties,
|
422
|
+
api_name: 'GetMonitor',
|
423
|
+
request_method: 'GET',
|
424
|
+
request_params: {
|
425
|
+
'end_time' => end_time,
|
426
|
+
'meters' => meters,
|
427
|
+
'resource' => resource,
|
428
|
+
'start_time' => start_time,
|
429
|
+
'step' => step, # step's available values: 5m, 15m, 2h, 1d
|
430
|
+
},
|
431
|
+
}
|
432
|
+
|
433
|
+
get_router_monitor_input_validate input
|
434
|
+
|
435
|
+
request = Request.new input
|
436
|
+
request.send
|
437
|
+
end
|
438
|
+
|
439
|
+
private
|
440
|
+
|
441
|
+
def get_router_monitor_input_validate(input)
|
442
|
+
input.deep_stringify_keys!
|
443
|
+
|
444
|
+
unless !input['request_params']['end_time'].nil? && !input['request_params']['end_time'].to_s.empty?
|
445
|
+
raise ParameterRequiredError.new('end_time', 'GetRouterMonitorInput')
|
446
|
+
end
|
447
|
+
|
448
|
+
unless !input['request_params']['meters'].nil? && !input['request_params']['meters'].to_s.empty?
|
449
|
+
raise ParameterRequiredError.new('meters', 'GetRouterMonitorInput')
|
450
|
+
end
|
451
|
+
|
452
|
+
unless !input['request_params']['resource'].nil? && !input['request_params']['resource'].to_s.empty?
|
453
|
+
raise ParameterRequiredError.new('resource', 'GetRouterMonitorInput')
|
454
|
+
end
|
455
|
+
|
456
|
+
unless !input['request_params']['start_time'].nil? && !input['request_params']['start_time'].to_s.empty?
|
457
|
+
raise ParameterRequiredError.new('start_time', 'GetRouterMonitorInput')
|
458
|
+
end
|
459
|
+
|
460
|
+
unless !input['request_params']['step'].nil? && !input['request_params']['step'].to_s.empty?
|
461
|
+
raise ParameterRequiredError.new('step', 'GetRouterMonitorInput')
|
462
|
+
end
|
463
|
+
|
464
|
+
if input['request_params']['step'] && !input['request_params']['step'].to_s.empty?
|
465
|
+
step_valid_values = %w(5m 15m 2h 1d)
|
466
|
+
unless step_valid_values.include? input['request_params']['step'].to_s
|
467
|
+
raise ParameterValueNotAllowedError.new(
|
468
|
+
'step',
|
469
|
+
input['request_params']['step'],
|
470
|
+
step_valid_values,
|
471
|
+
)
|
472
|
+
end
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
public
|
477
|
+
|
478
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/join_router.html
|
479
|
+
def join_router(dyn_ip_end: '', dyn_ip_start: '', features: nil, ip_network: '', manager_ip: '', router: '', vxnet: '')
|
480
|
+
input = {
|
481
|
+
config: config,
|
482
|
+
properties: properties,
|
483
|
+
api_name: 'JoinRouter',
|
484
|
+
request_method: 'GET',
|
485
|
+
request_params: {
|
486
|
+
'dyn_ip_end' => dyn_ip_end,
|
487
|
+
'dyn_ip_start' => dyn_ip_start,
|
488
|
+
'features' => features, # features's available values: 1
|
489
|
+
'ip_network' => ip_network,
|
490
|
+
'manager_ip' => manager_ip,
|
491
|
+
'router' => router,
|
492
|
+
'vxnet' => vxnet,
|
493
|
+
},
|
494
|
+
}
|
495
|
+
|
496
|
+
join_router_input_validate input
|
497
|
+
|
498
|
+
request = Request.new input
|
499
|
+
request.send
|
500
|
+
end
|
501
|
+
|
502
|
+
private
|
503
|
+
|
504
|
+
def join_router_input_validate(input)
|
505
|
+
input.deep_stringify_keys!
|
506
|
+
|
507
|
+
if input['request_params']['features'] && !input['request_params']['features'].to_s.empty?
|
508
|
+
features_valid_values = ['1']
|
509
|
+
unless features_valid_values.include? input['request_params']['features'].to_s
|
510
|
+
raise ParameterValueNotAllowedError.new(
|
511
|
+
'features',
|
512
|
+
input['request_params']['features'],
|
513
|
+
features_valid_values,
|
514
|
+
)
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
unless !input['request_params']['ip_network'].nil? && !input['request_params']['ip_network'].to_s.empty?
|
519
|
+
raise ParameterRequiredError.new('ip_network', 'JoinRouterInput')
|
520
|
+
end
|
521
|
+
|
522
|
+
unless !input['request_params']['router'].nil? && !input['request_params']['router'].to_s.empty?
|
523
|
+
raise ParameterRequiredError.new('router', 'JoinRouterInput')
|
524
|
+
end
|
525
|
+
|
526
|
+
unless !input['request_params']['vxnet'].nil? && !input['request_params']['vxnet'].to_s.empty?
|
527
|
+
raise ParameterRequiredError.new('vxnet', 'JoinRouterInput')
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
531
|
+
public
|
532
|
+
|
533
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/leave_router.html
|
534
|
+
def leave_router(router: '', vxnets: [])
|
535
|
+
input = {
|
536
|
+
config: config,
|
537
|
+
properties: properties,
|
538
|
+
api_name: 'LeaveRouter',
|
539
|
+
request_method: 'GET',
|
540
|
+
request_params: {
|
541
|
+
'router' => router,
|
542
|
+
'vxnets' => vxnets,
|
543
|
+
},
|
544
|
+
}
|
545
|
+
|
546
|
+
leave_router_input_validate input
|
547
|
+
|
548
|
+
request = Request.new input
|
549
|
+
request.send
|
550
|
+
end
|
551
|
+
|
552
|
+
private
|
553
|
+
|
554
|
+
def leave_router_input_validate(input)
|
555
|
+
input.deep_stringify_keys!
|
556
|
+
|
557
|
+
unless !input['request_params']['router'].nil? && !input['request_params']['router'].to_s.empty?
|
558
|
+
raise ParameterRequiredError.new('router', 'LeaveRouterInput')
|
559
|
+
end
|
560
|
+
|
561
|
+
unless !input['request_params']['vxnets'].nil? && !input['request_params']['vxnets'].to_s.empty?
|
562
|
+
raise ParameterRequiredError.new('vxnets', 'LeaveRouterInput')
|
563
|
+
end
|
564
|
+
end
|
565
|
+
|
566
|
+
public
|
567
|
+
|
568
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/modify_router_attributes.html
|
569
|
+
def modify_router_attributes(description: '', dyn_ip_end: '', dyn_ip_start: '', eip: '', features: nil, router: '', router_name: '', security_group: '', vxnet: '')
|
570
|
+
input = {
|
571
|
+
config: config,
|
572
|
+
properties: properties,
|
573
|
+
api_name: 'ModifyRouterAttributes',
|
574
|
+
request_method: 'GET',
|
575
|
+
request_params: {
|
576
|
+
'description' => description,
|
577
|
+
'dyn_ip_end' => dyn_ip_end,
|
578
|
+
'dyn_ip_start' => dyn_ip_start,
|
579
|
+
'eip' => eip,
|
580
|
+
'features' => features, # features's available values: 1, 2
|
581
|
+
'router' => router,
|
582
|
+
'router_name' => router_name,
|
583
|
+
'security_group' => security_group,
|
584
|
+
'vxnet' => vxnet,
|
585
|
+
},
|
586
|
+
}
|
587
|
+
|
588
|
+
modify_router_attributes_input_validate input
|
589
|
+
|
590
|
+
request = Request.new input
|
591
|
+
request.send
|
592
|
+
end
|
593
|
+
|
594
|
+
private
|
595
|
+
|
596
|
+
def modify_router_attributes_input_validate(input)
|
597
|
+
input.deep_stringify_keys!
|
598
|
+
|
599
|
+
if input['request_params']['features'] && !input['request_params']['features'].to_s.empty?
|
600
|
+
features_valid_values = %w(1 2)
|
601
|
+
unless features_valid_values.include? input['request_params']['features'].to_s
|
602
|
+
raise ParameterValueNotAllowedError.new(
|
603
|
+
'features',
|
604
|
+
input['request_params']['features'],
|
605
|
+
features_valid_values,
|
606
|
+
)
|
607
|
+
end
|
608
|
+
end
|
609
|
+
|
610
|
+
unless !input['request_params']['router'].nil? && !input['request_params']['router'].to_s.empty?
|
611
|
+
raise ParameterRequiredError.new('router', 'ModifyRouterAttributesInput')
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
615
|
+
public
|
616
|
+
|
617
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/modify_router_static_attributes.html
|
618
|
+
def modify_router_static_attributes(router_static: '', router_static_name: '', val1: '', val2: '', val3: '', val4: '', val5: '', val6: '')
|
619
|
+
input = {
|
620
|
+
config: config,
|
621
|
+
properties: properties,
|
622
|
+
api_name: 'ModifyRouterStaticAttributes',
|
623
|
+
request_method: 'GET',
|
624
|
+
request_params: {
|
625
|
+
'router_static' => router_static,
|
626
|
+
'router_static_name' => router_static_name,
|
627
|
+
'val1' => val1,
|
628
|
+
'val2' => val2,
|
629
|
+
'val3' => val3,
|
630
|
+
'val4' => val4,
|
631
|
+
'val5' => val5,
|
632
|
+
'val6' => val6,
|
633
|
+
},
|
634
|
+
}
|
635
|
+
|
636
|
+
modify_router_static_attributes_input_validate input
|
637
|
+
|
638
|
+
request = Request.new input
|
639
|
+
request.send
|
640
|
+
end
|
641
|
+
|
642
|
+
private
|
643
|
+
|
644
|
+
def modify_router_static_attributes_input_validate(input)
|
645
|
+
input.deep_stringify_keys!
|
646
|
+
|
647
|
+
unless !input['request_params']['router_static'].nil? && !input['request_params']['router_static'].to_s.empty?
|
648
|
+
raise ParameterRequiredError.new('router_static', 'ModifyRouterStaticAttributesInput')
|
649
|
+
end
|
650
|
+
end
|
651
|
+
|
652
|
+
public
|
653
|
+
|
654
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/modify_router_static_entry_attributes.html
|
655
|
+
def modify_router_static_entry_attributes(router_static_entry: '', router_static_entry_name: '', val1: '', val2: '')
|
656
|
+
input = {
|
657
|
+
config: config,
|
658
|
+
properties: properties,
|
659
|
+
api_name: 'ModifyRouterStaticEntryAttributes',
|
660
|
+
request_method: 'GET',
|
661
|
+
request_params: {
|
662
|
+
'router_static_entry' => router_static_entry,
|
663
|
+
'router_static_entry_name' => router_static_entry_name,
|
664
|
+
'val1' => val1,
|
665
|
+
'val2' => val2,
|
666
|
+
},
|
667
|
+
}
|
668
|
+
|
669
|
+
modify_router_static_entry_attributes_input_validate input
|
670
|
+
|
671
|
+
request = Request.new input
|
672
|
+
request.send
|
673
|
+
end
|
674
|
+
|
675
|
+
private
|
676
|
+
|
677
|
+
def modify_router_static_entry_attributes_input_validate(input)
|
678
|
+
input.deep_stringify_keys!
|
679
|
+
|
680
|
+
unless !input['request_params']['router_static_entry'].nil? && !input['request_params']['router_static_entry'].to_s.empty?
|
681
|
+
raise ParameterRequiredError.new('router_static_entry', 'ModifyRouterStaticEntryAttributesInput')
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
685
|
+
public
|
686
|
+
|
687
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/poweroff_routers.html
|
688
|
+
def power_off_routers(routers: [])
|
689
|
+
input = {
|
690
|
+
config: config,
|
691
|
+
properties: properties,
|
692
|
+
api_name: 'PowerOffRouters',
|
693
|
+
request_method: 'GET',
|
694
|
+
request_params: {
|
695
|
+
'routers' => routers,
|
696
|
+
},
|
697
|
+
}
|
698
|
+
|
699
|
+
power_off_routers_input_validate input
|
700
|
+
|
701
|
+
request = Request.new input
|
702
|
+
request.send
|
703
|
+
end
|
704
|
+
|
705
|
+
private
|
706
|
+
|
707
|
+
def power_off_routers_input_validate(input)
|
708
|
+
input.deep_stringify_keys!
|
709
|
+
|
710
|
+
unless !input['request_params']['routers'].nil? && !input['request_params']['routers'].to_s.empty?
|
711
|
+
raise ParameterRequiredError.new('routers', 'PowerOffRoutersInput')
|
712
|
+
end
|
713
|
+
end
|
714
|
+
|
715
|
+
public
|
716
|
+
|
717
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/poweron_routers.html
|
718
|
+
def power_on_routers(routers: [])
|
719
|
+
input = {
|
720
|
+
config: config,
|
721
|
+
properties: properties,
|
722
|
+
api_name: 'PowerOnRouters',
|
723
|
+
request_method: 'GET',
|
724
|
+
request_params: {
|
725
|
+
'routers' => routers,
|
726
|
+
},
|
727
|
+
}
|
728
|
+
|
729
|
+
power_on_routers_input_validate input
|
730
|
+
|
731
|
+
request = Request.new input
|
732
|
+
request.send
|
733
|
+
end
|
734
|
+
|
735
|
+
private
|
736
|
+
|
737
|
+
def power_on_routers_input_validate(input)
|
738
|
+
input.deep_stringify_keys!
|
739
|
+
|
740
|
+
unless !input['request_params']['routers'].nil? && !input['request_params']['routers'].to_s.empty?
|
741
|
+
raise ParameterRequiredError.new('routers', 'PowerOnRoutersInput')
|
742
|
+
end
|
743
|
+
end
|
744
|
+
|
745
|
+
public
|
746
|
+
|
747
|
+
# Documentation URL: https://docs.qingcloud.com/api/router/update_routers.html
|
748
|
+
def update_routers(routers: [])
|
749
|
+
input = {
|
750
|
+
config: config,
|
751
|
+
properties: properties,
|
752
|
+
api_name: 'UpdateRouters',
|
753
|
+
request_method: 'GET',
|
754
|
+
request_params: {
|
755
|
+
'routers' => routers,
|
756
|
+
},
|
757
|
+
}
|
758
|
+
|
759
|
+
update_routers_input_validate input
|
760
|
+
|
761
|
+
request = Request.new input
|
762
|
+
request.send
|
763
|
+
end
|
764
|
+
|
765
|
+
private
|
766
|
+
|
767
|
+
def update_routers_input_validate(input)
|
768
|
+
input.deep_stringify_keys!
|
769
|
+
|
770
|
+
unless !input['request_params']['routers'].nil? && !input['request_params']['routers'].to_s.empty?
|
771
|
+
raise ParameterRequiredError.new('routers', 'UpdateRoutersInput')
|
772
|
+
end
|
773
|
+
end
|
774
|
+
|
775
|
+
public
|
776
|
+
end
|
777
|
+
end
|
778
|
+
end
|