fog-voxel 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/fog-voxel.gemspec +4 -1
- data/lib/fog/bin/voxel.rb +1 -1
- data/lib/fog/compute/voxel.rb +26 -27
- data/lib/fog/compute/voxel/{image.rb → models/image.rb} +0 -0
- data/lib/fog/compute/voxel/{images.rb → models/images.rb} +2 -2
- data/lib/fog/compute/voxel/{server.rb → models/server.rb} +8 -8
- data/lib/fog/compute/voxel/{servers.rb → models/servers.rb} +2 -2
- data/lib/fog/compute/voxel/{real → requests}/devices_list.rb +1 -3
- data/lib/fog/compute/voxel/{real → requests}/devices_power.rb +1 -3
- data/lib/fog/compute/voxel/{real → requests}/images_list.rb +3 -5
- data/lib/fog/compute/voxel/{real → requests}/voxcloud_create.rb +0 -2
- data/lib/fog/compute/voxel/{real → requests}/voxcloud_delete.rb +0 -2
- data/lib/fog/compute/voxel/{real → requests}/voxcloud_status.rb +1 -3
- data/lib/fog/parsers/compute.rb +1 -1
- data/lib/fog/parsers/compute/voxel.rb +6 -6
- data/lib/fog/parsers/compute/voxel/basic.rb +6 -6
- data/lib/fog/parsers/compute/voxel/devices_list.rb +70 -71
- data/lib/fog/parsers/compute/voxel/images_list.rb +24 -24
- data/lib/fog/parsers/compute/voxel/voxcloud_create.rb +11 -11
- data/lib/fog/parsers/compute/voxel/voxcloud_delete.rb +6 -6
- data/lib/fog/parsers/compute/voxel/voxcloud_status.rb +12 -12
- data/lib/fog/voxel.rb +7 -7
- data/lib/fog/voxel/version.rb +1 -1
- metadata +12 -13
- data/lib/fog/compute/voxel/real.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85c43d9083f16f906a26dc8e7c8e3a4d4dcca878
|
4
|
+
data.tar.gz: 7ea00919d83478c031bd2a41fa29f4efe68acaef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ab3144dd07a4487950fec7433b12c29d92775c8d7836fa603d155f5b534494b1d29eb17e9b1e5cb6119a3e4135397163a5fee3d29fb7997a25ecf5367c833e3
|
7
|
+
data.tar.gz: 8765940e85eeb569c60a1304867fb4dafce14ab30b1d7ed09cabf3f6276ea4085c14f7172754be3e57cc7ae8d25037efc56bb71b09738e1dbf73ba920ae95a18
|
data/.rubocop.yml
CHANGED
data/fog-voxel.gemspec
CHANGED
@@ -14,7 +14,10 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = ""
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
|
17
|
+
files = `git ls-files -z`.split("\x0")
|
18
|
+
files.delete(".hound.yml")
|
19
|
+
spec.files = files
|
20
|
+
|
18
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
23
|
spec.require_paths = ["lib"]
|
data/lib/fog/bin/voxel.rb
CHANGED
@@ -14,7 +14,7 @@ class Voxel < Fog::Bin
|
|
14
14
|
hash[key] = case key
|
15
15
|
when :compute
|
16
16
|
Fog::Logger.warning("Voxel[:compute] is not recommended, use Compute[:voxel] for portability")
|
17
|
-
Fog::Compute.new(:provider =>
|
17
|
+
Fog::Compute.new(:provider => "Voxel")
|
18
18
|
else
|
19
19
|
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
20
20
|
end
|
data/lib/fog/compute/voxel.rb
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
-
require 'fog/voxel'
|
2
|
-
|
3
1
|
module Fog
|
4
2
|
module Compute
|
5
3
|
class Voxel < Fog::Service
|
6
|
-
autoload :Image,
|
7
|
-
autoload :Images,
|
8
|
-
autoload :Server,
|
9
|
-
autoload :Servers,
|
4
|
+
autoload :Image, File.expand_path("../voxel/models/image", __FILE__)
|
5
|
+
autoload :Images, File.expand_path("../voxel/models/images", __FILE__)
|
6
|
+
autoload :Server, File.expand_path("../voxel/models/server", __FILE__)
|
7
|
+
autoload :Servers, File.expand_path("../voxel/models/servers", __FILE__)
|
10
8
|
|
11
9
|
requires :voxel_api_key, :voxel_api_secret
|
12
10
|
recognizes :host, :port, :scheme, :persistent
|
13
11
|
|
14
|
-
model_path
|
12
|
+
model_path "fog/compute/voxel/models"
|
15
13
|
model :image
|
16
14
|
collection :images
|
17
15
|
model :server
|
18
16
|
collection :servers
|
19
17
|
|
20
|
-
request_path
|
18
|
+
request_path "fog/compute/voxel/requests"
|
21
19
|
request :images_list
|
22
20
|
request :devices_list
|
23
21
|
request :devices_power
|
@@ -35,21 +33,22 @@ module Fog
|
|
35
33
|
:servers => [],
|
36
34
|
:statuses => {},
|
37
35
|
:images => [
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
36
|
+
{ "id" => 1, "name" => "CentOS 4, 32-bit, base install" },
|
37
|
+
{ "id" => 2, "name" => "CentOS 4, 64-bit, base install" },
|
38
|
+
{ "id" => 3, "name" => "CentOS 5, 32-bit, base install" },
|
39
|
+
{ "id" => 4, "name" => "CentOS 5, 64-bit, base install" },
|
40
|
+
{ "id" => 7, "name" => "Fedora 10, 32-bit, base install" },
|
41
|
+
{ "id" => 8, "name" => "Fedora 10, 64-bit, base install" },
|
42
|
+
{ "id" => 10, "name" => "OpenSUSE 11, 64-bit, base install" },
|
43
|
+
{ "id" => 11, "name" => "Debian 5.0 \"lenny\", 32-bit, base install" },
|
44
|
+
{ "id" => 12, "name" => "Debian 5.0 \"lenny\", 64-bit, base install" },
|
45
|
+
{ "id" => 13, "name" => "Ubuntu 8.04 \"Hardy\", 32-bit, base install" },
|
46
|
+
{ "id" => 14, "name" => "Ubuntu 8.04 \"Hardy\", 64-bit, base install" },
|
47
|
+
{ "id" => 15, "name" => "Voxel Server Environment (VSE), 32-bit, base install" },
|
48
|
+
{ "id" => 16, "name" => "Voxel Server Environment (VSE), 64-bit, base install" },
|
49
|
+
{ "id" => 32, "name" => "Pantheon Official Mercury Stack for Drupal (based on VSE/64)" },
|
50
|
+
{ "id" => 55, "name" => "Ubuntu 10.04 \"Lucid\", 64-bit, base install" }
|
51
|
+
]
|
53
52
|
}
|
54
53
|
end
|
55
54
|
end
|
@@ -75,8 +74,8 @@ module Fog
|
|
75
74
|
include Collections
|
76
75
|
|
77
76
|
def initialize(options = {})
|
78
|
-
require
|
79
|
-
require
|
77
|
+
require "time"
|
78
|
+
require "digest/md5"
|
80
79
|
|
81
80
|
@voxel_api_key = options[:voxel_api_key]
|
82
81
|
@voxel_api_secret = options[:voxel_api_secret]
|
@@ -84,7 +83,7 @@ module Fog
|
|
84
83
|
@connection_options = options[:connection_options] || {}
|
85
84
|
@host = options[:host] || "api.voxel.net"
|
86
85
|
@port = options[:port] || 443
|
87
|
-
@scheme = options[:scheme] ||
|
86
|
+
@scheme = options[:scheme] || "https"
|
88
87
|
@persistent = options[:persistent] || false
|
89
88
|
|
90
89
|
@connection_options[:ssl_verify_peer] = false
|
@@ -103,7 +102,7 @@ module Fog
|
|
103
102
|
:parser => parser,
|
104
103
|
:path => "/version/1.0/"
|
105
104
|
)
|
106
|
-
unless data.body[
|
105
|
+
unless data.body["stat"] == "ok"
|
107
106
|
raise Fog::Compute::Voxel::Error, "#{data.body['err']['msg']}"
|
108
107
|
end
|
109
108
|
data
|
File without changes
|
@@ -5,12 +5,12 @@ module Fog
|
|
5
5
|
model Fog::Compute::Voxel::Image
|
6
6
|
|
7
7
|
def all
|
8
|
-
data = service.images_list.body[
|
8
|
+
data = service.images_list.body["images"]
|
9
9
|
load(data)
|
10
10
|
end
|
11
11
|
|
12
12
|
def get(image_id)
|
13
|
-
data = service.images_list(image_id).body[
|
13
|
+
data = service.images_list(image_id).body["images"]
|
14
14
|
|
15
15
|
if data.empty?
|
16
16
|
nil
|
@@ -9,10 +9,10 @@ module Fog
|
|
9
9
|
attribute :image_id
|
10
10
|
attribute :facility
|
11
11
|
attribute :disk_size
|
12
|
-
attribute :ip_assignments, :aliases =>
|
12
|
+
attribute :ip_assignments, :aliases => "ipassignments"
|
13
13
|
|
14
14
|
def initialize(attributes={})
|
15
|
-
self.image_id ||=
|
15
|
+
self.image_id ||= "55" # Ubuntu 10.04 LTS 64bit
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
@@ -28,15 +28,15 @@ module Fog
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def ready?
|
31
|
-
|
31
|
+
state == "SUCCEEDED"
|
32
32
|
end
|
33
33
|
|
34
34
|
def private_ip_address
|
35
|
-
ip_assignments.select {|ip_assignment| ip_assignment[
|
35
|
+
ip_assignments.select { |ip_assignment| ip_assignment["type"] == "internal" }.first
|
36
36
|
end
|
37
37
|
|
38
38
|
def public_ip_address
|
39
|
-
ip_assignments.select {|ip_assignment| ip_assignment[
|
39
|
+
ip_assignments.select { |ip_assignment| ip_assignment["type"] == "external" }.first
|
40
40
|
end
|
41
41
|
|
42
42
|
def reboot
|
@@ -46,11 +46,11 @@ module Fog
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def state
|
49
|
-
@state ||= service.voxcloud_status(id).body[
|
49
|
+
@state ||= service.voxcloud_status(id).body["devices"].first["status"]
|
50
50
|
end
|
51
51
|
|
52
52
|
def save
|
53
|
-
raise Fog::Errors::Error.new(
|
53
|
+
raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
|
54
54
|
requires :name, :image_id, :processing_cores, :facility, :disk_size
|
55
55
|
|
56
56
|
data = service.voxcloud_create({
|
@@ -61,7 +61,7 @@ module Fog
|
|
61
61
|
:processing_cores => processing_cores
|
62
62
|
}).body
|
63
63
|
|
64
|
-
merge_attributes(data[
|
64
|
+
merge_attributes(data["device"])
|
65
65
|
|
66
66
|
true
|
67
67
|
end
|
@@ -5,12 +5,12 @@ module Fog
|
|
5
5
|
model Fog::Compute::Voxel::Server
|
6
6
|
|
7
7
|
def all
|
8
|
-
data = service.devices_list.body[
|
8
|
+
data = service.devices_list.body["devices"].select { |device| device["type"]["id"] == "3" }
|
9
9
|
load(data)
|
10
10
|
end
|
11
11
|
|
12
12
|
def get(device_id)
|
13
|
-
if device_id && server = service.devices_list(device_id).body[
|
13
|
+
if device_id && server = service.devices_list(device_id).body["devices"]
|
14
14
|
new(server.first)
|
15
15
|
end
|
16
16
|
rescue Fog::Service::Error => error
|
@@ -2,12 +2,10 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class Voxel
|
4
4
|
class Real
|
5
|
-
require 'fog/voxel/parsers/voxel/devices_list'
|
6
|
-
|
7
5
|
def devices_list(device_id = nil)
|
8
6
|
options = {
|
9
7
|
:parser => Fog::Parsers::Compute::Voxel::DevicesList.new,
|
10
|
-
:verbosity =>
|
8
|
+
:verbosity => "normal"
|
11
9
|
}
|
12
10
|
|
13
11
|
unless device_id.nil?
|
@@ -2,14 +2,12 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class Voxel
|
4
4
|
class Real
|
5
|
-
require 'fog/voxel/parsers/voxel/basic'
|
6
|
-
|
7
5
|
def devices_power(device_id, power_action)
|
8
6
|
options = {
|
9
7
|
:device_id => device_id,
|
10
8
|
:parser => Fog::Parsers::Compute::Voxel::Basic.new,
|
11
9
|
:power_action => power_action,
|
12
|
-
:verbosity =>
|
10
|
+
:verbosity => "normal"
|
13
11
|
}
|
14
12
|
|
15
13
|
request("voxel.devices.power", options)
|
@@ -2,22 +2,20 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class Voxel
|
4
4
|
class Real
|
5
|
-
require 'fog/voxel/parsers/voxel/images_list'
|
6
|
-
|
7
5
|
def images_list(image_id = nil)
|
8
6
|
options = {
|
9
7
|
:parser => Fog::Parsers::Compute::Voxel::ImagesList.new,
|
10
|
-
:verbosity =>
|
8
|
+
:verbosity => "compact"
|
11
9
|
}
|
12
10
|
|
13
11
|
unless image_id.nil?
|
14
|
-
options[:verbosity] =
|
12
|
+
options[:verbosity] = "extended"
|
15
13
|
options[:image_id] = image_id
|
16
14
|
end
|
17
15
|
|
18
16
|
data = request("voxel.images.list", options)
|
19
17
|
|
20
|
-
if data.body[
|
18
|
+
if data.body["stat"] == "ok"
|
21
19
|
data
|
22
20
|
else
|
23
21
|
raise Fog::Compute::Voxel::NotFound
|
@@ -2,12 +2,10 @@ module Fog
|
|
2
2
|
module Compute
|
3
3
|
class Voxel
|
4
4
|
class Real
|
5
|
-
require 'fog/voxel/parsers/voxel/voxcloud_status'
|
6
|
-
|
7
5
|
def voxcloud_status(device_id = nil)
|
8
6
|
options = {
|
9
7
|
:parser => Fog::Parsers::Compute::Voxel::VoxcloudStatus.new,
|
10
|
-
:verbosity =>
|
8
|
+
:verbosity => "compact"
|
11
9
|
}
|
12
10
|
|
13
11
|
unless device_id.nil?
|
data/lib/fog/parsers/compute.rb
CHANGED
@@ -2,12 +2,12 @@ module Fog
|
|
2
2
|
module Parsers
|
3
3
|
module Compute
|
4
4
|
module Voxel
|
5
|
-
autoload :Basic,
|
6
|
-
autoload :DevicesList,
|
7
|
-
autoload :ImagesList,
|
8
|
-
autoload :VoxcloudCreate,
|
9
|
-
autoload :VoxcloudDelete,
|
10
|
-
autoload :Voxcloudstatus,
|
5
|
+
autoload :Basic, "fog/parsers/compute/voxel/basic"
|
6
|
+
autoload :DevicesList, "fog/parsers/compute/voxel/devices_list"
|
7
|
+
autoload :ImagesList, "fog/parsers/compute/voxel/images_list"
|
8
|
+
autoload :VoxcloudCreate, "fog/parsers/compute/voxel/voxcloud_create"
|
9
|
+
autoload :VoxcloudDelete, "fog/parsers/compute/voxel/voxcloud_delete"
|
10
|
+
autoload :Voxcloudstatus, "fog/parsers/compute/voxel/voxcloud_status"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -11,13 +11,13 @@ module Fog
|
|
11
11
|
super
|
12
12
|
|
13
13
|
case name
|
14
|
-
when
|
15
|
-
@response[
|
16
|
-
|
17
|
-
|
14
|
+
when "err"
|
15
|
+
@response["err"] = {
|
16
|
+
"code" => attr_value("code", attrs),
|
17
|
+
"msg" => attr_value("msg", attrs)
|
18
18
|
}
|
19
|
-
when
|
20
|
-
@response[
|
19
|
+
when "rsp"
|
20
|
+
@response["stat"] = attr_value("stat", attrs)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -5,7 +5,7 @@ module Fog
|
|
5
5
|
class DevicesList < Fog::Parsers::Base
|
6
6
|
def reset
|
7
7
|
@device = {}
|
8
|
-
@response = {
|
8
|
+
@response = { "devices" => [] }
|
9
9
|
@in_storage = false
|
10
10
|
end
|
11
11
|
|
@@ -13,90 +13,89 @@ module Fog
|
|
13
13
|
super
|
14
14
|
|
15
15
|
case name
|
16
|
-
when
|
17
|
-
@access_method = {
|
18
|
-
when
|
19
|
-
@device[
|
20
|
-
when
|
16
|
+
when "accessmethod"
|
17
|
+
@access_method = { "type" => attr_value("type", attrs) }
|
18
|
+
when "accessmethods"
|
19
|
+
@device["access_methods"] = []
|
20
|
+
when "device"
|
21
21
|
@device = {
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
"id" => attr_value("id", attrs),
|
23
|
+
"label" => attr_value("label", attrs),
|
24
|
+
"status" => attr_value("status", attrs)
|
25
25
|
}
|
26
|
-
when
|
27
|
-
@response[
|
28
|
-
|
29
|
-
|
26
|
+
when "err"
|
27
|
+
@response["err"] = {
|
28
|
+
"code" => attr_value("code", attrs),
|
29
|
+
"msg" => attr_value("msg", attrs)
|
30
30
|
}
|
31
|
-
when
|
32
|
-
@device[
|
33
|
-
if code = attr_value(
|
34
|
-
@device[
|
31
|
+
when "cage", "facility", "rack", "row", "zone"
|
32
|
+
@device["location"][name] = { "id" => attr_value("id", attrs) }
|
33
|
+
if code = attr_value("code", attrs)
|
34
|
+
@device["location"][name]["code"] = code
|
35
35
|
end
|
36
|
-
when
|
37
|
-
@drive = {
|
38
|
-
when
|
39
|
-
|
40
|
-
@device[
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
'description' => attr_value('description', attrs),
|
36
|
+
when "drive"
|
37
|
+
@drive = { "position" => attr_value("position", attrs) }
|
38
|
+
when "ipassignment"
|
39
|
+
@device["ipassignments"] = []
|
40
|
+
@device["ipassignments"] << {
|
41
|
+
"id" => attr_value("id", attrs),
|
42
|
+
"type" => attr_value("type", attrs),
|
43
|
+
"description" => attr_value("description", attrs),
|
45
44
|
}
|
46
|
-
when
|
47
|
-
@device[
|
48
|
-
when
|
49
|
-
@device[
|
50
|
-
when
|
51
|
-
@device[
|
52
|
-
when
|
53
|
-
@device[name] = {
|
54
|
-
when
|
55
|
-
@device[
|
56
|
-
when
|
57
|
-
@device[name] = attr_value(
|
58
|
-
when
|
59
|
-
@device[
|
60
|
-
when
|
61
|
-
@response[
|
62
|
-
when
|
63
|
-
@device[
|
45
|
+
when "ipassignments"
|
46
|
+
@device["ipassignments"] = {}
|
47
|
+
when "location"
|
48
|
+
@device["location"] = {}
|
49
|
+
when "memory"
|
50
|
+
@device["memory"] = { "size" => attr_value("size", attrs).to_i }
|
51
|
+
when "model", "type"
|
52
|
+
@device[name] = { "id" => attr_value("id", attrs) }
|
53
|
+
when "operating_system"
|
54
|
+
@device["operating_system"] = {}
|
55
|
+
when "power_consumption"
|
56
|
+
@device[name] = attr_value("unit", attrs)
|
57
|
+
when "processor"
|
58
|
+
@device["processor"] = {}
|
59
|
+
when "rsp"
|
60
|
+
@response["stat"] = attr_value("stat", attrs)
|
61
|
+
when "storage"
|
62
|
+
@device["drives"] = []
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
67
66
|
def end_element(name)
|
68
67
|
case name
|
69
|
-
when
|
70
|
-
@device[
|
71
|
-
when
|
72
|
-
@device[
|
73
|
-
when
|
74
|
-
@device[
|
75
|
-
when
|
76
|
-
@device[
|
77
|
-
when
|
68
|
+
when "access_method"
|
69
|
+
@device["access_methods"] << @access_method
|
70
|
+
when "architecture"
|
71
|
+
@device["operating_system"][name] = value.to_i
|
72
|
+
when "cage", "facility", "rack", "row", "zone"
|
73
|
+
@device["location"][name]["value"] = value
|
74
|
+
when "cores"
|
75
|
+
@device["processor"][name] = value.to_i
|
76
|
+
when "description"
|
78
77
|
@device[name] = value
|
79
|
-
when
|
80
|
-
@response[
|
78
|
+
when "device"
|
79
|
+
@response["devices"] << @device
|
81
80
|
@device = {}
|
82
|
-
when
|
83
|
-
@device[
|
81
|
+
when "drive"
|
82
|
+
@device["drives"] << @drive
|
84
83
|
@drive = {}
|
85
|
-
when
|
86
|
-
@device[
|
87
|
-
when
|
88
|
-
@device[
|
89
|
-
when
|
90
|
-
@device[name][
|
91
|
-
when
|
92
|
-
@device[
|
93
|
-
when
|
94
|
-
@device[
|
95
|
-
when
|
96
|
-
@device[name] = [value, @device[name]].join(
|
97
|
-
when
|
84
|
+
when "cores"
|
85
|
+
@device["processing_cores"] = value.to_i
|
86
|
+
when "ipassignment"
|
87
|
+
@device["ipassignments"].last["value"] = value
|
88
|
+
when "model", "type"
|
89
|
+
@device[name]["value"] = value
|
90
|
+
when "name"
|
91
|
+
@device["operating_system"][name] = value
|
92
|
+
when "position"
|
93
|
+
@device["location"][name] = value
|
94
|
+
when "power_consumption"
|
95
|
+
@device[name] = [value, @device[name]].join(" ")
|
96
|
+
when "size"
|
98
97
|
@drive[name] = value.to_i
|
99
|
-
when
|
98
|
+
when "host", "password", "protocol", "username"
|
100
99
|
@access_method[name] = value
|
101
100
|
end
|
102
101
|
end
|
@@ -5,47 +5,47 @@ module Fog
|
|
5
5
|
class ImagesList < Fog::Parsers::Base
|
6
6
|
def reset
|
7
7
|
@image = {}
|
8
|
-
@response = {
|
8
|
+
@response = { "images" => [] }
|
9
9
|
end
|
10
10
|
|
11
11
|
def start_element(name, attrs = [])
|
12
12
|
super
|
13
13
|
|
14
14
|
case name
|
15
|
-
when
|
16
|
-
@response[
|
17
|
-
|
18
|
-
|
15
|
+
when "err"
|
16
|
+
@response["err"] = {
|
17
|
+
"code" => attr_value("code", attrs),
|
18
|
+
"msg" => attr_value("msg", attrs)
|
19
19
|
}
|
20
|
-
when
|
21
|
-
@image[
|
22
|
-
when
|
20
|
+
when "size"
|
21
|
+
@image["filesystem"]["units"] = attr_value("units", attrs)
|
22
|
+
when "image"
|
23
23
|
@image = {
|
24
|
-
|
25
|
-
|
24
|
+
"id" => attr_value("id", attrs).to_i,
|
25
|
+
"summary" => attr_value("summary", attrs)
|
26
26
|
}
|
27
|
-
when
|
27
|
+
when "filesystem", "operating_system"
|
28
28
|
@image[name] = {}
|
29
|
-
when
|
30
|
-
@response[
|
29
|
+
when "rsp"
|
30
|
+
@response["stat"] = attr_value("stat", attrs)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
def end_element(name)
|
35
35
|
case name
|
36
|
-
when
|
37
|
-
@image[
|
38
|
-
when
|
39
|
-
@image[
|
40
|
-
when
|
36
|
+
when "architecture"
|
37
|
+
@image["operating_system"][name] = value.to_i
|
38
|
+
when "admin_username", "family", "product_family", "product_version", "version"
|
39
|
+
@image["operating_system"][name] = value
|
40
|
+
when "description"
|
41
41
|
@image[name] = value
|
42
|
-
when
|
43
|
-
@response[
|
42
|
+
when "image"
|
43
|
+
@response["images"] << @image
|
44
44
|
@image = {}
|
45
|
-
when
|
46
|
-
@image[
|
47
|
-
when
|
48
|
-
@image[
|
45
|
+
when "size"
|
46
|
+
@image["filesystem"][name] = value.to_i
|
47
|
+
when "type"
|
48
|
+
@image["filesystem"][name] = value
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -4,29 +4,29 @@ module Fog
|
|
4
4
|
module Voxel
|
5
5
|
class VoxcloudCreate < Fog::Parsers::Base
|
6
6
|
def reset
|
7
|
-
@response = {
|
7
|
+
@response = { "device" => {} }
|
8
8
|
end
|
9
9
|
|
10
10
|
def start_element(name, attrs = [])
|
11
11
|
super
|
12
12
|
|
13
13
|
case name
|
14
|
-
when
|
15
|
-
@response[
|
16
|
-
|
17
|
-
|
14
|
+
when "err"
|
15
|
+
@response["err"] = {
|
16
|
+
"code" => attr_value("code", attrs),
|
17
|
+
"msg" => attr_value("msg", attrs)
|
18
18
|
}
|
19
|
-
when
|
20
|
-
@response[
|
19
|
+
when "rsp"
|
20
|
+
@response["stat"] = attr_value("stat", attrs)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
def end_element(name)
|
25
25
|
case name
|
26
|
-
when
|
27
|
-
@response[
|
28
|
-
when
|
29
|
-
@response[
|
26
|
+
when "id"
|
27
|
+
@response["device"][name] = value
|
28
|
+
when "last_update"
|
29
|
+
@response["device"][name] = Time.at(value.to_i)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -11,12 +11,12 @@ module Fog
|
|
11
11
|
super
|
12
12
|
|
13
13
|
case name
|
14
|
-
when
|
15
|
-
@response[
|
16
|
-
when
|
17
|
-
@response[
|
18
|
-
|
19
|
-
|
14
|
+
when "rsp"
|
15
|
+
@response["stat"] = attr_value("stat", attrs)
|
16
|
+
when "err"
|
17
|
+
@response["err"] = {
|
18
|
+
"code" => attr_value("code", attrs),
|
19
|
+
"msg" => attr_value("msg", attrs)
|
20
20
|
}
|
21
21
|
end
|
22
22
|
end
|
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
module Voxel
|
5
5
|
class VoxcloudStatus < Fog::Parsers::Base
|
6
6
|
def reset
|
7
|
-
@response = {
|
7
|
+
@response = { "devices" => [] }
|
8
8
|
@device = {}
|
9
9
|
end
|
10
10
|
|
@@ -12,26 +12,26 @@ module Fog
|
|
12
12
|
super
|
13
13
|
|
14
14
|
case name
|
15
|
-
when
|
16
|
-
@response[
|
17
|
-
when
|
18
|
-
@response[
|
19
|
-
|
20
|
-
|
15
|
+
when "rsp"
|
16
|
+
@response["stat"] = attr_value("stat", attrs)
|
17
|
+
when "err"
|
18
|
+
@response["err"] = {
|
19
|
+
"code" => attr_value("code", attrs),
|
20
|
+
"msg" => attr_value("msg", attrs)
|
21
21
|
}
|
22
|
-
when
|
22
|
+
when "device"
|
23
23
|
@device = {}
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def end_element(name)
|
28
28
|
case name
|
29
|
-
when
|
30
|
-
@response[
|
29
|
+
when "device"
|
30
|
+
@response["devices"] << @device
|
31
31
|
@device = {}
|
32
|
-
when
|
32
|
+
when "id", "status"
|
33
33
|
@device[name] = value
|
34
|
-
when
|
34
|
+
when "last_update"
|
35
35
|
@device[name] = Time.at(value.to_i)
|
36
36
|
end
|
37
37
|
end
|
data/lib/fog/voxel.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "fog/core"
|
2
|
+
require "fog/xml"
|
3
|
+
require "digest/md5"
|
4
|
+
require File.expand_path("../voxel/version", __FILE__)
|
5
5
|
|
6
6
|
module Fog
|
7
7
|
module Voxel
|
8
8
|
extend Fog::Provider
|
9
9
|
|
10
|
-
service(:compute,
|
10
|
+
service(:compute, "Compute")
|
11
11
|
|
12
12
|
def self.create_signature(secret, options)
|
13
13
|
to_sign = options.keys.map { |k| k.to_s }.sort.map { |k| "#{k}#{options[k.to_sym]}" }.join("")
|
@@ -16,10 +16,10 @@ module Fog
|
|
16
16
|
end
|
17
17
|
|
18
18
|
module Compute
|
19
|
-
autoload :Voxel,
|
19
|
+
autoload :Voxel, File.expand_path("../compute/voxel", __FILE__)
|
20
20
|
end
|
21
21
|
|
22
22
|
module Parsers
|
23
|
-
autoload :Compute,
|
23
|
+
autoload :Compute, File.expand_path("../parsers/compute", __FILE__)
|
24
24
|
end
|
25
25
|
end
|
data/lib/fog/voxel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-voxel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo Henrique Lopes Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -160,17 +160,16 @@ files:
|
|
160
160
|
- gemfiles/Gemfile.1.9.3+
|
161
161
|
- lib/fog/bin/voxel.rb
|
162
162
|
- lib/fog/compute/voxel.rb
|
163
|
-
- lib/fog/compute/voxel/image.rb
|
164
|
-
- lib/fog/compute/voxel/images.rb
|
165
|
-
- lib/fog/compute/voxel/
|
166
|
-
- lib/fog/compute/voxel/
|
167
|
-
- lib/fog/compute/voxel/
|
168
|
-
- lib/fog/compute/voxel/
|
169
|
-
- lib/fog/compute/voxel/
|
170
|
-
- lib/fog/compute/voxel/
|
171
|
-
- lib/fog/compute/voxel/
|
172
|
-
- lib/fog/compute/voxel/
|
173
|
-
- lib/fog/compute/voxel/servers.rb
|
163
|
+
- lib/fog/compute/voxel/models/image.rb
|
164
|
+
- lib/fog/compute/voxel/models/images.rb
|
165
|
+
- lib/fog/compute/voxel/models/server.rb
|
166
|
+
- lib/fog/compute/voxel/models/servers.rb
|
167
|
+
- lib/fog/compute/voxel/requests/devices_list.rb
|
168
|
+
- lib/fog/compute/voxel/requests/devices_power.rb
|
169
|
+
- lib/fog/compute/voxel/requests/images_list.rb
|
170
|
+
- lib/fog/compute/voxel/requests/voxcloud_create.rb
|
171
|
+
- lib/fog/compute/voxel/requests/voxcloud_delete.rb
|
172
|
+
- lib/fog/compute/voxel/requests/voxcloud_status.rb
|
174
173
|
- lib/fog/parsers/compute.rb
|
175
174
|
- lib/fog/parsers/compute/voxel.rb
|
176
175
|
- lib/fog/parsers/compute/voxel/basic.rb
|
@@ -1,6 +0,0 @@
|
|
1
|
-
require 'fog/compute/voxel/real/devices_list'
|
2
|
-
require 'fog/compute/voxel/real/devices_power'
|
3
|
-
require 'fog/compute/voxel/real/images_list'
|
4
|
-
require 'fog/compute/voxel/real/voxcloud_create'
|
5
|
-
require 'fog/compute/voxel/real/voxcloud_delete'
|
6
|
-
require 'fog/compute/voxel/real/voxcloud_status'
|