fog-maestrodev 1.14.0.20130806165225 → 1.15.0.20130829165835

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.
Files changed (173) hide show
  1. data/changelog.txt +296 -0
  2. data/fog.gemspec +2 -2
  3. data/lib/fog/atmos/storage.rb +0 -3
  4. data/lib/fog/aws/cdn.rb +1 -2
  5. data/lib/fog/aws/compute.rb +52 -2
  6. data/lib/fog/aws/dns.rb +0 -1
  7. data/lib/fog/aws/models/auto_scaling/groups.rb +6 -3
  8. data/lib/fog/aws/models/compute/address.rb +1 -0
  9. data/lib/fog/aws/models/compute/flavors.rb +19 -0
  10. data/lib/fog/aws/models/compute/route_table.rb +69 -0
  11. data/lib/fog/aws/models/compute/route_tables.rb +92 -0
  12. data/lib/fog/aws/models/rds/instance_option.rb +21 -0
  13. data/lib/fog/aws/models/rds/instance_options.rb +30 -0
  14. data/lib/fog/aws/parsers/compute/associate_route_table.rb +20 -0
  15. data/lib/fog/aws/parsers/compute/create_route_table.rb +75 -0
  16. data/lib/fog/aws/parsers/compute/describe_account_attributes.rb +42 -0
  17. data/lib/fog/aws/parsers/compute/describe_route_tables.rb +85 -0
  18. data/lib/fog/aws/parsers/rds/describe_orderable_db_instance_options.rb +47 -0
  19. data/lib/fog/aws/rds.rb +5 -0
  20. data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_groups.rb +9 -1
  21. data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +15 -1
  22. data/lib/fog/aws/requests/compute/associate_dhcp_options.rb +2 -2
  23. data/lib/fog/aws/requests/compute/associate_route_table.rb +75 -0
  24. data/lib/fog/aws/requests/compute/attach_internet_gateway.rb +2 -2
  25. data/lib/fog/aws/requests/compute/create_route.rb +89 -0
  26. data/lib/fog/aws/requests/compute/create_route_table.rb +70 -0
  27. data/lib/fog/aws/requests/compute/create_vpc.rb +16 -1
  28. data/lib/fog/aws/requests/compute/delete_dhcp_options.rb +2 -2
  29. data/lib/fog/aws/requests/compute/delete_internet_gateway.rb +2 -2
  30. data/lib/fog/aws/requests/compute/delete_network_interface.rb +2 -2
  31. data/lib/fog/aws/requests/compute/delete_route.rb +60 -0
  32. data/lib/fog/aws/requests/compute/delete_route_table.rb +51 -0
  33. data/lib/fog/aws/requests/compute/delete_subnet.rb +2 -2
  34. data/lib/fog/aws/requests/compute/delete_vpc.rb +2 -2
  35. data/lib/fog/aws/requests/compute/describe_account_attributes.rb +49 -0
  36. data/lib/fog/aws/requests/compute/describe_route_tables.rb +87 -0
  37. data/lib/fog/aws/requests/compute/detach_internet_gateway.rb +2 -2
  38. data/lib/fog/aws/requests/compute/detach_network_interface.rb +2 -2
  39. data/lib/fog/aws/requests/compute/disassociate_route_table.rb +57 -0
  40. data/lib/fog/aws/requests/compute/reset_network_interface_attribute.rb +2 -1
  41. data/lib/fog/aws/requests/elb/create_load_balancer.rb +23 -9
  42. data/lib/fog/aws/requests/iam/upload_server_certificate.rb +1 -1
  43. data/lib/fog/aws/requests/rds/describe_orderable_db_instance_options.rb +76 -0
  44. data/lib/fog/aws/storage.rb +0 -2
  45. data/lib/fog/brightbox/models/compute/collaboration.rb +10 -2
  46. data/lib/fog/brightbox/models/compute/collaborations.rb +26 -2
  47. data/lib/fog/brightbox/models/compute/user_collaboration.rb +16 -1
  48. data/lib/fog/brightbox/models/compute/user_collaborations.rb +10 -2
  49. data/lib/fog/cloudstack/models/compute/server.rb +4 -0
  50. data/lib/fog/core/collection.rb +18 -0
  51. data/lib/fog/core/credentials.rb +6 -1
  52. data/lib/fog/google/compute.rb +17 -0
  53. data/lib/fog/google/examples/get_list_images.rb +27 -0
  54. data/lib/fog/google/examples/get_list_snapshots.rb +20 -0
  55. data/lib/fog/google/examples/image_create.rb +18 -0
  56. data/lib/fog/google/examples/launch_micro_instance.rb +10 -5
  57. data/lib/fog/google/examples/network.rb +21 -0
  58. data/lib/fog/google/models/compute/disk.rb +16 -5
  59. data/lib/fog/google/models/compute/image.rb +36 -18
  60. data/lib/fog/google/models/compute/images.rb +36 -10
  61. data/lib/fog/google/models/compute/server.rb +41 -11
  62. data/lib/fog/google/models/compute/servers.rb +1 -1
  63. data/lib/fog/google/models/compute/snapshot.rb +36 -0
  64. data/lib/fog/google/models/compute/snapshots.rb +28 -0
  65. data/lib/fog/google/requests/compute/delete_disk.rb +5 -1
  66. data/lib/fog/google/requests/compute/get_disk.rb +2 -1
  67. data/lib/fog/google/requests/compute/get_snapshot.rb +34 -0
  68. data/lib/fog/google/requests/compute/insert_disk.rb +23 -7
  69. data/lib/fog/google/requests/compute/insert_image.rb +16 -9
  70. data/lib/fog/google/requests/compute/insert_server.rb +22 -10
  71. data/lib/fog/google/requests/compute/list_disks.rb +1 -1
  72. data/lib/fog/google/requests/compute/list_snapshots.rb +30 -0
  73. data/lib/fog/google/storage.rb +1 -3
  74. data/lib/fog/hp/storage.rb +0 -2
  75. data/lib/fog/internet_archive/storage.rb +0 -2
  76. data/lib/fog/local/storage.rb +0 -2
  77. data/lib/fog/ninefold/storage.rb +0 -1
  78. data/lib/fog/openstack/models/storage/file.rb +2 -0
  79. data/lib/fog/openstack/requests/compute/add_flavor_access.rb +1 -1
  80. data/lib/fog/openstack/requests/compute/create_volume.rb +8 -7
  81. data/lib/fog/openstack/requests/compute/list_tenants_with_flavor_access.rb +1 -1
  82. data/lib/fog/openstack/requests/compute/remove_flavor_access.rb +1 -1
  83. data/lib/fog/openstack/requests/image/create_image.rb +23 -23
  84. data/lib/fog/openstack/requests/image/update_image.rb +31 -33
  85. data/lib/fog/openstack/requests/storage/get_object_https_url.rb +3 -3
  86. data/lib/fog/openstack/requests/storage/post_set_meta_temp_url_key.rb +1 -1
  87. data/lib/fog/openstack/storage.rb +10 -11
  88. data/lib/fog/openstack.rb +10 -1
  89. data/lib/fog/rackspace/cdn.rb +13 -0
  90. data/lib/fog/rackspace/compute.rb +8 -4
  91. data/lib/fog/rackspace/compute_v2.rb +2 -0
  92. data/lib/fog/rackspace/databases.rb +4 -4
  93. data/lib/fog/rackspace/dns.rb +6 -6
  94. data/lib/fog/rackspace/examples/compute_v2/bootstrap_server.rb +98 -0
  95. data/lib/fog/rackspace/load_balancers.rb +5 -4
  96. data/lib/fog/rackspace/models/compute_v2/flavors.rb +1 -2
  97. data/lib/fog/rackspace/models/compute_v2/images.rb +35 -3
  98. data/lib/fog/rackspace/models/compute_v2/metadatum.rb +2 -2
  99. data/lib/fog/rackspace/models/identity/service_catalog.rb +34 -16
  100. data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +8 -3
  101. data/lib/fog/rackspace/models/monitoring/alarm.rb +16 -8
  102. data/lib/fog/rackspace/models/monitoring/base.rb +2 -8
  103. data/lib/fog/rackspace/monitoring.rb +14 -6
  104. data/lib/fog/rackspace/requests/compute_v2/list_flavors_detail.rb +39 -0
  105. data/lib/fog/rackspace/requests/compute_v2/list_images.rb +15 -5
  106. data/lib/fog/rackspace/requests/compute_v2/list_images_detail.rb +53 -0
  107. data/lib/fog/rackspace/requests/identity/create_token.rb +1 -1
  108. data/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb +12 -0
  109. data/lib/fog/rackspace/requests/load_balancers/get_stats.rb +31 -0
  110. data/lib/fog/rackspace/requests/monitoring/get_entity.rb +33 -0
  111. data/lib/fog/rackspace/service.rb +7 -0
  112. data/lib/fog/rackspace/storage.rb +6 -3
  113. data/lib/fog/rackspace.rb +8 -5
  114. data/lib/fog/riakcs/provisioning.rb +0 -1
  115. data/lib/fog/riakcs/usage.rb +2 -3
  116. data/lib/fog/storage.rb +2 -0
  117. data/lib/fog/vcloud/examples/README.md +54 -0
  118. data/lib/fog/vcloud/examples/creating_a_connection.md +20 -0
  119. data/lib/fog/vcloud/examples/creating_a_vapp.md +17 -0
  120. data/lib/fog/vcloud/examples/get_network_information.md +10 -0
  121. data/lib/fog/vcloud/examples/get_vapp_information.md +10 -0
  122. data/lib/fog/vcloud/examples/more_on_vapps.md +23 -0
  123. data/lib/fog/version.rb +1 -1
  124. data/lib/tasks/changelog_task.rb +1 -0
  125. data/tests/aws/models/elb/model_tests.rb +5 -0
  126. data/tests/aws/models/rds/instance_option_tests.rb +14 -0
  127. data/tests/aws/requests/compute/client_tests.rb +25 -0
  128. data/tests/aws/requests/compute/route_tests.rb +277 -0
  129. data/tests/aws/requests/rds/helper.rb +22 -0
  130. data/tests/aws/requests/rds/instance_option_tests.rb +21 -0
  131. data/tests/core/credential_tests.rb +21 -0
  132. data/tests/core/service_tests.rb +26 -0
  133. data/tests/openstack/authenticate_tests.rb +22 -0
  134. data/tests/openstack/models/storage/file_tests.rb +20 -1
  135. data/tests/openstack/requests/compute/flavor_tests.rb +27 -12
  136. data/tests/openstack/requests/compute/volume_tests.rb +10 -12
  137. data/tests/openstack/requests/image/image_tests.rb +30 -15
  138. data/tests/rackspace/block_storage_tests.rb +9 -4
  139. data/tests/rackspace/cdn_tests.rb +14 -0
  140. data/tests/rackspace/compute_tests.rb +10 -4
  141. data/tests/rackspace/compute_v2_tests.rb +9 -4
  142. data/tests/rackspace/databases_tests.rb +9 -4
  143. data/tests/rackspace/dns_tests.rb +9 -4
  144. data/tests/rackspace/helper.rb +21 -2
  145. data/tests/rackspace/identity_tests.rb +9 -4
  146. data/tests/rackspace/load_balancer_tests.rb +8 -4
  147. data/tests/rackspace/models/compute_v2/server_tests.rb +18 -21
  148. data/tests/rackspace/models/identity/service_catalog_tests.rb +54 -29
  149. data/tests/rackspace/models/load_balancers/load_balancer_tests.rb +5 -0
  150. data/tests/rackspace/models/monitoring/alarm_examples_tests.rb +1 -1
  151. data/tests/rackspace/models/monitoring/alarm_tests.rb +2 -2
  152. data/tests/rackspace/monitoring_tests.rb +9 -4
  153. data/tests/rackspace/requests/compute_v2/flavor_tests.rb +6 -0
  154. data/tests/rackspace/requests/compute_v2/image_tests.rb +4 -0
  155. data/tests/rackspace/requests/compute_v2/server_tests.rb +2 -2
  156. data/tests/rackspace/requests/load_balancers/get_stats_tests.rb +13 -0
  157. data/tests/rackspace/requests/load_balancers/helper.rb +9 -0
  158. data/tests/rackspace/requests/monitoring/alarm_tests.rb +4 -5
  159. data/tests/rackspace/requests/monitoring/entity_tests.rb +9 -1
  160. data/tests/rackspace/requests/storage/large_object_tests.rb +12 -4
  161. data/tests/rackspace/storage_tests.rb +23 -4
  162. data/tests/rackspace/url_encoding_tests.rb +3 -1
  163. metadata +117 -133
  164. checksums.yaml +0 -15
  165. data/lib/fog/aws/parsers/compute/associate_dhcp_options.rb +0 -24
  166. data/lib/fog/aws/parsers/compute/attach_internet_gateway.rb +0 -24
  167. data/lib/fog/aws/parsers/compute/delete_dhcp_options.rb +0 -24
  168. data/lib/fog/aws/parsers/compute/delete_internet_gateway.rb +0 -24
  169. data/lib/fog/aws/parsers/compute/delete_network_interface.rb +0 -24
  170. data/lib/fog/aws/parsers/compute/delete_subnet.rb +0 -24
  171. data/lib/fog/aws/parsers/compute/delete_vpc.rb +0 -24
  172. data/lib/fog/aws/parsers/compute/detach_internet_gateway.rb +0 -24
  173. data/lib/fog/aws/parsers/compute/detach_network_interface.rb +0 -24
@@ -0,0 +1,70 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/create_route_table'
7
+
8
+ # Creates a route table for the specified VPC.
9
+ #
10
+ # ==== Parameters
11
+ # * VpcId<~String> - The ID of the VPC.
12
+ #
13
+ # === Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'requestId'<~String> - Id of the request
17
+ # * 'routeTable'<~Array> - Information about the newly created route table
18
+ # * 'routeTableId'<~String>
19
+ # * 'vpcId'<~String>
20
+ # * 'routeSet'<~Array>
21
+ # * 'item'<~Array>
22
+ # * 'destinationCidrBlock'<~String> - The CIDR address block used for the destination match.
23
+ # * 'gatewayId'<~String> - The ID of an Internet gateway attached to your VPC.
24
+ # * 'state'<~String> - The state of the route. ['blackhole', 'available']
25
+ #
26
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateRouteTable.html]
27
+ def create_route_table(vpc_id)
28
+ request({
29
+ 'Action' => 'CreateRouteTable',
30
+ 'VpcId' => vpc_id,
31
+ :parser => Fog::Parsers::Compute::AWS::CreateRouteTable.new
32
+ })
33
+ end
34
+ end
35
+
36
+ class Mock
37
+ def create_route_table(vpc_id)
38
+ response = Excon::Response.new
39
+ vpc = self.data[:vpcs].find { |vpc| vpc["vpcId"].eql? vpc_id }
40
+ unless vpc.nil?
41
+ response.status = 200
42
+ route_table = {
43
+ 'routeTableId' => "rtb-#{Fog::Mock.random_hex(8)}",
44
+ 'vpcId' => vpc["vpcId"],
45
+ 'routeSet' => [{
46
+ "destinationCidrBlock" => vpc["cidrBlock"],
47
+ "gatewayId" => "local",
48
+ "instanceId"=>nil,
49
+ "instanceOwnerId"=>nil,
50
+ "networkInterfaceId"=>nil,
51
+ "state" => "pending",
52
+ "origin" => "CreateRouteTable"
53
+ }],
54
+ 'associationSet' => [],
55
+ 'tagSet' => {}
56
+ }
57
+ self.data[:route_tables].push(route_table)
58
+ response.body = {
59
+ 'requestId'=> Fog::AWS::Mock.request_id,
60
+ 'routeTable' => [route_table]
61
+ }
62
+ response
63
+ else
64
+ raise Fog::Compute::AWS::NotFound.new("The vpc ID '#{vpc_id}' does not exist")
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -43,14 +43,29 @@ module Fog
43
43
  Excon::Response.new.tap do |response|
44
44
  if cidrBlock
45
45
  response.status = 200
46
+ vpc_id = Fog::AWS::Mock.request_id
46
47
  self.data[:vpcs].push({
47
- 'vpcId' => Fog::AWS::Mock.request_id,
48
+ 'vpcId' => vpc_id,
48
49
  'state' => 'pending',
49
50
  'cidrBlock' => cidrBlock,
50
51
  'dhcpOptionsId' => Fog::AWS::Mock.request_id,
51
52
  'tagSet' => {}
52
53
 
53
54
  })
55
+
56
+ #Creates a default route for the subnet
57
+ default_route = self.route_tables.new(:vpc_id => vpc_id)
58
+ default_route.save
59
+
60
+ # You are not able to push a main route in the normal AWS, so we are re-implementing some of the
61
+ # associate_route_table here in order to accomplish this.
62
+ route_table = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? default_route.id }
63
+
64
+ # This pushes a main route to the associationSet
65
+ # add_route_association(routeTableId, subnetId, main=false) is declared in assocate_route_table.rb
66
+ assoc = add_route_association(default_route.id, nil, true)
67
+ route_table["associationSet"].push(assoc)
68
+
54
69
  response.body = {
55
70
  'requestId' => Fog::AWS::Mock.request_id,
56
71
  'vpcSet' => self.data[:vpcs]
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/delete_dhcp_options'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
  #Deletes a set of DHCP options that you specify. Amazon VPC returns an error if the set of options you specify is currently
8
8
  #associated with a VPC. You can disassociate the set of options by associating either a new set of options or the default
9
9
  #options with the VPC.
@@ -22,7 +22,7 @@ module Fog
22
22
  request(
23
23
  'Action' => 'DeleteDhcpOptions',
24
24
  'DhcpOptionsId' => dhcp_options_id,
25
- :parser => Fog::Parsers::Compute::AWS::DeleteDhcpOptions.new
25
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
26
26
  )
27
27
  end
28
28
  end
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/delete_internet_gateway'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
  #Deletes an Internet gateway from your AWS account. The gateway must not be attached to a VPC
8
8
  #
9
9
  # ==== Parameters
@@ -20,7 +20,7 @@ module Fog
20
20
  request(
21
21
  'Action' => 'DeleteInternetGateway',
22
22
  'InternetGatewayId' => internet_gateway_id,
23
- :parser => Fog::Parsers::Compute::AWS::DeleteInternetGateway.new
23
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
24
24
  )
25
25
  end
26
26
  end
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/delete_network_interface'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
  # Deletes a network interface.
8
8
  #
9
9
  # ==== Parameters
@@ -20,7 +20,7 @@ module Fog
20
20
  request(
21
21
  'Action' => 'DeleteNetworkInterface',
22
22
  'NetworkInterfaceId' => network_interface_id,
23
- :parser => Fog::Parsers::Compute::AWS::DeleteNetworkInterface.new
23
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
24
24
  )
25
25
  end
26
26
  end
@@ -0,0 +1,60 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/basic'
7
+
8
+ # Deletes the specified route from the specified route table.
9
+ #
10
+ # ==== Parameters
11
+ # * RouteTableId<~String> - The ID of the route table.
12
+ # * DestinationCidrBlock<~String> - The CIDR range for the route. The value you specify must match the CIDR for the route exactly.
13
+ #
14
+ # ==== Returns
15
+ # * response<~Excon::Response>:
16
+ # * body<~Hash>:
17
+ # * 'requestId'<~String> - The ID of the request.
18
+ # * 'return'<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.
19
+ #
20
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteRoute.html]
21
+ def delete_route(route_table_id, destination_cidr_block)
22
+ request(
23
+ 'Action' => 'DeleteRoute',
24
+ 'RouteTableId' => route_table_id,
25
+ 'DestinationCidrBlock' => destination_cidr_block,
26
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
27
+ )
28
+ end
29
+
30
+ end
31
+
32
+ class Mock
33
+
34
+ def delete_route(route_table_id, destination_cidr_block)
35
+ route_table = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? route_table_id }
36
+ unless route_table.nil?
37
+ route = route_table['routeSet'].find { |route| route["destinationCidrBlock"].eql? destination_cidr_block }
38
+ if !route.nil? && route['gatewayId'] != "local"
39
+ route_table['routeSet'].delete(route)
40
+ response = Excon::Response.new
41
+ response.status = 200
42
+ response.body = {
43
+ 'requestId'=> Fog::AWS::Mock.request_id,
44
+ 'return' => true
45
+ }
46
+ response
47
+ elsif route['gatewayId'] == "local"
48
+ # Cannot delete the default route
49
+ raise Fog::Compute::AWS::Error, "InvalidParameterValue => cannot remove local route #{destination_cidr_block} in route table #{route_table_id}"
50
+ else
51
+ raise Fog::Compute::AWS::NotFound.new("no route with destination-cidr-block #{destination_cidr_block} in route table #{route_table_id}")
52
+ end
53
+ else
54
+ raise Fog::Compute::AWS::NotFound.new("no route with destination-cidr-block #{destination_cidr_block} in route table #{route_table_id}")
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,51 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/basic'
7
+
8
+ # Deletes the specified route table.
9
+ #
10
+ # ==== Parameters
11
+ # * RouteTableId<~String> - The ID of the route table.
12
+ #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'requestId'<~String> - The ID of request.
17
+ # * 'return'<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.
18
+ #
19
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteRouteTable.html]
20
+ def delete_route_table(route_table_id)
21
+ request(
22
+ 'Action' => 'DeleteRouteTable',
23
+ 'RouteTableId' => route_table_id,
24
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
25
+ )
26
+ end
27
+
28
+ end
29
+
30
+ class Mock
31
+ def delete_route_table(route_table_id)
32
+ route_table = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? route_table_id }
33
+ if !route_table.nil? && route_table['associationSet'].empty?
34
+ self.data[:route_tables].delete(route_table)
35
+ response = Excon::Response.new
36
+ response.status = 200
37
+ response.body = {
38
+ 'requestId'=> Fog::AWS::Mock.request_id,
39
+ 'return' => true
40
+ }
41
+ response
42
+ elsif route_table.nil?
43
+ raise Fog::Compute::AWS::NotFound.new("The routeTable ID '#{route_table_id}' does not exist")
44
+ elsif !route_table['associationSet'].empty?
45
+ raise Fog::Compute::AWS::Error, "DependencyViolation => The routeTable '#{route_table_id}' has dependencies and cannot be deleted."
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/delete_subnet'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
  # Deletes a subnet from a VPC. You must terminate all running instances in the subnet before deleting it, otherwise Amazon
8
8
  # VPC returns an error
9
9
  #
@@ -21,7 +21,7 @@ module Fog
21
21
  request(
22
22
  'Action' => 'DeleteSubnet',
23
23
  'SubnetId' => subnet_id,
24
- :parser => Fog::Parsers::Compute::AWS::DeleteSubnet.new
24
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
25
25
  )
26
26
  end
27
27
  end
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/delete_vpc'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
 
8
8
  # Deletes a VPC. You must detach or delete all gateways or other objects
9
9
  # that are dependent on the VPC first. For example, you must terminate
@@ -24,7 +24,7 @@ module Fog
24
24
  request(
25
25
  'Action' => 'DeleteVpc',
26
26
  'VpcId' => vpc_id,
27
- :parser => Fog::Parsers::Compute::AWS::DeleteVpc.new
27
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
28
28
  )
29
29
  end
30
30
  end
@@ -0,0 +1,49 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/describe_account_attributes'
7
+
8
+ # Describe account attributes
9
+ #
10
+ # ==== Parameters
11
+ # * filters<~Hash> - List of filters to limit results with
12
+ #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'requestId'<~String> = Id of request
17
+ # * 'accountAttributeSet'<~Array>:
18
+ # * 'attributeName'<~String> - supported-platforms
19
+ # * 'attributeValueSet'<~Array>:
20
+ # * 'attributeValue'<~String> - Value of attribute
21
+ #
22
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeAccountAttributes.html]
23
+
24
+ def describe_account_attributes(filters = {})
25
+ params = Fog::AWS.indexed_filters(filters)
26
+ request({
27
+ 'Action' => 'DescribeAccountAttributes',
28
+ :idempotent => true,
29
+ :parser => Fog::Parsers::Compute::AWS::DescribeAccountAttributes.new
30
+ }.merge!(params))
31
+ end
32
+ end
33
+
34
+ class Mock
35
+ def describe_account_attributes(filters = {})
36
+ account_attributes = self.data[:account_attributes]
37
+
38
+ Excon::Response.new(
39
+ :status => 200,
40
+ :body => {
41
+ 'requestId' => Fog::AWS::Mock.request_id,
42
+ 'accountAttributeSet' => account_attributes
43
+ }
44
+ )
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,87 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/describe_route_tables'
7
+
8
+ # Describe one or more of your route tables.
9
+ #
10
+ # ==== Parameters
11
+ # * RouteTableId<~String> - One or more route table IDs.
12
+ # * filters<~Hash> - List of filters to limit results with
13
+ #
14
+ # ==== Returns
15
+ # * response<~Excon::Response>:
16
+ # * body<~Hash>:
17
+ # * 'requestId'<~String> - The ID of the request.
18
+ # * 'routeTableSet'<~Array>:
19
+ # * 'routeTableId'<~String> - The route table's ID.
20
+ # * 'vpcId'<~String> - The ID of the VPC for the route table.
21
+ # * 'routeSet'<~Array>:
22
+ # * 'destinationCidrBlock'<~String> - The CIDR address block used for the destination match.
23
+ # * 'gatewayId'<~String> - The ID of a gateway attached to your VPC.
24
+ # * 'instanceId'<~String> - The ID of a NAT instance in your VPC.
25
+ # * 'instanceOwnerId'<~String> - The owner of the instance.
26
+ # * 'networkInterfaceId'<~String> - The network interface ID.
27
+ # * 'state'<~String> - The state of the route. The blackhole state indicates that the route's target isn't available.
28
+ # * 'origin'<~String> - Describes how the route was created.
29
+ # * 'associationSet'<~Array>:
30
+ # * 'RouteTableAssociationId'<~String> - An identifier representing the association between a route table and a subnet.
31
+ # * 'routeTableId'<~String> - The ID of the route table.
32
+ # * 'subnetId'<~String> - The ID of the subnet.
33
+ # * 'main'<~Boolean> - Indicates whether this is the main route table.
34
+ # * 'propagatingVgwSet'<~Array>:
35
+ # * 'gatewayID'<~String> - The ID of the virtual private gateway (VGW).
36
+ # * 'tagSet'<~Array>:
37
+ # * 'key'<~String> - The tag key.
38
+ # * 'value'<~String> - The tag value.
39
+ #
40
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRouteTables.html]
41
+ def describe_route_tables(filters = {})
42
+ unless filters.is_a?(Hash)
43
+ Fog::Logger.deprecation("describe_route_tables with #{filters.class} param is deprecated, use describe_route_tables('route-table-id' => []) instead [light_black](#{caller.first})[/]")
44
+ filters = {'route-table-id' => [*filters]}
45
+ end
46
+ params = Fog::AWS.indexed_filters(filters)
47
+ request({
48
+ 'Action' => 'DescribeRouteTables',
49
+ :parser => Fog::Parsers::Compute::AWS::DescribeRouteTables.new
50
+ }.merge!(params))
51
+ end
52
+ end
53
+
54
+ class Mock
55
+ def describe_route_tables(filters = {})
56
+ unless filters.is_a?(Hash)
57
+ Fog::Logger.deprecation("describe_route_tables with #{filters.class} param is deprecated, use describe_route_tables('route-table-id' => []) instead [light_black](#{caller.first})[/]")
58
+ filters = {'route-table-id' => [*filters]}
59
+ end
60
+
61
+ display_routes = self.data[:route_tables].dup
62
+
63
+ aliases = {
64
+ 'route-table-id' => 'routeTableId',
65
+ 'vpc-id' => 'vpcId'
66
+ }
67
+
68
+ for filter_key, filter_value in filters
69
+ filter_attribute = aliases[filter_key]
70
+ case filter_attribute
71
+ when 'routeTableId', 'vpcId'
72
+ display_routes.reject! { |routetable| routetable[filter_attribute] != filter_value }
73
+ end
74
+ end
75
+
76
+ Excon::Response.new(
77
+ :status => 200,
78
+ :body => {
79
+ 'requestId' => Fog::AWS::Mock.request_id,
80
+ 'routeTableSet' => display_routes
81
+ }
82
+ )
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/detach_internet_gateway'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
  # Detaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC
8
8
  #
9
9
  # ==== Parameters
@@ -23,7 +23,7 @@ module Fog
23
23
  'InternetGatewayId' => internet_gateway_id,
24
24
  'VpcId' => vpc_id,
25
25
  :idempotent => true,
26
- :parser => Fog::Parsers::Compute::AWS::DetachInternetGateway.new
26
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
27
27
  )
28
28
  end
29
29
 
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/detach_network_interface'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
  # Detaches a network interface.
8
8
  #
9
9
  # ==== Parameters
@@ -22,7 +22,7 @@ module Fog
22
22
  'Action' => 'DetachNetworkInterface',
23
23
  'AttachmentId' => attachment_id,
24
24
  'Force' => force,
25
- :parser => Fog::Parsers::Compute::AWS::DetachNetworkInterface.new
25
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
26
26
  )
27
27
  end
28
28
  end
@@ -0,0 +1,57 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/basic'
7
+
8
+ # Disassociates a subnet from a route table.
9
+ #
10
+ # ==== Parameters
11
+ # * AssociationId<~String> - The association ID representing the current association between the route table and subnet.
12
+ #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'requestId'<~String> - The ID of the request.
17
+ # * 'return'<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.
18
+ #
19
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DisassociateRouteTable.html]
20
+ def disassociate_route_table(association_id)
21
+ request(
22
+ 'Action' => 'DisassociateRouteTable',
23
+ 'AssociationId' => association_id,
24
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
25
+ )
26
+ end
27
+
28
+ end
29
+
30
+ class Mock
31
+
32
+ def disassociate_route_table(association_id)
33
+ assoc_array = nil
34
+ routetable = self.data[:route_tables].find { |routetable|
35
+ assoc_array = routetable["associationSet"].find { |association|
36
+ association['routeTableAssociationId'].eql? association_id
37
+ }
38
+ }
39
+ if !assoc_array.nil? && assoc_array['main'] == false
40
+ routetable['associationSet'].delete(assoc_array)
41
+ response = Excon::Response.new
42
+ response.status = 200
43
+ response.body = {
44
+ 'requestId' => Fog::AWS::Mock.request_id,
45
+ 'return' => true
46
+ }
47
+ response
48
+ elsif assoc_array.nil?
49
+ raise Fog::Compute::AWS::NotFound.new("The association ID '#{association_id}' does not exist")
50
+ elsif assoc_array['main'] == true
51
+ raise Fog::Compute::AWS::Error, "InvalidParameterValue => cannot disassociate the main route table association #{association_id}"
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -3,7 +3,8 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/describe_network_interface_attribute'
6
+ require 'fog/aws/parsers/compute/basic'
7
+
7
8
  # Resets a network interface attribute value
8
9
  #
9
10
  # ==== Parameters
@@ -74,15 +74,29 @@ module Fog
74
74
 
75
75
  dns_name = Fog::AWS::ELB::Mock.dns_name(lb_name, @region)
76
76
 
77
+ region = availability_zones ? availability_zones.first.gsub(/[a-z]$/, '') : "us-east-1"
78
+ supported_platforms = Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:account_attributes].detect { |h| h["attributeName"] == "supported-platforms" }["values"]
79
+ security_group = if supported_platforms.include?("EC2")
80
+ Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:security_groups]['amazon-elb-sg']
81
+ else
82
+ if default_sg = Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:security_groups].values.detect { |sg| sg['groupName'] =~ /default_elb/ }
83
+ default_sg
84
+ else
85
+ default_sg_name = "default_elb_#{Fog::Mock.random_hex(6)}"
86
+ default_sg = {
87
+ 'groupDescription' => 'default elb security group',
88
+ 'groupName' => default_sg_name,
89
+ 'groupId' => Fog::AWS::Mock.security_group_id,
90
+ 'ipPermissionsEgress' => [],
91
+ 'ipPermissions' => [],
92
+ 'ownerId' => self.data[:owner_id]
93
+ }
94
+ Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:security_groups][default_sg_name] = default_sg
95
+ end
96
+ default_sg
97
+ end
98
+
77
99
 
78
- Fog::Compute::AWS::Mock.data[@region][@aws_access_key_id][:security_groups]['amazon-elb-sg'] ||= {
79
- 'groupDescription' => 'amazon-elb-sg',
80
- 'groupName' => 'amazon-elb-sg',
81
- 'groupId' => 'amazon-elb',
82
- 'ownerId' => 'amazon-elb',
83
- 'ipPermissionsEgree' => [],
84
- 'ipPermissions' => [],
85
- }
86
100
 
87
101
  self.data[:load_balancers][lb_name] = {
88
102
  'AvailabilityZones' => availability_zones,
@@ -115,7 +129,7 @@ module Fog
115
129
  'Proper' => []
116
130
  },
117
131
  'SourceSecurityGroup' => {
118
- 'GroupName' => '',
132
+ 'GroupName' => security_group['groupName'],
119
133
  'OwnerAlias' => ''
120
134
  }
121
135
  }
@@ -71,7 +71,7 @@ module Fog
71
71
  end
72
72
 
73
73
  if self.data[:server_certificates][name]
74
- raise Fog::AWS::IAM::EntityAlreadyExists.new
74
+ raise Fog::AWS::IAM::EntityAlreadyExists.new("The Server Certificate with name #{name} already exists.")
75
75
  else
76
76
  response.status = 200
77
77
  path = options['Path'] || "/"