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
@@ -1,53 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
-
5
- class Network < Fog::Parsers::Vcloud::Base
6
-
7
- def reset
8
- @response = Struct::VcloudNetwork.new([])
9
- end
10
-
11
- def start_element(name,attributes=[])
12
- super
13
- case name
14
- when "Network"
15
- handle_root(attributes)
16
- when "Features"
17
- @in = :features
18
- when "Configuration"
19
- @in = :configuration
20
- @response.configuration = Struct::VcloudNetworkConfiguration.new
21
- end
22
- end
23
-
24
- def end_element(name)
25
- case @in
26
- when :features
27
- case name
28
- when "FenceMode"
29
- @response.features << Struct::VcloudNetworkFenceMode.new(@value)
30
- when "Features"
31
- @in = nil
32
- end
33
- when :configuration
34
- case name
35
- when "Gateway","Netmask","Dns"
36
- @response.configuration[name.downcase] = @value
37
- when "Configuration"
38
- @in = nil
39
- end
40
- else
41
- case name
42
- when "Description"
43
- @response.description = @value
44
- end
45
- end
46
- end
47
-
48
- end
49
-
50
- end
51
- end
52
- end
53
-
@@ -1,9 +0,0 @@
1
- module Fog
2
- module Vcloud
3
- module Terremark
4
- unless @required
5
- @required = true
6
- end
7
- end
8
- end
9
- end
@@ -1,59 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
- module Terremark
5
- module Ecloud
6
-
7
- class GetInternetServices < Fog::Parsers::Vcloud::Base
8
-
9
- def reset
10
- @response = Struct::TmrkEcloudList.new([])
11
- @in = nil
12
- @public_ip = nil
13
- end
14
-
15
- def start_element(name, attributes)
16
- @value = nil
17
- case name
18
- when 'InternetService'
19
- @in = :service
20
- @service = Struct::TmrkEcloudInternetService.new("application/vnd.tmrk.ecloud.internetService+xml")
21
- when 'PublicIpAddress'
22
- @in = :public_ip
23
- @public_ip = Struct::TmrkEcloudPublicIp.new("application/vnd.tmrk.ecloud.publicIp+xml")
24
- end
25
- end
26
-
27
- def end_element(name)
28
- target = case @in
29
- when :service
30
- @service
31
- when :public_ip
32
- @public_ip
33
- end
34
-
35
- case name
36
- when 'Href'
37
- target[name.downcase] = URI.parse(@value)
38
- when 'Name', 'Protocol', 'Description', 'SendString', 'HttpHeader'
39
- #The gsub takes the CamelCase names and turns them into camel_case
40
- target[Fog::Parsers::Vcloud.de_camel(name)] = @value
41
- when 'Id', 'Port', 'Timeout'
42
- target[name.downcase] = @value.to_i
43
- when 'Enabled'
44
- @service[name.downcase] = ( @value == "true" ? true : false )
45
- when 'InternetService'
46
- @response.links << @service
47
- @in = nil
48
- when 'PublicIpAddress'
49
- @service.public_ip = @public_ip
50
- @in = :service
51
- end
52
- end
53
-
54
- end
55
- end
56
- end
57
- end
58
- end
59
- end
@@ -1,30 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
- module Terremark
5
- module Ecloud
6
-
7
- class GetPublicIp < Fog::Parsers::Vcloud::Base
8
-
9
- def reset
10
- @response = Struct::TmrkEcloudPublicIp.new("application/vnd.tmrk.ecloud.publicIp+xml")
11
- end
12
-
13
- def end_element(name)
14
- case name
15
- when 'Href'
16
- @response[name.downcase] = URI.parse(@value)
17
- when 'Name'
18
- @response[name.downcase] = @value
19
- when 'Id'
20
- @response['id'] = @value.to_i
21
- end
22
- end
23
-
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
-
@@ -1,40 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
- module Terremark
5
- module Ecloud
6
-
7
- class GetPublicIps < Fog::Parsers::Vcloud::Base
8
-
9
- def reset
10
- @response = Struct::TmrkEcloudList.new([])
11
- end
12
-
13
- def start_element(name, attributes)
14
- @value = nil
15
- case name
16
- when 'PublicIPAddress'
17
- @ip_address = Struct::TmrkEcloudPublicIp.new("application/vnd.tmrk.ecloud.publicIp+xml")
18
- end
19
- end
20
-
21
- def end_element(name)
22
- case name
23
- when 'Href'
24
- @ip_address[name.downcase] = URI.parse(@value)
25
- when 'Name'
26
- @ip_address[name.downcase] = @value
27
- when 'Id'
28
- @ip_address[name.downcase] = @value.to_i
29
- when 'PublicIPAddress'
30
- @response.links << @ip_address
31
- end
32
- end
33
-
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
-
@@ -1,59 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
- module Terremark
5
- module Ecloud
6
-
7
- class GetVdc < Fog::Parsers::Vcloud::Base
8
-
9
- def reset
10
- @target = nil
11
- @response = Struct::TmrkEcloudVdc.new([],[],[],Struct::VcloudXCapacity.new,Struct::VcloudXCapacity.new,
12
- Struct::VcloudXCapacity.new,Struct::VcloudXCapacity.new,
13
- Struct::VcloudXCapacity.new)
14
- end
15
-
16
- def start_element(name, attributes)
17
- @value = ''
18
- case name
19
- when 'Cpu'
20
- @target = :cpu_capacity
21
- when 'DeployedVmsQuota'
22
- @target = :deployed_vm_quota
23
- when 'InstantiatedVmsQuota'
24
- @target = :instantiated_vm_quota
25
- when 'Memory'
26
- @target = :memory_capacity
27
- when 'StorageCapacity'
28
- @target = :storage_capacity
29
- when 'Link'
30
- @response.links << generate_link(attributes)
31
- when 'Network'
32
- @response.networks << generate_link(attributes)
33
- when 'ResourceEntity'
34
- @response.resource_entities << generate_link(attributes)
35
- when 'Vdc'
36
- handle_root(attributes)
37
- end
38
- end
39
-
40
- def end_element(name)
41
- case name
42
- when 'Allocated', 'Limit', 'Used'
43
- @response[@target][name.downcase] = @value.to_i
44
- when 'Units'
45
- @response[@target][name.downcase] = @value
46
- when 'Cpu', 'DeployedVmsQuota', 'InstantiatedVmsQuota', 'Memory', 'StorageCapacity'
47
- @target = nil
48
- when 'Description'
49
- @response.description = @value
50
- end
51
- end
52
-
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end
59
-
@@ -1,58 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
- module Terremark
5
- module Ecloud
6
-
7
- class InternetService < Fog::Parsers::Vcloud::Base
8
-
9
- def reset
10
- @response = Struct::TmrkEcloudInternetService.new("application/vnd.tmrk.ecloud.internetService+xml")
11
- @in = nil
12
- @public_ip = nil
13
- end
14
-
15
- def start_element(name, attributes)
16
- @value = nil
17
- case name
18
- when 'InternetService'
19
- @in = :service
20
- when 'PublicIpAddress'
21
- @in = :public_ip
22
- @public_ip = Struct::TmrkEcloudPublicIp.new("application/vnd.tmrk.ecloud.publicIp+xml")
23
- end
24
- end
25
-
26
- def end_element(name)
27
- target = case @in
28
- when :service
29
- @response
30
- when :public_ip
31
- @public_ip
32
- end
33
-
34
- case name
35
- when 'Href'
36
- target[name.downcase] = URI.parse(@value)
37
- when 'Name', 'Protocol', 'Description', 'SendString', 'HttpHeader'
38
- #The gsub takes the CamelCase names and turns them into camel_case
39
- target[Fog::Parsers::Vcloud.de_camel(name)] = @value
40
- when 'Id', 'Port', 'Timeout'
41
- target[name.downcase] = @value.to_i
42
- when 'Enabled'
43
- @response[name.downcase] = ( @value == "true" ? true : false )
44
- when 'InternetService'
45
- @in = nil
46
- when 'PublicIpAddress'
47
- @response.public_ip = @public_ip
48
- @in = :service
49
- end
50
- end
51
-
52
- end
53
- end
54
- end
55
- end
56
- end
57
- end
58
-
@@ -1,28 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
- module Terremark
5
- module Ecloud
6
-
7
- class Network < Fog::Parsers::Vcloud::Network
8
-
9
- def reset
10
- @response = Struct::TmrkEcloudNetwork.new([])
11
- end
12
-
13
- def start_element(name,attributes=[])
14
- super
15
- case name
16
- when "Link"
17
- @response.ips_link = generate_link(attributes)
18
- end
19
- end
20
-
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
27
-
28
-
@@ -1,31 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
- module Terremark
5
- module Ecloud
6
-
7
- class NetworkIps< Fog::Parsers::Vcloud::Base
8
-
9
- def reset
10
- @response = Struct::TmrkEcloudNetworkIps.new([])
11
- @ip_address = Struct::TmrkEcloudNetworkIp.new
12
- end
13
-
14
- def end_element(name)
15
- case name
16
- when 'Name', 'Status', 'Server'
17
- @ip_address[name.downcase] = @value
18
- when 'IpAddress'
19
- @response.addresses << @ip_address
20
- @ip_address = Struct::TmrkEcloudNetworkIp.new
21
- end
22
- end
23
-
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
-
31
-
@@ -1,27 +0,0 @@
1
- module Fog
2
- module Vcloud
3
- module Terremark
4
- module Ecloud
5
- module Real
6
-
7
- # See /lib/fog/vcloud/requests/get_organizations.rb
8
- def login
9
- unauthenticated_request({
10
- :expects => 200,
11
- :headers => {
12
- 'Authorization' => authorization_header,
13
- 'Content-Type' => "application/vnd.vmware.vcloud.orgList+xml"
14
- },
15
- :method => 'POST',
16
- :parser => Fog::Parsers::Vcloud::Login.new,
17
- :uri => @login_uri
18
- })
19
- end
20
-
21
- end
22
- end
23
- end
24
- end
25
- end
26
-
27
-
@@ -1,34 +0,0 @@
1
- module Fog
2
- module Parsers
3
- module Vcloud
4
- module Terremark
5
- module Vcloud
6
-
7
- class GetVdc < Fog::Parsers::Vcloud::Base
8
-
9
- def reset
10
- @target = nil
11
- @response = Struct::TmrkVcloudVdc.new([],[],[])
12
- end
13
-
14
- def start_element(name, attributes)
15
- @value = ''
16
- case name
17
- when 'Link'
18
- @response.links << generate_link(attributes)
19
- when 'Network'
20
- @response.networks << generate_link(attributes)
21
- when 'ResourceEntity'
22
- @response.resource_entities << generate_link(attributes)
23
- when 'Vdc'
24
- handle_root(attributes)
25
- end
26
- end
27
-
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
34
-
@@ -1,74 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Fog::Vcloud, initialized w/ the TMRK Vcloud module", :type => :tmrk_vcloud_request do
4
- subject { @vcloud }
5
-
6
- it { should respond_to :get_vdc }
7
-
8
- describe :get_vdc do
9
- context "with a valid vdc uri" do
10
- before { @vdc = @vcloud.get_vdc(URI.parse(@mock_vdc[:href])) }
11
- subject { @vdc }
12
-
13
- it_should_behave_like "all requests"
14
-
15
- its(:headers) { should include "Content-Type" }
16
- its(:body) { should be_an_instance_of Struct::TmrkVcloudVdc }
17
-
18
- describe :headers do
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 }
25
-
26
- it_should_behave_like "it has a vcloud v0.8 xmlns"
27
- it_should_behave_like "a tmrk vdc"
28
-
29
- its(:name) { should == @mock_vdc[:name] }
30
- its(:href) { should == URI.parse(@mock_vdc[:href]) }
31
-
32
- describe "#links" do
33
- subject { @vdc.body.links }
34
- it { should have(3).links }
35
-
36
- describe "#link[0]" do
37
- subject { @vdc.body.links[0] }
38
- it_should_behave_like "a vdc catalog link"
39
- end
40
-
41
- describe "#link[1]" do
42
- subject { @vdc.body.links[1] }
43
-
44
- it_should_behave_like "all rel=down vcloud links"
45
- it_should_behave_like "all vcloud application/xml types"
46
- specify { subject.href.should == URI.parse(@mock_vdc[:href] + "/publicIps") }
47
- end
48
-
49
- describe "#link[2]" do
50
- subject { @vdc.body.links[2] }
51
-
52
- it_should_behave_like "all rel=down vcloud links"
53
- it_should_behave_like "all vcloud application/xml types"
54
- specify { subject.href.should == URI.parse(@mock_vdc[:href] + "/internetServices") }
55
- end
56
- end
57
- describe :networks do
58
- subject { @vdc.body.networks }
59
- it_should_behave_like "the mocked tmrk network links"
60
- end
61
- describe "#resource_entities" do
62
- subject { @vdc.body.resource_entities }
63
- it_should_behave_like "the mocked tmrk resource entity links"
64
- end
65
- end
66
- end
67
-
68
- context "with a vdc uri that doesn't exist" do
69
- subject { lambda { @vcloud.get_vdc(URI.parse('https://www.fakey.com/api/v0.8/vdc/999')) } }
70
-
71
- it_should_behave_like "a request for a resource that doesn't exist"
72
- end
73
- end
74
- end