cloudstack_client 0.4.0 → 0.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7468c8972d624355482e3946e890bd8b542e5b30
|
4
|
+
data.tar.gz: 3ef12511c1d261aab67bea420f14c1179dcb185c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc02b7356af99bae24863ff226baa5295272134a946177ce4fe218cfccf4ea08c609472cb6a9459cdce551fbf43c1f6ace4bbb224649f50ebb3ae944dd3ae2e8
|
7
|
+
data.tar.gz: 5b5f73dd889f9e00f0a7714a6e841d781d7bcf856ac18ce4056f15d81c7b0733ba3446cc400f98e04b02883adab8770e7549416811170b246bae8cf2ea680b01
|
@@ -26,7 +26,6 @@ module CloudstackClient
|
|
26
26
|
@api_url = api_url
|
27
27
|
@api_key = api_key
|
28
28
|
@secret_key = secret_key
|
29
|
-
@use_ssl = api_url.start_with? "https"
|
30
29
|
@verbose = opts[:quiet] ? false : true
|
31
30
|
@debug = opts[:debug] ? true : false
|
32
31
|
end
|
@@ -57,8 +56,11 @@ module CloudstackClient
|
|
57
56
|
|
58
57
|
uri = URI.parse(url)
|
59
58
|
http = Net::HTTP.new(uri.host, uri.port)
|
60
|
-
|
61
|
-
|
59
|
+
|
60
|
+
if uri.scheme == 'https'
|
61
|
+
http.use_ssl = true
|
62
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
63
|
+
end
|
62
64
|
|
63
65
|
begin
|
64
66
|
response = http.request(Net::HTTP::Get.new(uri.request_uri))
|
@@ -68,22 +70,26 @@ module CloudstackClient
|
|
68
70
|
exit 1
|
69
71
|
end
|
70
72
|
|
71
|
-
|
73
|
+
|
74
|
+
if response.is_a? Net::HTTPOK
|
72
75
|
begin
|
73
76
|
json = JSON.parse(response.body)
|
74
77
|
json[params['command'].downcase + 'response']
|
75
78
|
rescue JSON::ParserError
|
76
|
-
puts "Error parsing response from server
|
77
|
-
|
79
|
+
puts "Error parsing response from server:"
|
80
|
+
puts response.body
|
81
|
+
exit 2
|
78
82
|
end
|
79
|
-
elsif response.is_a?(Net::HTTPUnauthorized)
|
80
|
-
puts "Error #{response.code}: #{response.message}"
|
81
|
-
exit 2
|
82
83
|
else
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
begin
|
85
|
+
json = JSON.parse(response.body)
|
86
|
+
puts "Error executing command."
|
87
|
+
puts "#{json['errorresponse']['errorcode']}: #{json['errorresponse']['errortext']}"
|
88
|
+
rescue JSON::ParserError
|
89
|
+
puts "Error parsing response from server."
|
90
|
+
puts "#{response.code}: #{response.body}"
|
91
|
+
end
|
92
|
+
exit 3
|
87
93
|
end
|
88
94
|
end
|
89
95
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module CloudstackClient
|
2
|
+
|
3
|
+
module AffinityGroup
|
4
|
+
|
5
|
+
##
|
6
|
+
# List Affinity Groups.
|
7
|
+
|
8
|
+
def list_affinity_groups(args = {})
|
9
|
+
params = {
|
10
|
+
'command' => 'listAffinityGroups',
|
11
|
+
}
|
12
|
+
|
13
|
+
if args[:account]
|
14
|
+
account = list_accounts({name: args[:account]}).first
|
15
|
+
unless account
|
16
|
+
puts "Error: Account #{args[:account]} not found."
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
params['domainid'] = account["domainid"]
|
20
|
+
params['account'] = args[:account]
|
21
|
+
end
|
22
|
+
|
23
|
+
if args['listall']
|
24
|
+
params['listall'] = true
|
25
|
+
params['isrecursive'] = true
|
26
|
+
end
|
27
|
+
|
28
|
+
params['name'] = args['name'] if args['name']
|
29
|
+
params['type'] = args['type'] if args['type']
|
30
|
+
params['virtualmachineid'] = args['virtualmachine_id'] if args['virtualmachine_id']
|
31
|
+
params['keyword'] = args['keyword'] if args['keyword']
|
32
|
+
|
33
|
+
json = send_request(params)
|
34
|
+
json['affinitygroup'] || []
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -14,10 +14,13 @@ module CloudstackClient
|
|
14
14
|
params['projectid'] = args[:project_id] if args[:project_id]
|
15
15
|
|
16
16
|
if args[:account]
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
account = list_accounts({name: args[:account]}).first
|
18
|
+
unless account
|
19
|
+
puts "Error: Account #{args[:account]} not found."
|
20
|
+
exit 1
|
20
21
|
end
|
22
|
+
params['domainid'] = account["domainid"]
|
23
|
+
params['account'] = args[:account]
|
21
24
|
end
|
22
25
|
|
23
26
|
json = send_request(params)
|
@@ -115,10 +118,13 @@ module CloudstackClient
|
|
115
118
|
end
|
116
119
|
|
117
120
|
if args[:account]
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
+
account = list_accounts({name: args[:account]}).first
|
122
|
+
unless account
|
123
|
+
puts "Error: Account #{args[:account]} not found."
|
124
|
+
exit 1
|
121
125
|
end
|
126
|
+
params['domainid'] = account["domainid"]
|
127
|
+
params['account'] = args[:account]
|
122
128
|
end
|
123
129
|
|
124
130
|
json = send_request(params)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstack_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nik Wolfgramm
|
@@ -14,28 +14,28 @@ dependencies:
|
|
14
14
|
name: rdoc
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 10.0.4
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 10.0.4
|
41
41
|
description: A ruby CloudStack API client
|
@@ -45,7 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
49
49
|
- Gemfile
|
50
50
|
- LICENSE.txt
|
51
51
|
- README.md
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- lib/cloudstack_client.rb
|
54
54
|
- lib/cloudstack_client/client.rb
|
55
55
|
- lib/cloudstack_client/commands/account.rb
|
56
|
+
- lib/cloudstack_client/commands/affinity_group.rb
|
56
57
|
- lib/cloudstack_client/commands/capacity.rb
|
57
58
|
- lib/cloudstack_client/commands/cluster.rb
|
58
59
|
- lib/cloudstack_client/commands/disk_offering.rb
|
@@ -85,23 +86,23 @@ licenses:
|
|
85
86
|
metadata: {}
|
86
87
|
post_install_message:
|
87
88
|
rdoc_options:
|
88
|
-
- --line-numbers
|
89
|
-
- --inline-source
|
89
|
+
- "--line-numbers"
|
90
|
+
- "--inline-source"
|
90
91
|
require_paths:
|
91
92
|
- lib
|
92
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
94
|
requirements:
|
94
|
-
- -
|
95
|
+
- - ">="
|
95
96
|
- !ruby/object:Gem::Version
|
96
97
|
version: 1.9.3
|
97
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
99
|
requirements:
|
99
|
-
- -
|
100
|
+
- - ">="
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
104
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.0
|
105
|
+
rubygems_version: 2.2.0
|
105
106
|
signing_key:
|
106
107
|
specification_version: 4
|
107
108
|
summary: A ruby CloudStack API client
|