cloudstack_client 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -3
- data/cloudstack_client.gemspec +4 -4
- data/lib/cloudstack_client/client.rb +7 -5
- data/lib/cloudstack_client/commands/server.rb +2 -0
- data/lib/cloudstack_client/commands/volume.rb +5 -1
- data/lib/cloudstack_client/version.rb +1 -1
- metadata +20 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9fbb45ce40bdb0236d5343c0cbc3b4c10db971d
|
4
|
+
data.tar.gz: c5424aaf51e164f39ffec350e092cb66b0d0302e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f188a35132d0fb2ddb6ab2751fbc520b80d270a7ab38904395410dbde12811a5120edd7c50cb0df27b2ca6b0e1c3bb8a3c2d69d9c72173475cb2470d2de39788
|
7
|
+
data.tar.gz: dd9189799dee9b6b107ecbeda491f7eee3f0a687603b0dbf8f1888c526f9d960b1232ebead4f6ba36755db01a3b801feecffa1c7ed76e80cebfde79caea7c1ae
|
data/README.md
CHANGED
@@ -2,16 +2,32 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/cloudstack_client.png)](http://badge.fury.io/rb/cloudstack_client)
|
4
4
|
|
5
|
-
A
|
5
|
+
A CloudStack API client written in Ruby.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Install the cloudstack_client gem:
|
10
10
|
|
11
11
|
$ gem install cloudstack_client
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require "cloudstack_client"
|
17
|
+
|
18
|
+
cs = CloudstackClient::Connection.new(
|
19
|
+
'https://cloudstack.url/client/api',
|
20
|
+
'API_KEY',
|
21
|
+
'API_SECRET'
|
22
|
+
)
|
23
|
+
|
24
|
+
cs.list_servers(status: 'running').each do |server|
|
25
|
+
puts server['name']
|
26
|
+
end
|
27
|
+
```
|
12
28
|
|
13
29
|
## References
|
14
|
-
- [
|
30
|
+
- [Apache CloudStack API documentation](http://cloudstack.apache.org/docs/api/)
|
15
31
|
|
16
32
|
## Contributing
|
17
33
|
|
@@ -23,6 +39,6 @@ Install the cloudstack_client gem:
|
|
23
39
|
|
24
40
|
## License
|
25
41
|
|
26
|
-
Copyright (c)
|
42
|
+
Copyright (c) 2014, Nik Wolfgramm
|
27
43
|
|
28
44
|
Released under the MIT License. See the [LICENSE](https://raw.github.com/niwo/cloudstack_client/master/LICENSE.txt) file for further details.
|
data/cloudstack_client.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = CloudstackClient::VERSION
|
9
9
|
gem.authors = ["Nik Wolfgramm"]
|
10
10
|
gem.email = ["nik.wolfgramm@gmail.com"]
|
11
|
-
gem.description = %q{
|
12
|
-
gem.summary = %q{
|
11
|
+
gem.description = %q{CloudStack API client written in Ruby}
|
12
|
+
gem.summary = %q{CloudStack API client written in Ruby}
|
13
13
|
gem.homepage = "https://github.com/niwo/cloudstack_client"
|
14
14
|
gem.license = 'MIT'
|
15
15
|
|
@@ -20,5 +20,5 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.rdoc_options = %w[--line-numbers --inline-source]
|
21
21
|
|
22
22
|
gem.add_development_dependency('rdoc')
|
23
|
-
gem.add_development_dependency('rake', '~> 10.0.4')
|
24
|
-
end
|
23
|
+
gem.add_development_dependency('rake', '~> 10.0', '>= 10.0.4')
|
24
|
+
end
|
@@ -74,7 +74,7 @@ module CloudstackClient
|
|
74
74
|
if response.is_a? Net::HTTPOK
|
75
75
|
begin
|
76
76
|
json = JSON.parse(response.body)
|
77
|
-
json[params['command'].downcase + 'response']
|
77
|
+
json = json[params['command'].downcase + 'response']
|
78
78
|
rescue JSON::ParserError
|
79
79
|
puts "Error parsing response from server:"
|
80
80
|
puts response.body
|
@@ -83,10 +83,12 @@ module CloudstackClient
|
|
83
83
|
else
|
84
84
|
begin
|
85
85
|
json = JSON.parse(response.body)
|
86
|
-
puts "Error executing command
|
87
|
-
puts
|
88
|
-
|
89
|
-
puts "
|
86
|
+
puts "Error executing command..."
|
87
|
+
puts json if @debug
|
88
|
+
json = json[params['command'].downcase + 'response']
|
89
|
+
puts "#{json['errorcode']}: #{json['errortext']}"
|
90
|
+
rescue
|
91
|
+
puts "Error parsing response from server..."
|
90
92
|
puts "#{response.code}: #{response.body}"
|
91
93
|
end
|
92
94
|
exit 3
|
@@ -4,7 +4,7 @@ module CloudstackClient
|
|
4
4
|
|
5
5
|
##
|
6
6
|
# Lists all volumes.
|
7
|
-
|
7
|
+
|
8
8
|
def list_volumes(args = {})
|
9
9
|
params = {
|
10
10
|
'command' => 'listVolumes',
|
@@ -40,6 +40,10 @@ module CloudstackClient
|
|
40
40
|
params['type'] = args[:type] if args[:type]
|
41
41
|
params['keyword'] = args[:keyword] if args[:keyword]
|
42
42
|
params['name'] = args[:name] if args[:name]
|
43
|
+
params['virtualmachineid'] = args[:virtual_machine_id] if args[:virtual_machine_id]
|
44
|
+
params['tags'] = args[:tags] if args[:tags]
|
45
|
+
params['podid'] = args[:pod_id] if args[:pod_id]
|
46
|
+
params['isrecursive'] = args[:is_recursive] if args[:is_recursive]
|
43
47
|
|
44
48
|
json = send_request(params)
|
45
49
|
json['volume'] || []
|
metadata
CHANGED
@@ -1,51 +1,57 @@
|
|
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.2
|
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-
|
11
|
+
date: 2014-02-19 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
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
- - '>='
|
32
35
|
- !ruby/object:Gem::Version
|
33
36
|
version: 10.0.4
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- -
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '10.0'
|
44
|
+
- - '>='
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 10.0.4
|
41
|
-
description:
|
47
|
+
description: CloudStack API client written in Ruby
|
42
48
|
email:
|
43
49
|
- nik.wolfgramm@gmail.com
|
44
50
|
executables: []
|
45
51
|
extensions: []
|
46
52
|
extra_rdoc_files: []
|
47
53
|
files:
|
48
|
-
-
|
54
|
+
- .gitignore
|
49
55
|
- Gemfile
|
50
56
|
- LICENSE.txt
|
51
57
|
- README.md
|
@@ -86,24 +92,24 @@ licenses:
|
|
86
92
|
metadata: {}
|
87
93
|
post_install_message:
|
88
94
|
rdoc_options:
|
89
|
-
-
|
90
|
-
-
|
95
|
+
- --line-numbers
|
96
|
+
- --inline-source
|
91
97
|
require_paths:
|
92
98
|
- lib
|
93
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
100
|
requirements:
|
95
|
-
- -
|
101
|
+
- - '>='
|
96
102
|
- !ruby/object:Gem::Version
|
97
103
|
version: 1.9.3
|
98
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
105
|
requirements:
|
100
|
-
- -
|
106
|
+
- - '>='
|
101
107
|
- !ruby/object:Gem::Version
|
102
108
|
version: '0'
|
103
109
|
requirements: []
|
104
110
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.0.3
|
106
112
|
signing_key:
|
107
113
|
specification_version: 4
|
108
|
-
summary:
|
114
|
+
summary: CloudStack API client written in Ruby
|
109
115
|
test_files: []
|