fog-maestrodev 1.14.0.20130806165225 → 1.15.0.20130829165835

Sign up to get free protection for your applications and to get access to all the features.
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,92 @@
1
+ require 'fog/core/collection'
2
+ require 'fog/aws/models/compute/route_table'
3
+
4
+ module Fog
5
+ module Compute
6
+ class AWS
7
+
8
+ class RouteTables < Fog::Collection
9
+
10
+ attribute :filters
11
+
12
+ model Fog::Compute::AWS::RouteTable
13
+
14
+ # Creates a new route table
15
+ #
16
+ # AWS.route_tables.new
17
+ #
18
+ # ==== Returns
19
+ #
20
+ # Returns the details of the new route table
21
+ #
22
+ #>> AWS.route_tables.new
23
+ # <Fog::Compute::AWS::RouteTable
24
+ # id=nil,
25
+ # vpc_id=nil,
26
+ # routes=nil,
27
+ # associations=nil,
28
+ # tags=nil
29
+ # >
30
+ #
31
+
32
+ def initialize(attributes)
33
+ self.filters ||= {}
34
+ super
35
+ end
36
+
37
+ # Returns an array of all route tables that have been created
38
+ #
39
+ # AWS.route_tables.all
40
+ #
41
+ # ==== Returns
42
+ #
43
+ # Returns an array of all route tables
44
+ #
45
+ #>> AWS.route_tables.all
46
+ # <Fog::Compute::AWS::RouteTables
47
+ # filters={}
48
+ # [
49
+ # <Fog::Compute::AWS::RouteTable
50
+ # id="rtb-41e8552f",
51
+ # TODO
52
+ # >
53
+ # ]
54
+ # >
55
+ #
56
+
57
+ def all(filters = filters)
58
+ unless filters.is_a?(Hash)
59
+ Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('route-table-id' => []) instead [light_black](#{caller.first})[/]")
60
+ filters = {'route-table-id' => [*filters]}
61
+ end
62
+ self.filters = filters
63
+ data = service.describe_route_tables(filters).body
64
+ load(data['routeTableSet'])
65
+ end
66
+
67
+ # Used to retrieve a route table
68
+ # route_table_id is required to get the associated route table information.
69
+ #
70
+ # You can run the following command to get the details:
71
+ # AWS.route_tables.get("rtb-41e8552f")
72
+ #
73
+ # ==== Returns
74
+ #
75
+ #>> AWS.route_tables.get("rtb-41e8552f")
76
+ # <Fog::Compute::AWS::RouteTable
77
+ # id="rtb-41e8552f",
78
+ # TODO
79
+ # >
80
+ #
81
+
82
+ def get(route_table_id)
83
+ if route_table_id
84
+ self.class.new(:service => service).all('route-table-id' => route_table_id).first
85
+ end
86
+ end
87
+
88
+ end
89
+
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,21 @@
1
+ require 'fog/core/model'
2
+
3
+ module Fog
4
+ module AWS
5
+ class RDS
6
+
7
+ class InstanceOption < Fog::Model
8
+
9
+ attribute :multi_az_capable, :aliases => 'MultiAZCapable', :type => :boolean
10
+ attribute :engine, :aliases => 'Engine'
11
+ attribute :license_model, :aliases => 'LicenseModel'
12
+ attribute :read_replica_capable, :aliases => 'ReadReplicaCapable', :type => :boolean
13
+ attribute :engine_version, :aliases => 'EngineVersion'
14
+ attribute :availability_zones, :aliases => 'AvailabilityZones', :type => :array
15
+ attribute :db_instance_class, :aliases => 'DBInstanceClass'
16
+ attribute :vpc, :aliases => 'Vpc', :type => :boolean
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ require 'fog/core/collection'
2
+ require 'fog/aws/models/rds/instance_option'
3
+
4
+ module Fog
5
+ module AWS
6
+ class RDS
7
+
8
+ class InstanceOptions < Fog::PagedCollection
9
+ attribute :filters
10
+ attribute :engine
11
+ model Fog::AWS::RDS::InstanceOption
12
+
13
+ def initialize(attributes)
14
+ self.filters ||= {}
15
+ super
16
+ end
17
+
18
+ # This method deliberately returns only a single page of results
19
+ def all(filters=filters)
20
+ self.filters.merge!(filters)
21
+
22
+ result = service.describe_orderable_db_instance_options(engine, self.filters).body['DescribeOrderableDBInstanceOptionsResult']
23
+ self.filters[:marker] = result['Marker']
24
+ load(result['OrderableDBInstanceOptions'])
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+
6
+ class AssociateRouteTable < Fog::Parsers::Base
7
+
8
+ def end_element(name)
9
+ case name
10
+ when 'requestId', 'associationId'
11
+ @response[name] = value
12
+ end
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,75 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+
6
+ class CreateRouteTable < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @in_route_set = false
10
+ @in_association_set = false
11
+ @route = {}
12
+ @association = {}
13
+ @route_table = { 'routeSet' => [], 'tagSet' => {}, 'associationSet' => [] }
14
+ @response = { 'routeTable' => [] }
15
+ @tag = {}
16
+ end
17
+
18
+ def start_element(name, attrs = [])
19
+ super
20
+ case name
21
+ when 'tagSet'
22
+ @in_tag_set = true
23
+ when 'routeSet'
24
+ @in_route_set = true
25
+ when 'associationSet'
26
+ @in_association_set = true
27
+ end
28
+ end
29
+
30
+ def end_element(name)
31
+ if @in_tag_set
32
+ case name
33
+ when 'item'
34
+ @route_table['tagSet'][@tag['key']] = @tag['value']
35
+ @tag = {}
36
+ when 'tagSet'
37
+ @in_tag_set = false
38
+ end
39
+ elsif @in_route_set
40
+ case name
41
+ when 'routeSet'
42
+ @in_route_set = false
43
+ when 'destinationCidrBlock', 'gatewayId', 'state'
44
+ @route[name] = value
45
+ when 'item'
46
+ @route_table['routeSet'] << @route
47
+ @route = {}
48
+ end
49
+ elsif @in_association_set
50
+ case name
51
+ when 'routeTableAssociationId', 'routeTableId', 'main'
52
+ @association[name] = value
53
+ when 'associationSet'
54
+ @route_table['associationSet'] << @association
55
+ @in_association_set = false
56
+ end
57
+ else
58
+ case name
59
+ when 'routeTableId', 'vpcId'
60
+ @route_table[name] = value
61
+ when 'routeTable'
62
+ @response['routeTable'] << @route_table
63
+ @route_table = { 'routeSet' => {}, 'tagSet' => {}, 'associationSet' => {} }
64
+ when 'requestId'
65
+ @response[name] = value
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+
@@ -0,0 +1,42 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+
6
+ class DescribeAccountAttributes < Fog::Parsers::Base
7
+ def reset
8
+ @attribute = { 'values' => []}
9
+ @account_attributes = []
10
+ @response = { 'accountAttributeSet' => [] }
11
+ end
12
+
13
+ def start_element(name, attrs = [])
14
+ super
15
+ case name
16
+ when 'attributeValueSet'
17
+ @in_attribute_value_set = true
18
+ end
19
+ end
20
+
21
+ def end_element(name)
22
+ case name
23
+ when 'attributeName'
24
+ @attribute[name] = value
25
+ when 'attributeValue'
26
+ @attribute['values'] << value
27
+ when['requestId']
28
+ @response[name] = value
29
+ when 'item'
30
+ @response['accountAttributeSet'] << @attribute
31
+ @attribute = { 'values' => []} unless @in_attribute_value_set
32
+ when 'attributeValueSet'
33
+ @in_attribute_value_set = false
34
+ else
35
+ end
36
+ @response['accountAttributeSet'].uniq!
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,85 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+
6
+ class DescribeRouteTables < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @association = { 'routeTableAssociationId' => nil, 'routeTableId' => nil, 'subnetId' => nil, 'main' => false }
10
+ @in_association_set = false
11
+ @in_route_set = false
12
+ @route = { 'destinationCidrBlock' => nil, 'gatewayId' => nil, 'instanceId' => nil, 'instanceOwnerId' => nil, 'networkInterfaceId' => nil, 'state' => nil, 'origin' => nil }
13
+ @response = { 'routeTableSet' => [] }
14
+ @tag = {}
15
+ @route_table = { 'associationSet' => [], 'tagSet' => {}, 'routeSet' => [] }
16
+ end
17
+
18
+ def start_element(name, attrs = [])
19
+ super
20
+ case name
21
+ when 'associationSet'
22
+ @in_association_set = true
23
+ when 'tagSet'
24
+ @in_tag_set = true
25
+ when 'routeSet'
26
+ @in_route_set = true
27
+ end
28
+ end
29
+
30
+ def end_element(name)
31
+ if @in_association_set
32
+ case name
33
+ when 'associationSet'
34
+ @in_association_set = false
35
+ when 'routeTableAssociationId', 'routeTableId', 'subnetId'
36
+ @association[name] = value
37
+ when 'main'
38
+ if value == 'true'
39
+ @association[name] = true
40
+ else
41
+ @association[name] = false
42
+ end
43
+ when 'item'
44
+ @route_table['associationSet'] << @association
45
+ @association = { 'routeTableAssociationId' => nil, 'routeTableId' => nil, 'subnetId' => nil, 'main' => false }
46
+ end
47
+ elsif @in_tag_set
48
+ case name
49
+ when 'key', 'value'
50
+ @tag[name] = value
51
+ when 'item'
52
+ @route_table['tagSet'][@tag['key']] = @tag['value']
53
+ @tag = {}
54
+ when 'tagSet'
55
+ @in_tag_set = false
56
+ end
57
+ elsif @in_route_set
58
+ case name
59
+ when 'destinationCidrBlock', 'gatewayId', 'instanceId', 'instanceOwnerId', 'networkInterfaceId', 'state', 'origin'
60
+ @route[name] = value
61
+ when 'item'
62
+ @route_table['routeSet'] << @route
63
+ @route = { 'destinationCidrBlock' => nil, 'gatewayId' => nil, 'instanceId' => nil, 'instanceOwnerId' => nil, 'networkInterfaceId' => nil, 'state' => nil, 'origin' => nil }
64
+ when 'routeSet'
65
+ @in_route_set = false
66
+ end
67
+ else
68
+ case name
69
+ when 'routeTableId', 'vpcId'
70
+ @route_table[name] = value
71
+ when 'item'
72
+ @response['routeTableSet'] << @route_table
73
+ @route_table = { 'associationSet' => [], 'tagSet' => {}, 'routeSet' => [] }
74
+ when 'requestId'
75
+ @response[name] = value
76
+ end
77
+ end
78
+ end
79
+
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,47 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module RDS
5
+
6
+ class DescribeOrderableDBInstanceOptions < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'DescribeOrderableDBInstanceOptionsResult' => {'OrderableDBInstanceOptions' => []}, 'ResponseMetadata' => {} }
10
+ @db_instance_option = {}
11
+ @db_instance_options = []
12
+ end
13
+
14
+ def start_element(name, attrs = [])
15
+ case name
16
+ when 'AvailabilityZones' then @availability_zones = []
17
+ when 'AvailabilityZone' then @availability_zone = {}
18
+ end
19
+ super
20
+ end
21
+
22
+ def end_element(name)
23
+ case name
24
+ when 'MultiAZCapable', 'ReadReplicaCapable', 'Vpc' then @db_instance_option[name] = to_boolean(value)
25
+ when 'Engine', 'LicenseModel', 'EngineVersion', 'DBInstanceClass' then @db_instance_option[name] = value
26
+ when 'AvailabilityZones' then @db_instance_option[name] = @availability_zones
27
+ when 'AvailabilityZone' then @availability_zones << @availability_zone unless @availability_zone.empty?
28
+ when 'Name' then @availability_zone[name] = value
29
+ when 'ProvisionedIopsCapable' then @availability_zone[name] = to_boolean(value)
30
+ when 'OrderableDBInstanceOption'
31
+ @db_instance_options << @db_instance_option
32
+ @db_instance_option = {}
33
+ when 'OrderableDBInstanceOptions'
34
+ @response['DescribeOrderableDBInstanceOptionsResult']['OrderableDBInstanceOptions'] = @db_instance_options
35
+ when 'Marker' then @response['DescribeOrderableDBInstanceOptionsResult'][name] = value
36
+ when 'RequestId' then @response['ResponseMetadata'][name] = value
37
+ end
38
+ end
39
+
40
+ def to_boolean(v)
41
+ (v =~ /\A\s*(true|yes|1|y)\s*$/i) == 0
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
data/lib/fog/aws/rds.rb CHANGED
@@ -51,6 +51,8 @@ module Fog
51
51
  request :describe_db_subnet_groups
52
52
  # TODO: :delete_db_subnet_group, :modify_db_subnet_group
53
53
 
54
+ request :describe_orderable_db_instance_options
55
+
54
56
  request :describe_db_log_files
55
57
  request :download_db_logfile_portion
56
58
 
@@ -73,6 +75,9 @@ module Fog
73
75
  model :subnet_group
74
76
  collection :subnet_groups
75
77
 
78
+ model :instance_option
79
+ collection :instance_options
80
+
76
81
  model :log_file
77
82
  collection :log_files
78
83
 
@@ -111,7 +111,15 @@ module Fog
111
111
 
112
112
  def describe_auto_scaling_groups(options = {})
113
113
  results = { 'AutoScalingGroups' => [] }
114
- self.data[:auto_scaling_groups].each do |asg_name, asg_data|
114
+ asg_set = self.data[:auto_scaling_groups]
115
+
116
+ if !options["AutoScalingGroupNames"].nil?
117
+ asg_set = asg_set.reject do |asg_name, asg_data|
118
+ ![*options["AutoScalingGroupNames"]].include?(asg_name)
119
+ end
120
+ end
121
+
122
+ asg_set.each do |asg_name, asg_data|
115
123
  results['AutoScalingGroups'] << {
116
124
  'AutoScalingGroupName' => asg_name
117
125
  }.merge!(asg_data)
@@ -76,7 +76,21 @@ module Fog
76
76
 
77
77
  def describe_policies(options = {})
78
78
  results = { 'ScalingPolicies' => [] }
79
- self.data[:scaling_policies].each do |asp_name, asp_data|
79
+ policy_set = self.data[:scaling_policies]
80
+
81
+ for opt_key, opt_value in options
82
+ if opt_key == "PolicyNames" && opt_value != nil && opt_value != ""
83
+ policy_set = policy_set.reject do |asp_name, asp_data|
84
+ ![*options["PolicyNames"]].include?(asp_name)
85
+ end
86
+ elsif opt_key == "AutoScalingGroupName" && opt_value != nil && opt_value != ""
87
+ policy_set = policy_set.reject do |asp_name, asp_data|
88
+ options["AutoScalingGroupName"] != asp_data["AutoScalingGroupName"]
89
+ end
90
+ end
91
+ end
92
+
93
+ policy_set.each do |asp_name, asp_data|
80
94
  results['ScalingPolicies'] << {
81
95
  'PolicyName' => asp_name
82
96
  }.merge!(asp_data)
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/associate_dhcp_options'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
  #
8
8
  #
9
9
  # ==== Parameters
@@ -24,7 +24,7 @@ module Fog
24
24
  'DhcpOptionsId' => dhcp_options_id,
25
25
  'VpcId' => vpc_id,
26
26
  :idempotent => true,
27
- :parser => Fog::Parsers::Compute::AWS::AttachInternetGateway.new
27
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
28
28
  )
29
29
  end
30
30
 
@@ -0,0 +1,75 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/associate_route_table'
7
+ # Associates a subnet with a route table.
8
+ #
9
+ # ==== Parameters
10
+ # * RouteTableId<~String> - The ID of the route table
11
+ # * SubnetId<~String> - The ID of the subnet
12
+ #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'requestId'<~String> - The ID of the request
17
+ # * 'associationId'<~String> - The route table association ID (needed to disassociate the route table)
18
+ #
19
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-AssociateRouteTable.html]
20
+ def associate_route_table(routeTableId, subnetId)
21
+ request(
22
+ 'Action' => 'AssociateRouteTable',
23
+ 'RouteTableId' => routeTableId,
24
+ 'SubnetId' => subnetId,
25
+ :parser => Fog::Parsers::Compute::AWS::AssociateRouteTable.new
26
+ )
27
+ end
28
+
29
+ end
30
+
31
+ class Mock
32
+
33
+ def associate_route_table(routeTableId, subnetId)
34
+ routetable = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? routeTableId }
35
+ subnet = self.data[:subnets].find { |subnet| subnet["subnetId"].eql? subnetId }
36
+
37
+ if !routetable.nil? && !subnet.nil?
38
+ response = Excon::Response.new
39
+ response.status = 200
40
+ association = add_route_association(routeTableId, subnetId)
41
+ routetable["associationSet"].push(association)
42
+ response.body = {
43
+ 'requestId' => Fog::AWS::Mock.request_id,
44
+ 'associationId' => association['routeTableAssociationId']
45
+ }
46
+ response
47
+ elsif routetable.nil?
48
+ raise Fog::Compute::AWS::NotFound.new("The routeTable ID '#{routeTableId}' does not exist")
49
+ else
50
+ raise Fog::Compute::AWS::NotFound.new("The subnet ID '#{subnetId}' does not exist")
51
+ end
52
+
53
+ end
54
+
55
+ private
56
+
57
+ def add_route_association(routeTableId, subnetId, main=nil)
58
+ response = {
59
+ "routeTableAssociationId" => "rtbassoc-#{Fog::Mock.random_hex(8)}",
60
+ "routeTableId" => routeTableId,
61
+ "subnetId" => nil,
62
+ "main" => false
63
+ }
64
+ if main
65
+ response['main'] = true
66
+ else
67
+ response['subnetId'] = subnetId
68
+ end
69
+ response
70
+ end
71
+
72
+ end
73
+ end
74
+ end
75
+ end
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/attach_internet_gateway'
6
+ require 'fog/aws/parsers/compute/basic'
7
7
  # Attaches 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::AttachInternetGateway.new
26
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
27
27
  )
28
28
  end
29
29
 
@@ -0,0 +1,89 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/basic'
7
+
8
+ # Creates a route in a route table within a VPC.
9
+ #
10
+ # ==== Parameters
11
+ # * RouteTableId<~String> - The ID of the route table for the route.
12
+ # * DestinationCidrBlock<~String> - The CIDR address block used for the destination match. Routing decisions are based on the most specific match.
13
+ # * GatewayId<~String> - The ID of an Internet gateway attached to your VPC.
14
+ # * InstanceId<~String> - he ID of a NAT instance in your VPC. The operation fails if you specify an instance ID unless exactly one network interface is attached.
15
+ # * NetworkInterfaceId<~String> - The ID of a network interface.
16
+ #
17
+ # === Returns
18
+ # * response<~Excon::Response>:
19
+ # * body<~Hash>:
20
+ # * 'requestId'<~String> - Id of the request
21
+ # * 'return'<~Boolean> - Returns true if the request succeeds. Otherwise, returns an error.
22
+ #
23
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateRoute.html]
24
+ def create_route(route_table_id, destination_cidr_block, internet_gateway_id=nil, instance_id=nil, network_interface_id=nil)
25
+ request_vars = {
26
+ 'Action' => 'CreateRoute',
27
+ 'RouteTableId' => route_table_id,
28
+ 'DestinationCidrBlock' => destination_cidr_block,
29
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
30
+ }
31
+ if internet_gateway_id
32
+ request_vars['GatewayId'] = internet_gateway_id
33
+ elsif instance_id
34
+ request_vars['InstanceId'] = instance_id
35
+ elsif network_interface_id
36
+ request_vars['NetworkInterfaceId'] = network_interface_id
37
+ end
38
+ request(request_vars)
39
+ end
40
+ end
41
+
42
+ class Mock
43
+
44
+ def create_route(route_table_id, destination_cidr_block, internet_gateway_id=nil, instance_id=nil, network_interface_id=nil)
45
+ instance_owner_id = nil
46
+ route_table = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? route_table_id }
47
+ if !route_table.nil? && destination_cidr_block
48
+ if !internet_gateway_id.nil? || !instance_id.nil? || !network_interface_id.nil?
49
+ if !internet_gateway_id.nil? && self.internet_gateways.all('internet-gateway-id'=>internet_gateway_id).first.nil?
50
+ raise Fog::Compute::AWS::NotFound.new("The gateway ID '#{internet_gateway_id}' does not exist")
51
+ elsif !instance_id.nil? && self.servers.all('instance-id'=>instance_id).first.nil?
52
+ raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist")
53
+ elsif !network_interface_id.nil? && self.network_interfaces.all('networkInterfaceId'=>network_interface_id).first.nil?
54
+ raise Fog::Compute::AWS::NotFound.new("The networkInterface ID '#{network_interface_id}' does not exist")
55
+ elsif !route_table['routeSet'].find { |route| route['destinationCidrBlock'].eql? destination_cidr_block }.nil?
56
+ raise Fog::Compute::AWS::Error, "RouteAlreadyExists => The route identified by #{destination_cidr_block} already exists."
57
+ else
58
+ response = Excon::Response.new
59
+ route_table['routeSet'].push({
60
+ "destinationCidrBlock" => destination_cidr_block,
61
+ "gatewayId" => internet_gateway_id,
62
+ "instanceId"=>instance_id,
63
+ "instanceOwnerId"=>instance_owner_id,
64
+ "networkInterfaceId"=>network_interface_id,
65
+ "state" => "pending",
66
+ "origin" => "CreateRoute"
67
+ })
68
+ response.status = 200
69
+ response.body = {
70
+ 'requestId'=> Fog::AWS::Mock.request_id,
71
+ 'return' => true
72
+ }
73
+ response
74
+ end
75
+ else
76
+ message = 'MissingParameter => '
77
+ message << 'The request must contain either a gateway id, a network interface id, or an instance id'
78
+ raise Fog::Compute::AWS::Error.new(message)
79
+ end
80
+ elsif route_table.nil?
81
+ raise Fog::Compute::AWS::NotFound.new("The routeTable ID '#{route_table_id}' does not exist")
82
+ elsif destination_cidr_block.empty?
83
+ raise Fog::Compute::AWS::InvalidParameterValue.new("Value () for parameter destinationCidrBlock is invalid. This is not a valid CIDR block.")
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end