fog 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -8
- data/Gemfile.lock +3 -3
- data/bin/fog +2 -10
- data/fog.gemspec +45 -20
- data/lib/fog.rb +2 -1
- data/lib/fog/attributes.rb +48 -8
- data/lib/fog/aws/ec2.rb +5 -2
- data/lib/fog/aws/elb.rb +5 -2
- data/lib/fog/aws/models/ec2/server.rb +1 -1
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +43 -12
- data/lib/fog/aws/s3.rb +2 -2
- data/lib/fog/aws/simpledb.rb +15 -3
- data/lib/fog/bin.rb +11 -2
- data/lib/fog/bluebox.rb +5 -1
- data/lib/fog/connection.rb +9 -1
- data/lib/fog/credentials.rb +3 -0
- data/lib/fog/new_servers.rb +89 -0
- data/lib/fog/new_servers/bin.rb +30 -0
- data/lib/fog/new_servers/requests/add_server.rb +39 -0
- data/lib/fog/new_servers/requests/cancel_server.rb +36 -0
- data/lib/fog/new_servers/requests/get_server.rb +42 -0
- data/lib/fog/new_servers/requests/list_images.rb +33 -0
- data/lib/fog/new_servers/requests/list_plans.rb +36 -0
- data/lib/fog/new_servers/requests/list_servers.rb +43 -0
- data/lib/fog/new_servers/requests/reboot_server.rb +30 -0
- data/lib/fog/parser.rb +6 -0
- data/lib/fog/rackspace/files.rb +8 -2
- data/lib/fog/rackspace/models/servers/server.rb +5 -0
- data/lib/fog/rackspace/servers.rb +5 -1
- data/lib/fog/service.rb +6 -1
- data/lib/fog/slicehost.rb +5 -1
- data/lib/fog/terremark/ecloud.rb +1 -0
- data/lib/fog/terremark/shared.rb +4 -1
- data/lib/fog/terremark/vcloud.rb +1 -0
- data/lib/fog/vcloud.rb +150 -141
- data/lib/fog/vcloud/bin.rb +2 -2
- data/lib/fog/vcloud/collection.rb +3 -84
- data/lib/fog/vcloud/extension.rb +44 -0
- data/lib/fog/vcloud/generators.rb +33 -0
- data/lib/fog/vcloud/model.rb +5 -38
- data/lib/fog/vcloud/models/vdc.rb +14 -24
- data/lib/fog/vcloud/models/vdcs.rb +13 -8
- data/lib/fog/vcloud/requests/get_network.rb +4 -11
- data/lib/fog/vcloud/requests/get_organization.rb +4 -11
- data/lib/fog/vcloud/requests/get_vdc.rb +4 -12
- data/lib/fog/vcloud/requests/get_versions.rb +4 -13
- data/lib/fog/vcloud/requests/login.rb +4 -4
- data/lib/fog/vcloud/terremark/ecloud.rb +125 -54
- data/lib/fog/vcloud/terremark/ecloud/models/catalog.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/catalog_item.rb +31 -0
- data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +21 -22
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +11 -25
- data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +38 -5
- data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +11 -15
- data/lib/fog/vcloud/terremark/ecloud/models/network.rb +52 -11
- data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +14 -13
- data/lib/fog/vcloud/terremark/ecloud/models/node.rb +47 -0
- data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/public_ip.rb +6 -9
- data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +19 -3
- data/lib/fog/vcloud/terremark/ecloud/models/server.rb +203 -0
- data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +43 -0
- data/lib/fog/vcloud/terremark/ecloud/models/task.rb +22 -0
- data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +32 -10
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +5 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +23 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +54 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +14 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +53 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +52 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +42 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb +115 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_internet_service.rb +4 -23
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_node.rb +0 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +9 -16
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network.rb +8 -14
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +36 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +44 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +11 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_node.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_nodes.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb +5 -19
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb +5 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task_list.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vapp.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +7 -15
- data/lib/fog/vcloud/terremark/ecloud/requests/power_off.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_on.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_reset.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_shutdown.rb +18 -0
- data/lib/fog/vcloud/terremark/vcloud.rb +4 -18
- data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +4 -12
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +18 -0
- data/spec/vcloud/bin_spec.rb +2 -2
- data/spec/vcloud/models/vdc_spec.rb +35 -29
- data/spec/vcloud/requests/get_network_spec.rb +32 -43
- data/spec/vcloud/requests/get_organization_spec.rb +45 -38
- data/spec/vcloud/requests/get_vdc_spec.rb +42 -32
- data/spec/vcloud/requests/get_versions_spec.rb +17 -17
- data/spec/vcloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/spec_helper.rb +137 -46
- data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +53 -58
- data/spec/vcloud/terremark/ecloud/models/internet_services_spec.rb +20 -20
- data/spec/vcloud/terremark/ecloud/models/ip_spec.rb +22 -21
- data/spec/vcloud/terremark/ecloud/models/ips_spec.rb +18 -18
- data/spec/vcloud/terremark/ecloud/models/network_spec.rb +55 -51
- data/spec/vcloud/terremark/ecloud/models/networks_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/public_ip_spec.rb +26 -27
- data/spec/vcloud/terremark/ecloud/models/public_ips_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/vdc_spec.rb +52 -36
- data/spec/vcloud/terremark/ecloud/models/vdcs_spec.rb +18 -15
- data/spec/vcloud/terremark/ecloud/requests/add_internet_service_spec.rb +46 -43
- data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +37 -32
- data/spec/vcloud/terremark/ecloud/requests/delete_internet_service_spec.rb +26 -23
- data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +57 -49
- data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +41 -0
- data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +39 -34
- data/spec/vcloud/terremark/ecloud/requests/get_network_spec.rb +26 -48
- data/spec/vcloud/terremark/ecloud/requests/get_public_ip_spec.rb +25 -26
- data/spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb +35 -27
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +85 -110
- data/spec/vcloud/terremark/ecloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/vcloud_spec.rb +9 -8
- metadata +62 -26
- data/lib/fog/vcloud/parser.rb +0 -42
- data/lib/fog/vcloud/parsers/get_organization.rb +0 -37
- data/lib/fog/vcloud/parsers/get_vdc.rb +0 -62
- data/lib/fog/vcloud/parsers/get_versions.rb +0 -46
- data/lib/fog/vcloud/parsers/login.rb +0 -36
- data/lib/fog/vcloud/parsers/network.rb +0 -53
- data/lib/fog/vcloud/terremark/all.rb +0 -9
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_internet_services.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ip.rb +0 -30
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ips.rb +0 -40
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/internet_service.rb +0 -58
- data/lib/fog/vcloud/terremark/ecloud/parsers/network.rb +0 -28
- data/lib/fog/vcloud/terremark/ecloud/parsers/network_ips.rb +0 -31
- data/lib/fog/vcloud/terremark/ecloud/requests/login.rb +0 -27
- data/lib/fog/vcloud/terremark/vcloud/parsers/get_vdc.rb +0 -34
- data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +0 -74
@@ -1,63 +1,41 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe Fog::Vcloud, :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :get_network }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
describe :get_network, :type => :vcloud_request do
|
10
|
+
context "with a valid network uri" do
|
11
|
+
before { @network = @vcloud.get_network( @mock_network[:href] ) }
|
12
|
+
subject { @network }
|
12
13
|
|
13
|
-
|
14
|
+
it_should_behave_like "all responses"
|
15
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.network+xml" }
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
describe :body do
|
18
|
+
subject { @network.body }
|
17
19
|
|
18
|
-
|
19
|
-
let(:header) { @network.headers["Content-Type"] }
|
20
|
-
specify { header.should == "application/vnd.vmware.vcloud.network+xml" }
|
21
|
-
end
|
22
|
-
|
23
|
-
describe :body do
|
24
|
-
subject { @network.body }
|
25
|
-
|
26
|
-
it_should_behave_like "it has a vcloud v0.8 xmlns"
|
27
|
-
|
28
|
-
its(:configuration) { should be_an_instance_of Struct::VcloudNetworkConfiguration }
|
29
|
-
its(:features) { should be_an_instance_of Array }
|
30
|
-
its(:ips_link) { should be_an_instance_of Struct::VcloudLink }
|
31
|
-
its(:href) { should == URI.parse("https://fakey.com/api/v0.8/network/31") }
|
32
|
-
its(:type) { should == "application/vnd.vmware.vcloud.network+xml" }
|
33
|
-
its(:name) { should == @mock_network[:name] }
|
34
|
-
|
35
|
-
describe :configuration do
|
36
|
-
subject { @network.body.configuration }
|
20
|
+
it { should have(9).keys }
|
37
21
|
|
38
|
-
|
39
|
-
its(:netmask) { should == "255.255.255.0" }
|
40
|
-
end
|
22
|
+
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
41
23
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
24
|
+
it { should have_key_with_value :type, "application/vnd.vmware.vcloud.network+xml" }
|
25
|
+
it { should have_key_with_value :Features, {:FenceMode => "isolated"} }
|
26
|
+
it { should have_key_with_value :href, @mock_network[:href] }
|
27
|
+
it { should have_key_with_value :name, @mock_network[:name] }
|
28
|
+
it { should have_key_with_value :Configuration, {:Gateway => @mock_network[:gateway],
|
29
|
+
:Netmask => @mock_network[:netmask] } }
|
49
30
|
|
50
|
-
describe "FenceMode Feature" do
|
51
|
-
subject { @network.body.features.detect { |feature| feature.is_a?(Struct::VcloudNetworkFenceMode) } }
|
52
|
-
its(:mode) { should == "isolated" }
|
53
31
|
end
|
54
|
-
|
55
32
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
33
|
+
context "with a network uri that doesn't exist" do
|
34
|
+
subject { lambda { @vcloud.get_network(URI.parse('https://www.fakey.com/api/v0.8/network/999')) } }
|
35
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
36
|
+
end
|
60
37
|
end
|
61
38
|
end
|
39
|
+
else
|
62
40
|
end
|
63
41
|
|
@@ -1,40 +1,39 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :get_public_ip }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
subject { @public_ip }
|
16
|
-
|
17
|
-
it_should_behave_like "all requests"
|
9
|
+
describe "#get_public_ip" do
|
10
|
+
context "with a valid public_ip_uri" do
|
11
|
+
before do
|
12
|
+
@mock_ip = @mock_vdc[:public_ips].first
|
13
|
+
@public_ip = @vcloud.get_public_ip( @mock_ip[:href] )
|
14
|
+
end
|
18
15
|
|
19
|
-
|
20
|
-
specify { subject.headers['Content-Type'].should == "application/vnd.tmrk.ecloud.publicIp+xml" }
|
16
|
+
subject { @public_ip }
|
21
17
|
|
22
|
-
|
18
|
+
it_should_behave_like "all responses"
|
19
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.tmrk.ecloud.publicIp+xml" }
|
23
20
|
|
24
|
-
|
25
|
-
|
21
|
+
describe "#body" do
|
22
|
+
subject { @public_ip.body }
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
its(:Name) { should == @mock_ip[:name] }
|
25
|
+
its(:Href) { should == @mock_ip[:href] }
|
26
|
+
its(:Id) { should == @mock_ip[:id] }
|
30
27
|
|
28
|
+
end
|
31
29
|
end
|
32
|
-
end
|
33
30
|
|
34
|
-
|
35
|
-
|
31
|
+
context "with a public_ips_uri that doesn't exist" do
|
32
|
+
subject { lambda { @vcloud.get_public_ip(URI.parse('https://www.fakey.c/piv89')) } }
|
36
33
|
|
37
|
-
|
34
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
35
|
+
end
|
38
36
|
end
|
39
37
|
end
|
38
|
+
else
|
40
39
|
end
|
@@ -1,44 +1,52 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :get_public_ips }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
describe "#get_public_ips" do
|
10
|
+
context "with a valid public_ips_uri" do
|
11
|
+
before { @public_ips = @vcloud.get_public_ips(URI.parse(@mock_vdc[:href] + "/publicIps")) }
|
12
|
+
subject { @public_ips }
|
12
13
|
|
13
|
-
|
14
|
+
it_should_behave_like "all responses"
|
15
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.tmrk.ecloud.publicIpsList+xml" }
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
describe "#body" do
|
18
|
+
subject { @public_ips.body }
|
17
19
|
|
18
|
-
|
20
|
+
it { should have(1).item }
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
subject { @public_ips.body.links }
|
22
|
+
describe "[:PublicIPAddress]" do
|
23
|
+
subject { @public_ips.body[:PublicIPAddress] }
|
23
24
|
|
24
|
-
|
25
|
+
it { should have(@mock_vdc[:public_ips].length).addresses }
|
26
|
+
|
27
|
+
[0,1,2].each do |idx|
|
28
|
+
|
29
|
+
context "[#{idx}]" do
|
30
|
+
subject { @public_ips.body[:PublicIPAddress][idx] }
|
31
|
+
let(:public_ip) { @mock_vdc[:public_ips][idx] }
|
32
|
+
its(:Href) { should == public_ip[:href] }
|
33
|
+
its(:Id) { should == public_ip[:id] }
|
34
|
+
its(:Name) { should == public_ip[:name] }
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
25
38
|
|
26
|
-
[0,1,2].each do |idx|
|
27
|
-
let(:ip) { subject[idx] }
|
28
|
-
let(:mock_ip) { @mock_vdc[:public_ips][idx] }
|
29
|
-
specify { ip.should be_an_instance_of Struct::TmrkEcloudPublicIp }
|
30
|
-
specify { ip.name.should == mock_ip[:name] }
|
31
|
-
specify { ip.id.should == mock_ip[:id] }
|
32
|
-
specify { ip.href.should == URI.parse("#{@base_url}/extensions/publicIp/#{mock_ip[:id]}") }
|
33
39
|
end
|
40
|
+
|
34
41
|
end
|
35
42
|
end
|
36
|
-
end
|
37
43
|
|
38
|
-
|
39
|
-
|
44
|
+
context "with a public_ips_uri that doesn't exist" do
|
45
|
+
subject { lambda { @vcloud.get_public_ips(URI.parse('https://www.fakey.c/piv8vc99')) } }
|
40
46
|
|
41
|
-
|
47
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
48
|
+
end
|
42
49
|
end
|
43
50
|
end
|
51
|
+
else
|
44
52
|
end
|
@@ -1,135 +1,110 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :get_vdc }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
describe "#get_vdc" do
|
10
|
+
context "with a valid vdc uri" do
|
11
|
+
before { @vdc = @vcloud.get_vdc(URI.parse(@mock_vdc[:href])) }
|
12
|
+
subject { @vdc }
|
12
13
|
|
13
|
-
|
14
|
+
it_should_behave_like "all responses"
|
15
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.vdc+xml" }
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
describe "#body" do
|
18
|
+
subject { @vdc.body }
|
17
19
|
|
18
|
-
|
19
|
-
let(:header) { @vdc.headers["Content-Type"] }
|
20
|
-
specify { header.should == "application/vnd.vmware.vcloud.vdc+xml" }
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#body" do
|
24
|
-
subject { @vdc.body }
|
20
|
+
it { should have(11).items }
|
25
21
|
|
26
|
-
|
27
|
-
it_should_behave_like "a tmrk vdc"
|
22
|
+
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
28
23
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
its(:Description) { should == "" }
|
25
|
+
its(:StorageCapacity) { should == {:Units => "bytes * 10^9", :Allocated => @mock_vdc[:storage][:allocated], :Used => @mock_vdc[:storage][:used] } }
|
26
|
+
its(:ComputeCapacity) { should == {:InstantiatedVmsQuota => { :Limit => "-1", :Used => "-1" },
|
27
|
+
:Memory => { :Units => "bytes * 2^20", :Allocated => @mock_vdc[:memory][:allocated] },
|
28
|
+
:Cpu => { :Units => "hz * 10^6", :Allocated => @mock_vdc[:cpu][:allocated] },
|
29
|
+
:DeployedVmsQuota => { :Limit => "-1", :Used => "-1" } } }
|
34
30
|
|
35
|
-
|
36
|
-
its(:href) { should == URI.parse(@mock_vdc[:href]) }
|
37
|
-
its(:description) { should == '' }
|
31
|
+
its(:Link) { should have(4).links }
|
38
32
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
33
|
+
describe "link 0" do
|
34
|
+
subject { @vdc.body[:Link][0] }
|
35
|
+
it { should have(4).attributes }
|
36
|
+
its(:type) { should == "application/vnd.vmware.vcloud.catalog+xml" }
|
37
|
+
its(:rel) { should == "down" }
|
38
|
+
its(:href) { should == "#{@mock_vdc[:href]}/catalog" }
|
39
|
+
its(:name) { should == @mock_vdc[:name] }
|
46
40
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
specify { subject.href.should == URI.parse(@mock_vdc[:href].sub('/vdc','/extensions/vdc') + "/publicIps") }
|
41
|
+
describe "link 1" do
|
42
|
+
subject { @vdc.body[:Link][1] }
|
43
|
+
it { should have(4).attributes }
|
44
|
+
its(:type) { should == "application/vnd.tmrk.ecloud.publicIpsList+xml" }
|
45
|
+
its(:rel) { should == "down" }
|
46
|
+
its(:href) { should == "#{@mock_vdc[:extension_href]}/publicIps"}
|
47
|
+
its(:name) { should == "Public IPs" }
|
55
48
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
specify { subject.href.should == URI.parse(@mock_vdc[:href] + "/internetServices") }
|
49
|
+
describe "link 2" do
|
50
|
+
subject { @vdc.body[:Link][2] }
|
51
|
+
it { should have(4).attributes }
|
52
|
+
its(:type) { should == "application/vnd.tmrk.ecloud.internetServicesList+xml" }
|
53
|
+
its(:rel) { should == "down" }
|
54
|
+
its(:href) { should == "#{@mock_vdc[:extension_href]}/internetServices"}
|
55
|
+
its(:name) { should == "Internet Services" }
|
64
56
|
end
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
specify { subject.href.should == URI.parse(@mock_vdc[:href].sub('/vdc','/extensions/vdc') + "/firewallAcls") }
|
57
|
+
describe "link 3" do
|
58
|
+
subject { @vdc.body[:Link][3] }
|
59
|
+
it { should have(4).attributes }
|
60
|
+
its(:type) { should == "application/vnd.tmrk.ecloud.firewallAclsList+xml" }
|
61
|
+
its(:rel) { should == "down" }
|
62
|
+
its(:href) { should == "#{@mock_vdc[:extension_href]}/firewallAcls"}
|
63
|
+
its(:name) { should == "Firewall Access List" }
|
73
64
|
end
|
74
|
-
end
|
75
65
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
66
|
+
let(:resource_entities) { subject[:ResourceEntities][:ResourceEntity] }
|
67
|
+
specify { resource_entities.should have(@mock_vdc[:vms].length).vapps }
|
68
|
+
|
69
|
+
describe "[:ResourceEntities][:ResourceEntity]" do
|
70
|
+
context "[0]" do
|
71
|
+
subject { @vdc.body[:ResourceEntities][:ResourceEntity][0] }
|
72
|
+
it { should be_a_vapp_link_to @mock_vdc[:vms][0] }
|
73
|
+
end
|
74
|
+
context "[1]" do
|
75
|
+
subject { @vdc.body[:ResourceEntities][:ResourceEntity][1] }
|
76
|
+
it { should be_a_vapp_link_to @mock_vdc[:vms][1] }
|
77
|
+
end
|
78
|
+
context "[2]" do
|
79
|
+
subject { @vdc.body[:ResourceEntities][:ResourceEntity][2] }
|
80
|
+
it { should be_a_vapp_link_to @mock_vdc[:vms][2] }
|
81
|
+
end
|
82
|
+
end
|
88
83
|
|
89
|
-
|
90
|
-
subject { @vdc.body.cpu_capacity }
|
91
|
-
its(:units) { should == "hz * 10^6" }
|
92
|
-
its(:allocated) { should == @mock_vdc[:cpu][:allocated] }
|
93
|
-
its(:used) { should == nil }
|
94
|
-
its(:limit) { should == nil }
|
95
|
-
end
|
84
|
+
its(:name) { should == @mock_vdc[:name] }
|
96
85
|
|
97
|
-
|
98
|
-
|
99
|
-
it { should be_an_instance_of Struct::VcloudXCapacity }
|
100
|
-
its(:units) { should == "bytes * 2^20" }
|
101
|
-
its(:allocated) { should == @mock_vdc[:memory][:allocated] }
|
102
|
-
its(:used) { should == nil }
|
103
|
-
its(:limit) { should == nil }
|
104
|
-
end
|
86
|
+
let(:available_networks) { subject[:AvailableNetworks][:Network] }
|
87
|
+
specify { available_networks.should have(2).networks }
|
105
88
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
it { should be_an_instance_of Struct::VcloudXCapacity }
|
117
|
-
its(:limit) { should == -1 }
|
118
|
-
its(:used) { should == -1 }
|
119
|
-
its(:units) { should == nil }
|
120
|
-
its(:allocated) { should == nil }
|
121
|
-
end
|
122
|
-
describe "#resource_entities" do
|
123
|
-
subject { @vdc.body.resource_entities }
|
124
|
-
it_should_behave_like "the mocked tmrk resource entity links"
|
89
|
+
describe "[:AvailableNetworks][:Network]" do
|
90
|
+
context "[0]" do
|
91
|
+
subject { @vdc.body[:AvailableNetworks][:Network][0] }
|
92
|
+
it { should be_a_network_link_to @mock_vdc[:networks][0] }
|
93
|
+
end
|
94
|
+
context "[1]" do
|
95
|
+
subject { @vdc.body[:AvailableNetworks][:Network][1] }
|
96
|
+
it { should be_a_network_link_to @mock_vdc[:networks][1] }
|
97
|
+
end
|
98
|
+
end
|
125
99
|
end
|
126
100
|
end
|
127
|
-
end
|
128
101
|
|
129
|
-
|
130
|
-
|
102
|
+
context "with a vdc uri that doesn't exist" do
|
103
|
+
subject { lambda { @vcloud.get_vdc(URI.parse('https://www.fakey.com/api/v0.8/vdc/999')) } }
|
131
104
|
|
132
|
-
|
105
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
106
|
+
end
|
133
107
|
end
|
134
108
|
end
|
109
|
+
else
|
135
110
|
end
|