fog 0.0.84 → 0.0.85
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +47 -37
- data/bin/fog +9 -10
- data/fog.gemspec +23 -4
- data/lib/fog.rb +19 -1
- data/lib/fog/aws.rb +23 -0
- data/lib/fog/aws/bin.rb +4 -0
- data/lib/fog/aws/ec2.rb +20 -27
- data/lib/fog/aws/elb.rb +115 -0
- data/lib/fog/aws/models/ec2/server.rb +7 -1
- data/lib/fog/aws/models/s3/directories.rb +4 -4
- data/lib/fog/aws/models/s3/directory.rb +13 -11
- data/lib/fog/aws/parsers/elb/deregister_instances_from_load_balancer.rb +26 -0
- data/lib/fog/aws/parsers/elb/describe_instance_health.rb +30 -0
- data/lib/fog/aws/parsers/elb/describe_load_balancers.rb +101 -0
- data/lib/fog/aws/parsers/elb/disable_availability_zones_for_load_balancer.rb +26 -0
- data/lib/fog/aws/parsers/elb/enable_availability_zones_for_load_balancer.rb +26 -0
- data/lib/fog/aws/parsers/elb/register_instances_with_load_balancer.rb +26 -0
- data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -2
- data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +45 -0
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +44 -0
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +57 -0
- data/lib/fog/aws/requests/elb/disable_availability_zones_for_load_balancer.rb +44 -0
- data/lib/fog/aws/requests/elb/enable_availability_zones_for_load_balancer.rb +44 -0
- data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +45 -0
- data/lib/fog/aws/s3.rb +8 -1
- data/lib/fog/aws/simpledb.rb +9 -18
- data/lib/fog/bin.rb +11 -1
- data/lib/fog/credentials.rb +1 -0
- data/lib/fog/local.rb +72 -0
- data/lib/fog/local/bin.rb +34 -0
- data/lib/fog/local/models/directories.rb +43 -0
- data/lib/fog/local/models/directory.rb +47 -0
- data/lib/fog/local/models/file.rb +58 -0
- data/lib/fog/local/models/files.rb +74 -0
- data/lib/fog/model.rb +2 -8
- data/lib/fog/rackspace/models/files/directories.rb +3 -3
- data/lib/fog/rackspace/models/files/directory.rb +8 -5
- data/lib/fog/rackspace/models/servers/server.rb +7 -3
- data/lib/fog/rackspace/requests/servers/create_server.rb +1 -1
- data/lib/fog/ssh.rb +91 -25
- data/lib/fog/terremark/bin.rb +1 -8
- data/lib/fog/terremark/ecloud.rb +14 -5
- data/lib/fog/terremark/models/shared/server.rb +54 -3
- data/lib/fog/terremark/parsers/shared/vapp.rb +1 -1
- data/lib/fog/terremark/requests/shared/get_network.rb +39 -1
- data/lib/fog/terremark/requests/shared/get_organization.rb +45 -1
- data/lib/fog/terremark/requests/shared/get_organizations.rb +2 -1
- data/lib/fog/terremark/requests/shared/get_public_ips.rb +32 -1
- data/lib/fog/terremark/requests/shared/get_vdc.rb +83 -1
- data/lib/fog/terremark/requests/shared/{reset.rb → power_reset.rb} +1 -1
- data/lib/fog/terremark/requests/shared/power_shutdown.rb +32 -0
- data/lib/fog/terremark/shared.rb +139 -18
- data/lib/fog/terremark/vcloud.rb +14 -5
- data/spec/aws/models/ec2/address_spec.rb +1 -3
- data/spec/aws/models/ec2/snapshot_spec.rb +25 -49
- data/spec/aws/models/ec2/snapshots_spec.rb +25 -31
- data/spec/aws/models/ec2/volume_spec.rb +9 -3
- data/spec/aws/models/s3/directory_spec.rb +14 -14
- data/spec/aws/requests/ec2/associate_address_spec.rb +4 -5
- data/spec/aws/requests/ec2/attach_volume_spec.rb +14 -16
- data/spec/aws/requests/ec2/create_snapshot_spec.rb +2 -3
- data/spec/aws/requests/ec2/delete_snapshot_spec.rb +5 -6
- data/spec/aws/requests/ec2/describe_instances_spec.rb +3 -2
- data/spec/aws/requests/ec2/describe_snapshots_spec.rb +21 -25
- data/spec/aws/requests/ec2/detach_volume_spec.rb +14 -16
- data/spec/aws/requests/ec2/disassociate_address_spec.rb +3 -4
- data/spec/aws/requests/ec2/get_console_output_spec.rb +1 -0
- data/spec/aws/requests/s3/get_service_spec.rb +5 -6
- data/spec/spec_helper.rb +0 -20
- data/tests/helper.rb +0 -10
- data/tests/rackspace/requests/servers/create_image_tests.rb +2 -2
- data/tests/rackspace/requests/servers/create_server_tests.rb +3 -2
- data/tests/rackspace/requests/servers/delete_image_tests.rb +2 -2
- data/tests/rackspace/requests/servers/delete_server_tests.rb +1 -1
- data/tests/rackspace/requests/servers/get_server_details_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_addresses_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_private_addresses_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_public_addresses_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_servers_detail_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_servers_tests.rb +1 -1
- data/tests/rackspace/requests/servers/reboot_server_tests.rb +3 -3
- data/tests/rackspace/requests/servers/update_server_tests.rb +1 -1
- data/tests/slicehost/requests/create_slice_tests.rb +1 -1
- data/tests/slicehost/requests/delete_slice_tests.rb +1 -1
- data/tests/slicehost/requests/get_slice_tests.rb +1 -1
- data/tests/slicehost/requests/reboot_slice_tests.rb +2 -2
- metadata +24 -5
- data/lib/fog/terremark/requests/shared/shutdown.rb +0 -43
@@ -26,7 +26,45 @@ module Fog
|
|
26
26
|
module Mock
|
27
27
|
|
28
28
|
def get_network(network_id)
|
29
|
-
|
29
|
+
network_id = network_id.to_i
|
30
|
+
response = Excon::Response.new
|
31
|
+
if network = @data[:organizations].map { |org| org[:vdcs].map { |vdc| vdc[:networks] } }.flatten.detect { |network| network[:id] == network_id }
|
32
|
+
|
33
|
+
body = { "links" => [],
|
34
|
+
"type" => "application/vnd.vmware.vcloud.network+xml",
|
35
|
+
"href" => "#{@base_url}/network/#{network_id}" }
|
36
|
+
|
37
|
+
network.each_key do |key|
|
38
|
+
body[key.to_s] = network[key]
|
39
|
+
end
|
40
|
+
|
41
|
+
link = { "name" => "IP Addresses",
|
42
|
+
"rel" => "down",
|
43
|
+
"type" => "application/xml" }
|
44
|
+
link["href"] = case self
|
45
|
+
when Fog::Terremark::Ecloud::Mock
|
46
|
+
"#{@base_url}/extensions/network/#{network_id}/ips"
|
47
|
+
when Fog::Terremark::Vcloud::Mock
|
48
|
+
"#{@base_url}/network/#{network_id}/ipAddresses"
|
49
|
+
end
|
50
|
+
body["links"] << link
|
51
|
+
|
52
|
+
response.status = 200
|
53
|
+
response.body = body
|
54
|
+
response.headers = Fog::Terremark::Shared::Mock.headers(response.body,
|
55
|
+
case self
|
56
|
+
when Fog::Terremark::Ecloud::Mock
|
57
|
+
"application/vnd.vmware.vcloud.network+xml"
|
58
|
+
when Fog::Terremark::Vcloud::Mock
|
59
|
+
"application/xml; charset=utf-8"
|
60
|
+
end
|
61
|
+
)
|
62
|
+
else
|
63
|
+
response.status = Fog::Terremark::Shared::Mock.unathorized_status
|
64
|
+
response.headers = Fog::Terremark::Shared::Mock.error_headers
|
65
|
+
end
|
66
|
+
|
67
|
+
response
|
30
68
|
end
|
31
69
|
|
32
70
|
end
|
@@ -33,7 +33,51 @@ module Fog
|
|
33
33
|
module Mock
|
34
34
|
|
35
35
|
def get_organization(organization_id)
|
36
|
-
|
36
|
+
organization_id = organization_id.to_i
|
37
|
+
response = Excon::Response.new
|
38
|
+
|
39
|
+
if org = @data[:organizations].detect { |org| org[:info][:id] == organization_id }
|
40
|
+
|
41
|
+
body = { "name" => org[:info][:name],
|
42
|
+
"href" => "#{@base_url}/org/#{org[:info][:id]}",
|
43
|
+
"Links" => [] }
|
44
|
+
|
45
|
+
body["Links"] = case self
|
46
|
+
when Fog::Terremark::Vcloud::Mock
|
47
|
+
_vdc_links(org[:vdcs][0])
|
48
|
+
when Fog::Terremark::Ecloud::Mock
|
49
|
+
org[:vdcs].map do |vdc|
|
50
|
+
_vdc_links(vdc)
|
51
|
+
end.flatten
|
52
|
+
end
|
53
|
+
|
54
|
+
response.status = 200
|
55
|
+
response.body = body
|
56
|
+
response.headers = Fog::Terremark::Shared::Mock.headers(response.body, "application/vnd.vmware.vcloud.org+xml")
|
57
|
+
else
|
58
|
+
response.status = Fog::Terremark::Shared::Mock.unathorized_status
|
59
|
+
response.headers = Fog::Terremark::Shared::Mock.error_headers
|
60
|
+
end
|
61
|
+
|
62
|
+
response
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def _vdc_links(vdc)
|
68
|
+
[{ "name" => vdc[:name],
|
69
|
+
"href" => "#{@base_url}/vdc/#{vdc[:id]}",
|
70
|
+
"rel" => "down",
|
71
|
+
"type" => "application/vnd.vmware.vcloud.vdc+xml" },
|
72
|
+
{ "name" => "#{vdc[:name]} Catalog",
|
73
|
+
"href" => "#{@base_url}/vdc/#{vdc[:id]}/catalog",
|
74
|
+
"rel" => "down",
|
75
|
+
"type" => "application/vnd.vmware.vcloud.catalog+xml" },
|
76
|
+
{ "name" => "#{vdc[:name]} Tasks List",
|
77
|
+
"href" => "#{@base_url}/vdc/#{vdc[:id]}/taskslist",
|
78
|
+
"rel" => "down",
|
79
|
+
"type" => "application/vnd.vmware.vcloud.tasksList+xml" }
|
80
|
+
]
|
37
81
|
end
|
38
82
|
end
|
39
83
|
|
@@ -33,11 +33,12 @@ module Fog
|
|
33
33
|
response = Excon::Response.new
|
34
34
|
org_list = @data[:organizations].map do |organization|
|
35
35
|
{ "name" => organization[:info][:name],
|
36
|
-
"href" => "
|
36
|
+
"href" => "#{@base_url}/org/#{organization[:info][:id]}",
|
37
37
|
"type" => "application/vnd.vmware.vcloud.org+xml"
|
38
38
|
}
|
39
39
|
end
|
40
40
|
response.body = { "OrgList" => org_list }
|
41
|
+
response.status = 200
|
41
42
|
response.headers = Fog::Terremark::Shared::Mock.headers(response.body, "application/vnd.vmware.vcloud.orgList+xml")
|
42
43
|
response
|
43
44
|
end
|
@@ -32,7 +32,38 @@ module Fog
|
|
32
32
|
module Mock
|
33
33
|
|
34
34
|
def get_public_ips(vdc_id)
|
35
|
-
|
35
|
+
vdc_id = vdc_id.to_i
|
36
|
+
response = Excon::Response.new
|
37
|
+
|
38
|
+
if vdc = @data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:id] == vdc_id }
|
39
|
+
body = { "PublicIpAddresses" => [] }
|
40
|
+
vdc[:public_ips].each do |ip|
|
41
|
+
ip = { "name" => ip[:name],
|
42
|
+
"href" => case self
|
43
|
+
when Fog::Terremark::Ecloud::Mock
|
44
|
+
"#{@base_url}/extensions/publicIp/#{ip[:id]}"
|
45
|
+
when Fog::Terremark::Vcloud::Mock
|
46
|
+
"#{@base_url}/PublicIps/#{ip[:id]}"
|
47
|
+
end,
|
48
|
+
"id" => ip[:id].to_s }
|
49
|
+
body["PublicIpAddresses"] << ip
|
50
|
+
end
|
51
|
+
response.status = 200
|
52
|
+
response.body = body
|
53
|
+
response.headers = Fog::Terremark::Shared::Mock.headers(response.body,
|
54
|
+
case self
|
55
|
+
when Fog::Terremark::Ecloud::Mock
|
56
|
+
"application/vnd.tmrk.ecloud.publicIpsList+xml"
|
57
|
+
when Fog::Terremark::Vcloud::Mock
|
58
|
+
"application/xml; charset=utf-8"
|
59
|
+
end
|
60
|
+
)
|
61
|
+
else
|
62
|
+
response.status = Fog::Terremark::Shared::Mock.unathorized_status
|
63
|
+
response.headers = Fog::Terremark::Shared::Mock.error_headers
|
64
|
+
end
|
65
|
+
|
66
|
+
response
|
36
67
|
end
|
37
68
|
|
38
69
|
end
|
@@ -34,7 +34,89 @@ module Fog
|
|
34
34
|
module Mock
|
35
35
|
|
36
36
|
def get_vdc(vdc_id)
|
37
|
-
|
37
|
+
vdc_id = vdc_id.to_i
|
38
|
+
response = Excon::Response.new
|
39
|
+
|
40
|
+
if vdc = @data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:id] == vdc_id }
|
41
|
+
|
42
|
+
body = { "name" => vdc[:name],
|
43
|
+
"href" => "#{@base_url}/vdc/#{vdc[:id]}",
|
44
|
+
"StorageCapacity" => {},
|
45
|
+
"ComputeCapacity" => { "InstantiatedVmsQuota" => {},
|
46
|
+
"DeployedVmsQuota" => {},
|
47
|
+
"Cpu" => {},
|
48
|
+
"Memory" => {} },
|
49
|
+
"ResourceEntities" => [],
|
50
|
+
"AvailableNetworks" => [],
|
51
|
+
"links" => [] }
|
52
|
+
|
53
|
+
case self
|
54
|
+
when Fog::Terremark::Ecloud::Mock
|
55
|
+
body["StorageCapacity"] = { "Units" => "bytes * 10^9" }
|
56
|
+
vdc[:storage].each { |k,v| body["StorageCapacity"][k.to_s.capitalize] = v.to_s }
|
57
|
+
|
58
|
+
body["ComputeCapacity"] = { "InstantiatedVmsQuota" => {"Limit" => "-1", "Used" => "-1"},
|
59
|
+
"DeployedVmsQuota" => {"Limit" => "-1", "Used" => "-1"},
|
60
|
+
"Cpu" => { "Units" => "hz * 10^6" },
|
61
|
+
"Memory" => { "Units" => "bytes * 2^20" } }
|
62
|
+
|
63
|
+
[:cpu, :memory].each do |key|
|
64
|
+
vdc[key].each { |k,v| body["ComputeCapacity"][key.to_s.capitalize][k.to_s.capitalize] = v.to_s }
|
65
|
+
end
|
66
|
+
|
67
|
+
body["links"] << { "name" => "Public IPs",
|
68
|
+
"href" => "#{@base_url}/extensions/vdc/#{vdc[:id]}/publicIps",
|
69
|
+
"rel" => "down",
|
70
|
+
"type" => "application/vnd.tmrk.ecloud.publicIpsList+xml" }
|
71
|
+
|
72
|
+
body["links"] << { "name" => "Internet Services",
|
73
|
+
"href" => "#{@base_url}/extensions/vdc/#{vdc[:id]}/internetServices",
|
74
|
+
"rel" => "down",
|
75
|
+
"type" => "application/vnd.tmrk.ecloud.internetServicesList+xml" }
|
76
|
+
|
77
|
+
body["links"] << { "name" => "Firewall Access List",
|
78
|
+
"href" => "#{@base_url}/extensions/vdc/#{vdc[:id]}/firewallAcls",
|
79
|
+
"rel" => "down",
|
80
|
+
"type" => "application/vnd.tmrk.ecloud.firewallAclsList+xml" }
|
81
|
+
|
82
|
+
when Fog::Terremark::Vcloud::Mock
|
83
|
+
body["links"] << { "name" => "Public IPs",
|
84
|
+
"href" => "#{@base_url}/vdc/#{vdc[:id]}/publicIps",
|
85
|
+
"rel" => "down",
|
86
|
+
"type" => "application/xml" }
|
87
|
+
|
88
|
+
body["links"] << { "name" => "Internet Services",
|
89
|
+
"href" => "#{@base_url}/vdc/#{vdc[:id]}/internetServices",
|
90
|
+
"rel" => "down",
|
91
|
+
"type" => "application/xml" }
|
92
|
+
end
|
93
|
+
|
94
|
+
vdc[:vms].each do |vm|
|
95
|
+
body["ResourceEntities"] << { "name" => vm[:name],
|
96
|
+
"href" => "#{@base_url}/vapp/#{vm[:id]}",
|
97
|
+
"type" => "application/vnd.vmware.vcloud.vApp+xml" }
|
98
|
+
end
|
99
|
+
|
100
|
+
vdc[:networks].each do |network|
|
101
|
+
body["AvailableNetworks"] << { "name" => network[:name],
|
102
|
+
"href" => "#{@base_url}/network/#{network[:id]}",
|
103
|
+
"type" => "application/vnd.vmware.vcloud.network+xml" }
|
104
|
+
end
|
105
|
+
|
106
|
+
body["links"] << { "name" => vdc[:name],
|
107
|
+
"href" => "#{@base_url}/vdc/#{vdc[:id]}/catalog",
|
108
|
+
"rel" => "down",
|
109
|
+
"type" => "application/vnd.vmware.vcloud.catalog+xml" }
|
110
|
+
|
111
|
+
response.status = 200
|
112
|
+
response.body = body
|
113
|
+
response.headers = Fog::Terremark::Shared::Mock.headers(response.body, "application/vnd.vmware.vcloud.org+xml")
|
114
|
+
else
|
115
|
+
response.status = Fog::Terremark::Shared::Mock.unathorized_status
|
116
|
+
response.headers = Fog::Terremark::Shared::Mock.error_headers
|
117
|
+
end
|
118
|
+
|
119
|
+
response
|
38
120
|
end
|
39
121
|
|
40
122
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Terremark
|
3
|
+
module Shared
|
4
|
+
module Real
|
5
|
+
|
6
|
+
# Shutdown a vapp
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * vapp_id<~Integer> - Id of vapp to shutdown
|
10
|
+
#
|
11
|
+
# ==== Returns
|
12
|
+
# Nothing
|
13
|
+
def power_shutdown(vapp_id)
|
14
|
+
request(
|
15
|
+
:expects => 204,
|
16
|
+
:method => 'POST',
|
17
|
+
:path => "vApp/#{vapp_id}/power/action/shutdown"
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
module Mock
|
24
|
+
|
25
|
+
def power_shutdown(vapp_id)
|
26
|
+
raise MockNotImplemented.new("Contributions welcome!")
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/fog/terremark/shared.rb
CHANGED
@@ -2,6 +2,23 @@ module Fog
|
|
2
2
|
module Terremark
|
3
3
|
module Shared
|
4
4
|
|
5
|
+
# Commond methods shared by Real and Mock
|
6
|
+
module Common
|
7
|
+
|
8
|
+
# TODO: bust cache on organization creation?
|
9
|
+
def default_organization_id
|
10
|
+
@default_organization_id ||= begin
|
11
|
+
org_list = get_organizations.body['OrgList']
|
12
|
+
if org_list.length == 1
|
13
|
+
org_list.first['href'].split('/').last.to_i
|
14
|
+
else
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
5
22
|
module Parser
|
6
23
|
|
7
24
|
def parse(data)
|
@@ -16,28 +33,44 @@ module Fog
|
|
16
33
|
end
|
17
34
|
|
18
35
|
module Real
|
19
|
-
|
20
|
-
# TODO: bust cache on organization creation?
|
21
|
-
def default_organization_id
|
22
|
-
@default_organization_id ||= begin
|
23
|
-
org_list = get_organizations.body['OrgList']
|
24
|
-
if org_list.length == 1
|
25
|
-
org_list.first['href'].split('/').last.to_i
|
26
|
-
else
|
27
|
-
nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
36
|
+
include Common
|
31
37
|
|
32
38
|
private
|
33
39
|
|
40
|
+
def auth_token
|
41
|
+
response = @connection.request({
|
42
|
+
:expects => 200,
|
43
|
+
:headers => {
|
44
|
+
'Authorization' => "Basic #{Base64.encode64("#{@terremark_username}:#{@terremark_password}").chomp!}",
|
45
|
+
'Content-Type' => "application/vnd.vmware.vcloud.orgList+xml"
|
46
|
+
},
|
47
|
+
:host => @host,
|
48
|
+
:method => 'POST',
|
49
|
+
:parser => Fog::Parsers::Terremark::Shared::GetOrganizations.new,
|
50
|
+
:path => "#{@path}/login"
|
51
|
+
})
|
52
|
+
response.headers['Set-Cookie']
|
53
|
+
end
|
54
|
+
|
34
55
|
def request(params)
|
35
56
|
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
|
57
|
+
unless @cookie
|
58
|
+
@cookie = auth_token
|
59
|
+
end
|
60
|
+
begin
|
61
|
+
do_request(params)
|
62
|
+
rescue Excon::Errors::Unauthorized => e
|
63
|
+
@cookie = auth_token
|
64
|
+
do_request(params)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def do_request(params)
|
36
69
|
headers = {}
|
37
70
|
if @cookie
|
38
71
|
headers.merge!('Cookie' => @cookie)
|
39
72
|
end
|
40
|
-
|
73
|
+
@connection.request({
|
41
74
|
:body => params[:body],
|
42
75
|
:expects => params[:expects],
|
43
76
|
:headers => headers.merge!(params[:headers] || {}),
|
@@ -51,6 +84,7 @@ module Fog
|
|
51
84
|
end
|
52
85
|
|
53
86
|
module Mock
|
87
|
+
include Common
|
54
88
|
|
55
89
|
DATA = {
|
56
90
|
:organizations =>
|
@@ -58,12 +92,96 @@ module Fog
|
|
58
92
|
{
|
59
93
|
:info => {
|
60
94
|
:name => "Boom Inc.",
|
61
|
-
:id =>
|
62
|
-
}
|
95
|
+
:id => 1
|
96
|
+
},
|
97
|
+
:vdcs => [
|
98
|
+
{ :id => 21,
|
99
|
+
:name => "Boomstick",
|
100
|
+
:storage => { :used => 105, :allocated => 200 },
|
101
|
+
:cpu => { :allocated => 10000 },
|
102
|
+
:memory => { :allocated => 20480 },
|
103
|
+
:networks => [
|
104
|
+
{ :id => 31,
|
105
|
+
:name => "1.2.3.0/24",
|
106
|
+
:subnet => "1.2.3.0/24",
|
107
|
+
:gateway => "1.2.3.1",
|
108
|
+
:netmask => "255.255.255.0",
|
109
|
+
:fencemode => "isolated"
|
110
|
+
},
|
111
|
+
{ :id => 32,
|
112
|
+
:name => "4.5.6.0/24",
|
113
|
+
:subnet => "4.5.6.0/24",
|
114
|
+
:gateway => "4.5.6.1",
|
115
|
+
:netmask => "255.255.255.0",
|
116
|
+
:fencemode => "isolated"
|
117
|
+
},
|
118
|
+
],
|
119
|
+
:vms => [
|
120
|
+
{ :id => 41,
|
121
|
+
:name => "Broom 1"
|
122
|
+
},
|
123
|
+
{ :id => 42,
|
124
|
+
:name => "Broom 2"
|
125
|
+
},
|
126
|
+
{ :id => 43,
|
127
|
+
:name => "Email!"
|
128
|
+
}
|
129
|
+
],
|
130
|
+
:public_ips => [
|
131
|
+
{ :id => 51,
|
132
|
+
:name => "99.1.2.3"
|
133
|
+
},
|
134
|
+
{ :id => 52,
|
135
|
+
:name => "99.1.2.4"
|
136
|
+
},
|
137
|
+
{ :id => 53,
|
138
|
+
:name => "99.1.9.7"
|
139
|
+
}
|
140
|
+
]
|
141
|
+
},
|
142
|
+
{ :id => 22,
|
143
|
+
:storage => { :used => 40, :allocated => 150 },
|
144
|
+
:cpu => { :allocated => 1000 },
|
145
|
+
:memory => { :allocated => 2048 },
|
146
|
+
:name => "Rock-n-Roll",
|
147
|
+
:networks => [
|
148
|
+
{ :id => 33,
|
149
|
+
:name => "7.8.9.0/24",
|
150
|
+
:subnet => "7.8.9.0/24",
|
151
|
+
:gateway => "7.8.9.1",
|
152
|
+
:netmask => "255.255.255.0",
|
153
|
+
:fencemode => "isolated"
|
154
|
+
}
|
155
|
+
],
|
156
|
+
:vms => [
|
157
|
+
{ :id => 44,
|
158
|
+
:name => "Master Blaster"
|
159
|
+
}
|
160
|
+
],
|
161
|
+
:public_ips => [
|
162
|
+
{ :id => 54,
|
163
|
+
:name => "99.99.99.99"
|
164
|
+
}
|
165
|
+
]
|
166
|
+
}
|
167
|
+
]
|
63
168
|
}
|
64
169
|
]
|
65
170
|
}
|
66
171
|
|
172
|
+
def self.error_headers
|
173
|
+
{"X-Powered-By"=>"ASP.NET",
|
174
|
+
"Date"=> Time.now.to_s,
|
175
|
+
"Content-Type"=>"text/html",
|
176
|
+
"Content-Length"=>"0",
|
177
|
+
"Server"=>"Microsoft-IIS/7.0",
|
178
|
+
"Cache-Control"=>"private"}
|
179
|
+
end
|
180
|
+
|
181
|
+
def self.unathorized_status
|
182
|
+
401
|
183
|
+
end
|
184
|
+
|
67
185
|
def self.headers(body, content_type)
|
68
186
|
{"X-Powered-By"=>"ASP.NET",
|
69
187
|
"Date"=> Time.now.to_s,
|
@@ -74,6 +192,10 @@ module Fog
|
|
74
192
|
"Cache-Control"=>"private"}
|
75
193
|
end
|
76
194
|
|
195
|
+
def self.status
|
196
|
+
200
|
197
|
+
end
|
198
|
+
|
77
199
|
def initialize(options={})
|
78
200
|
self.class.instance_eval '
|
79
201
|
def self.data
|
@@ -152,11 +274,10 @@ module Fog
|
|
152
274
|
require 'fog/terremark/requests/shared/get_vapp_template'
|
153
275
|
require 'fog/terremark/requests/shared/get_vdc'
|
154
276
|
require 'fog/terremark/requests/shared/instantiate_vapp_template'
|
155
|
-
require 'fog/terremark/requests/shared/reset'
|
156
277
|
require 'fog/terremark/requests/shared/power_off'
|
157
278
|
require 'fog/terremark/requests/shared/power_on'
|
158
|
-
require 'fog/terremark/requests/shared/
|
159
|
-
|
279
|
+
require 'fog/terremark/requests/shared/power_reset'
|
280
|
+
require 'fog/terremark/requests/shared/power_shutdown'
|
160
281
|
end
|
161
282
|
|
162
283
|
end
|