fog 0.0.61 → 0.0.62
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/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/fog.gemspec +19 -5
- data/lib/fog/aws/models/s3/files.rb +1 -1
- data/lib/fog/slicehost/requests/reboot_slice.rb +0 -1
- data/lib/fog/terremark.rb +10 -0
- data/lib/fog/terremark/parsers/get_catalog.rb +2 -1
- data/lib/fog/terremark/parsers/get_catalog_item.rb +2 -2
- data/lib/fog/terremark/parsers/get_organization.rb +2 -1
- data/lib/fog/terremark/parsers/get_tasks_list.rb +50 -0
- data/lib/fog/terremark/parsers/get_vapp_template.rb +2 -2
- data/lib/fog/terremark/parsers/get_vdc.rb +4 -3
- data/lib/fog/terremark/parsers/instantiate_vapp_template.rb +39 -0
- data/lib/fog/terremark/parsers/task.rb +38 -0
- data/lib/fog/terremark/parsers/vapp.rb +45 -0
- data/lib/fog/terremark/requests/delete_vapp.rb +40 -0
- data/lib/fog/terremark/requests/deploy_vapp.rb +43 -0
- data/lib/fog/terremark/requests/get_organizations.rb +0 -1
- data/lib/fog/terremark/requests/get_task.rb +47 -0
- data/lib/fog/terremark/requests/get_tasks_list.rb +40 -0
- data/lib/fog/terremark/requests/get_vapp.rb +50 -0
- data/lib/fog/terremark/requests/instantiate_vapp_template.rb +118 -0
- data/lib/fog/terremark/requests/power_off.rb +43 -0
- data/lib/fog/terremark/requests/power_on.rb +43 -0
- data/lib/fog/terremark/requests/reset.rb +43 -0
- data/lib/fog/terremark/requests/shutdown.rb +43 -0
- metadata +19 -5
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require "#{current_directory}/lib/fog"
|
|
7
7
|
begin
|
8
8
|
require 'jeweler'
|
9
9
|
Jeweler::Tasks.new do |gem|
|
10
|
-
gem.add_dependency('excon', '>=0.0.
|
10
|
+
gem.add_dependency('excon', '>=0.0.21')
|
11
11
|
gem.add_dependency('formatador', '>=0.0.10')
|
12
12
|
gem.add_dependency('json')
|
13
13
|
gem.add_dependency('mime-types')
|
data/VERSION.yml
CHANGED
data/fog.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fog}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.62"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["geemus (Wesley Beary)"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-30}
|
13
13
|
s.default_executable = %q{fog}
|
14
14
|
s.description = %q{brings clouds to you}
|
15
15
|
s.email = %q{geemus@gmail.com}
|
@@ -213,14 +213,28 @@ Gem::Specification.new do |s|
|
|
213
213
|
"lib/fog/terremark/parsers/get_catalog_item.rb",
|
214
214
|
"lib/fog/terremark/parsers/get_organization.rb",
|
215
215
|
"lib/fog/terremark/parsers/get_organizations.rb",
|
216
|
+
"lib/fog/terremark/parsers/get_tasks_list.rb",
|
216
217
|
"lib/fog/terremark/parsers/get_vapp_template.rb",
|
217
218
|
"lib/fog/terremark/parsers/get_vdc.rb",
|
219
|
+
"lib/fog/terremark/parsers/instantiate_vapp_template.rb",
|
220
|
+
"lib/fog/terremark/parsers/task.rb",
|
221
|
+
"lib/fog/terremark/parsers/vapp.rb",
|
222
|
+
"lib/fog/terremark/requests/delete_vapp.rb",
|
223
|
+
"lib/fog/terremark/requests/deploy_vapp.rb",
|
218
224
|
"lib/fog/terremark/requests/get_catalog.rb",
|
219
225
|
"lib/fog/terremark/requests/get_catalog_item.rb",
|
220
226
|
"lib/fog/terremark/requests/get_organization.rb",
|
221
227
|
"lib/fog/terremark/requests/get_organizations.rb",
|
228
|
+
"lib/fog/terremark/requests/get_task.rb",
|
229
|
+
"lib/fog/terremark/requests/get_tasks_list.rb",
|
230
|
+
"lib/fog/terremark/requests/get_vapp.rb",
|
222
231
|
"lib/fog/terremark/requests/get_vapp_template.rb",
|
223
232
|
"lib/fog/terremark/requests/get_vdc.rb",
|
233
|
+
"lib/fog/terremark/requests/instantiate_vapp_template.rb",
|
234
|
+
"lib/fog/terremark/requests/power_off.rb",
|
235
|
+
"lib/fog/terremark/requests/power_on.rb",
|
236
|
+
"lib/fog/terremark/requests/reset.rb",
|
237
|
+
"lib/fog/terremark/requests/shutdown.rb",
|
224
238
|
"spec/aws/models/ec2/address_spec.rb",
|
225
239
|
"spec/aws/models/ec2/addresses_spec.rb",
|
226
240
|
"spec/aws/models/ec2/flavors_spec.rb",
|
@@ -460,14 +474,14 @@ Gem::Specification.new do |s|
|
|
460
474
|
s.specification_version = 3
|
461
475
|
|
462
476
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
463
|
-
s.add_runtime_dependency(%q<excon>, [">= 0.0.
|
477
|
+
s.add_runtime_dependency(%q<excon>, [">= 0.0.21"])
|
464
478
|
s.add_runtime_dependency(%q<formatador>, [">= 0.0.10"])
|
465
479
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
466
480
|
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
467
481
|
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
468
482
|
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
|
469
483
|
else
|
470
|
-
s.add_dependency(%q<excon>, [">= 0.0.
|
484
|
+
s.add_dependency(%q<excon>, [">= 0.0.21"])
|
471
485
|
s.add_dependency(%q<formatador>, [">= 0.0.10"])
|
472
486
|
s.add_dependency(%q<json>, [">= 0"])
|
473
487
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
@@ -475,7 +489,7 @@ Gem::Specification.new do |s|
|
|
475
489
|
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
476
490
|
end
|
477
491
|
else
|
478
|
-
s.add_dependency(%q<excon>, [">= 0.0.
|
492
|
+
s.add_dependency(%q<excon>, [">= 0.0.21"])
|
479
493
|
s.add_dependency(%q<formatador>, [">= 0.0.10"])
|
480
494
|
s.add_dependency(%q<json>, [">= 0"])
|
481
495
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
@@ -39,7 +39,7 @@ module Fog
|
|
39
39
|
'max-keys' => @max_keys,
|
40
40
|
'prefix' => @prefix
|
41
41
|
}.merge!(options)
|
42
|
-
options = options.reject {|key,value| value.nil? || value.empty?}
|
42
|
+
options = options.reject {|key,value| value.nil? || value.to_s.empty?}
|
43
43
|
data = connection.get_object(directory.name, key, options, &block)
|
44
44
|
file_data = {
|
45
45
|
:body => data.body,
|
@@ -22,7 +22,6 @@ module Fog
|
|
22
22
|
# * 'status'<~String> - Current status of the slice
|
23
23
|
def reboot_slice(slice_id, type = 'SOFT')
|
24
24
|
request(
|
25
|
-
:body => '', # Gives a 411 Length Required without this
|
26
25
|
:expects => 200,
|
27
26
|
:method => 'PUT',
|
28
27
|
:parser => Fog::Parsers::Slicehost::GetSlice.new,
|
data/lib/fog/terremark.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
+
require 'fog/terremark/requests/delete_vapp'
|
2
|
+
require 'fog/terremark/requests/deploy_vapp'
|
1
3
|
require 'fog/terremark/requests/get_catalog'
|
2
4
|
require 'fog/terremark/requests/get_catalog_item'
|
3
5
|
require 'fog/terremark/requests/get_organization'
|
4
6
|
require 'fog/terremark/requests/get_organizations'
|
7
|
+
require 'fog/terremark/requests/get_task'
|
8
|
+
require 'fog/terremark/requests/get_tasks_list'
|
9
|
+
require 'fog/terremark/requests/get_vapp'
|
5
10
|
require 'fog/terremark/requests/get_vapp_template'
|
6
11
|
require 'fog/terremark/requests/get_vdc'
|
12
|
+
require 'fog/terremark/requests/instantiate_vapp_template'
|
13
|
+
require 'fog/terremark/requests/reset'
|
14
|
+
require 'fog/terremark/requests/power_off'
|
15
|
+
require 'fog/terremark/requests/power_on'
|
16
|
+
require 'fog/terremark/requests/shutdown'
|
7
17
|
|
8
18
|
module Fog
|
9
19
|
module Terremark
|
@@ -21,7 +21,8 @@ module Fog
|
|
21
21
|
catalog = {}
|
22
22
|
until attributes.empty?
|
23
23
|
if attributes.first.is_a?(Array)
|
24
|
-
|
24
|
+
attribute = attributes.shift
|
25
|
+
catalog[attribute.first] = attribute.last
|
25
26
|
else
|
26
27
|
catalog[attributes.shift] = attributes.shift
|
27
28
|
end
|
@@ -5,7 +5,6 @@ module Fog
|
|
5
5
|
class GetCatalogItem < Fog::Parsers::Base
|
6
6
|
|
7
7
|
def reset
|
8
|
-
@property_key
|
9
8
|
@response = { 'Entity' => {}, 'Properties' => {} }
|
10
9
|
end
|
11
10
|
|
@@ -20,7 +19,8 @@ module Fog
|
|
20
19
|
catalog_item = {}
|
21
20
|
until attributes.empty?
|
22
21
|
if attributes.first.is_a?(Array)
|
23
|
-
|
22
|
+
attribute = attributes.shift
|
23
|
+
catalog_item[attribute.first] = attribute.last
|
24
24
|
else
|
25
25
|
catalog_item[attributes.shift] = attributes.shift
|
26
26
|
end
|
@@ -21,7 +21,8 @@ module Fog
|
|
21
21
|
org = {}
|
22
22
|
until attributes.empty?
|
23
23
|
if attributes.first.is_a?(Array)
|
24
|
-
|
24
|
+
attribute = attributes.shift
|
25
|
+
org[attribute.first] = attribute.last
|
25
26
|
else
|
26
27
|
org[attributes.shift] = attributes.shift
|
27
28
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
|
5
|
+
class GetTasksList < Fog::Parsers::Base
|
6
|
+
|
7
|
+
def reset
|
8
|
+
@response = { 'Tasks' => [] }
|
9
|
+
@task = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attributes)
|
13
|
+
@value = ''
|
14
|
+
case name
|
15
|
+
when 'Owner', 'Result'
|
16
|
+
data = {}
|
17
|
+
until attributes.empty?
|
18
|
+
data[attributes.shift] = attributes.shift
|
19
|
+
end
|
20
|
+
@task[name] = data
|
21
|
+
when 'Task'
|
22
|
+
until attributes.empty?
|
23
|
+
@task[attributes.shift] = attributes.shift
|
24
|
+
end
|
25
|
+
when 'TasksList'
|
26
|
+
tasks_list = {}
|
27
|
+
until attributes.empty?
|
28
|
+
if attributes.first.is_a?(Array)
|
29
|
+
attribute = attributes.shift
|
30
|
+
tasks_list[attribute.first] = attribute.last
|
31
|
+
else
|
32
|
+
tasks_list[attributes.shift] = attributes.shift
|
33
|
+
end
|
34
|
+
end
|
35
|
+
@response['href'] = tasks_list['href']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def end_element(name)
|
40
|
+
if name == 'Task'
|
41
|
+
@response['Tasks'] << @task
|
42
|
+
@task = {}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -5,7 +5,6 @@ module Fog
|
|
5
5
|
class GetVappTemplate < Fog::Parsers::Base
|
6
6
|
|
7
7
|
def reset
|
8
|
-
@property_key
|
9
8
|
@response = { 'Links' => [] }
|
10
9
|
end
|
11
10
|
|
@@ -22,7 +21,8 @@ module Fog
|
|
22
21
|
vapp_template = {}
|
23
22
|
until attributes.empty?
|
24
23
|
if attributes.first.is_a?(Array)
|
25
|
-
|
24
|
+
attribute = attributes.shift
|
25
|
+
vapp_template[attribute.first] = attribute.last
|
26
26
|
else
|
27
27
|
vapp_template[attributes.shift] = attributes.shift
|
28
28
|
end
|
@@ -20,7 +20,7 @@ module Fog
|
|
20
20
|
'Memory' => {}
|
21
21
|
},
|
22
22
|
'StorageCapacity' => {},
|
23
|
-
'ResourceEntities' =>
|
23
|
+
'ResourceEntities' => []
|
24
24
|
}
|
25
25
|
end
|
26
26
|
|
@@ -52,14 +52,15 @@ module Fog
|
|
52
52
|
until attributes.empty?
|
53
53
|
resource_entity[attributes.shift] = attributes.shift
|
54
54
|
end
|
55
|
-
@response['
|
55
|
+
@response['ResourceEntities'] << resource_entity
|
56
56
|
when 'StorageCapacity'
|
57
57
|
@in_storage_capacity = true
|
58
58
|
when 'Vdc'
|
59
59
|
vdc = {}
|
60
60
|
until attributes.empty?
|
61
61
|
if attributes.first.is_a?(Array)
|
62
|
-
|
62
|
+
attribute = attributes.shift
|
63
|
+
vdc[attribute.first] = attribute.last
|
63
64
|
else
|
64
65
|
vdc[attributes.shift] = attributes.shift
|
65
66
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
|
5
|
+
class InstantiateVappTemplate < Fog::Parsers::Base
|
6
|
+
|
7
|
+
def reset
|
8
|
+
@property_key
|
9
|
+
@response = { 'Links' => [] }
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name, attributes)
|
13
|
+
@value = ''
|
14
|
+
case name
|
15
|
+
when 'Link'
|
16
|
+
link = {}
|
17
|
+
until attributes.empty?
|
18
|
+
link[attributes.shift] = attributes.shift
|
19
|
+
end
|
20
|
+
@response['Links'] << link
|
21
|
+
when 'VApp'
|
22
|
+
vapp_template = {}
|
23
|
+
until attributes.empty?
|
24
|
+
if attributes.first.is_a?(Array)
|
25
|
+
attribute = attributes.shift
|
26
|
+
vapp_template[attribute.first] = attribute.last
|
27
|
+
else
|
28
|
+
vapp_template[attributes.shift] = attributes.shift
|
29
|
+
end
|
30
|
+
end
|
31
|
+
@response.merge!(vapp_template.reject {|key, value| !['href', 'name', 'size', 'status', 'type'].include?(key)})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
|
5
|
+
class Task < Fog::Parsers::Base
|
6
|
+
|
7
|
+
def reset
|
8
|
+
@response = {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def start_element(name, attributes)
|
12
|
+
@value = ''
|
13
|
+
case name
|
14
|
+
when 'Owner', 'Result'
|
15
|
+
data = {}
|
16
|
+
until attributes.empty?
|
17
|
+
data[attributes.shift] = attributes.shift
|
18
|
+
end
|
19
|
+
@response[name] = data
|
20
|
+
when 'Task'
|
21
|
+
task = {}
|
22
|
+
until attributes.empty?
|
23
|
+
if attributes.first.is_a?(Array)
|
24
|
+
attribute = attributes.shift
|
25
|
+
task[attribute.first] = attribute.last
|
26
|
+
else
|
27
|
+
task[attributes.shift] = attributes.shift
|
28
|
+
end
|
29
|
+
end
|
30
|
+
@response.merge!(task.reject {|key,value| !['endTime', 'href', 'startTime', 'status', 'type'].include?(key)})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module Terremark
|
4
|
+
|
5
|
+
class Vapp < Fog::Parsers::Base
|
6
|
+
|
7
|
+
def reset
|
8
|
+
@response = { 'Links' => [] }
|
9
|
+
end
|
10
|
+
|
11
|
+
def start_element(name, attributes)
|
12
|
+
@value = ''
|
13
|
+
case name
|
14
|
+
when 'Link'
|
15
|
+
link = {}
|
16
|
+
until attributes.empty?
|
17
|
+
link[attributes.shift] = attributes.shift
|
18
|
+
end
|
19
|
+
@response['Links'] << link
|
20
|
+
when 'Vapp'
|
21
|
+
vapp = {}
|
22
|
+
until attributes.empty?
|
23
|
+
if attributes.first.is_a?(Array)
|
24
|
+
attribute = attributes.shift
|
25
|
+
vapp[attribute.first] = attribute.last
|
26
|
+
else
|
27
|
+
vapp[attributes.shift] = attributes.shift
|
28
|
+
end
|
29
|
+
end
|
30
|
+
@response.merge!(task.reject {|key,value| !['href', 'name', 'size', 'status', 'type'].include?(key)})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def end_element(name)
|
35
|
+
case name
|
36
|
+
when 'IpAddress'
|
37
|
+
@response['IpAddress'] = @value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
# Destroy a vapp
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * vapp_id<~Integer> - Id of vapp to destroy
|
9
|
+
#
|
10
|
+
# ==== Returns
|
11
|
+
# * response<~Excon::Response>:
|
12
|
+
# * body<~Hash>:
|
13
|
+
|
14
|
+
# FIXME
|
15
|
+
|
16
|
+
# * 'CatalogItems'<~Array>
|
17
|
+
# * 'href'<~String> - linke to item
|
18
|
+
# * 'name'<~String> - name of item
|
19
|
+
# * 'type'<~String> - type of item
|
20
|
+
# * 'description'<~String> - Description of catalog
|
21
|
+
# * 'name'<~String> - Name of catalog
|
22
|
+
def delete_vapp(vapp_id)
|
23
|
+
request(
|
24
|
+
:expects => 202,
|
25
|
+
:method => 'DELETE',
|
26
|
+
:path => "vApp/#{vapp_id}"
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class Mock
|
33
|
+
|
34
|
+
def delete_vapp(vapp_id)
|
35
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/task'
|
6
|
+
|
7
|
+
# Reserve requested resources and deploy vApp
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * vapp_id<~Integer> - Id of vApp to deploy
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * 'endTime'<~String> - endTime of task
|
16
|
+
# * 'href'<~String> - link to task
|
17
|
+
# * 'startTime'<~String> - startTime of task
|
18
|
+
# * 'status'<~String> - status of task
|
19
|
+
# * 'type'<~String> - type of task
|
20
|
+
# * 'Owner'<~String> -
|
21
|
+
# * 'href'<~String> - href of owner
|
22
|
+
# * 'name'<~String> - name of owner
|
23
|
+
# * 'type'<~String> - type of owner
|
24
|
+
def deploy_vapp(vapp_id)
|
25
|
+
request(
|
26
|
+
:expects => 202,
|
27
|
+
:method => 'POST',
|
28
|
+
:parser => Fog::Parsers::Terremark::Task.new,
|
29
|
+
:path => "/vApp/#{vapp_id}/action/deploy"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class Mock
|
36
|
+
|
37
|
+
def deploy_vapp(task_id)
|
38
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/task'
|
6
|
+
|
7
|
+
# Get details of a task
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * task_id<~Integer> - Id of task to lookup
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * 'endTime'<~String> - endTime of task
|
16
|
+
# * 'href'<~String> - link to task
|
17
|
+
# * 'startTime'<~String> - startTime of task
|
18
|
+
# * 'status'<~String> - status of task
|
19
|
+
# * 'type'<~String> - type of task
|
20
|
+
# * 'Owner'<~String> -
|
21
|
+
# * 'href'<~String> - href of owner
|
22
|
+
# * 'name'<~String> - name of owner
|
23
|
+
# * 'type'<~String> - type of owner
|
24
|
+
# * 'Result'<~String> -
|
25
|
+
# * 'href'<~String> - href of result
|
26
|
+
# * 'name'<~String> - name of result
|
27
|
+
# * 'type'<~String> - type of result
|
28
|
+
def get_task(task_id)
|
29
|
+
request(
|
30
|
+
:expects => 200,
|
31
|
+
:method => 'GET',
|
32
|
+
:parser => Fog::Parsers::Terremark::Task.new,
|
33
|
+
:path => "/task/#{task_id}"
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
class Mock
|
40
|
+
|
41
|
+
def get_task(task_id)
|
42
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/get_tasks_list'
|
6
|
+
|
7
|
+
# Get list of tasks
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * tasks_list_id<~Integer> - Id of tasks lists to view
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * 'CatalogItems'<~Array>
|
16
|
+
# * 'href'<~String> - linke to item
|
17
|
+
# * 'name'<~String> - name of item
|
18
|
+
# * 'type'<~String> - type of item
|
19
|
+
# * 'description'<~String> - Description of catalog
|
20
|
+
# * 'name'<~String> - Name of catalog
|
21
|
+
def get_tasks_list(tasks_list_id)
|
22
|
+
request(
|
23
|
+
:expects => 200,
|
24
|
+
:method => 'GET',
|
25
|
+
:parser => Fog::Parsers::Terremark::GetTasksList.new,
|
26
|
+
:path => "/tasksList/#{tasks_list_id}"
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class Mock
|
33
|
+
|
34
|
+
def get_tasks_list(tasks_list_id)
|
35
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/vapp'
|
6
|
+
|
7
|
+
# Get details of a vapp
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * vapp_id<~Integer> - Id of vapp to lookup
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
|
16
|
+
# FIXME
|
17
|
+
|
18
|
+
# * 'endTime'<~String> - endTime of task
|
19
|
+
# * 'href'<~String> - link to task
|
20
|
+
# * 'startTime'<~String> - startTime of task
|
21
|
+
# * 'status'<~String> - status of task
|
22
|
+
# * 'type'<~String> - type of task
|
23
|
+
# * 'Owner'<~String> -
|
24
|
+
# * 'href'<~String> - href of owner
|
25
|
+
# * 'name'<~String> - name of owner
|
26
|
+
# * 'type'<~String> - type of owner
|
27
|
+
# * 'Result'<~String> -
|
28
|
+
# * 'href'<~String> - href of result
|
29
|
+
# * 'name'<~String> - name of result
|
30
|
+
# * 'type'<~String> - type of result
|
31
|
+
def get_vapp(vapp_id)
|
32
|
+
request(
|
33
|
+
:expects => 200,
|
34
|
+
:method => 'GET',
|
35
|
+
:parser => Fog::Parsers::Terremark::Vapp.new,
|
36
|
+
:path => "/vapp/#{vapp_id}"
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
class Mock
|
43
|
+
|
44
|
+
def get_vapp(vapp_id)
|
45
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/instantiate_vapp_template'
|
6
|
+
|
7
|
+
# Instatiate a vapp template
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * vdc_id<~Integer> - Id of vdc to instantiate template in
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
|
16
|
+
# FIXME
|
17
|
+
|
18
|
+
# * 'CatalogItems'<~Array>
|
19
|
+
# * 'href'<~String> - linke to item
|
20
|
+
# * 'name'<~String> - name of item
|
21
|
+
# * 'type'<~String> - type of item
|
22
|
+
# * 'description'<~String> - Description of catalog
|
23
|
+
# * 'name'<~String> - Name of catalog
|
24
|
+
def instantiate_vapp_template(name)
|
25
|
+
# FIXME: much cheating to commence
|
26
|
+
|
27
|
+
organization_id = get_organizations.body['OrgList'].first['href'].split('/').last
|
28
|
+
organization = get_organization(organization_id).body
|
29
|
+
vdc_id = organization['Links'].select {|link| link['type'] == 'application/vnd.vmware.vcloud.vdc+xml'}.first['href'].split('/').last
|
30
|
+
vdc = get_vdc(vdc_id).body
|
31
|
+
network_id = vdc['AvailableNetworks'].first['href'].split('/').last
|
32
|
+
catalog_item = 12 # Ubuntu JeOS 9.10 (64-bit)
|
33
|
+
|
34
|
+
# case UNRESOLVED:
|
35
|
+
# return "0";
|
36
|
+
# case RESOLVED:
|
37
|
+
# return "1";
|
38
|
+
# case OFF:
|
39
|
+
# return "2";
|
40
|
+
# case SUSPENDED:
|
41
|
+
# return "3";
|
42
|
+
# case ON:
|
43
|
+
# return "4";
|
44
|
+
# default:
|
45
|
+
#
|
46
|
+
# /**
|
47
|
+
# * The vApp is unresolved (one or more file references are unavailable in the cloud)
|
48
|
+
# */
|
49
|
+
# UNRESOLVED,
|
50
|
+
# /**
|
51
|
+
# * The vApp is resolved (all file references are available in the cloud) but not deployed
|
52
|
+
# */
|
53
|
+
# RESOLVED,
|
54
|
+
# /**
|
55
|
+
# * The vApp is deployed and powered off
|
56
|
+
# */
|
57
|
+
# OFF,
|
58
|
+
# /**
|
59
|
+
# * The vApp is deployed and suspended
|
60
|
+
# */
|
61
|
+
# SUSPENDED,
|
62
|
+
# /**
|
63
|
+
# * The vApp is deployed and powered on
|
64
|
+
# */
|
65
|
+
# ON;
|
66
|
+
|
67
|
+
data = <<-DATA
|
68
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
69
|
+
<InstantiateVAppTemplateParams name="#{name}" xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://services.vcloudexpress.terremark.com/api/v0.8/ns/vcloud.xsd">
|
70
|
+
<VAppTemplate href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/#{catalog_item}" />
|
71
|
+
<InstantiationParams xmlns:vmw="http://www.vmware.com/schema/ovf">
|
72
|
+
<ProductSection xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:q1="http://www.vmware.com/vcloud/v0.8"/>
|
73
|
+
<VirtualHardwareSection xmlns:q1="http://www.vmware.com/vcloud/v0.8">
|
74
|
+
<Item xmlns="http://schemas.dmtf.org/ovf/envelope/1">
|
75
|
+
<InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</InstanceID>
|
76
|
+
<ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</ResourceType>
|
77
|
+
<VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</VirtualQuantity>
|
78
|
+
</Item>
|
79
|
+
<Item xmlns="http://schemas.dmtf.org/ovf/envelope/1">
|
80
|
+
<InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</InstanceID>
|
81
|
+
<ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</ResourceType>
|
82
|
+
<VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">512</VirtualQuantity>
|
83
|
+
</Item>
|
84
|
+
</VirtualHardwareSection>
|
85
|
+
<NetworkConfigSection>
|
86
|
+
<NetworkConfig name="Network 1">
|
87
|
+
<Features>
|
88
|
+
<vmw:FenceMode>allowInOut</vmw:FenceMode>
|
89
|
+
<vmw:Dhcp>true</vmw:Dhcp>
|
90
|
+
</Features>
|
91
|
+
<NetworkAssociation href="https://services.vcloudexpress.terremark.com/api/v8/network/#{network_id}" />
|
92
|
+
</NetworkConfig>
|
93
|
+
</NetworkConfigSection>
|
94
|
+
</InstantiationParams>
|
95
|
+
</InstantiateVAppTemplateParams>
|
96
|
+
DATA
|
97
|
+
|
98
|
+
request(
|
99
|
+
:body => data,
|
100
|
+
:expects => 200,
|
101
|
+
:headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml' },
|
102
|
+
:method => 'POST',
|
103
|
+
:parser => Fog::Parsers::Terremark::InstantiateVappTemplate.new,
|
104
|
+
:path => "/vdc/#{vdc_id}/action/instantiatevAppTemplate"
|
105
|
+
)
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
class Mock
|
111
|
+
|
112
|
+
def instatiate_vapp_template(vapp_template_id)
|
113
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/task'
|
6
|
+
|
7
|
+
# Power off a vapp
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * vapp_id<~Integer> - Id of vapp to power off
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * 'endTime'<~String> - endTime of task
|
16
|
+
# * 'href'<~String> - link to task
|
17
|
+
# * 'startTime'<~String> - startTime of task
|
18
|
+
# * 'status'<~String> - status of task
|
19
|
+
# * 'type'<~String> - type of task
|
20
|
+
# * 'Owner'<~String> -
|
21
|
+
# * 'href'<~String> - href of owner
|
22
|
+
# * 'name'<~String> - name of owner
|
23
|
+
# * 'type'<~String> - type of owner
|
24
|
+
def power_off(vapp_id)
|
25
|
+
request(
|
26
|
+
:expects => 202,
|
27
|
+
:method => 'POST',
|
28
|
+
:parser => Fog::Parsers::Terremark::Task.new,
|
29
|
+
:path => "/vApp/#{vapp_id}/power/action/powerOff"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class Mock
|
36
|
+
|
37
|
+
def power_off(vapp_id)
|
38
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/task'
|
6
|
+
|
7
|
+
# Power on a vapp
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * vapp_id<~Integer> - Id of vapp to power on
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * 'endTime'<~String> - endTime of task
|
16
|
+
# * 'href'<~String> - link to task
|
17
|
+
# * 'startTime'<~String> - startTime of task
|
18
|
+
# * 'status'<~String> - status of task
|
19
|
+
# * 'type'<~String> - type of task
|
20
|
+
# * 'Owner'<~String> -
|
21
|
+
# * 'href'<~String> - href of owner
|
22
|
+
# * 'name'<~String> - name of owner
|
23
|
+
# * 'type'<~String> - type of owner
|
24
|
+
def power_on(vapp_id)
|
25
|
+
request(
|
26
|
+
:expects => 202,
|
27
|
+
:method => 'POST',
|
28
|
+
:parser => Fog::Parsers::Terremark::Task.new,
|
29
|
+
:path => "/vApp/#{vapp_id}/power/action/powerOn"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class Mock
|
36
|
+
|
37
|
+
def power_on(vapp_id)
|
38
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/task'
|
6
|
+
|
7
|
+
# Reset a vapp
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * vapp_id<~Integer> - Id of vapp to reset
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * 'endTime'<~String> - endTime of task
|
16
|
+
# * 'href'<~String> - link to task
|
17
|
+
# * 'startTime'<~String> - startTime of task
|
18
|
+
# * 'status'<~String> - status of task
|
19
|
+
# * 'type'<~String> - type of task
|
20
|
+
# * 'Owner'<~String> -
|
21
|
+
# * 'href'<~String> - href of owner
|
22
|
+
# * 'name'<~String> - name of owner
|
23
|
+
# * 'type'<~String> - type of owner
|
24
|
+
def reset(vapp_id)
|
25
|
+
request(
|
26
|
+
:expects => 202,
|
27
|
+
:method => 'POST',
|
28
|
+
:parser => Fog::Parsers::Terremark::Task.new,
|
29
|
+
:path => "/vApp/#{vapp_id}/power/action/reset"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class Mock
|
36
|
+
|
37
|
+
def reset(vapp_id)
|
38
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
class Real
|
4
|
+
|
5
|
+
require 'fog/terremark/parsers/task'
|
6
|
+
|
7
|
+
# Shutdown a vapp
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * vapp_id<~Integer> - Id of vapp to shutdown
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * 'endTime'<~String> - endTime of task
|
16
|
+
# * 'href'<~String> - link to task
|
17
|
+
# * 'startTime'<~String> - startTime of task
|
18
|
+
# * 'status'<~String> - status of task
|
19
|
+
# * 'type'<~String> - type of task
|
20
|
+
# * 'Owner'<~String> -
|
21
|
+
# * 'href'<~String> - href of owner
|
22
|
+
# * 'name'<~String> - name of owner
|
23
|
+
# * 'type'<~String> - type of owner
|
24
|
+
def shutdown(vapp_id)
|
25
|
+
request(
|
26
|
+
:expects => 202,
|
27
|
+
:method => 'POST',
|
28
|
+
:parser => Fog::Parsers::Terremark::Task.new,
|
29
|
+
:path => "/vApp/#{vapp_id}/power/action/shutdown"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class Mock
|
36
|
+
|
37
|
+
def shutdown(vapp_id)
|
38
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 62
|
9
|
+
version: 0.0.62
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-30 00:00:00 -07:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 0
|
29
29
|
- 0
|
30
|
-
-
|
31
|
-
version: 0.0.
|
30
|
+
- 21
|
31
|
+
version: 0.0.21
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -297,14 +297,28 @@ files:
|
|
297
297
|
- lib/fog/terremark/parsers/get_catalog_item.rb
|
298
298
|
- lib/fog/terremark/parsers/get_organization.rb
|
299
299
|
- lib/fog/terremark/parsers/get_organizations.rb
|
300
|
+
- lib/fog/terremark/parsers/get_tasks_list.rb
|
300
301
|
- lib/fog/terremark/parsers/get_vapp_template.rb
|
301
302
|
- lib/fog/terremark/parsers/get_vdc.rb
|
303
|
+
- lib/fog/terremark/parsers/instantiate_vapp_template.rb
|
304
|
+
- lib/fog/terremark/parsers/task.rb
|
305
|
+
- lib/fog/terremark/parsers/vapp.rb
|
306
|
+
- lib/fog/terremark/requests/delete_vapp.rb
|
307
|
+
- lib/fog/terremark/requests/deploy_vapp.rb
|
302
308
|
- lib/fog/terremark/requests/get_catalog.rb
|
303
309
|
- lib/fog/terremark/requests/get_catalog_item.rb
|
304
310
|
- lib/fog/terremark/requests/get_organization.rb
|
305
311
|
- lib/fog/terremark/requests/get_organizations.rb
|
312
|
+
- lib/fog/terremark/requests/get_task.rb
|
313
|
+
- lib/fog/terremark/requests/get_tasks_list.rb
|
314
|
+
- lib/fog/terremark/requests/get_vapp.rb
|
306
315
|
- lib/fog/terremark/requests/get_vapp_template.rb
|
307
316
|
- lib/fog/terremark/requests/get_vdc.rb
|
317
|
+
- lib/fog/terremark/requests/instantiate_vapp_template.rb
|
318
|
+
- lib/fog/terremark/requests/power_off.rb
|
319
|
+
- lib/fog/terremark/requests/power_on.rb
|
320
|
+
- lib/fog/terremark/requests/reset.rb
|
321
|
+
- lib/fog/terremark/requests/shutdown.rb
|
308
322
|
- spec/aws/models/ec2/address_spec.rb
|
309
323
|
- spec/aws/models/ec2/addresses_spec.rb
|
310
324
|
- spec/aws/models/ec2/flavors_spec.rb
|