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,185 @@
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
+ # QingCloud provides QingCloud Service API (API Version 2013-08-30)
22
+ class QingCloudService
23
+ attr_accessor :config, :properties
24
+
25
+ def initialize(config)
26
+ self.config = config
27
+ self.properties = {
28
+ }
29
+ end
30
+
31
+ # Documentation URL: https://docs.qingcloud.com/api/zone/describe_zones.html
32
+ def describe_zones(status: [], zones: [])
33
+ input = {
34
+ config: config,
35
+ properties: properties,
36
+ api_name: 'DescribeZones',
37
+ request_method: 'GET',
38
+ request_params: {
39
+ 'status' => status,
40
+ 'zones' => zones,
41
+ },
42
+ }
43
+
44
+ describe_zones_input_validate input
45
+
46
+ request = Request.new input
47
+ request.send
48
+ end
49
+
50
+ private
51
+
52
+ def describe_zones_input_validate(input)
53
+ input.deep_stringify_keys!
54
+ end
55
+
56
+ public
57
+
58
+ def cache(zone)
59
+ properties = {
60
+ 'zone' => zone,
61
+ }
62
+ CacheService.new(config, self.properties.merge(properties))
63
+ end
64
+
65
+ def dns_alias(zone)
66
+ properties = {
67
+ 'zone' => zone,
68
+ }
69
+ DNSAliasService.new(config, self.properties.merge(properties))
70
+ end
71
+
72
+ def eip(zone)
73
+ properties = {
74
+ 'zone' => zone,
75
+ }
76
+ EIPService.new(config, self.properties.merge(properties))
77
+ end
78
+
79
+ def image(zone)
80
+ properties = {
81
+ 'zone' => zone,
82
+ }
83
+ ImageService.new(config, self.properties.merge(properties))
84
+ end
85
+
86
+ def instance(zone)
87
+ properties = {
88
+ 'zone' => zone,
89
+ }
90
+ InstanceService.new(config, self.properties.merge(properties))
91
+ end
92
+
93
+ def job(zone)
94
+ properties = {
95
+ 'zone' => zone,
96
+ }
97
+ JobService.new(config, self.properties.merge(properties))
98
+ end
99
+
100
+ def key_pair(zone)
101
+ properties = {
102
+ 'zone' => zone,
103
+ }
104
+ KeyPairService.new(config, self.properties.merge(properties))
105
+ end
106
+
107
+ def load_balancer(zone)
108
+ properties = {
109
+ 'zone' => zone,
110
+ }
111
+ LoadBalancerService.new(config, self.properties.merge(properties))
112
+ end
113
+
114
+ def mongo(zone)
115
+ properties = {
116
+ 'zone' => zone,
117
+ }
118
+ MongoService.new(config, self.properties.merge(properties))
119
+ end
120
+
121
+ def rdb(zone)
122
+ properties = {
123
+ 'zone' => zone,
124
+ }
125
+ RDBService.new(config, self.properties.merge(properties))
126
+ end
127
+
128
+ def router(zone)
129
+ properties = {
130
+ 'zone' => zone,
131
+ }
132
+ RouterService.new(config, self.properties.merge(properties))
133
+ end
134
+
135
+ def security_group(zone)
136
+ properties = {
137
+ 'zone' => zone,
138
+ }
139
+ SecurityGroupService.new(config, self.properties.merge(properties))
140
+ end
141
+
142
+ def shared_storage(zone)
143
+ properties = {
144
+ 'zone' => zone,
145
+ }
146
+ SharedStorageService.new(config, self.properties.merge(properties))
147
+ end
148
+
149
+ def snapshot(zone)
150
+ properties = {
151
+ 'zone' => zone,
152
+ }
153
+ SnapshotService.new(config, self.properties.merge(properties))
154
+ end
155
+
156
+ def tag(zone)
157
+ properties = {
158
+ 'zone' => zone,
159
+ }
160
+ TagService.new(config, self.properties.merge(properties))
161
+ end
162
+
163
+ def user_data(zone)
164
+ properties = {
165
+ 'zone' => zone,
166
+ }
167
+ UserDataService.new(config, self.properties.merge(properties))
168
+ end
169
+
170
+ def volume(zone)
171
+ properties = {
172
+ 'zone' => zone,
173
+ }
174
+ VolumeService.new(config, self.properties.merge(properties))
175
+ end
176
+
177
+ def vxnet(zone)
178
+ properties = {
179
+ 'zone' => zone,
180
+ }
181
+ VxNetService.new(config, self.properties.merge(properties))
182
+ end
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,751 @@
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 RDBService
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/rdb/apply_rdb_parameter_group.html
30
+ def apply_rdb_parameter_group(rdb: '')
31
+ input = {
32
+ config: config,
33
+ properties: properties,
34
+ api_name: 'ApplyRDBParameterGroup',
35
+ request_method: 'GET',
36
+ request_params: {
37
+ 'rdb' => rdb,
38
+ },
39
+ }
40
+
41
+ apply_rdb_parameter_group_input_validate input
42
+
43
+ request = Request.new input
44
+ request.send
45
+ end
46
+
47
+ private
48
+
49
+ def apply_rdb_parameter_group_input_validate(input)
50
+ input.deep_stringify_keys!
51
+
52
+ unless !input['request_params']['rdb'].nil? && !input['request_params']['rdb'].to_s.empty?
53
+ raise ParameterRequiredError.new('rdb', 'ApplyRDBParameterGroupInput')
54
+ end
55
+ end
56
+
57
+ public
58
+
59
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/cease_rdb_instance.html
60
+ def cease_rdb_instance(rdb: '', rdb_instance: '')
61
+ input = {
62
+ config: config,
63
+ properties: properties,
64
+ api_name: 'CeaseRDBInstance',
65
+ request_method: 'GET',
66
+ request_params: {
67
+ 'rdb' => rdb,
68
+ 'rdb_instance' => rdb_instance,
69
+ },
70
+ }
71
+
72
+ cease_rdb_instance_input_validate input
73
+
74
+ request = Request.new input
75
+ request.send
76
+ end
77
+
78
+ private
79
+
80
+ def cease_rdb_instance_input_validate(input)
81
+ input.deep_stringify_keys!
82
+
83
+ unless !input['request_params']['rdb'].nil? && !input['request_params']['rdb'].to_s.empty?
84
+ raise ParameterRequiredError.new('rdb', 'CeaseRDBInstanceInput')
85
+ end
86
+
87
+ unless !input['request_params']['rdb_instance'].nil? && !input['request_params']['rdb_instance'].to_s.empty?
88
+ raise ParameterRequiredError.new('rdb_instance', 'CeaseRDBInstanceInput')
89
+ end
90
+ end
91
+
92
+ public
93
+
94
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/copy_rdb_instance_files_to_ftp.html
95
+ def copy_rdb_instance_files_to_f_t_p(files: [], rdb_instance: '')
96
+ input = {
97
+ config: config,
98
+ properties: properties,
99
+ api_name: 'CopyRDBInstanceFilesToFTP',
100
+ request_method: 'GET',
101
+ request_params: {
102
+ 'files' => files,
103
+ 'rdb_instance' => rdb_instance,
104
+ },
105
+ }
106
+
107
+ copy_rdb_instance_files_to_f_t_p_input_validate input
108
+
109
+ request = Request.new input
110
+ request.send
111
+ end
112
+
113
+ private
114
+
115
+ def copy_rdb_instance_files_to_f_t_p_input_validate(input)
116
+ input.deep_stringify_keys!
117
+
118
+ unless !input['request_params']['files'].nil? && !input['request_params']['files'].to_s.empty?
119
+ raise ParameterRequiredError.new('files', 'CopyRDBInstanceFilesToFTPInput')
120
+ end
121
+
122
+ unless !input['request_params']['rdb_instance'].nil? && !input['request_params']['rdb_instance'].to_s.empty?
123
+ raise ParameterRequiredError.new('rdb_instance', 'CopyRDBInstanceFilesToFTPInput')
124
+ end
125
+ end
126
+
127
+ public
128
+
129
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/create_rdb.html
130
+ def create_rdb(auto_backup_time: nil, description: '', engine_version: '', node_count: nil, private_ips: [], proxy_count: nil, rdb_class: nil, rdb_engine: '', rdb_name: '', rdb_password: '', rdb_type: nil, rdb_username: '', storage_size: nil, vxnet: '')
131
+ input = {
132
+ config: config,
133
+ properties: properties,
134
+ api_name: 'CreateRDB',
135
+ request_method: 'GET',
136
+ request_params: {
137
+ 'auto_backup_time' => auto_backup_time,
138
+ 'description' => description,
139
+ 'engine_version' => engine_version, # engine_version's available values: mysql,5.5, mysql,5.6, mysql,5.7, psql,9.3, psql,9.4
140
+ 'node_count' => node_count,
141
+ 'private_ips' => private_ips,
142
+ 'proxy_count' => proxy_count,
143
+ 'rdb_class' => rdb_class,
144
+ 'rdb_engine' => rdb_engine, # rdb_engine's available values: mysql, psql
145
+ 'rdb_name' => rdb_name,
146
+ 'rdb_password' => rdb_password,
147
+ 'rdb_type' => rdb_type, # rdb_type's available values: 1, 2, 4, 8, 16, 32
148
+ 'rdb_username' => rdb_username,
149
+ 'storage_size' => storage_size,
150
+ 'vxnet' => vxnet,
151
+ },
152
+ }
153
+
154
+ create_rdb_input_validate input
155
+
156
+ request = Request.new input
157
+ request.send
158
+ end
159
+
160
+ private
161
+
162
+ def create_rdb_input_validate(input)
163
+ input.deep_stringify_keys!
164
+
165
+ if input['request_params']['engine_version'] && !input['request_params']['engine_version'].to_s.empty?
166
+ engine_version_valid_values = ['mysql,5.5', 'mysql,5.6', 'mysql,5.7', 'psql,9.3', 'psql,9.4']
167
+ unless engine_version_valid_values.include? input['request_params']['engine_version'].to_s
168
+ raise ParameterValueNotAllowedError.new(
169
+ 'engine_version',
170
+ input['request_params']['engine_version'],
171
+ engine_version_valid_values,
172
+ )
173
+ end
174
+ end
175
+
176
+ input['request_params']['private_ips'].map do |x|
177
+ end
178
+
179
+ if input['request_params']['rdb_engine'] && !input['request_params']['rdb_engine'].to_s.empty?
180
+ rdb_engine_valid_values = %w(mysql psql)
181
+ unless rdb_engine_valid_values.include? input['request_params']['rdb_engine'].to_s
182
+ raise ParameterValueNotAllowedError.new(
183
+ 'rdb_engine',
184
+ input['request_params']['rdb_engine'],
185
+ rdb_engine_valid_values,
186
+ )
187
+ end
188
+ end
189
+
190
+ unless !input['request_params']['rdb_password'].nil? && !input['request_params']['rdb_password'].to_s.empty?
191
+ raise ParameterRequiredError.new('rdb_password', 'CreateRDBInput')
192
+ end
193
+
194
+ unless !input['request_params']['rdb_type'].nil? && !input['request_params']['rdb_type'].to_s.empty?
195
+ raise ParameterRequiredError.new('rdb_type', 'CreateRDBInput')
196
+ end
197
+
198
+ if input['request_params']['rdb_type'] && !input['request_params']['rdb_type'].to_s.empty?
199
+ rdb_type_valid_values = %w(1 2 4 8 16 32)
200
+ unless rdb_type_valid_values.include? input['request_params']['rdb_type'].to_s
201
+ raise ParameterValueNotAllowedError.new(
202
+ 'rdb_type',
203
+ input['request_params']['rdb_type'],
204
+ rdb_type_valid_values,
205
+ )
206
+ end
207
+ end
208
+
209
+ unless !input['request_params']['rdb_username'].nil? && !input['request_params']['rdb_username'].to_s.empty?
210
+ raise ParameterRequiredError.new('rdb_username', 'CreateRDBInput')
211
+ end
212
+
213
+ unless !input['request_params']['storage_size'].nil? && !input['request_params']['storage_size'].to_s.empty?
214
+ raise ParameterRequiredError.new('storage_size', 'CreateRDBInput')
215
+ end
216
+
217
+ unless !input['request_params']['vxnet'].nil? && !input['request_params']['vxnet'].to_s.empty?
218
+ raise ParameterRequiredError.new('vxnet', 'CreateRDBInput')
219
+ end
220
+ end
221
+
222
+ public
223
+
224
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/create_rdb_from_snapshot.html
225
+ def create_rdb_from_snapshot(auto_backup_time: nil, description: '', engine_version: '', node_count: nil, private_ips: [], proxy_count: nil, rdb_engine: '', rdb_name: '', rdb_type: nil, snapshot: '', storage_size: nil, vxnet: '')
226
+ input = {
227
+ config: config,
228
+ properties: properties,
229
+ api_name: 'CreateRDBFromSnapshot',
230
+ request_method: 'GET',
231
+ request_params: {
232
+ 'auto_backup_time' => auto_backup_time,
233
+ 'description' => description,
234
+ 'engine_version' => engine_version, # engine_version's available values: mysql,5.5, mysql,5.6, mysql,5.7, psql,9.3, psql,9.4
235
+ 'node_count' => node_count,
236
+ 'private_ips' => private_ips,
237
+ 'proxy_count' => proxy_count,
238
+ 'rdb_engine' => rdb_engine, # rdb_engine's available values: mysql, psql
239
+ 'rdb_name' => rdb_name,
240
+ 'rdb_type' => rdb_type, # rdb_type's available values: 1, 2, 4, 8, 16, 32
241
+ 'snapshot' => snapshot,
242
+ 'storage_size' => storage_size,
243
+ 'vxnet' => vxnet,
244
+ },
245
+ }
246
+
247
+ create_rdb_from_snapshot_input_validate input
248
+
249
+ request = Request.new input
250
+ request.send
251
+ end
252
+
253
+ private
254
+
255
+ def create_rdb_from_snapshot_input_validate(input)
256
+ input.deep_stringify_keys!
257
+
258
+ if input['request_params']['engine_version'] && !input['request_params']['engine_version'].to_s.empty?
259
+ engine_version_valid_values = ['mysql,5.5', 'mysql,5.6', 'mysql,5.7', 'psql,9.3', 'psql,9.4']
260
+ unless engine_version_valid_values.include? input['request_params']['engine_version'].to_s
261
+ raise ParameterValueNotAllowedError.new(
262
+ 'engine_version',
263
+ input['request_params']['engine_version'],
264
+ engine_version_valid_values,
265
+ )
266
+ end
267
+ end
268
+
269
+ input['request_params']['private_ips'].map do |x|
270
+ end
271
+
272
+ if input['request_params']['rdb_engine'] && !input['request_params']['rdb_engine'].to_s.empty?
273
+ rdb_engine_valid_values = %w(mysql psql)
274
+ unless rdb_engine_valid_values.include? input['request_params']['rdb_engine'].to_s
275
+ raise ParameterValueNotAllowedError.new(
276
+ 'rdb_engine',
277
+ input['request_params']['rdb_engine'],
278
+ rdb_engine_valid_values,
279
+ )
280
+ end
281
+ end
282
+
283
+ unless !input['request_params']['rdb_type'].nil? && !input['request_params']['rdb_type'].to_s.empty?
284
+ raise ParameterRequiredError.new('rdb_type', 'CreateRDBFromSnapshotInput')
285
+ end
286
+
287
+ if input['request_params']['rdb_type'] && !input['request_params']['rdb_type'].to_s.empty?
288
+ rdb_type_valid_values = %w(1 2 4 8 16 32)
289
+ unless rdb_type_valid_values.include? input['request_params']['rdb_type'].to_s
290
+ raise ParameterValueNotAllowedError.new(
291
+ 'rdb_type',
292
+ input['request_params']['rdb_type'],
293
+ rdb_type_valid_values,
294
+ )
295
+ end
296
+ end
297
+
298
+ unless !input['request_params']['snapshot'].nil? && !input['request_params']['snapshot'].to_s.empty?
299
+ raise ParameterRequiredError.new('snapshot', 'CreateRDBFromSnapshotInput')
300
+ end
301
+
302
+ unless !input['request_params']['vxnet'].nil? && !input['request_params']['vxnet'].to_s.empty?
303
+ raise ParameterRequiredError.new('vxnet', 'CreateRDBFromSnapshotInput')
304
+ end
305
+ end
306
+
307
+ public
308
+
309
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/create_temp_rdb_instance_from_snapshot.html
310
+ def create_temp_rdb_instance_from_snapshot(rdb: '', snapshot: '')
311
+ input = {
312
+ config: config,
313
+ properties: properties,
314
+ api_name: 'CreateTempRDBInstanceFromSnapshot',
315
+ request_method: 'GET',
316
+ request_params: {
317
+ 'rdb' => rdb,
318
+ 'snapshot' => snapshot,
319
+ },
320
+ }
321
+
322
+ create_temp_rdb_instance_from_snapshot_input_validate input
323
+
324
+ request = Request.new input
325
+ request.send
326
+ end
327
+
328
+ private
329
+
330
+ def create_temp_rdb_instance_from_snapshot_input_validate(input)
331
+ input.deep_stringify_keys!
332
+
333
+ unless !input['request_params']['rdb'].nil? && !input['request_params']['rdb'].to_s.empty?
334
+ raise ParameterRequiredError.new('rdb', 'CreateTempRDBInstanceFromSnapshotInput')
335
+ end
336
+
337
+ unless !input['request_params']['snapshot'].nil? && !input['request_params']['snapshot'].to_s.empty?
338
+ raise ParameterRequiredError.new('snapshot', 'CreateTempRDBInstanceFromSnapshotInput')
339
+ end
340
+ end
341
+
342
+ public
343
+
344
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/delete_rdbs.html
345
+ def delete_rdbs(rdbs: [])
346
+ input = {
347
+ config: config,
348
+ properties: properties,
349
+ api_name: 'DeleteRDBs',
350
+ request_method: 'GET',
351
+ request_params: {
352
+ 'rdbs' => rdbs,
353
+ },
354
+ }
355
+
356
+ delete_rdbs_input_validate input
357
+
358
+ request = Request.new input
359
+ request.send
360
+ end
361
+
362
+ private
363
+
364
+ def delete_rdbs_input_validate(input)
365
+ input.deep_stringify_keys!
366
+
367
+ unless !input['request_params']['rdbs'].nil? && !input['request_params']['rdbs'].to_s.empty?
368
+ raise ParameterRequiredError.new('rdbs', 'DeleteRDBsInput')
369
+ end
370
+ end
371
+
372
+ public
373
+
374
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/describe_rdb_parameters.html
375
+ def describe_rdb_parameters(limit: nil, offset: nil, parameter_group: '', rdb: '')
376
+ input = {
377
+ config: config,
378
+ properties: properties,
379
+ api_name: 'DescribeRDBParameters',
380
+ request_method: 'GET',
381
+ request_params: {
382
+ 'limit' => limit,
383
+ 'offset' => offset,
384
+ 'parameter_group' => parameter_group,
385
+ 'rdb' => rdb,
386
+ },
387
+ }
388
+
389
+ describe_rdb_parameters_input_validate input
390
+
391
+ request = Request.new input
392
+ request.send
393
+ end
394
+
395
+ private
396
+
397
+ def describe_rdb_parameters_input_validate(input)
398
+ input.deep_stringify_keys!
399
+
400
+ unless !input['request_params']['rdb'].nil? && !input['request_params']['rdb'].to_s.empty?
401
+ raise ParameterRequiredError.new('rdb', 'DescribeRDBParametersInput')
402
+ end
403
+ end
404
+
405
+ public
406
+
407
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/describe_rdbs.html
408
+ def describe_rdbs(limit: nil, offset: nil, rdb_engine: '', rdb_name: '', rdbs: [], search_word: '', status: [], tags: [], verbose: nil)
409
+ input = {
410
+ config: config,
411
+ properties: properties,
412
+ api_name: 'DescribeRDBs',
413
+ request_method: 'GET',
414
+ request_params: {
415
+ 'limit' => limit,
416
+ 'offset' => offset,
417
+ 'rdb_engine' => rdb_engine,
418
+ 'rdb_name' => rdb_name,
419
+ 'rdbs' => rdbs,
420
+ 'search_word' => search_word,
421
+ 'status' => status,
422
+ 'tags' => tags,
423
+ 'verbose' => verbose,
424
+ },
425
+ }
426
+
427
+ describe_rdbs_input_validate input
428
+
429
+ request = Request.new input
430
+ request.send
431
+ end
432
+
433
+ private
434
+
435
+ def describe_rdbs_input_validate(input)
436
+ input.deep_stringify_keys!
437
+ end
438
+
439
+ public
440
+
441
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/get_rdb_instance_files.html
442
+ def get_rdb_instance_files(rdb_instance: '')
443
+ input = {
444
+ config: config,
445
+ properties: properties,
446
+ api_name: 'GetRDBInstanceFiles',
447
+ request_method: 'GET',
448
+ request_params: {
449
+ 'rdb_instance' => rdb_instance,
450
+ },
451
+ }
452
+
453
+ get_rdb_instance_files_input_validate input
454
+
455
+ request = Request.new input
456
+ request.send
457
+ end
458
+
459
+ private
460
+
461
+ def get_rdb_instance_files_input_validate(input)
462
+ input.deep_stringify_keys!
463
+
464
+ unless !input['request_params']['rdb_instance'].nil? && !input['request_params']['rdb_instance'].to_s.empty?
465
+ raise ParameterRequiredError.new('rdb_instance', 'GetRDBInstanceFilesInput')
466
+ end
467
+ end
468
+
469
+ public
470
+
471
+ # Documentation URL: https://docs.qingcloud.com/api/monitor/get_rdb_monitor.html
472
+ def get_rdb_monitor(end_time: '', meters: [], rdb_engine: '', rdb_instance: '', resource: '', role: '', start_time: '', step: '')
473
+ input = {
474
+ config: config,
475
+ properties: properties,
476
+ api_name: 'GetRDBMonitor',
477
+ request_method: 'GET',
478
+ request_params: {
479
+ 'end_time' => end_time,
480
+ 'meters' => meters,
481
+ 'rdb_engine' => rdb_engine,
482
+ 'rdb_instance' => rdb_instance,
483
+ 'resource' => resource,
484
+ 'role' => role,
485
+ 'start_time' => start_time,
486
+ 'step' => step, # step's available values: 5m, 15m, 2h, 1d
487
+ },
488
+ }
489
+
490
+ get_rdb_monitor_input_validate input
491
+
492
+ request = Request.new input
493
+ request.send
494
+ end
495
+
496
+ private
497
+
498
+ def get_rdb_monitor_input_validate(input)
499
+ input.deep_stringify_keys!
500
+
501
+ unless !input['request_params']['end_time'].nil? && !input['request_params']['end_time'].to_s.empty?
502
+ raise ParameterRequiredError.new('end_time', 'GetRDBMonitorInput')
503
+ end
504
+
505
+ unless !input['request_params']['meters'].nil? && !input['request_params']['meters'].to_s.empty?
506
+ raise ParameterRequiredError.new('meters', 'GetRDBMonitorInput')
507
+ end
508
+
509
+ unless !input['request_params']['rdb_engine'].nil? && !input['request_params']['rdb_engine'].to_s.empty?
510
+ raise ParameterRequiredError.new('rdb_engine', 'GetRDBMonitorInput')
511
+ end
512
+
513
+ unless !input['request_params']['resource'].nil? && !input['request_params']['resource'].to_s.empty?
514
+ raise ParameterRequiredError.new('resource', 'GetRDBMonitorInput')
515
+ end
516
+
517
+ unless !input['request_params']['role'].nil? && !input['request_params']['role'].to_s.empty?
518
+ raise ParameterRequiredError.new('role', 'GetRDBMonitorInput')
519
+ end
520
+
521
+ unless !input['request_params']['start_time'].nil? && !input['request_params']['start_time'].to_s.empty?
522
+ raise ParameterRequiredError.new('start_time', 'GetRDBMonitorInput')
523
+ end
524
+
525
+ unless !input['request_params']['step'].nil? && !input['request_params']['step'].to_s.empty?
526
+ raise ParameterRequiredError.new('step', 'GetRDBMonitorInput')
527
+ end
528
+
529
+ if input['request_params']['step'] && !input['request_params']['step'].to_s.empty?
530
+ step_valid_values = %w(5m 15m 2h 1d)
531
+ unless step_valid_values.include? input['request_params']['step'].to_s
532
+ raise ParameterValueNotAllowedError.new(
533
+ 'step',
534
+ input['request_params']['step'],
535
+ step_valid_values,
536
+ )
537
+ end
538
+ end
539
+ end
540
+
541
+ public
542
+
543
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/modify_rdb_parameters.html
544
+ def modify_rdb_parameters(parameters: [], rdb: '')
545
+ input = {
546
+ config: config,
547
+ properties: properties,
548
+ api_name: 'ModifyRDBParameters',
549
+ request_method: 'GET',
550
+ request_params: {
551
+ 'parameters' => parameters,
552
+ 'rdb' => rdb,
553
+ },
554
+ }
555
+
556
+ modify_rdb_parameters_input_validate input
557
+
558
+ request = Request.new input
559
+ request.send
560
+ end
561
+
562
+ private
563
+
564
+ def modify_rdb_parameters_input_validate(input)
565
+ input.deep_stringify_keys!
566
+
567
+ input['request_params']['parameters'].map do |x|
568
+ end
569
+
570
+ unless !input['request_params']['rdb'].nil? && !input['request_params']['rdb'].to_s.empty?
571
+ raise ParameterRequiredError.new('rdb', 'ModifyRDBParametersInput')
572
+ end
573
+ end
574
+
575
+ public
576
+
577
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/rdbs_join_vxnet.html
578
+ def rdbs_join_vxnet(rdbs: [], vxnet: '')
579
+ input = {
580
+ config: config,
581
+ properties: properties,
582
+ api_name: 'RDBsJoinVxnet',
583
+ request_method: 'GET',
584
+ request_params: {
585
+ 'rdbs' => rdbs,
586
+ 'vxnet' => vxnet,
587
+ },
588
+ }
589
+
590
+ rdbs_join_vxnet_input_validate input
591
+
592
+ request = Request.new input
593
+ request.send
594
+ end
595
+
596
+ private
597
+
598
+ def rdbs_join_vxnet_input_validate(input)
599
+ input.deep_stringify_keys!
600
+
601
+ unless !input['request_params']['rdbs'].nil? && !input['request_params']['rdbs'].to_s.empty?
602
+ raise ParameterRequiredError.new('rdbs', 'RDBsJoinVxnetInput')
603
+ end
604
+
605
+ unless !input['request_params']['vxnet'].nil? && !input['request_params']['vxnet'].to_s.empty?
606
+ raise ParameterRequiredError.new('vxnet', 'RDBsJoinVxnetInput')
607
+ end
608
+ end
609
+
610
+ public
611
+
612
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/rdbs_leave_vxnet.html
613
+ def rdbs_leave_vxnet(rdbs: [], vxnet: '')
614
+ input = {
615
+ config: config,
616
+ properties: properties,
617
+ api_name: 'RDBsLeaveVxnet',
618
+ request_method: 'GET',
619
+ request_params: {
620
+ 'rdbs' => rdbs,
621
+ 'vxnet' => vxnet,
622
+ },
623
+ }
624
+
625
+ rdbs_leave_vxnet_input_validate input
626
+
627
+ request = Request.new input
628
+ request.send
629
+ end
630
+
631
+ private
632
+
633
+ def rdbs_leave_vxnet_input_validate(input)
634
+ input.deep_stringify_keys!
635
+
636
+ unless !input['request_params']['rdbs'].nil? && !input['request_params']['rdbs'].to_s.empty?
637
+ raise ParameterRequiredError.new('rdbs', 'RDBsLeaveVxnetInput')
638
+ end
639
+
640
+ unless !input['request_params']['vxnet'].nil? && !input['request_params']['vxnet'].to_s.empty?
641
+ raise ParameterRequiredError.new('vxnet', 'RDBsLeaveVxnetInput')
642
+ end
643
+ end
644
+
645
+ public
646
+
647
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/resize_rdbs.html
648
+ def resize_rdbs(rdb_type: nil, rdbs: [], storage_size: nil)
649
+ input = {
650
+ config: config,
651
+ properties: properties,
652
+ api_name: 'ResizeRDBs',
653
+ request_method: 'GET',
654
+ request_params: {
655
+ 'rdb_type' => rdb_type, # rdb_type's available values: 1, 2, 4, 8, 16, 32
656
+ 'rdbs' => rdbs,
657
+ 'storage_size' => storage_size,
658
+ },
659
+ }
660
+
661
+ resize_rdbs_input_validate input
662
+
663
+ request = Request.new input
664
+ request.send
665
+ end
666
+
667
+ private
668
+
669
+ def resize_rdbs_input_validate(input)
670
+ input.deep_stringify_keys!
671
+
672
+ if input['request_params']['rdb_type'] && !input['request_params']['rdb_type'].to_s.empty?
673
+ rdb_type_valid_values = %w(1 2 4 8 16 32)
674
+ unless rdb_type_valid_values.include? input['request_params']['rdb_type'].to_s
675
+ raise ParameterValueNotAllowedError.new(
676
+ 'rdb_type',
677
+ input['request_params']['rdb_type'],
678
+ rdb_type_valid_values,
679
+ )
680
+ end
681
+ end
682
+
683
+ unless !input['request_params']['rdbs'].nil? && !input['request_params']['rdbs'].to_s.empty?
684
+ raise ParameterRequiredError.new('rdbs', 'ResizeRDBsInput')
685
+ end
686
+ end
687
+
688
+ public
689
+
690
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/start_rdbs.html
691
+ def start_rdbs(rdbs: [])
692
+ input = {
693
+ config: config,
694
+ properties: properties,
695
+ api_name: 'StartRDBs',
696
+ request_method: 'GET',
697
+ request_params: {
698
+ 'rdbs' => rdbs,
699
+ },
700
+ }
701
+
702
+ start_rdbs_input_validate input
703
+
704
+ request = Request.new input
705
+ request.send
706
+ end
707
+
708
+ private
709
+
710
+ def start_rdbs_input_validate(input)
711
+ input.deep_stringify_keys!
712
+
713
+ unless !input['request_params']['rdbs'].nil? && !input['request_params']['rdbs'].to_s.empty?
714
+ raise ParameterRequiredError.new('rdbs', 'StartRDBsInput')
715
+ end
716
+ end
717
+
718
+ public
719
+
720
+ # Documentation URL: https://docs.qingcloud.com/api/rdb/stop_rdbs.html
721
+ def stop_rdbs(rdbs: [])
722
+ input = {
723
+ config: config,
724
+ properties: properties,
725
+ api_name: 'StopRDBs',
726
+ request_method: 'GET',
727
+ request_params: {
728
+ 'rdbs' => rdbs,
729
+ },
730
+ }
731
+
732
+ stop_rdbs_input_validate input
733
+
734
+ request = Request.new input
735
+ request.send
736
+ end
737
+
738
+ private
739
+
740
+ def stop_rdbs_input_validate(input)
741
+ input.deep_stringify_keys!
742
+
743
+ unless !input['request_params']['rdbs'].nil? && !input['request_params']['rdbs'].to_s.empty?
744
+ raise ParameterRequiredError.new('rdbs', 'StopRDBsInput')
745
+ end
746
+ end
747
+
748
+ public
749
+ end
750
+ end
751
+ end