qingcloud-sdk 0.2.3

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.
@@ -0,0 +1,699 @@
1
+ module QingCloud
2
+ module SDK
3
+ module Client
4
+
5
+ class Service < Foundation
6
+
7
+ def check_api_keys
8
+ begin
9
+ eval(build_fetch_match)
10
+ rescue Error::APIError
11
+ false
12
+ self.response['ret_code'] == 1200 ? false : true
13
+ end
14
+ end
15
+
16
+ # Instance
17
+
18
+ def describe_instances(
19
+ instances: [],
20
+ image_id: [],
21
+ instance_type: [],
22
+ status: [],
23
+ search_word: nil,
24
+ verbose: nil,
25
+ offset: nil,
26
+ limit: nil,
27
+ zone:)eval(build_fetch_match)
28
+ end
29
+
30
+ def run_instances(
31
+ image_id:,
32
+ instance_type: nil,
33
+ cpu: nil,
34
+ memory: nil,
35
+ count: 1,
36
+ instance_name: nil,
37
+ login_mode:,
38
+ login_keypair: nil,
39
+ login_passwd: nil,
40
+ vxnets: [],
41
+ security_group: nil,
42
+ volumes: [],
43
+ need_newsid: nil,
44
+ need_userdata: nil,
45
+ userdata_type: nil,
46
+ userdata_value: nil,
47
+ userdata_path: nil,
48
+ zone:)eval(build_fetch_match)
49
+ end
50
+
51
+ def terminate_instances(
52
+ instances:,
53
+ zone:)eval(build_fetch_match)
54
+ end
55
+
56
+ def start_instances(
57
+ instances:,
58
+ zone:)eval(build_fetch_match)
59
+ end
60
+
61
+ def stop_instances(
62
+ instances:,
63
+ force: nil,
64
+ zone:)eval(build_fetch_match)
65
+ end
66
+
67
+ def restart_instances(
68
+ instances:,
69
+ zone:)eval(build_fetch_match)
70
+ end
71
+
72
+ def reset_instances(
73
+ instances:,
74
+ login_mode:,
75
+ login_keypair: nil,
76
+ login_passwd: nil,
77
+ need_newsid: nil,
78
+ zone:)eval(build_fetch_match)
79
+ end
80
+
81
+ def resize_instances(
82
+ instances:,
83
+ instance_type: nil,
84
+ cpu: nil,
85
+ memory: nil,
86
+ zone: nil)eval(build_fetch_match)
87
+ end
88
+
89
+ def modify_instance_attributes(
90
+ instance:,
91
+ instance_name: nil,
92
+ description: nil,
93
+ zone:)eval(build_fetch_match)
94
+ end
95
+
96
+ # Volume
97
+
98
+ def describe_volumes(
99
+ volumes: [],
100
+ volume_type: nil,
101
+ status: [],
102
+ search_word: nil,
103
+ verbose: nil,
104
+ offset: nil,
105
+ limit: nil,
106
+ zone:)eval(build_fetch_match)
107
+ end
108
+
109
+ def create_volumes(
110
+ size:,
111
+ volume_name: nil,
112
+ volume_type: nil,
113
+ count: nil,
114
+ zone:)eval(build_fetch_match)
115
+ end
116
+
117
+ def delete_volumes(
118
+ volumes:,
119
+ zone:)eval(build_fetch_match)
120
+ end
121
+
122
+ def attach_volumes(
123
+ volumes:,
124
+ instance:,
125
+ zone:)eval(build_fetch_match)
126
+ end
127
+
128
+ def detach_volumes(
129
+ volumes:,
130
+ instance:,
131
+ zone:)eval(build_fetch_match)
132
+ end
133
+
134
+ def resize_volumes(
135
+ volumes:,
136
+ size:,
137
+ zone:)eval(build_fetch_match)
138
+ end
139
+
140
+ def modify_volume_attributes(
141
+ volume:,
142
+ volume_name: nil,
143
+ description: nil,
144
+ zone:)eval(build_fetch_match)
145
+ end
146
+
147
+ # VXNet
148
+
149
+ def describe_vxnets(
150
+ vxnets: [],
151
+ vxnet_type: nil,
152
+ search_word: nil,
153
+ verbose: nil,
154
+ offset: nil,
155
+ limit: nil,
156
+ zone:)eval(build_fetch_match)
157
+ end
158
+
159
+ def create_vxnets(
160
+ vxnet_name: nil,
161
+ vxnet_type:,
162
+ count: nil,
163
+ zone:)eval(build_fetch_match)
164
+ end
165
+
166
+ def delete_vxnets(
167
+ vxnets:,
168
+ zone:)eval(build_fetch_match)
169
+ end
170
+
171
+ def join_vxnets(
172
+ vxnet:,
173
+ instances:,
174
+ zone:)eval(build_fetch_match)
175
+ end
176
+
177
+ def leave_vxnets(
178
+ vxnet:,
179
+ instances:,
180
+ zone:)eval(build_fetch_match)
181
+ end
182
+
183
+ def modify_vxnet_attributes(
184
+ vxnet:,
185
+ vxnet_name: nil,
186
+ description: nil,
187
+ zone:)eval(build_fetch_match)
188
+ end
189
+
190
+ def describe_vxnet_instances(
191
+ vxnet:,
192
+ instances: [],
193
+ instance_type: nil,
194
+ status: nil,
195
+ image: nil,
196
+ offset: nil,
197
+ limit: nil,
198
+ zone:)eval(build_fetch_match)
199
+ end
200
+
201
+ # Router
202
+
203
+ def describe_routers(
204
+ routers: [],
205
+ status: [],
206
+ search_word: nil,
207
+ verbose: nil,
208
+ offset: nil,
209
+ limit: nil,
210
+ zone:)eval(build_fetch_match)
211
+ end
212
+
213
+ def create_routers(
214
+ router_name: nil,
215
+ router_type: nil,
216
+ count: nil,
217
+ security_group: nil,
218
+ zone:)eval(build_fetch_match)
219
+ end
220
+
221
+ def delete_routers(
222
+ routers:,
223
+ zone:)eval(build_fetch_match)
224
+ end
225
+
226
+ def update_routers(
227
+ routers:,
228
+ zone:)eval(build_fetch_match)
229
+ end
230
+
231
+ def power_off_routers(
232
+ routers:,
233
+ zone:)eval(build_fetch_match)
234
+ end
235
+
236
+ def power_on_routers(
237
+ routers:,
238
+ zone:)eval(build_fetch_match)
239
+ end
240
+
241
+ def join_routers(
242
+ vxnet:,
243
+ router:,
244
+ ip_network:,
245
+ features: nil,
246
+ zone:)eval(build_fetch_match)
247
+ end
248
+
249
+ def leave_routers(
250
+ vxnets:,
251
+ router:,
252
+ zone:)eval(build_fetch_match)
253
+ end
254
+
255
+ def modify_router_attributes(
256
+ router:,
257
+ eip: nil,
258
+ security_group: nil,
259
+ router_name: nil,
260
+ description: nil,
261
+ zone:)eval(build_fetch_match)
262
+ end
263
+
264
+ def describe_router_vxnets(
265
+ router: nil,
266
+ vxnet: nil,
267
+ verbose: nil,
268
+ offset: nil,
269
+ limit: nil,
270
+ zone:)eval(build_fetch_match)
271
+ end
272
+
273
+ # Eip
274
+
275
+ def describe_eips(
276
+ eips: [],
277
+ instance_id: nil,
278
+ status: [],
279
+ search_word: nil,
280
+ offset: nil,
281
+ limit: nil,
282
+ zone:)eval(build_fetch_match)
283
+ end
284
+
285
+ def allocate_eips(
286
+ bandwidth:,
287
+ billing_mode: nil,
288
+ eip_name: nil,
289
+ count: nil,
290
+ need_icp: nil,
291
+ zone:)eval(build_fetch_match)
292
+ end
293
+
294
+ def release_eips(
295
+ eips: [],
296
+ zone:)eval(build_fetch_match)
297
+ end
298
+
299
+ def associate_eips(
300
+ eip:,
301
+ instance:,
302
+ zone:)eval(build_fetch_match)
303
+ end
304
+
305
+ def dssociate_eips(
306
+ eip:,
307
+ zone:)eval(build_fetch_match)
308
+ end
309
+
310
+ def change_eips_bandwidth(
311
+ eips:,
312
+ bandwidth:,
313
+ zone:)eval(build_fetch_match)
314
+ end
315
+
316
+ def change_eips_billing_mode(
317
+ eips:,
318
+ billing_mode:,
319
+ zone:)eval(build_fetch_match)
320
+ end
321
+
322
+ def modify_eip_attributes(
323
+ eips:,
324
+ eip_name: nil,
325
+ description: nil,
326
+ zone:)eval(build_fetch_match)
327
+ end
328
+
329
+ # SecurityGroup
330
+
331
+ def describe_security_groups(
332
+ security_groups: [],
333
+ search_word: nil,
334
+ verbose: nil,
335
+ offset: nil,
336
+ limit: nil,
337
+ zone:)eval(build_fetch_match)
338
+ end
339
+
340
+ def create_security_group(
341
+ security_group_name: nil,
342
+ zone:)eval(build_fetch_match)
343
+ end
344
+
345
+ def delete_security_groups(
346
+ security_groups:,
347
+ zone:)eval(build_fetch_match)
348
+ end
349
+
350
+ def apply_security_group(
351
+ security_group:,
352
+ instances: [],
353
+ zone:)eval(build_fetch_match)
354
+ end
355
+
356
+ def modify_security_group_attributes(
357
+ security_group:,
358
+ security_group_name: nil,
359
+ description: nil,
360
+ zone:)eval(build_fetch_match)
361
+ end
362
+
363
+ def describe_security_group_rules(
364
+ security_group: nil,
365
+ security_group_rules: [],
366
+ direction: nil,
367
+ offset: nil,
368
+ limit: nil,
369
+ zone:)eval(build_fetch_match)
370
+ end
371
+
372
+ # KeyPair
373
+
374
+ def describe_key_pairs(
375
+ keypairs: [],
376
+ instance_id: nil,
377
+ encrypt_method: nil,
378
+ search_word: nil,
379
+ verbose: nil,
380
+ offset: nil,
381
+ limit: nil,
382
+ zone:)eval(build_fetch_match)
383
+ end
384
+
385
+ def create_key_pairs(
386
+ keypair_name: nil,
387
+ mode: nil,
388
+ encrypt_method: nil,
389
+ public_key: nil,
390
+ zone:)eval(build_fetch_match)
391
+ end
392
+
393
+ def delete_key_pairs(
394
+ keypairs:,
395
+ zone:)eval(build_fetch_match)
396
+ end
397
+
398
+ def attach_key_pairs(
399
+ keypairs:,
400
+ instances:,
401
+ zone:)eval(build_fetch_match)
402
+ end
403
+
404
+ def detach_key_pairs(
405
+ keypairs:,
406
+ instances:,
407
+ zone:)eval(build_fetch_match)
408
+ end
409
+
410
+ def modify_key_pair_attributes(
411
+ keypair:,
412
+ keypair_name: nil,
413
+ description: nil,
414
+ zone:)eval(build_fetch_match)
415
+ end
416
+
417
+ # Image
418
+
419
+ def describe_images(
420
+ images: [],
421
+ processor_type: nil,
422
+ os_family: nil,
423
+ visibility: nil,
424
+ provider: nil,
425
+ status: [],
426
+ search_word: nil,
427
+ verbose: nil,
428
+ offset: nil,
429
+ limit: nil,
430
+ zone:)eval(build_fetch_match)
431
+ end
432
+
433
+ def capture_instance(
434
+ instance:,
435
+ image_name: nil,
436
+ zone:)eval(build_fetch_match)
437
+ end
438
+
439
+ def delete_images(
440
+ images:,
441
+ zone:)eval(build_fetch_match)
442
+ end
443
+
444
+ def modify_image_attributes(
445
+ image:,
446
+ image_name: nil,
447
+ description: nil,
448
+ zone:)eval(build_fetch_match)
449
+ end
450
+
451
+ # LoadBalancer
452
+
453
+ def create_load_balancer(
454
+ eips: [],
455
+ vxnet: nil,
456
+ private_ip: nil,
457
+ loadbalancer_type: nil,
458
+ loadbalancer_name: nil,
459
+ security_group: nil,
460
+ zone:)eval(build_fetch_match)
461
+ end
462
+
463
+ def describe_load_balancers(
464
+ loadbalancers: [],
465
+ status: [],
466
+ search_word: nil,
467
+ verbose: nil,
468
+ offset: nil,
469
+ limit: nil,
470
+ zone:)eval(build_fetch_match)
471
+ end
472
+
473
+ def delete_load_balancers(
474
+ loadbalancers:,
475
+ zone:)eval(build_fetch_match)
476
+ end
477
+
478
+ def modify_load_balancer_attributes(
479
+ loadbalancer:,
480
+ loadbalancer_name: nil,
481
+ security_group: nil,
482
+ description: nil,
483
+ private_ip: nil,
484
+ zone:)eval(build_fetch_match)
485
+ end
486
+
487
+ def start_load_balancers(
488
+ loadbalancers:,
489
+ zone:)eval(build_fetch_match)
490
+ end
491
+
492
+ def stop_load_balancers(
493
+ loadbalancers:,
494
+ zone:)eval(build_fetch_match)
495
+ end
496
+
497
+ def update_load_balancers(
498
+ loadbalancers:,
499
+ zone:)eval(build_fetch_match)
500
+ end
501
+
502
+ def resize_load_balancers(
503
+ loadbalancers:,
504
+ loadbalancer_type:,
505
+ zone:)eval(build_fetch_match)
506
+ end
507
+
508
+ def associate_eips_to_load_balancer(
509
+ eips:,
510
+ loadbalancer:,
511
+ zone:)eval(build_fetch_match)
512
+ end
513
+
514
+ def dissociate_eips_from_load_balancer(
515
+ eips:,
516
+ loadbalancer:,
517
+ zone:)eval(build_fetch_match)
518
+ end
519
+
520
+ # Monitor
521
+
522
+ def get_monitor(
523
+ resource:,
524
+ meters:,
525
+ step:,
526
+ start_time:,
527
+ end_time:,
528
+ zone:)eval(build_fetch_match)
529
+ end
530
+
531
+ def get_load_balancer_monitor(
532
+ resource:,
533
+ meters:,
534
+ step:,
535
+ start_time:,
536
+ end_time:,
537
+ zone:)eval(build_fetch_match)
538
+ end
539
+
540
+ def get_rdb_monitor(
541
+ resource:,
542
+ meters:,
543
+ step:,
544
+ start_time:,
545
+ end_time:,
546
+ zone:)eval(build_fetch 'GetRDBMonitor')
547
+ end
548
+
549
+ # Snapshot
550
+
551
+ def describe_snapshots(
552
+ snapshots: [],
553
+ resource_id: nil,
554
+ snapshot_type: nil,
555
+ status: [],
556
+ search_word: nil,
557
+ verbose: nil,
558
+ offset: nil,
559
+ limit: nil,
560
+ zone:)eval(build_fetch_match)
561
+ end
562
+
563
+ def create_snapshots(
564
+ resources:,
565
+ snapshot_name: nil,
566
+ is_full: nil,
567
+ zone:)eval(build_fetch_match)
568
+ end
569
+
570
+ def delete_snapshots(
571
+ snapshots:,
572
+ zone:)eval(build_fetch_match)
573
+ end
574
+
575
+ def apply_snapshots(
576
+ snapshots:,
577
+ zone:)eval(build_fetch_match)
578
+ end
579
+
580
+ def modify_snapshot_attributes(
581
+ snapshot:,
582
+ snapshot_name: nil,
583
+ description: nil,
584
+ zone:)eval(build_fetch_match)
585
+ end
586
+
587
+ def capture_instance_from_snapshot(
588
+ snapshot:,
589
+ image_name: nil,
590
+ zone:)eval(build_fetch_match)
591
+ end
592
+
593
+ def create_volume_from_snapshot(
594
+ snapshot:,
595
+ volume_name: nil,
596
+ zone:)eval(build_fetch_match)
597
+ end
598
+
599
+ # UserData
600
+
601
+ def upload_user_data_attachment(
602
+ attachment_content:,
603
+ attachment_name: nil,
604
+ zone:)eval(build_fetch_match)
605
+ end
606
+
607
+ # Job
608
+
609
+ def describe_jobs(
610
+ jobs: [],
611
+ status: [],
612
+ job_action: nil,
613
+ verbose: nil,
614
+ offset: nil,
615
+ limit: nil,
616
+ zone:) eval(build_fetch_match)
617
+ end
618
+
619
+ # Zone
620
+
621
+ def describe_zones(
622
+ zones: [],
623
+ status: []) eval(build_fetch_match)
624
+ end
625
+
626
+ # RemoteDataBase
627
+
628
+ def create_rdb(
629
+ vxnet:,
630
+ rdb_engine: nil,
631
+ engine_version: nil,
632
+ rdb_username:,
633
+ rdb_password:,
634
+ rdb_type:,
635
+ storage_size:,
636
+ rdb_name: nil,
637
+ description: nil,
638
+ auto_backup_time: nil,
639
+ zone:)eval(build_fetch 'CreateRDB')
640
+ end
641
+
642
+ def describe_rdbs(
643
+ rdbs: [],
644
+ status: [],
645
+ rdb_name: nil,
646
+ verbose: nil,
647
+ offset: nil,
648
+ limit: nil,
649
+ zone:)eval(build_fetch 'DescribeRDBs')
650
+ end
651
+
652
+ def delete_rdbs(
653
+ rdbs:,
654
+ zone:)eval(build_fetch 'DeleteRDBs')
655
+ end
656
+
657
+ def start_rdbs(
658
+ rdbs:,
659
+ zone:)eval(build_fetch 'StartRDBs')
660
+ end
661
+
662
+ def stop_rdbs(
663
+ rdbs:,
664
+ zone:)eval(build_fetch 'StopRDBs')
665
+ end
666
+
667
+ def resize_rdbs(
668
+ rdbs:,
669
+ rdb_type: nil,
670
+ storage_size: nil,
671
+ zone:)eval(build_fetch 'ResizeRDBs')
672
+ end
673
+
674
+ def rdbs_leave_vxnet(
675
+ rdbs:,
676
+ vxnet:,
677
+ zone:)eval(build_fetch 'RDBsLeaveVxnet')
678
+ end
679
+
680
+ def rdbs_join_vxnet(
681
+ rdbs:,
682
+ vxnet:,
683
+ zone:)eval(build_fetch 'RDBsJoinVxnet')
684
+ end
685
+
686
+ def create_rdb_from_snapshot(
687
+ vxnet:,
688
+ rdb_type:,
689
+ rdb_name: nil,
690
+ description: nil,
691
+ auto_backup_time: nil,
692
+ zone:)eval(build_fetch 'CreateRDBFromSnapshot')
693
+ end
694
+
695
+ end
696
+
697
+ end
698
+ end
699
+ end
@@ -0,0 +1,19 @@
1
+ module QingCloud
2
+ module SDK
3
+ module Contract
4
+
5
+ SUPPORT_DIRECTORY = "#{Dir.home}/.qingcloud"
6
+ CONFIG_FILE_NAME = 'qingcloud.json'
7
+ CONFIG_FILE_PATH = "#{SUPPORT_DIRECTORY}/#{CONFIG_FILE_NAME}"
8
+ LOG_FILE_NAME = 'qingcloud.log'
9
+ LOG_FILE_PATH = "#{SUPPORT_DIRECTORY}/#{LOG_FILE_NAME}"
10
+
11
+ TEMPLATE_DIRECTORY = Gem::Specification.find_by_name('qingcloud-sdk').gem_dir + '/lib/qingcloud/sdk/template'
12
+ TEMPLATE_CONFIG_FILE_NAME = 'qingcloud.json'
13
+ TEMPLATE_CONFIG_FILE_PATH = "#{TEMPLATE_DIRECTORY}/#{TEMPLATE_CONFIG_FILE_NAME}"
14
+
15
+ API_URL = 'https://api.qingcloud.com/iaas/?'
16
+
17
+ end
18
+ end
19
+ end