fog 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. data/Gemfile +8 -8
  2. data/Gemfile.lock +3 -3
  3. data/bin/fog +2 -10
  4. data/fog.gemspec +45 -20
  5. data/lib/fog.rb +2 -1
  6. data/lib/fog/attributes.rb +48 -8
  7. data/lib/fog/aws/ec2.rb +5 -2
  8. data/lib/fog/aws/elb.rb +5 -2
  9. data/lib/fog/aws/models/ec2/server.rb +1 -1
  10. data/lib/fog/aws/requests/simpledb/put_attributes.rb +43 -12
  11. data/lib/fog/aws/s3.rb +2 -2
  12. data/lib/fog/aws/simpledb.rb +15 -3
  13. data/lib/fog/bin.rb +11 -2
  14. data/lib/fog/bluebox.rb +5 -1
  15. data/lib/fog/connection.rb +9 -1
  16. data/lib/fog/credentials.rb +3 -0
  17. data/lib/fog/new_servers.rb +89 -0
  18. data/lib/fog/new_servers/bin.rb +30 -0
  19. data/lib/fog/new_servers/requests/add_server.rb +39 -0
  20. data/lib/fog/new_servers/requests/cancel_server.rb +36 -0
  21. data/lib/fog/new_servers/requests/get_server.rb +42 -0
  22. data/lib/fog/new_servers/requests/list_images.rb +33 -0
  23. data/lib/fog/new_servers/requests/list_plans.rb +36 -0
  24. data/lib/fog/new_servers/requests/list_servers.rb +43 -0
  25. data/lib/fog/new_servers/requests/reboot_server.rb +30 -0
  26. data/lib/fog/parser.rb +6 -0
  27. data/lib/fog/rackspace/files.rb +8 -2
  28. data/lib/fog/rackspace/models/servers/server.rb +5 -0
  29. data/lib/fog/rackspace/servers.rb +5 -1
  30. data/lib/fog/service.rb +6 -1
  31. data/lib/fog/slicehost.rb +5 -1
  32. data/lib/fog/terremark/ecloud.rb +1 -0
  33. data/lib/fog/terremark/shared.rb +4 -1
  34. data/lib/fog/terremark/vcloud.rb +1 -0
  35. data/lib/fog/vcloud.rb +150 -141
  36. data/lib/fog/vcloud/bin.rb +2 -2
  37. data/lib/fog/vcloud/collection.rb +3 -84
  38. data/lib/fog/vcloud/extension.rb +44 -0
  39. data/lib/fog/vcloud/generators.rb +33 -0
  40. data/lib/fog/vcloud/model.rb +5 -38
  41. data/lib/fog/vcloud/models/vdc.rb +14 -24
  42. data/lib/fog/vcloud/models/vdcs.rb +13 -8
  43. data/lib/fog/vcloud/requests/get_network.rb +4 -11
  44. data/lib/fog/vcloud/requests/get_organization.rb +4 -11
  45. data/lib/fog/vcloud/requests/get_vdc.rb +4 -12
  46. data/lib/fog/vcloud/requests/get_versions.rb +4 -13
  47. data/lib/fog/vcloud/requests/login.rb +4 -4
  48. data/lib/fog/vcloud/terremark/ecloud.rb +125 -54
  49. data/lib/fog/vcloud/terremark/ecloud/models/catalog.rb +30 -0
  50. data/lib/fog/vcloud/terremark/ecloud/models/catalog_item.rb +31 -0
  51. data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +21 -22
  52. data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +11 -25
  53. data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +38 -5
  54. data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +11 -15
  55. data/lib/fog/vcloud/terremark/ecloud/models/network.rb +52 -11
  56. data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +14 -13
  57. data/lib/fog/vcloud/terremark/ecloud/models/node.rb +47 -0
  58. data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +30 -0
  59. data/lib/fog/vcloud/terremark/ecloud/models/public_ip.rb +6 -9
  60. data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +19 -3
  61. data/lib/fog/vcloud/terremark/ecloud/models/server.rb +203 -0
  62. data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +43 -0
  63. data/lib/fog/vcloud/terremark/ecloud/models/task.rb +22 -0
  64. data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +30 -0
  65. data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +32 -10
  66. data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +5 -6
  67. data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +23 -10
  68. data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +54 -0
  69. data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +14 -12
  70. data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +53 -0
  71. data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +52 -0
  72. data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +42 -0
  73. data/lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb +115 -0
  74. data/lib/fog/vcloud/terremark/ecloud/requests/delete_internet_service.rb +4 -23
  75. data/lib/fog/vcloud/terremark/ecloud/requests/delete_node.rb +0 -0
  76. data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +19 -0
  77. data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +18 -0
  78. data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +18 -0
  79. data/lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb +18 -0
  80. data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +9 -16
  81. data/lib/fog/vcloud/terremark/ecloud/requests/get_network.rb +8 -14
  82. data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +36 -0
  83. data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +44 -0
  84. data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +11 -12
  85. data/lib/fog/vcloud/terremark/ecloud/requests/get_node.rb +18 -0
  86. data/lib/fog/vcloud/terremark/ecloud/requests/get_nodes.rb +18 -0
  87. data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb +5 -19
  88. data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb +5 -12
  89. data/lib/fog/vcloud/terremark/ecloud/requests/get_task.rb +18 -0
  90. data/lib/fog/vcloud/terremark/ecloud/requests/get_task_list.rb +19 -0
  91. data/lib/fog/vcloud/terremark/ecloud/requests/get_vapp.rb +18 -0
  92. data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +7 -15
  93. data/lib/fog/vcloud/terremark/ecloud/requests/power_off.rb +18 -0
  94. data/lib/fog/vcloud/terremark/ecloud/requests/power_on.rb +18 -0
  95. data/lib/fog/vcloud/terremark/ecloud/requests/power_reset.rb +18 -0
  96. data/lib/fog/vcloud/terremark/ecloud/requests/power_shutdown.rb +18 -0
  97. data/lib/fog/vcloud/terremark/vcloud.rb +4 -18
  98. data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +4 -12
  99. data/spec/aws/requests/simpledb/put_attributes_spec.rb +18 -0
  100. data/spec/vcloud/bin_spec.rb +2 -2
  101. data/spec/vcloud/models/vdc_spec.rb +35 -29
  102. data/spec/vcloud/requests/get_network_spec.rb +32 -43
  103. data/spec/vcloud/requests/get_organization_spec.rb +45 -38
  104. data/spec/vcloud/requests/get_vdc_spec.rb +42 -32
  105. data/spec/vcloud/requests/get_versions_spec.rb +17 -17
  106. data/spec/vcloud/requests/login_spec.rb +7 -4
  107. data/spec/vcloud/spec_helper.rb +137 -46
  108. data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +53 -58
  109. data/spec/vcloud/terremark/ecloud/models/internet_services_spec.rb +20 -20
  110. data/spec/vcloud/terremark/ecloud/models/ip_spec.rb +22 -21
  111. data/spec/vcloud/terremark/ecloud/models/ips_spec.rb +18 -18
  112. data/spec/vcloud/terremark/ecloud/models/network_spec.rb +55 -51
  113. data/spec/vcloud/terremark/ecloud/models/networks_spec.rb +16 -15
  114. data/spec/vcloud/terremark/ecloud/models/public_ip_spec.rb +26 -27
  115. data/spec/vcloud/terremark/ecloud/models/public_ips_spec.rb +16 -15
  116. data/spec/vcloud/terremark/ecloud/models/vdc_spec.rb +52 -36
  117. data/spec/vcloud/terremark/ecloud/models/vdcs_spec.rb +18 -15
  118. data/spec/vcloud/terremark/ecloud/requests/add_internet_service_spec.rb +46 -43
  119. data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +37 -32
  120. data/spec/vcloud/terremark/ecloud/requests/delete_internet_service_spec.rb +26 -23
  121. data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +57 -49
  122. data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +41 -0
  123. data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +39 -34
  124. data/spec/vcloud/terremark/ecloud/requests/get_network_spec.rb +26 -48
  125. data/spec/vcloud/terremark/ecloud/requests/get_public_ip_spec.rb +25 -26
  126. data/spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb +35 -27
  127. data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +85 -110
  128. data/spec/vcloud/terremark/ecloud/requests/login_spec.rb +7 -4
  129. data/spec/vcloud/vcloud_spec.rb +9 -8
  130. metadata +62 -26
  131. data/lib/fog/vcloud/parser.rb +0 -42
  132. data/lib/fog/vcloud/parsers/get_organization.rb +0 -37
  133. data/lib/fog/vcloud/parsers/get_vdc.rb +0 -62
  134. data/lib/fog/vcloud/parsers/get_versions.rb +0 -46
  135. data/lib/fog/vcloud/parsers/login.rb +0 -36
  136. data/lib/fog/vcloud/parsers/network.rb +0 -53
  137. data/lib/fog/vcloud/terremark/all.rb +0 -9
  138. data/lib/fog/vcloud/terremark/ecloud/parsers/get_internet_services.rb +0 -59
  139. data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ip.rb +0 -30
  140. data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ips.rb +0 -40
  141. data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +0 -59
  142. data/lib/fog/vcloud/terremark/ecloud/parsers/internet_service.rb +0 -58
  143. data/lib/fog/vcloud/terremark/ecloud/parsers/network.rb +0 -28
  144. data/lib/fog/vcloud/terremark/ecloud/parsers/network_ips.rb +0 -31
  145. data/lib/fog/vcloud/terremark/ecloud/requests/login.rb +0 -27
  146. data/lib/fog/vcloud/terremark/vcloud/parsers/get_vdc.rb +0 -34
  147. data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +0 -74
@@ -0,0 +1,44 @@
1
+ #
2
+ # AFAICT this is basically undocumented ATM - 6/18/2010 - freeformz
3
+ #
4
+
5
+ module Fog
6
+ module Vcloud
7
+ module Terremark
8
+ module Ecloud
9
+
10
+ module Real
11
+ basic_request :get_network_ip
12
+ end
13
+
14
+ module Mock
15
+
16
+ def get_network_ip(ip_uri)
17
+ response = Excon::Response.new
18
+ ip_id = ip_uri.split("/").last
19
+ if network = mock_data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:networks] } }.flatten.detect { |network| IPAddr.new(network[:subnet]).to_range.map { |ip| ip.to_s.gsub('.','') }.include?(ip_id) }
20
+ ip = IPAddr.new(network[:subnet]).to_range.detect { |ip| ip.to_s.gsub('.','') == ip_id }
21
+ xml = Builder::XmlMarkup.new
22
+ mock_it 200,
23
+ xml.IpAddress(ecloud_xmlns) {
24
+ xml.Id( ip_id )
25
+ xml.Href( ip_uri.to_s )
26
+ xml.Name( ip.to_s )
27
+ if network[:ips].has_key?(ip.to_s)
28
+ xml.Status( "Assigned" )
29
+ xml.Server( network[:ips][ip.to_s] )
30
+ else
31
+ xml.Status( "Available" )
32
+ end
33
+ },
34
+ { 'Content-Type' => 'application/vnd.tmrk.ecloud.ip+xml' }
35
+ else
36
+ mock_error 200, "401 Unauthorized"
37
+ end
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,38 +1,37 @@
1
+ #
2
+ # AFAICT - This is basically undocumented - 6/18/2010 - freeformz
3
+ #
4
+
1
5
  module Fog
2
6
  module Vcloud
3
7
  module Terremark
4
8
  module Ecloud
5
- module Real
6
-
7
- def get_network_ips(network_ips_uri)
8
- request(
9
- :expects => 200,
10
- :method => 'GET',
11
- :parser => Fog::Parsers::Vcloud::Terremark::Ecloud::NetworkIps.new,
12
- :uri => network_ips_uri
13
- )
14
- end
15
9
 
10
+ module Real
11
+ basic_request :get_network_ips
16
12
  end
17
13
 
18
14
  module Mock
19
15
  require 'ipaddr'
20
16
 
21
17
  def get_network_ips(network_ips_uri)
18
+ network_ips_uri = ensure_unparsed(network_ips_uri)
22
19
  response = Excon::Response.new
23
- if network = mock_data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:networks] } }.flatten.detect { |network| network[:href] == network_ips_uri.to_s.gsub(%r:/ips$:,'') }
20
+ if network = mock_data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:networks] } }.flatten.detect { |network| network[:href] == network_ips_uri.gsub(%r:/ips$:,'') }
24
21
  xml = Builder::XmlMarkup.new
25
- mock_it Fog::Parsers::Vcloud::Terremark::Ecloud::NetworkIps.new, 200,
22
+ mock_it 200,
26
23
  xml.IpAddresses {
27
24
  IPAddr.new(network[:name]).to_range.to_a[3..-2].each do |ip|
28
25
  xml.IpAddress {
29
26
  xml.Name(ip.to_s)
27
+ xml.Href("#{Fog::Vcloud::Terremark::Ecloud::Mock.extension_url}/ip/#{ip.to_s.gsub('.','')}")
30
28
  if network[:ips].has_key?(ip.to_s)
31
29
  xml.Status("Assigned")
32
30
  xml.Server(network[:ips][ip.to_s])
33
31
  else
34
32
  xml.Status("Available")
35
33
  end
34
+ xml.RnatAddress(network[:rnat])
36
35
  }
37
36
  end
38
37
  },
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :get_node
8
+ end
9
+
10
+ module Mock
11
+ def get_node(node_uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :get_nodes
8
+ end
9
+
10
+ module Mock
11
+ def get_nodes(nodes_uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -4,20 +4,7 @@ module Fog
4
4
  module Ecloud
5
5
 
6
6
  module Real
7
-
8
- def get_public_ip(public_ip_uri)
9
- opts = {
10
- :expects => 200,
11
- :method => 'GET',
12
- :parser => Fog::Parsers::Vcloud::Terremark::Ecloud::GetPublicIp.new,
13
- :uri => public_ip_uri
14
- }
15
- if self.class == Fog::Terremark::Ecloud::Real
16
- opts[:path] = "extensions/publicIp/#{public_ip_id}"
17
- end
18
- request(opts)
19
- end
20
-
7
+ basic_request :get_public_ip
21
8
  end
22
9
 
23
10
  module Mock
@@ -27,16 +14,15 @@ module Fog
27
14
  #
28
15
 
29
16
  def get_public_ip(public_ip_uri)
30
- ip_id = public_ip_uri.to_s.split('/')[-1]
31
- if ip = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.map { |vdc| vdc[:public_ips] }.flatten.detect { |ip| ip[:id].to_s == ip_id }
17
+ public_ip_uri = ensure_unparsed(public_ip_uri)
18
+ if ip = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.map { |vdc| vdc[:public_ips] }.flatten.detect { |ip| ip[:href] == public_ip_uri }
32
19
  xml = Builder::XmlMarkup.new
33
- mock_it(Fog::Parsers::Vcloud::Terremark::Ecloud::GetPublicIp.new, 200,
20
+ mock_it 200,
34
21
  xml.PublicIp(:xmlns => "urn:tmrk:eCloudExtensions-2.0", :"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance") {
35
22
  xml.Id(ip[:id])
36
- xml.Href("#{Fog::Vcloud::Terremark::Ecloud::Mock.base_url}/extensions/publicIp/#{ip[:id]}")
23
+ xml.Href(ip[:href])
37
24
  xml.Name(ip[:name])
38
25
  }, { 'Content-Type' => 'application/vnd.tmrk.ecloud.publicIp+xml' }
39
- )
40
26
  else
41
27
  mock_error 200, "401 Unauthorized"
42
28
  end
@@ -4,15 +4,7 @@ module Fog
4
4
  module Ecloud
5
5
 
6
6
  module Real
7
-
8
- def get_public_ips(public_ips_uri)
9
- request(
10
- :expects => 200,
11
- :method => 'GET',
12
- :parser => Fog::Parsers::Vcloud::Terremark::Ecloud::GetPublicIps.new,
13
- :uri => public_ips_uri
14
- )
15
- end
7
+ basic_request :get_public_ips
16
8
  end
17
9
 
18
10
  module Mock
@@ -22,14 +14,15 @@ module Fog
22
14
  #http://support.theenterprisecloud.com/kb/default.asp?id=577&Lang=1&SID=
23
15
  #
24
16
  def get_public_ips(public_ips_uri)
25
- if vdc = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:href].split('/').last == public_ips_uri.to_s.split('/')[-2] }
17
+ public_ips_uri = ensure_unparsed(public_ips_uri)
18
+ if vdc = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:href].split('/').last == public_ips_uri.split('/')[-2] }
26
19
  xml = Builder::XmlMarkup.new
27
- mock_it Fog::Parsers::Vcloud::Terremark::Ecloud::GetPublicIps.new, 200,
20
+ mock_it 200,
28
21
  xml.PublicIPAddresses {
29
22
  vdc[:public_ips].each do |ip|
30
23
  xml.PublicIPAddress {
31
24
  xml.Id(ip[:id])
32
- xml.Href("#{Fog::Vcloud::Terremark::Ecloud::Mock.base_url}/extensions/publicIp/#{ip[:id]}")
25
+ xml.Href(ip[:href])
33
26
  xml.Name(ip[:name])
34
27
  }
35
28
  end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :get_task
8
+ end
9
+
10
+ module Mock
11
+ def get_task(task__uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :get_task_list
8
+ end
9
+
10
+ module Mock
11
+ def get_task_list(task_list_uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :get_vapp
8
+ end
9
+
10
+ module Mock
11
+ def get_vapp(vapp_uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -4,16 +4,7 @@ module Fog
4
4
  module Ecloud
5
5
 
6
6
  module Real
7
-
8
- # Get details of a vdc
9
- def get_vdc(vdc_uri)
10
- request(
11
- :expects => 200,
12
- :method => 'GET',
13
- :parser => Fog::Parsers::Vcloud::Terremark::Ecloud::GetVdc.new,
14
- :uri => vdc_uri
15
- )
16
- end
7
+ # Handled by the main Vcloud get_vdc
17
8
  end
18
9
 
19
10
  module Mock
@@ -22,24 +13,25 @@ module Fog
22
13
  #http://support.theenterprisecloud.com/kb/default.asp?id=545&Lang=1&SID=
23
14
 
24
15
  def get_vdc(vdc_uri)
25
- if vdc = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| URI.parse(vdc[:href]) == vdc_uri }
16
+ vdc_uri = ensure_unparsed(vdc_uri)
17
+ if vdc = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:href] == vdc_uri }
26
18
  xml = Builder::XmlMarkup.new
27
- mock_it Fog::Parsers::Vcloud::Terremark::Ecloud::GetVdc.new, 200,
19
+ mock_it 200,
28
20
  xml.Vdc(xmlns.merge(:href => vdc[:href], :name => vdc[:name])) {
29
21
  xml.Link(:rel => "down",
30
22
  :href => vdc[:href] + "/catalog",
31
23
  :type => "application/vnd.vmware.vcloud.catalog+xml",
32
24
  :name => vdc[:name])
33
25
  xml.Link(:rel => "down",
34
- :href => vdc[:href].gsub('/vdc','/extensions/vdc') + "/publicIps",
26
+ :href => vdc[:extension_href] + "/publicIps",
35
27
  :type => "application/vnd.tmrk.ecloud.publicIpsList+xml",
36
28
  :name => "Public IPs")
37
29
  xml.Link(:rel => "down",
38
- :href => vdc[:href] + "/internetServices",
30
+ :href => vdc[:extension_href] + "/internetServices",
39
31
  :type => "application/vnd.tmrk.ecloud.internetServicesList+xml",
40
32
  :name => "Internet Services")
41
33
  xml.Link(:rel => "down",
42
- :href => vdc[:href].sub('/vdc','/extensions/vdc') + "/firewallAcls",
34
+ :href => vdc[:extension_href] + "/firewallAcls",
43
35
  :type => "application/vnd.tmrk.ecloud.firewallAclsList+xml",
44
36
  :name => "Firewall Access List")
45
37
  xml.Description("")
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :power_off, 202, 'POST'
8
+ end
9
+
10
+ module Mock
11
+ def power_off(off_uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :power_on, 202, 'POST'
8
+ end
9
+
10
+ module Mock
11
+ def power_on(on_uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :power_reset, 202, 'POST'
8
+ end
9
+
10
+ module Mock
11
+ def power_reset(reset_uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Vcloud
3
+ module Terremark
4
+ module Ecloud
5
+
6
+ module Real
7
+ basic_request :power_shutdown, 204, 'POST'
8
+ end
9
+
10
+ module Mock
11
+ def power_shutdown(shutdown_uri)
12
+ Fog::Mock.not_implemented
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -2,26 +2,12 @@ module Fog
2
2
  module Vcloud
3
3
  module Terremark
4
4
  module Vcloud
5
+ extend Fog::Vcloud::Extension
5
6
 
6
- module Versions
7
- SUPPORTED = ["v0.8"]
8
- end
7
+ versions "v0.8"
9
8
 
10
- def self.extended(klass)
11
- #Do anything we need to do here that's specific to ecloud
12
- unless @required
13
- require 'fog/vcloud/terremark/all'
14
- require 'fog/vcloud/terremark/vcloud/parsers/get_vdc'
15
- require 'fog/vcloud/terremark/vcloud/requests/get_vdc'
16
- Struct.new("TmrkVcloudVdc", :links, :resource_entities, :networks, :href, :type, :name, :xmlns)
17
- @required = true
18
- end
19
- if Fog.mocking?
20
- klass.extend Fog::Vcloud::Terremark::Vcloud::Mock
21
- else
22
- klass.extend Fog::Vcloud::Terremark::Vcloud::Real
23
- end
24
- end
9
+ request_path 'fog/vcloud/terremark/vcloud/requests'
10
+ request :get_vdc
25
11
 
26
12
  private
27
13
 
@@ -4,16 +4,7 @@ module Fog
4
4
  module Vcloud
5
5
 
6
6
  module Real
7
-
8
- # Get details of a vdc
9
- def get_vdc(vdc_uri)
10
- request(
11
- :expects => 200,
12
- :method => 'GET',
13
- :parser => Fog::Parsers::Vcloud::Terremark::Vcloud::GetVdc.new,
14
- :uri => vdc_uri
15
- )
16
- end
7
+ # Handled by the main Vcloud get_vdc
17
8
  end
18
9
 
19
10
  module Mock
@@ -22,9 +13,10 @@ module Fog
22
13
  #https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/09-get-vdc.aspx
23
14
 
24
15
  def get_vdc(vdc_uri)
25
- if vdc = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| URI.parse(vdc[:href]) == vdc_uri }
16
+ vdc_uri = ensure_unparsed(vdc_uri)
17
+ if vdc = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:href] == vdc_uri }
26
18
  xml = Builder::XmlMarkup.new
27
- mock_it Fog::Parsers::Vcloud::Terremark::Vcloud::GetVdc.new, 200,
19
+ mock_it 200,
28
20
  xml.Vdc(xmlns.merge(:href => vdc[:href], :name => vdc[:name])) {
29
21
  xml.Link(:rel => "down",
30
22
  :href => vdc[:href] + "/catalog",