qingcloudserver 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/client/service.rb +64 -0
- data/lib/version.rb +1 -1
- data/qingcloudserver.gemspec +0 -2
- data/test/server_test.rb +25 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 681864bd01c5b179cce3e81d386f546d123aa2ea
|
4
|
+
data.tar.gz: 3f2b93ab9a729142e2353c41760c0478fb946179
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f900d9008f9ddf4d203a1233d21f22b6b71d8c21951684be939400a1b32a667a81a14880aa800d74c25051632237780707d7a3f9e8554411ee49377a0ff9078
|
7
|
+
data.tar.gz: 4b2c5f3dbd437ea2e317eb2c0184f5dab4ca78efe888642d7ce0c496f8d5f3298bbf6a239d3f9fdaeaaa71c8f5f0303504fd3c4855ef88c9f74ed50d84af5806
|
data/lib/client/service.rb
CHANGED
@@ -14,6 +14,70 @@ module QingCloudServer
|
|
14
14
|
zone:
|
15
15
|
)eval(make_action_and_params)
|
16
16
|
end
|
17
|
+
|
18
|
+
def run_instances(
|
19
|
+
image_id:,
|
20
|
+
instance_type: nil,
|
21
|
+
cpu: nil,
|
22
|
+
memory: nil,
|
23
|
+
count: 1,
|
24
|
+
instance_name: nil,
|
25
|
+
login_mode:,
|
26
|
+
login_pair: nil,
|
27
|
+
login_passwd: nil,
|
28
|
+
vxnets_N: [],
|
29
|
+
security_group: nil,
|
30
|
+
volumes_N: [],
|
31
|
+
need_newsid: nil,
|
32
|
+
need_userdata: nil,
|
33
|
+
user_data_type: nil,
|
34
|
+
user_data_value: nil,
|
35
|
+
user_data_path: nil,
|
36
|
+
user_data_file: nil,
|
37
|
+
zone:)eval(make_action_and_params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def terminate_instances(
|
41
|
+
instances_N:,
|
42
|
+
zone:
|
43
|
+
)eval(make_action_and_params)
|
44
|
+
end
|
45
|
+
|
46
|
+
def start_instances(
|
47
|
+
instances_N:,
|
48
|
+
zone:
|
49
|
+
)eval(make_action_and_params)
|
50
|
+
end
|
51
|
+
|
52
|
+
def stop_instances(
|
53
|
+
instances_N:,
|
54
|
+
force: nil,
|
55
|
+
zone:
|
56
|
+
)eval(make_action_and_params)
|
57
|
+
end
|
58
|
+
|
59
|
+
def restart_instances(
|
60
|
+
instances_N:,
|
61
|
+
zone:
|
62
|
+
)eval(make_action_and_params)
|
63
|
+
end
|
64
|
+
|
65
|
+
def resize_instances(
|
66
|
+
instances_N:,
|
67
|
+
instance_type: nil,
|
68
|
+
cpu: nil,
|
69
|
+
memory: nil,
|
70
|
+
zone:
|
71
|
+
)eval(make_action_and_params)
|
72
|
+
end
|
73
|
+
|
74
|
+
def modify_instance_attributes(
|
75
|
+
instance:,
|
76
|
+
instance_name: nil,
|
77
|
+
description: nil,
|
78
|
+
zone:
|
79
|
+
)eval(make_action_and_params)
|
80
|
+
end
|
17
81
|
end
|
18
82
|
end
|
19
83
|
end
|
data/lib/version.rb
CHANGED
data/qingcloudserver.gemspec
CHANGED
data/test/server_test.rb
CHANGED
@@ -3,6 +3,29 @@ require_relative '../lib/qingcloud_server'
|
|
3
3
|
connector = QingCloudServer::Client::Connector.init("NULYIYWTTUXRAGENKRQM", "SKw7I862utQqhH98jTsKaxyWMybe2jrY0cF8EgE0")
|
4
4
|
service = QingCloudServer::Client::Service.new(connector)
|
5
5
|
|
6
|
-
|
6
|
+
# tj = status_N: ["running"]
|
7
|
+
# tj = instances_N: ["i-j7rdjua9"]
|
8
|
+
# service.describe_instances(status_N: ["running"], zone:'pek2', offset: 10, limit: 100, verbose: 1)
|
7
9
|
|
8
|
-
puts service.response
|
10
|
+
# puts "response.class is {service.response.class}"
|
11
|
+
# puts service.response
|
12
|
+
|
13
|
+
# service.run_instances(image_id: "img-e9stua0m", login_mode: "passwd", login_passwd: "Sillyboy12$", zone: "pek2", cpu:1, memory: 1024)
|
14
|
+
# puts "run_instances #{service.response}"
|
15
|
+
|
16
|
+
# service.terminate_instances(instances_N:["i-29stv83u"], zone: "pek2")
|
17
|
+
# puts "terminate_instances #{service.response}"
|
18
|
+
|
19
|
+
|
20
|
+
# service.stop_instances(instances_N: ["i-j7rdjua9"], zone: "pek2")
|
21
|
+
|
22
|
+
# service.restart_instances(instances_N: ["i-j7rdjua9"], zone: "pek2")
|
23
|
+
# puts service.response
|
24
|
+
|
25
|
+
# service.resize_instances(instances_N: ["i-j7rdjua9"], cpu: 1, memory: 1024, zone: "pek2")
|
26
|
+
# puts service.response
|
27
|
+
|
28
|
+
# service.start_instances(instances_N: ["i-j7rdjua9"], zone: "pek2")
|
29
|
+
# puts service.response
|
30
|
+
|
31
|
+
service.modify_instance_attributes(instance: "i-j7rdjua9", instance_name: "centos_test_yuehua", zone: "pek2")
|