cloudstack_client 0.3.6 → 0.4.0
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 +4 -4
- data/README.md +3 -1
- data/lib/cloudstack_client/client.rb +12 -9
- data/lib/cloudstack_client/commands/region.rb +19 -0
- data/lib/cloudstack_client/commands/snapshot.rb +11 -0
- data/lib/cloudstack_client/commands/storage_pool.rb +31 -0
- data/lib/cloudstack_client/commands/volume.rb +9 -0
- data/lib/cloudstack_client/version.rb +1 -1
- metadata +14 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 81f5d7509c2e4e783ea7f5cfff1c85f7a86fd155
|
|
4
|
+
data.tar.gz: b4d711d1eeda40f84b812cc9600a3a63e6168973
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27566da29f73610f11bf053f4b0c362f3e0b4ed4bb43dbb707079094e6a53744b67d990ef8ccad6756ed07eacacbf7bfaa60a5843fca29889909f632338ee43c
|
|
7
|
+
data.tar.gz: 8e3c7fe4b0fe2c9697776d0cb157987633e9803a23f7296a5f76227c328af27d9bc9d618f1f9ce56a6f75dddf09a60dba53a41610c01e98c467e9b6298f36e77
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# cloudstack_client
|
|
2
2
|
|
|
3
|
+
[](http://badge.fury.io/rb/cloudstack_client)
|
|
4
|
+
|
|
3
5
|
A ruby CloudStack API client.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
@@ -23,4 +25,4 @@ Install the cloudstack_client gem:
|
|
|
23
25
|
|
|
24
26
|
Copyright (c) 2013, Nik Wolfgramm
|
|
25
27
|
|
|
26
|
-
Released under the MIT License. See the [LICENSE](https://raw.github.com/niwo/cloudstack_client/master/LICENSE.txt) file for further details.
|
|
28
|
+
Released under the MIT License. See the [LICENSE](https://raw.github.com/niwo/cloudstack_client/master/LICENSE.txt) file for further details.
|
|
@@ -68,20 +68,23 @@ module CloudstackClient
|
|
|
68
68
|
exit 1
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
if
|
|
71
|
+
if response.is_a?(Net::HTTPOK)
|
|
72
|
+
begin
|
|
73
|
+
json = JSON.parse(response.body)
|
|
74
|
+
json[params['command'].downcase + 'response']
|
|
75
|
+
rescue JSON::ParserError
|
|
76
|
+
puts "Error parsing response from server."
|
|
77
|
+
exit 1
|
|
78
|
+
end
|
|
79
|
+
elsif response.is_a?(Net::HTTPUnauthorized)
|
|
80
|
+
puts "Error #{response.code}: #{response.message}"
|
|
81
|
+
exit 2
|
|
82
|
+
else
|
|
72
83
|
puts "Error #{response.code}: #{response.message}"
|
|
73
84
|
puts JSON.pretty_generate(JSON.parse(response.body))
|
|
74
85
|
puts "URL: #{url}"
|
|
75
86
|
exit 1
|
|
76
87
|
end
|
|
77
|
-
|
|
78
|
-
begin
|
|
79
|
-
json = JSON.parse(response.body)
|
|
80
|
-
rescue JSON::ParserError
|
|
81
|
-
puts "Error parsing response from server."
|
|
82
|
-
exit 1
|
|
83
|
-
end
|
|
84
|
-
json[params['command'].downcase + 'response']
|
|
85
88
|
end
|
|
86
89
|
|
|
87
90
|
##
|
|
@@ -12,6 +12,15 @@ module CloudstackClient
|
|
|
12
12
|
}
|
|
13
13
|
params['name'] = args[:name] if args[:name]
|
|
14
14
|
|
|
15
|
+
if args[:zone]
|
|
16
|
+
zone = get_zone(args[:zone])
|
|
17
|
+
unless zone
|
|
18
|
+
puts "Error: Zone #{args[:zone]} not found"
|
|
19
|
+
exit 1
|
|
20
|
+
end
|
|
21
|
+
params['zoneid'] = zone['id']
|
|
22
|
+
end
|
|
23
|
+
|
|
15
24
|
if args[:project]
|
|
16
25
|
project = get_project(args[:project])
|
|
17
26
|
unless project
|
|
@@ -20,6 +29,7 @@ module CloudstackClient
|
|
|
20
29
|
end
|
|
21
30
|
params['projectid'] = project['id']
|
|
22
31
|
end
|
|
32
|
+
|
|
23
33
|
if args[:account]
|
|
24
34
|
account = list_accounts({name: args[:account]}).first
|
|
25
35
|
unless account
|
|
@@ -29,6 +39,7 @@ module CloudstackClient
|
|
|
29
39
|
params['domainid'] = account["domainid"]
|
|
30
40
|
params['account'] = args[:account]
|
|
31
41
|
end
|
|
42
|
+
|
|
32
43
|
params['listall'] = args[:listall] if args[:listall]
|
|
33
44
|
|
|
34
45
|
json = send_request(params)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module CloudstackClient
|
|
2
|
+
|
|
3
|
+
module StoragePool
|
|
4
|
+
|
|
5
|
+
##
|
|
6
|
+
# Lists all storage pools.
|
|
7
|
+
|
|
8
|
+
def list_storage_pools(args = {})
|
|
9
|
+
params = {
|
|
10
|
+
'command' => 'listStoragePools',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if args[:zone]
|
|
14
|
+
zone = get_zone(args[:zone])
|
|
15
|
+
unless zone
|
|
16
|
+
puts "Error: Zone #{args[:zone]} not found"
|
|
17
|
+
exit 1
|
|
18
|
+
end
|
|
19
|
+
params['zoneid'] = zone['id']
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
params['keyword'] = args[:keyword] if args[:keyword]
|
|
23
|
+
params['name'] = args[:name] if args[:name]
|
|
24
|
+
|
|
25
|
+
json = send_request(params)
|
|
26
|
+
json['storagepool'] || []
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -27,6 +27,15 @@ module CloudstackClient
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
if args[:project]
|
|
31
|
+
project = get_project(args[:project])
|
|
32
|
+
unless project
|
|
33
|
+
puts "Error: project #{args[:project]} not found."
|
|
34
|
+
exit 1
|
|
35
|
+
end
|
|
36
|
+
params['projectid'] = project['id']
|
|
37
|
+
end
|
|
38
|
+
|
|
30
39
|
params['projectid'] = args[:project_id] if args[:project_id]
|
|
31
40
|
params['type'] = args[:type] if args[:type]
|
|
32
41
|
params['keyword'] = args[:keyword] if args[:keyword]
|
metadata
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudstack_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nik Wolfgramm
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-01-
|
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
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
|
-
-
|
|
48
|
+
- .gitignore
|
|
49
49
|
- Gemfile
|
|
50
50
|
- LICENSE.txt
|
|
51
51
|
- README.md
|
|
@@ -66,11 +66,13 @@ files:
|
|
|
66
66
|
- lib/cloudstack_client/commands/pod.rb
|
|
67
67
|
- lib/cloudstack_client/commands/port_forwarding_rule.rb
|
|
68
68
|
- lib/cloudstack_client/commands/project.rb
|
|
69
|
+
- lib/cloudstack_client/commands/region.rb
|
|
69
70
|
- lib/cloudstack_client/commands/router.rb
|
|
70
71
|
- lib/cloudstack_client/commands/server.rb
|
|
71
72
|
- lib/cloudstack_client/commands/service_offering.rb
|
|
72
73
|
- lib/cloudstack_client/commands/snapshot.rb
|
|
73
74
|
- lib/cloudstack_client/commands/ssh_key_pair.rb
|
|
75
|
+
- lib/cloudstack_client/commands/storage_pool.rb
|
|
74
76
|
- lib/cloudstack_client/commands/template.rb
|
|
75
77
|
- lib/cloudstack_client/commands/user.rb
|
|
76
78
|
- lib/cloudstack_client/commands/volume.rb
|
|
@@ -83,23 +85,23 @@ licenses:
|
|
|
83
85
|
metadata: {}
|
|
84
86
|
post_install_message:
|
|
85
87
|
rdoc_options:
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
+
- --line-numbers
|
|
89
|
+
- --inline-source
|
|
88
90
|
require_paths:
|
|
89
91
|
- lib
|
|
90
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
93
|
requirements:
|
|
92
|
-
- -
|
|
94
|
+
- - '>='
|
|
93
95
|
- !ruby/object:Gem::Version
|
|
94
96
|
version: 1.9.3
|
|
95
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
98
|
requirements:
|
|
97
|
-
- -
|
|
99
|
+
- - '>='
|
|
98
100
|
- !ruby/object:Gem::Version
|
|
99
101
|
version: '0'
|
|
100
102
|
requirements: []
|
|
101
103
|
rubyforge_project:
|
|
102
|
-
rubygems_version: 2.
|
|
104
|
+
rubygems_version: 2.0.3
|
|
103
105
|
signing_key:
|
|
104
106
|
specification_version: 4
|
|
105
107
|
summary: A ruby CloudStack API client
|