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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -21
  3. data/README.md +141 -61
  4. data/bin/console +3 -3
  5. data/lib/qingcloud/sdk.rb +16 -14
  6. data/lib/qingcloud/sdk/general/config.rb +70 -0
  7. data/lib/qingcloud/sdk/general/contract.rb +28 -17
  8. data/lib/qingcloud/sdk/general/default/config.yaml +13 -0
  9. data/lib/qingcloud/sdk/general/error.rb +41 -32
  10. data/lib/qingcloud/sdk/general/logger.rb +54 -0
  11. data/lib/qingcloud/sdk/request/preprocessor.rb +81 -0
  12. data/lib/qingcloud/sdk/request/request.rb +80 -0
  13. data/lib/qingcloud/sdk/request/signer.rb +53 -0
  14. data/lib/qingcloud/sdk/service/cache.rb +1005 -0
  15. data/lib/qingcloud/sdk/service/dns_alias.rb +150 -0
  16. data/lib/qingcloud/sdk/service/eip.rb +389 -0
  17. data/lib/qingcloud/sdk/service/image.rb +304 -0
  18. data/lib/qingcloud/sdk/service/instance.rb +585 -0
  19. data/lib/qingcloud/sdk/service/job.rb +71 -0
  20. data/lib/qingcloud/sdk/service/key_pair.rb +257 -0
  21. data/lib/qingcloud/sdk/service/load_balancer.rb +1119 -0
  22. data/lib/qingcloud/sdk/service/mongo.rb +566 -0
  23. data/lib/qingcloud/sdk/service/qingcloud.rb +185 -0
  24. data/lib/qingcloud/sdk/service/rdb.rb +751 -0
  25. data/lib/qingcloud/sdk/service/router.rb +778 -0
  26. data/lib/qingcloud/sdk/service/security_group.rb +645 -0
  27. data/lib/qingcloud/sdk/service/shared_storage.rb +666 -0
  28. data/lib/qingcloud/sdk/service/snapshot.rb +283 -0
  29. data/lib/qingcloud/sdk/service/tag.rb +227 -0
  30. data/lib/qingcloud/sdk/service/user_data.rb +61 -0
  31. data/lib/qingcloud/sdk/service/volume.rb +296 -0
  32. data/lib/qingcloud/sdk/service/vxnet.rb +295 -0
  33. data/lib/qingcloud/sdk/version.rb +19 -5
  34. metadata +98 -29
  35. data/.gitignore +0 -13
  36. data/.rspec +0 -2
  37. data/.travis.yml +0 -3
  38. data/Rakefile +0 -6
  39. data/lib/qingcloud/sdk/iaas/connector.rb +0 -99
  40. data/lib/qingcloud/sdk/iaas/foundation.rb +0 -73
  41. data/lib/qingcloud/sdk/iaas/service.rb +0 -1274
  42. data/lib/qingcloud/sdk/template/config.json +0 -4
  43. data/lib/qingcloud/sdk/utility/file_manager.rb +0 -43
  44. data/lib/qingcloud/sdk/utility/json_parser.rb +0 -41
  45. data/lib/qingcloud/sdk/utility/logger.rb +0 -19
  46. data/qingcloud-sdk.gemspec +0 -31
@@ -0,0 +1,645 @@
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 SecurityGroupService
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/sg/add_security_group_rules.html
30
+ def add_security_group_rules(rules: [], security_group: '')
31
+ input = {
32
+ config: config,
33
+ properties: properties,
34
+ api_name: 'AddSecurityGroupRules',
35
+ request_method: 'GET',
36
+ request_params: {
37
+ 'rules' => rules,
38
+ 'security_group' => security_group,
39
+ },
40
+ }
41
+
42
+ add_security_group_rules_input_validate input
43
+
44
+ request = Request.new input
45
+ request.send
46
+ end
47
+
48
+ private
49
+
50
+ def add_security_group_rules_input_validate(input)
51
+ input.deep_stringify_keys!
52
+
53
+ unless !input['request_params']['rules'].nil? && !input['request_params']['rules'].to_s.empty?
54
+ raise ParameterRequiredError.new('rules', 'AddSecurityGroupRulesInput')
55
+ end
56
+
57
+ input['request_params']['rules'].map do |x|
58
+ next unless x['action'] && !x['action'].to_s.empty?
59
+ action_valid_values = %w(accept drop)
60
+ next if action_valid_values.include? x['action'].to_s
61
+ raise ParameterValueNotAllowedError.new(
62
+ 'action',
63
+ x['action'],
64
+ action_valid_values,
65
+ )
66
+ end
67
+
68
+ unless !input['request_params']['security_group'].nil? && !input['request_params']['security_group'].to_s.empty?
69
+ raise ParameterRequiredError.new('security_group', 'AddSecurityGroupRulesInput')
70
+ end
71
+ end
72
+
73
+ public
74
+
75
+ # Documentation URL: https://docs.qingcloud.com/api/sg/apply_security_group.html
76
+ def apply_security_group(instances: [], security_group: '')
77
+ input = {
78
+ config: config,
79
+ properties: properties,
80
+ api_name: 'ApplySecurityGroup',
81
+ request_method: 'GET',
82
+ request_params: {
83
+ 'instances' => instances,
84
+ 'security_group' => security_group,
85
+ },
86
+ }
87
+
88
+ apply_security_group_input_validate input
89
+
90
+ request = Request.new input
91
+ request.send
92
+ end
93
+
94
+ private
95
+
96
+ def apply_security_group_input_validate(input)
97
+ input.deep_stringify_keys!
98
+
99
+ unless !input['request_params']['security_group'].nil? && !input['request_params']['security_group'].to_s.empty?
100
+ raise ParameterRequiredError.new('security_group', 'ApplySecurityGroupInput')
101
+ end
102
+ end
103
+
104
+ public
105
+
106
+ # Documentation URL: https://docs.qingcloud.com/api/sg/create_security_group.html
107
+ def create_security_group(security_group_name: '')
108
+ input = {
109
+ config: config,
110
+ properties: properties,
111
+ api_name: 'CreateSecurityGroup',
112
+ request_method: 'GET',
113
+ request_params: {
114
+ 'security_group_name' => security_group_name,
115
+ },
116
+ }
117
+
118
+ create_security_group_input_validate input
119
+
120
+ request = Request.new input
121
+ request.send
122
+ end
123
+
124
+ private
125
+
126
+ def create_security_group_input_validate(input)
127
+ input.deep_stringify_keys!
128
+ end
129
+
130
+ public
131
+
132
+ # Documentation URL: https://docs.qingcloud.com/api/sg/create_security_group_ipset.html
133
+ def create_security_group_ip_set(ipset_type: nil, security_group_ipset_name: '', val: '')
134
+ input = {
135
+ config: config,
136
+ properties: properties,
137
+ api_name: 'CreateSecurityGroupIPSet',
138
+ request_method: 'GET',
139
+ request_params: {
140
+ 'ipset_type' => ipset_type, # ipset_type's available values: 0, 1
141
+ 'security_group_ipset_name' => security_group_ipset_name,
142
+ 'val' => val,
143
+ },
144
+ }
145
+
146
+ create_security_group_ip_set_input_validate input
147
+
148
+ request = Request.new input
149
+ request.send
150
+ end
151
+
152
+ private
153
+
154
+ def create_security_group_ip_set_input_validate(input)
155
+ input.deep_stringify_keys!
156
+
157
+ unless !input['request_params']['ipset_type'].nil? && !input['request_params']['ipset_type'].to_s.empty?
158
+ raise ParameterRequiredError.new('ipset_type', 'CreateSecurityGroupIPSetInput')
159
+ end
160
+
161
+ if input['request_params']['ipset_type'] && !input['request_params']['ipset_type'].to_s.empty?
162
+ ipset_type_valid_values = %w(0 1)
163
+ unless ipset_type_valid_values.include? input['request_params']['ipset_type'].to_s
164
+ raise ParameterValueNotAllowedError.new(
165
+ 'ipset_type',
166
+ input['request_params']['ipset_type'],
167
+ ipset_type_valid_values,
168
+ )
169
+ end
170
+ end
171
+
172
+ unless !input['request_params']['val'].nil? && !input['request_params']['val'].to_s.empty?
173
+ raise ParameterRequiredError.new('val', 'CreateSecurityGroupIPSetInput')
174
+ end
175
+ end
176
+
177
+ public
178
+
179
+ # Documentation URL: https://docs.qingcloud.com/api/sg/create_security_group_snapshot.html
180
+ def create_security_group_snapshot(name: '', security_group: '')
181
+ input = {
182
+ config: config,
183
+ properties: properties,
184
+ api_name: 'CreateSecurityGroupSnapshot',
185
+ request_method: 'GET',
186
+ request_params: {
187
+ 'name' => name,
188
+ 'security_group' => security_group,
189
+ },
190
+ }
191
+
192
+ create_security_group_snapshot_input_validate input
193
+
194
+ request = Request.new input
195
+ request.send
196
+ end
197
+
198
+ private
199
+
200
+ def create_security_group_snapshot_input_validate(input)
201
+ input.deep_stringify_keys!
202
+
203
+ unless !input['request_params']['security_group'].nil? && !input['request_params']['security_group'].to_s.empty?
204
+ raise ParameterRequiredError.new('security_group', 'CreateSecurityGroupSnapshotInput')
205
+ end
206
+ end
207
+
208
+ public
209
+
210
+ # Documentation URL: https://docs.qingcloud.com/api/sg/delete_security_group_ipsets.html
211
+ def delete_security_group_ip_sets(security_group_ipsets: [])
212
+ input = {
213
+ config: config,
214
+ properties: properties,
215
+ api_name: 'DeleteSecurityGroupIPSets',
216
+ request_method: 'GET',
217
+ request_params: {
218
+ 'security_group_ipsets' => security_group_ipsets,
219
+ },
220
+ }
221
+
222
+ delete_security_group_ip_sets_input_validate input
223
+
224
+ request = Request.new input
225
+ request.send
226
+ end
227
+
228
+ private
229
+
230
+ def delete_security_group_ip_sets_input_validate(input)
231
+ input.deep_stringify_keys!
232
+
233
+ unless !input['request_params']['security_group_ipsets'].nil? && !input['request_params']['security_group_ipsets'].to_s.empty?
234
+ raise ParameterRequiredError.new('security_group_ipsets', 'DeleteSecurityGroupIPSetsInput')
235
+ end
236
+ end
237
+
238
+ public
239
+
240
+ # Documentation URL: https://docs.qingcloud.com/api/sg/delete_security_group_rules.html
241
+ def delete_security_group_rules(security_group_rules: [])
242
+ input = {
243
+ config: config,
244
+ properties: properties,
245
+ api_name: 'DeleteSecurityGroupRules',
246
+ request_method: 'GET',
247
+ request_params: {
248
+ 'security_group_rules' => security_group_rules,
249
+ },
250
+ }
251
+
252
+ delete_security_group_rules_input_validate input
253
+
254
+ request = Request.new input
255
+ request.send
256
+ end
257
+
258
+ private
259
+
260
+ def delete_security_group_rules_input_validate(input)
261
+ input.deep_stringify_keys!
262
+
263
+ unless !input['request_params']['security_group_rules'].nil? && !input['request_params']['security_group_rules'].to_s.empty?
264
+ raise ParameterRequiredError.new('security_group_rules', 'DeleteSecurityGroupRulesInput')
265
+ end
266
+ end
267
+
268
+ public
269
+
270
+ # Documentation URL: https://docs.qingcloud.com/api/sg/delete_security_group_snapshots.html
271
+ def delete_security_group_snapshots(security_group_snapshots: [])
272
+ input = {
273
+ config: config,
274
+ properties: properties,
275
+ api_name: 'DeleteSecurityGroupSnapshots',
276
+ request_method: 'GET',
277
+ request_params: {
278
+ 'security_group_snapshots' => security_group_snapshots,
279
+ },
280
+ }
281
+
282
+ delete_security_group_snapshots_input_validate input
283
+
284
+ request = Request.new input
285
+ request.send
286
+ end
287
+
288
+ private
289
+
290
+ def delete_security_group_snapshots_input_validate(input)
291
+ input.deep_stringify_keys!
292
+
293
+ unless !input['request_params']['security_group_snapshots'].nil? && !input['request_params']['security_group_snapshots'].to_s.empty?
294
+ raise ParameterRequiredError.new('security_group_snapshots', 'DeleteSecurityGroupSnapshotsInput')
295
+ end
296
+ end
297
+
298
+ public
299
+
300
+ # Documentation URL: https://docs.qingcloud.com/api/sg/delete_security_groups.html
301
+ def delete_security_groups(security_groups: [])
302
+ input = {
303
+ config: config,
304
+ properties: properties,
305
+ api_name: 'DeleteSecurityGroups',
306
+ request_method: 'GET',
307
+ request_params: {
308
+ 'security_groups' => security_groups,
309
+ },
310
+ }
311
+
312
+ delete_security_groups_input_validate input
313
+
314
+ request = Request.new input
315
+ request.send
316
+ end
317
+
318
+ private
319
+
320
+ def delete_security_groups_input_validate(input)
321
+ input.deep_stringify_keys!
322
+
323
+ unless !input['request_params']['security_groups'].nil? && !input['request_params']['security_groups'].to_s.empty?
324
+ raise ParameterRequiredError.new('security_groups', 'DeleteSecurityGroupsInput')
325
+ end
326
+ end
327
+
328
+ public
329
+
330
+ # Documentation URL: https://docs.qingcloud.com/api/sg/describe_security_group_ipsets.html
331
+ def describe_security_group_ip_sets(ipset_type: nil, limit: nil, offset: nil, security_group_ipset_name: '', security_group_ipsets: [], tags: [], verbose: nil)
332
+ input = {
333
+ config: config,
334
+ properties: properties,
335
+ api_name: 'DescribeSecurityGroupIPSets',
336
+ request_method: 'GET',
337
+ request_params: {
338
+ 'ipset_type' => ipset_type, # ipset_type's available values: 0, 1
339
+ 'limit' => limit,
340
+ 'offset' => offset,
341
+ 'security_group_ipset_name' => security_group_ipset_name,
342
+ 'security_group_ipsets' => security_group_ipsets,
343
+ 'tags' => tags,
344
+ 'verbose' => verbose,
345
+ },
346
+ }
347
+
348
+ describe_security_group_ip_sets_input_validate input
349
+
350
+ request = Request.new input
351
+ request.send
352
+ end
353
+
354
+ private
355
+
356
+ def describe_security_group_ip_sets_input_validate(input)
357
+ input.deep_stringify_keys!
358
+
359
+ if input['request_params']['ipset_type'] && !input['request_params']['ipset_type'].to_s.empty?
360
+ ipset_type_valid_values = %w(0 1)
361
+ unless ipset_type_valid_values.include? input['request_params']['ipset_type'].to_s
362
+ raise ParameterValueNotAllowedError.new(
363
+ 'ipset_type',
364
+ input['request_params']['ipset_type'],
365
+ ipset_type_valid_values,
366
+ )
367
+ end
368
+ end
369
+ end
370
+
371
+ public
372
+
373
+ # Documentation URL: https://docs.qingcloud.com/api/sg/describe_security_group_rules.html
374
+ def describe_security_group_rules(direction: nil, limit: nil, offset: nil, security_group: '', security_group_rules: [])
375
+ input = {
376
+ config: config,
377
+ properties: properties,
378
+ api_name: 'DescribeSecurityGroupRules',
379
+ request_method: 'GET',
380
+ request_params: {
381
+ 'direction' => direction, # direction's available values: 0, 1
382
+ 'limit' => limit,
383
+ 'offset' => offset,
384
+ 'security_group' => security_group,
385
+ 'security_group_rules' => security_group_rules,
386
+ },
387
+ }
388
+
389
+ describe_security_group_rules_input_validate input
390
+
391
+ request = Request.new input
392
+ request.send
393
+ end
394
+
395
+ private
396
+
397
+ def describe_security_group_rules_input_validate(input)
398
+ input.deep_stringify_keys!
399
+
400
+ if input['request_params']['direction'] && !input['request_params']['direction'].to_s.empty?
401
+ direction_valid_values = %w(0 1)
402
+ unless direction_valid_values.include? input['request_params']['direction'].to_s
403
+ raise ParameterValueNotAllowedError.new(
404
+ 'direction',
405
+ input['request_params']['direction'],
406
+ direction_valid_values,
407
+ )
408
+ end
409
+ end
410
+
411
+ unless !input['request_params']['security_group'].nil? && !input['request_params']['security_group'].to_s.empty?
412
+ raise ParameterRequiredError.new('security_group', 'DescribeSecurityGroupRulesInput')
413
+ end
414
+ end
415
+
416
+ public
417
+
418
+ # Documentation URL: https://docs.qingcloud.com/api/sg/describe_security_group_snapshots.html
419
+ def describe_security_group_snapshots(limit: nil, offset: nil, reverse: nil, security_group: '', security_group_snapshots: [])
420
+ input = {
421
+ config: config,
422
+ properties: properties,
423
+ api_name: 'DescribeSecurityGroupSnapshots',
424
+ request_method: 'GET',
425
+ request_params: {
426
+ 'limit' => limit,
427
+ 'offset' => offset,
428
+ 'reverse' => reverse,
429
+ 'security_group' => security_group,
430
+ 'security_group_snapshots' => security_group_snapshots,
431
+ },
432
+ }
433
+
434
+ describe_security_group_snapshots_input_validate input
435
+
436
+ request = Request.new input
437
+ request.send
438
+ end
439
+
440
+ private
441
+
442
+ def describe_security_group_snapshots_input_validate(input)
443
+ input.deep_stringify_keys!
444
+
445
+ unless !input['request_params']['security_group'].nil? && !input['request_params']['security_group'].to_s.empty?
446
+ raise ParameterRequiredError.new('security_group', 'DescribeSecurityGroupSnapshotsInput')
447
+ end
448
+ end
449
+
450
+ public
451
+
452
+ # Documentation URL: https://docs.qingcloud.com/api/sg/describe_security_groups.html
453
+ def describe_security_groups(limit: nil, offset: nil, search_word: '', security_groups: [], tags: [], verbose: nil)
454
+ input = {
455
+ config: config,
456
+ properties: properties,
457
+ api_name: 'DescribeSecurityGroups',
458
+ request_method: 'GET',
459
+ request_params: {
460
+ 'limit' => limit,
461
+ 'offset' => offset,
462
+ 'search_word' => search_word,
463
+ 'security_groups' => security_groups,
464
+ 'tags' => tags,
465
+ 'verbose' => verbose,
466
+ },
467
+ }
468
+
469
+ describe_security_groups_input_validate input
470
+
471
+ request = Request.new input
472
+ request.send
473
+ end
474
+
475
+ private
476
+
477
+ def describe_security_groups_input_validate(input)
478
+ input.deep_stringify_keys!
479
+ end
480
+
481
+ public
482
+
483
+ # Documentation URL: https://docs.qingcloud.com/api/sg/modify_security_group_attributes.html
484
+ def modify_security_group_attributes(description: '', security_group: '', security_group_name: '')
485
+ input = {
486
+ config: config,
487
+ properties: properties,
488
+ api_name: 'ModifySecurityGroupAttributes',
489
+ request_method: 'GET',
490
+ request_params: {
491
+ 'description' => description,
492
+ 'security_group' => security_group,
493
+ 'security_group_name' => security_group_name,
494
+ },
495
+ }
496
+
497
+ modify_security_group_attributes_input_validate input
498
+
499
+ request = Request.new input
500
+ request.send
501
+ end
502
+
503
+ private
504
+
505
+ def modify_security_group_attributes_input_validate(input)
506
+ input.deep_stringify_keys!
507
+
508
+ unless !input['request_params']['security_group'].nil? && !input['request_params']['security_group'].to_s.empty?
509
+ raise ParameterRequiredError.new('security_group', 'ModifySecurityGroupAttributesInput')
510
+ end
511
+ end
512
+
513
+ public
514
+
515
+ # Documentation URL: https://docs.qingcloud.com/api/sg/modify_security_group_ipset_attributes.html
516
+ def modify_security_group_ip_set_attributes(description: '', security_group_ipset: '', security_group_ipset_name: '', val: '')
517
+ input = {
518
+ config: config,
519
+ properties: properties,
520
+ api_name: 'ModifySecurityGroupIPSetAttributes',
521
+ request_method: 'GET',
522
+ request_params: {
523
+ 'description' => description,
524
+ 'security_group_ipset' => security_group_ipset,
525
+ 'security_group_ipset_name' => security_group_ipset_name,
526
+ 'val' => val,
527
+ },
528
+ }
529
+
530
+ modify_security_group_ip_set_attributes_input_validate input
531
+
532
+ request = Request.new input
533
+ request.send
534
+ end
535
+
536
+ private
537
+
538
+ def modify_security_group_ip_set_attributes_input_validate(input)
539
+ input.deep_stringify_keys!
540
+
541
+ unless !input['request_params']['security_group_ipset'].nil? && !input['request_params']['security_group_ipset'].to_s.empty?
542
+ raise ParameterRequiredError.new('security_group_ipset', 'ModifySecurityGroupIPSetAttributesInput')
543
+ end
544
+ end
545
+
546
+ public
547
+
548
+ # Documentation URL: https://docs.qingcloud.com/api/sg/modify_security_group_rule_attributes.html
549
+ def modify_security_group_rule_attributes(direction: nil, priority: nil, protocol: '', rule_action: '', security_group: '', security_group_rule: '', security_group_rule_name: '', val1: nil, val2: nil, val3: nil)
550
+ input = {
551
+ config: config,
552
+ properties: properties,
553
+ api_name: 'ModifySecurityGroupRuleAttributes',
554
+ request_method: 'GET',
555
+ request_params: {
556
+ 'direction' => direction, # direction's available values: 0, 1
557
+ 'priority' => priority,
558
+ 'protocol' => protocol,
559
+ 'rule_action' => rule_action, # rule_action's available values: accept, drop
560
+ 'security_group' => security_group,
561
+ 'security_group_rule' => security_group_rule,
562
+ 'security_group_rule_name' => security_group_rule_name,
563
+ 'val1' => val1,
564
+ 'val2' => val2,
565
+ 'val3' => val3,
566
+ },
567
+ }
568
+
569
+ modify_security_group_rule_attributes_input_validate input
570
+
571
+ request = Request.new input
572
+ request.send
573
+ end
574
+
575
+ private
576
+
577
+ def modify_security_group_rule_attributes_input_validate(input)
578
+ input.deep_stringify_keys!
579
+
580
+ if input['request_params']['direction'] && !input['request_params']['direction'].to_s.empty?
581
+ direction_valid_values = %w(0 1)
582
+ unless direction_valid_values.include? input['request_params']['direction'].to_s
583
+ raise ParameterValueNotAllowedError.new(
584
+ 'direction',
585
+ input['request_params']['direction'],
586
+ direction_valid_values,
587
+ )
588
+ end
589
+ end
590
+
591
+ if input['request_params']['rule_action'] && !input['request_params']['rule_action'].to_s.empty?
592
+ rule_action_valid_values = %w(accept drop)
593
+ unless rule_action_valid_values.include? input['request_params']['rule_action'].to_s
594
+ raise ParameterValueNotAllowedError.new(
595
+ 'rule_action',
596
+ input['request_params']['rule_action'],
597
+ rule_action_valid_values,
598
+ )
599
+ end
600
+ end
601
+
602
+ unless !input['request_params']['security_group_rule'].nil? && !input['request_params']['security_group_rule'].to_s.empty?
603
+ raise ParameterRequiredError.new('security_group_rule', 'ModifySecurityGroupRuleAttributesInput')
604
+ end
605
+ end
606
+
607
+ public
608
+
609
+ # Documentation URL: https://docs.qingcloud.com/api/sg/rollback_security_group.html
610
+ def rollback_security_group(security_group: '', security_group_snapshot: '')
611
+ input = {
612
+ config: config,
613
+ properties: properties,
614
+ api_name: 'RollbackSecurityGroup',
615
+ request_method: 'GET',
616
+ request_params: {
617
+ 'security_group' => security_group,
618
+ 'security_group_snapshot' => security_group_snapshot,
619
+ },
620
+ }
621
+
622
+ rollback_security_group_input_validate input
623
+
624
+ request = Request.new input
625
+ request.send
626
+ end
627
+
628
+ private
629
+
630
+ def rollback_security_group_input_validate(input)
631
+ input.deep_stringify_keys!
632
+
633
+ unless !input['request_params']['security_group'].nil? && !input['request_params']['security_group'].to_s.empty?
634
+ raise ParameterRequiredError.new('security_group', 'RollbackSecurityGroupInput')
635
+ end
636
+
637
+ unless !input['request_params']['security_group_snapshot'].nil? && !input['request_params']['security_group_snapshot'].to_s.empty?
638
+ raise ParameterRequiredError.new('security_group_snapshot', 'RollbackSecurityGroupInput')
639
+ end
640
+ end
641
+
642
+ public
643
+ end
644
+ end
645
+ end