cloudstack_helper 0.3 → 0.4
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.
- data/README.md +13 -4
- data/cloudstack_helper.gemspec +1 -1
- data/lib/cloudstack_helper.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -4,6 +4,7 @@ cloudstack_helper is a simple ruby library that helps making request to CloudSta
|
|
4
4
|
## Library Usage
|
5
5
|
|
6
6
|
```ruby
|
7
|
+
require 'rubygems'
|
7
8
|
require 'cloudstack_helper'
|
8
9
|
|
9
10
|
API_URL = "http://mycloudstack:8080/client/api"
|
@@ -12,10 +13,17 @@ cloudstack_helper is a simple ruby library that helps making request to CloudSta
|
|
12
13
|
cs_helper = CloudStackHelper.new(:api_key => API_KEY, :secret_key => SECRET_KEY, :api_url => API_URL)
|
13
14
|
|
14
15
|
params = {:command => "listZones"}
|
15
|
-
|
16
|
+
result = cs_helper.get(params).body
|
17
|
+
puts result
|
16
18
|
|
17
19
|
params[:response] = "json"
|
18
|
-
|
20
|
+
result = cs_helper.get(params).body
|
21
|
+
puts result
|
22
|
+
|
23
|
+
params.merge!({:command => 'deployVirtualMachine', :serviceofferingid => 12, :templateid => 4, :zoneid => 1, :displayname => 'my shiny vm'})
|
24
|
+
result = cs_helper.get(params).body
|
25
|
+
puts result
|
26
|
+
|
19
27
|
```
|
20
28
|
|
21
29
|
## Script Usage
|
@@ -35,10 +43,11 @@ cloudstack_helper is a simple ruby library that helps making request to CloudSta
|
|
35
43
|
```
|
36
44
|
|
37
45
|
####Configuration
|
38
|
-
By default, if you don't specify a config file, cloudstack_rb assumes there is a config file in the current working directory under the name 'cloudstack.
|
46
|
+
By default, if you don't specify a config file, cloudstack_rb assumes there is a config file in the current working directory under the name 'cloudstack.yml'
|
39
47
|
The config file should look like this
|
48
|
+
|
40
49
|
```
|
41
50
|
api_url: "http://mycloudstack:8080/client/api"
|
42
51
|
api_key: "WiUVlx74PpVE8w7z7J7gtojiOQasdaFL3A054D_IPeSxxcm1PadgasdgujGSJBGiS2uBcG0GoLwLisosDCA"
|
43
52
|
secret_key: "uqzgrfMXnYSVvUiasdgj0DgvtXBemILs_npqi90Ki0xigOKjagvQTtYg093EUrHSLZJEnI3lV1z9PrQmv2SxQ"
|
44
|
-
|
53
|
+
```
|
data/cloudstack_helper.gemspec
CHANGED
data/lib/cloudstack_helper.rb
CHANGED
@@ -27,7 +27,7 @@ class CloudStackHelper
|
|
27
27
|
# with the user’s Secret Key.
|
28
28
|
# 4. Base64 encode the resulting byte array in UTF-8 so that it can be safely transmitted via HTTP.
|
29
29
|
def generate_signature(params)
|
30
|
-
params.each { |k,v| params[k] = CGI.escape(v).gsub('+', '%20').downcase }
|
30
|
+
params.each { |k,v| params[k] = CGI.escape(v.to_s).gsub('+', '%20').downcase }
|
31
31
|
sorted_params = params.sort_by{|key,value| key.to_s}
|
32
32
|
|
33
33
|
data = parameterize(sorted_params, false)
|
metadata
CHANGED