fog 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (282) hide show
  1. data/.gitignore +1 -0
  2. data/README.md +1 -0
  3. data/Rakefile +2 -1
  4. data/changelog.txt +184 -0
  5. data/docs/cdn/index.markdown +69 -3
  6. data/fog.gemspec +2 -2
  7. data/lib/fog.rb +2 -1
  8. data/lib/fog/atmos/models/storage/file.rb +16 -14
  9. data/lib/fog/aws/auto_scaling.rb +55 -13
  10. data/lib/fog/aws/cdn.rb +69 -9
  11. data/lib/fog/aws/cloud_watch.rb +15 -1
  12. data/lib/fog/aws/compute.rb +2 -0
  13. data/lib/fog/aws/models/auto_scaling/group.rb +10 -4
  14. data/lib/fog/aws/models/cdn/distribution.rb +93 -0
  15. data/lib/fog/aws/models/cdn/distribution_helper.rb +64 -0
  16. data/lib/fog/aws/models/cdn/distributions.rb +32 -0
  17. data/lib/fog/aws/models/cdn/distributions_helper.rb +47 -0
  18. data/lib/fog/aws/models/cdn/invalidation.rb +64 -0
  19. data/lib/fog/aws/models/cdn/invalidations.rb +54 -0
  20. data/lib/fog/aws/models/cdn/streaming_distribution.rb +77 -0
  21. data/lib/fog/aws/models/cdn/streaming_distributions.rb +32 -0
  22. data/lib/fog/aws/models/compute/server.rb +0 -23
  23. data/lib/fog/aws/models/compute/spot_request.rb +2 -24
  24. data/lib/fog/aws/models/rds/server.rb +18 -0
  25. data/lib/fog/aws/models/rds/subnet_group.rb +20 -0
  26. data/lib/fog/aws/models/rds/subnet_groups.rb +27 -0
  27. data/lib/fog/aws/models/storage/file.rb +1 -1
  28. data/lib/fog/aws/parsers/auto_scaling/describe_adjustment_types.rb +15 -2
  29. data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb +39 -13
  30. data/lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_notification_types.rb +43 -0
  31. data/lib/fog/aws/parsers/auto_scaling/describe_metric_collection_types.rb +3 -3
  32. data/lib/fog/aws/parsers/auto_scaling/describe_notification_configurations.rb +42 -0
  33. data/lib/fog/aws/parsers/auto_scaling/describe_scaling_process_types.rb +15 -2
  34. data/lib/fog/aws/parsers/auto_scaling/describe_tags.rb +46 -0
  35. data/lib/fog/aws/parsers/auto_scaling/describe_termination_policy_types.rb +44 -0
  36. data/lib/fog/aws/parsers/cdn/get_invalidation.rb +32 -0
  37. data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +1 -1
  38. data/lib/fog/aws/parsers/cloud_watch/list_metrics.rb +1 -1
  39. data/lib/fog/aws/parsers/compute/describe_availability_zones.rb +13 -2
  40. data/lib/fog/aws/parsers/compute/describe_reserved_instances.rb +1 -1
  41. data/lib/fog/aws/parsers/elasticache/base.rb +0 -2
  42. data/lib/fog/aws/parsers/elasticache/engine_defaults_parser.rb +1 -1
  43. data/lib/fog/aws/parsers/elasticache/event_list.rb +2 -0
  44. data/lib/fog/aws/parsers/rds/base.rb +32 -0
  45. data/lib/fog/aws/parsers/rds/create_db_subnet_group.rb +38 -0
  46. data/lib/fog/aws/parsers/rds/describe_db_subnet_groups.rb +38 -0
  47. data/lib/fog/aws/parsers/rds/event_list.rb +40 -0
  48. data/lib/fog/aws/parsers/rds/subnet_group_parser.rb +38 -0
  49. data/lib/fog/aws/parsers/rds/tag_list_parser.rb +35 -0
  50. data/lib/fog/aws/rds.rb +24 -7
  51. data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +36 -16
  52. data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +19 -12
  53. data/lib/fog/aws/requests/auto_scaling/create_or_update_tags.rb +63 -0
  54. data/lib/fog/aws/requests/auto_scaling/delete_auto_scaling_group.rb +10 -3
  55. data/lib/fog/aws/requests/auto_scaling/delete_notification_configuration.rb +21 -5
  56. data/lib/fog/aws/requests/auto_scaling/delete_policy.rb +2 -2
  57. data/lib/fog/aws/requests/auto_scaling/delete_tags.rb +63 -0
  58. data/lib/fog/aws/requests/auto_scaling/describe_adjustment_types.rb +4 -3
  59. data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_groups.rb +17 -13
  60. data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_instances.rb +1 -1
  61. data/lib/fog/aws/requests/auto_scaling/describe_auto_scaling_notification_types.rb +55 -0
  62. data/lib/fog/aws/requests/auto_scaling/describe_metric_collection_types.rb +6 -5
  63. data/lib/fog/aws/requests/auto_scaling/describe_notification_configurations.rb +79 -0
  64. data/lib/fog/aws/requests/auto_scaling/describe_policies.rb +1 -1
  65. data/lib/fog/aws/requests/auto_scaling/describe_scaling_process_types.rb +4 -3
  66. data/lib/fog/aws/requests/auto_scaling/describe_tags.rb +74 -0
  67. data/lib/fog/aws/requests/auto_scaling/describe_termination_policy_types.rb +53 -0
  68. data/lib/fog/aws/requests/auto_scaling/disable_metrics_collection.rb +1 -1
  69. data/lib/fog/aws/requests/auto_scaling/enable_metrics_collection.rb +2 -2
  70. data/lib/fog/aws/requests/auto_scaling/put_notification_configuration.rb +30 -11
  71. data/lib/fog/aws/requests/auto_scaling/put_scaling_policy.rb +4 -4
  72. data/lib/fog/aws/requests/auto_scaling/put_scheduled_update_group_action.rb +8 -5
  73. data/lib/fog/aws/requests/auto_scaling/set_desired_capacity.rb +2 -2
  74. data/lib/fog/aws/requests/auto_scaling/set_instance_health.rb +2 -2
  75. data/lib/fog/aws/requests/auto_scaling/suspend_processes.rb +1 -1
  76. data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +30 -18
  77. data/lib/fog/aws/requests/cdn/delete_distribution.rb +31 -0
  78. data/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +30 -0
  79. data/lib/fog/aws/requests/cdn/get_distribution.rb +28 -0
  80. data/lib/fog/aws/requests/cdn/get_distribution_list.rb +29 -0
  81. data/lib/fog/aws/requests/cdn/get_invalidation.rb +60 -0
  82. data/lib/fog/aws/requests/cdn/get_invalidation_list.rb +41 -0
  83. data/lib/fog/aws/requests/cdn/get_streaming_distribution.rb +26 -0
  84. data/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb +30 -0
  85. data/lib/fog/aws/requests/cdn/post_distribution.rb +44 -0
  86. data/lib/fog/aws/requests/cdn/post_invalidation.rb +33 -0
  87. data/lib/fog/aws/requests/cdn/post_streaming_distribution.rb +44 -0
  88. data/lib/fog/aws/requests/cdn/put_distribution_config.rb +28 -0
  89. data/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb +28 -0
  90. data/lib/fog/aws/requests/compute/create_image.rb +32 -5
  91. data/lib/fog/aws/requests/compute/create_subnet.rb +3 -3
  92. data/lib/fog/aws/requests/compute/create_volume.rb +2 -2
  93. data/lib/fog/aws/requests/compute/register_image.rb +1 -1
  94. data/lib/fog/aws/requests/elasticache/describe_events.rb +7 -4
  95. data/lib/fog/aws/requests/glacier/create_archive.rb +1 -1
  96. data/lib/fog/aws/requests/glacier/initiate_multipart_upload.rb +1 -1
  97. data/lib/fog/aws/requests/rds/add_tags_to_resource.rb +46 -0
  98. data/lib/fog/aws/requests/rds/create_db_instance.rb +2 -0
  99. data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +58 -0
  100. data/lib/fog/aws/requests/rds/describe_db_subnet_groups.rb +63 -0
  101. data/lib/fog/aws/requests/rds/describe_events.rb +52 -0
  102. data/lib/fog/aws/requests/rds/list_tags_for_resource.rb +44 -0
  103. data/lib/fog/aws/requests/rds/remove_tags_from_resource.rb +44 -0
  104. data/lib/fog/aws/sqs.rb +1 -1
  105. data/lib/fog/aws/storage.rb +1 -1
  106. data/lib/fog/bin/openstack.rb +5 -0
  107. data/lib/fog/bluebox/models/compute/server.rb +0 -19
  108. data/lib/fog/bluebox/requests/compute/create_block.rb +8 -8
  109. data/lib/fog/brightbox/compute.rb +56 -7
  110. data/lib/fog/brightbox/models/compute/accounts.rb +29 -0
  111. data/lib/fog/brightbox/models/compute/api_client.rb +37 -0
  112. data/lib/fog/brightbox/models/compute/api_clients.rb +24 -0
  113. data/lib/fog/brightbox/models/compute/application.rb +27 -0
  114. data/lib/fog/brightbox/models/compute/applications.rb +28 -0
  115. data/lib/fog/brightbox/models/compute/server.rb +3 -1
  116. data/lib/fog/brightbox/models/compute/users.rb +1 -3
  117. data/lib/fog/brightbox/requests/compute/create_application.rb +13 -0
  118. data/lib/fog/brightbox/requests/compute/create_cloud_ip.rb +2 -2
  119. data/lib/fog/brightbox/requests/compute/destroy_application.rb +14 -0
  120. data/lib/fog/brightbox/requests/compute/get_account.rb +28 -4
  121. data/lib/fog/brightbox/requests/compute/get_application.rb +14 -0
  122. data/lib/fog/brightbox/requests/compute/get_authenticated_user.rb +19 -0
  123. data/lib/fog/brightbox/requests/compute/get_scoped_account.rb +19 -0
  124. data/lib/fog/brightbox/requests/compute/get_user.rb +28 -5
  125. data/lib/fog/brightbox/requests/compute/list_accounts.rb +13 -0
  126. data/lib/fog/brightbox/requests/compute/list_applications.rb +13 -0
  127. data/lib/fog/brightbox/requests/compute/reset_secret_application.rb +14 -0
  128. data/lib/fog/brightbox/requests/compute/update_account.rb +51 -3
  129. data/lib/fog/brightbox/requests/compute/update_application.rb +15 -0
  130. data/lib/fog/brightbox/requests/compute/update_firewall_rule.rb +4 -2
  131. data/lib/fog/brightbox/requests/compute/update_scoped_account.rb +37 -0
  132. data/lib/fog/clodo/models/compute/server.rb +7 -44
  133. data/lib/fog/compute/models/server.rb +23 -2
  134. data/lib/fog/core/time.rb +2 -0
  135. data/lib/fog/core/wait_for.rb +0 -2
  136. data/lib/fog/ecloud/models/compute/servers.rb +3 -1
  137. data/lib/fog/ecloud/requests/compute/get_servers.rb +1 -1
  138. data/lib/fog/ecloud/requests/compute/get_tasks.rb +1 -1
  139. data/lib/fog/go_grid/models/compute/server.rb +0 -4
  140. data/lib/fog/google/storage.rb +1 -1
  141. data/lib/fog/hp/models/compute/server.rb +1 -23
  142. data/lib/fog/hp/storage.rb +0 -1
  143. data/lib/fog/joyent/models/compute/server.rb +4 -0
  144. data/lib/fog/joyent/models/compute/servers.rb +4 -3
  145. data/lib/fog/libvirt/models/compute/server.rb +1 -27
  146. data/lib/fog/linode/models/compute/server.rb +0 -1
  147. data/lib/fog/local/models/storage/directory.rb +1 -1
  148. data/lib/fog/network.rb +26 -0
  149. data/lib/fog/ninefold/compute.rb +8 -0
  150. data/lib/fog/ninefold/requests/compute/assign_to_load_balancer_rule.rb +13 -0
  151. data/lib/fog/ninefold/requests/compute/create_load_balancer_rule.rb +11 -0
  152. data/lib/fog/ninefold/requests/compute/delete_load_balancer_rule.rb +11 -0
  153. data/lib/fog/ninefold/requests/compute/list_load_balancer_rule_instances.rb +15 -0
  154. data/lib/fog/ninefold/requests/compute/list_load_balancer_rules.rb +14 -0
  155. data/lib/fog/ninefold/requests/compute/remove_from_load_balancer_rule.rb +12 -0
  156. data/lib/fog/ninefold/requests/compute/update_load_balancer_rule.rb +15 -0
  157. data/lib/fog/ninefold/storage.rb +14 -112
  158. data/lib/fog/openstack.rb +4 -1
  159. data/lib/fog/openstack/compute.rb +20 -1
  160. data/lib/fog/openstack/identity.rb +67 -18
  161. data/lib/fog/openstack/image.rb +12 -4
  162. data/lib/fog/openstack/models/compute/security_group.rb +1 -1
  163. data/lib/fog/openstack/models/compute/server.rb +5 -23
  164. data/lib/fog/openstack/models/identity/tenants.rb +5 -3
  165. data/lib/fog/openstack/models/identity/users.rb +4 -1
  166. data/lib/fog/openstack/models/image/image.rb +6 -1
  167. data/lib/fog/openstack/models/network/network.rb +46 -0
  168. data/lib/fog/openstack/models/network/networks.rb +34 -0
  169. data/lib/fog/openstack/models/network/port.rb +52 -0
  170. data/lib/fog/openstack/models/network/ports.rb +34 -0
  171. data/lib/fog/openstack/models/network/subnet.rb +55 -0
  172. data/lib/fog/openstack/models/network/subnets.rb +34 -0
  173. data/lib/fog/openstack/network.rb +234 -0
  174. data/lib/fog/openstack/requests/compute/attach_volume.rb +10 -0
  175. data/lib/fog/openstack/requests/compute/create_security_group.rb +15 -11
  176. data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +17 -15
  177. data/lib/fog/openstack/requests/compute/create_server.rb +7 -1
  178. data/lib/fog/openstack/requests/compute/create_volume.rb +10 -10
  179. data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +16 -1
  180. data/lib/fog/openstack/requests/compute/detach_volume.rb +5 -0
  181. data/lib/fog/openstack/requests/compute/get_snapshot_details.rb +4 -4
  182. data/lib/fog/openstack/requests/compute/get_volume_details.rb +9 -9
  183. data/lib/fog/openstack/requests/compute/list_security_groups.rb +3 -3
  184. data/lib/fog/openstack/requests/compute/list_volumes.rb +14 -14
  185. data/lib/fog/openstack/requests/identity/create_tenant.rb +3 -3
  186. data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
  187. data/lib/fog/openstack/requests/identity/delete_role.rb +1 -1
  188. data/lib/fog/openstack/requests/identity/get_tenant.rb +1 -1
  189. data/lib/fog/openstack/requests/identity/list_roles.rb +7 -0
  190. data/lib/fog/openstack/requests/image/create_image.rb +36 -38
  191. data/lib/fog/openstack/requests/image/delete_image.rb +0 -2
  192. data/lib/fog/openstack/requests/image/list_public_images.rb +7 -25
  193. data/lib/fog/openstack/requests/image/list_public_images_detailed.rb +2 -41
  194. data/lib/fog/openstack/requests/image/update_image.rb +26 -21
  195. data/lib/fog/openstack/requests/image/update_image_members.rb +37 -0
  196. data/lib/fog/openstack/requests/network/create_network.rb +44 -0
  197. data/lib/fog/openstack/requests/network/create_port.rb +52 -0
  198. data/lib/fog/openstack/requests/network/create_subnet.rb +56 -0
  199. data/lib/fog/openstack/requests/network/delete_network.rb +30 -0
  200. data/lib/fog/openstack/requests/network/delete_port.rb +30 -0
  201. data/lib/fog/openstack/requests/network/delete_subnet.rb +30 -0
  202. data/lib/fog/openstack/requests/network/get_network.rb +42 -0
  203. data/lib/fog/openstack/requests/network/get_port.rb +48 -0
  204. data/lib/fog/openstack/requests/network/get_subnet.rb +49 -0
  205. data/lib/fog/openstack/requests/network/list_networks.rb +27 -0
  206. data/lib/fog/openstack/requests/network/list_ports.rb +27 -0
  207. data/lib/fog/openstack/requests/network/list_subnets.rb +27 -0
  208. data/lib/fog/openstack/requests/network/set_tenant.rb +21 -0
  209. data/lib/fog/openstack/requests/network/update_network.rb +41 -0
  210. data/lib/fog/openstack/requests/network/update_port.rb +44 -0
  211. data/lib/fog/openstack/requests/network/update_subnet.rb +44 -0
  212. data/lib/fog/openstack/requests/volume/create_volume.rb +10 -10
  213. data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +16 -1
  214. data/lib/fog/openstack/requests/volume/get_snapshot_details.rb +6 -6
  215. data/lib/fog/openstack/requests/volume/get_volume_details.rb +10 -10
  216. data/lib/fog/openstack/requests/volume/list_volumes.rb +14 -14
  217. data/lib/fog/openstack/volume.rb +10 -0
  218. data/lib/fog/rackspace/models/compute/server.rb +1 -24
  219. data/lib/fog/rackspace/models/compute_v2/server.rb +4 -2
  220. data/lib/fog/rackspace/requests/compute_v2/create_server.rb +1 -1
  221. data/lib/fog/rackspace/requests/compute_v2/list_servers.rb +1 -1
  222. data/lib/fog/storm_on_demand/models/compute/server.rb +1 -5
  223. data/lib/fog/virtual_box/models/compute/server.rb +2 -44
  224. data/lib/fog/vmfusion/models/compute/server.rb +3 -36
  225. data/lib/fog/vsphere/models/compute/server.rb +1 -1
  226. data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +2 -31
  227. data/lib/fog/vsphere/requests/compute/vm_clone.rb +35 -7
  228. data/tests/aws/models/cdn/distribution_tests.rb +15 -0
  229. data/tests/aws/models/cdn/distributions_tests.rb +15 -0
  230. data/tests/aws/models/cdn/invalidation_tests.rb +32 -0
  231. data/tests/aws/models/cdn/invalidations_tests.rb +15 -0
  232. data/tests/aws/models/cdn/streaming_distribution_tests.rb +15 -0
  233. data/tests/aws/models/cdn/streaming_distributions_tests.rb +15 -0
  234. data/tests/aws/models/rds/tagging_tests.rb +20 -0
  235. data/tests/aws/requests/auto_scaling/auto_scaling_tests.rb +1 -11
  236. data/tests/aws/requests/auto_scaling/describe_types_tests.rb +102 -0
  237. data/tests/aws/requests/auto_scaling/helper.rb +47 -3
  238. data/tests/aws/requests/auto_scaling/notification_configuration_tests.rb +123 -0
  239. data/tests/aws/requests/auto_scaling/tag_tests.rb +62 -0
  240. data/tests/aws/requests/cdn/cdn_tests.rb +252 -0
  241. data/tests/aws/requests/compute/image_tests.rb +32 -1
  242. data/tests/aws/requests/compute/volume_tests.rb +3 -3
  243. data/tests/aws/requests/rds/describe_events.rb +16 -0
  244. data/tests/aws/requests/rds/helper.rb +26 -0
  245. data/tests/aws/requests/rds/subnet_groups_test.rb +48 -0
  246. data/tests/aws/requests/rds/tagging_tests.rb +78 -0
  247. data/tests/brightbox/requests/compute/account_tests.rb +24 -4
  248. data/tests/brightbox/requests/compute/application_test.rb +63 -0
  249. data/tests/brightbox/requests/compute/helper.rb +49 -1
  250. data/tests/helper.rb +4 -1
  251. data/tests/local/models/directory_tests.rb +16 -0
  252. data/tests/ninefold/requests/compute/helper.rb +53 -0
  253. data/tests/ninefold/requests/compute/load_balancer_tests.rb +66 -0
  254. data/tests/openstack/models/image/image_tests.rb +1 -0
  255. data/tests/openstack/models/network/network_tests.rb +24 -0
  256. data/tests/openstack/models/network/networks_tests.rb +21 -0
  257. data/tests/openstack/models/network/port_tests.rb +28 -0
  258. data/tests/openstack/models/network/ports_tests.rb +25 -0
  259. data/tests/openstack/models/network/subnet_tests.rb +30 -0
  260. data/tests/openstack/models/network/subnets_tests.rb +27 -0
  261. data/tests/openstack/requests/compute/image_tests.rb +3 -4
  262. data/tests/openstack/requests/compute/quota_tests.rb +2 -0
  263. data/tests/openstack/requests/compute/security_group_tests.rb +10 -10
  264. data/tests/openstack/requests/compute/server_tests.rb +3 -1
  265. data/tests/openstack/requests/compute/volume_tests.rb +11 -12
  266. data/tests/openstack/requests/identity/tenant_tests.rb +2 -1
  267. data/tests/openstack/requests/image/image_tests.rb +66 -45
  268. data/tests/openstack/requests/network/network_tests.rb +56 -0
  269. data/tests/openstack/requests/network/port_tests.rb +63 -0
  270. data/tests/openstack/requests/network/subnet_tests.rb +66 -0
  271. data/tests/rackspace/models/identity/user_tests.rb +1 -1
  272. data/tests/rackspace/models/identity/users_tests.rb +1 -1
  273. metadata +137 -13
  274. data/lib/fog/ninefold/models/storage/directories.rb +0 -48
  275. data/lib/fog/ninefold/models/storage/directory.rb +0 -53
  276. data/lib/fog/ninefold/models/storage/file.rb +0 -108
  277. data/lib/fog/ninefold/models/storage/files.rb +0 -73
  278. data/lib/fog/ninefold/requests/storage/delete_namespace.rb +0 -19
  279. data/lib/fog/ninefold/requests/storage/get_namespace.rb +0 -20
  280. data/lib/fog/ninefold/requests/storage/head_namespace.rb +0 -20
  281. data/lib/fog/ninefold/requests/storage/post_namespace.rb +0 -20
  282. data/lib/fog/ninefold/requests/storage/put_namespace.rb +0 -20
@@ -0,0 +1,53 @@
1
+ module Fog
2
+ module AWS
3
+ class AutoScaling
4
+
5
+ class Real
6
+
7
+ require 'fog/aws/parsers/auto_scaling/describe_termination_policy_types'
8
+
9
+ # Returns a list of all termination policies supported by Auto Scaling.
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'ResponseMetadata'<~Hash>:
15
+ # * 'RequestId'<~String> - Id of request
16
+ # * 'DescribeTerminationPolicyTypesResult'<~Hash>:
17
+ # * 'TerminationPolicyTypes'<~Array>:
18
+ # * terminationtype<~String>:
19
+ #
20
+ # ==== See Also
21
+ # http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_DescribeTerminationPolicyTypes.html
22
+ #
23
+ def describe_termination_policy_types()
24
+ request({
25
+ 'Action' => 'DescribeTerminationPolicyTypes',
26
+ :idempotent => true,
27
+ :parser => Fog::Parsers::AWS::AutoScaling::DescribeTerminationPolicyTypes.new
28
+ })
29
+ end
30
+
31
+ end
32
+
33
+ class Mock
34
+
35
+ def describe_termination_policy_types()
36
+ results = { 'TerminationPolicyTypes' => [] }
37
+ self.data[:termination_policy_types].each do |termination_policy_type|
38
+ results['TerminationPolicyTypes'] << termination_policy_type
39
+ end
40
+ response = Excon::Response.new
41
+ response.status = 200
42
+ response.body = {
43
+ 'DescribeTerminationPolicyTypesResult' => results,
44
+ 'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
45
+ }
46
+ response
47
+ end
48
+
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -42,7 +42,7 @@ module Fog
42
42
  class Mock
43
43
 
44
44
  def disable_metrics_collection(auto_scaling_group_name, options = {})
45
- unless data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
45
+ unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
46
46
  Fog::AWS::AutoScaling::ValidationError.new("Group #{auto_scaling_group_name} not found")
47
47
  end
48
48
 
@@ -49,10 +49,10 @@ module Fog
49
49
  class Mock
50
50
 
51
51
  def enable_metrics_collection(auto_scaling_group_name, granularity, options = {})
52
- unless data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
52
+ unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
53
53
  Fog::AWS::AutoScaling::ValidationError.new("Group #{auto_scaling_group_name} not found")
54
54
  end
55
- unless data[:metric_collection_types][:granularities].include?(granularity)
55
+ unless self.data[:metric_collection_types][:granularities].include?(granularity)
56
56
  Fog::AWS::AutoScaling::ValidationError.new('Valid metrics granularity type is: [1Minute].')
57
57
  end
58
58
 
@@ -6,15 +6,16 @@ module Fog
6
6
 
7
7
  require 'fog/aws/parsers/auto_scaling/put_notification_configuration'
8
8
 
9
- # Creates a notification configuration for an Auto Scaling group. To update an
10
- # existing policy, overwrite the existing notification configuration name
11
- # and set the parameter(s) you want to change.
9
+ # Creates a notification configuration for an Auto Scaling group. To
10
+ # update an existing policy, overwrite the existing notification
11
+ # configuration name and set the parameter(s) you want to change.
12
12
  #
13
13
  # ==== Parameters
14
- # * auto_scaling_group_name<~String> - The name of the Auto Scaling group.
15
- # * notification_types<~Array> - The type of events that will trigger the
16
- # notification.
17
- # * topic_arn<~String> - The Amazon Resource Name (ARN) of the Amazon
14
+ # * auto_scaling_group_name<~String> - The name of the Auto Scaling
15
+ # group.
16
+ # * notification_types<~Array> - The type of events that will trigger
17
+ # the notification.
18
+ # * topic_arn<~String> - The Amazon Resource Name (ARN) of the Amazon
18
19
  # Simple Notification Service (SNS) topic.
19
20
  # ==== Returns
20
21
  # * response<~Excon::Response>:
@@ -26,14 +27,13 @@ module Fog
26
27
  # http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_PutNotificationConfiguration.html
27
28
  #
28
29
  def put_notification_configuration(auto_scaling_group_name, notification_types, topic_arn)
29
- options = {}
30
- options.merge!(AWS.indexed_param('NotificationTypes.member.%d', [*notification_types]))
30
+ params = AWS.indexed_param('NotificationTypes.member.%d', [*notification_types])
31
31
  request({
32
32
  'Action' => 'PutNotificationConfiguration',
33
33
  'AutoScalingGroupName' => auto_scaling_group_name,
34
34
  'TopicARN' => topic_arn,
35
35
  :parser => Fog::Parsers::AWS::AutoScaling::PutNotificationConfiguration.new
36
- }.merge!(options))
36
+ }.merge!(params))
37
37
  end
38
38
 
39
39
  end
@@ -41,7 +41,26 @@ module Fog
41
41
  class Mock
42
42
 
43
43
  def put_notification_configuration(auto_scaling_group_name, notification_types, topic_arn)
44
- Fog::Mock.not_implemented
44
+ unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
45
+ raise Fog::AWS::AutoScaling::ValidationError.new("AutoScalingGroup name not found - #{auto_scaling_group_name}")
46
+ end
47
+ if notification_types.to_a.empty?
48
+ raise Fog::AWS::AutoScaling::ValidationError.new("1 validation error detected: Value null at 'notificationTypes' failed to satisfy constraint: Member must not be null")
49
+ end
50
+ invalid_types = notification_types.to_a - self.data[:notification_types]
51
+ unless invalid_types.empty?
52
+ raise Fog::AWS::AutoScaling::ValidationError.new("&quot;#{invalid_types.first}&quot; is not a valid Notification Type.")
53
+ end
54
+
55
+ self.data[:notification_configurations][auto_scaling_group_name] ||= {}
56
+ self.data[:notification_configurations][auto_scaling_group_name][topic_arn] = notification_types.to_a.uniq
57
+
58
+ response = Excon::Response.new
59
+ response.status = 200
60
+ response.body = {
61
+ 'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
62
+ }
63
+ response
45
64
  end
46
65
 
47
66
  end
@@ -46,7 +46,7 @@ module Fog
46
46
  'AdjustmentType' => adjustment_type,
47
47
  'AutoScalingGroupName' => auto_scaling_group_name,
48
48
  'PolicyName' => policy_name,
49
- 'ScalingAdjustment' => scaling_adjustment,
49
+ 'ScalingAdjustment' => scaling_adjustment,
50
50
  :parser => Fog::Parsers::AWS::AutoScaling::PutScalingPolicy.new
51
51
  }.merge!(options))
52
52
  end
@@ -56,16 +56,16 @@ module Fog
56
56
  class Mock
57
57
 
58
58
  def put_scaling_policy(adjustment_type, auto_scaling_group_name, policy_name, scaling_adjustment, options = {})
59
- unless data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
59
+ unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
60
60
  raise Fog::AWS::AutoScaling::ValidationError.new('Auto Scaling Group name not found - null')
61
61
  end
62
- data[:scaling_policies][policy_name] = {
62
+ self.data[:scaling_policies][policy_name] = {
63
63
  'AdjustmentType' => adjustment_type,
64
64
  'Alarms' => [],
65
65
  'AutoScalingGroupName' => auto_scaling_group_name,
66
66
  'Cooldown' => 0,
67
67
  'MinAdjustmentStep' => 0,
68
- 'PolicyARN' => "arn:aws:autoscaling:eu-west-1:000000000000:scalingPolicy:00000000-0000-0000-0000-000000000000:autoScalingGroupName/#{auto_scaling_group_name}:policyName/#{policy_name}",
68
+ 'PolicyARN' => Fog::AWS::Mock.arn('autoscaling', self.data[:owner_id], "scalingPolicy:00000000-0000-0000-0000-000000000000:autoScalingGroupName/#{auto_scaling_group_name}:policyName/#{policy_name}", self.region),
69
69
  'PolicyName' => policy_name,
70
70
  'ScalingAdjustment' => scaling_adjustment
71
71
  }.merge!(options)
@@ -14,7 +14,8 @@ module Fog
14
14
  # * auto_scaling_group_name<~String> - The name or ARN of the Auto
15
15
  # Scaling Group.
16
16
  # * scheduled_action_name<~String> - Name of this scaling action.
17
- # * time<~Datetime> - The time for this action to start (deprecated use StartTime EndTime and Recurrence)
17
+ # * time<~Datetime> - The time for this action to start (deprecated:
18
+ # use StartTime, EndTime and Recurrence).
18
19
  # * options<~Hash>:
19
20
  # * 'DesiredCapacity'<~Integer> - The number of EC2 instances that
20
21
  # should be running in this group.
@@ -23,9 +24,11 @@ module Fog
23
24
  # group.
24
25
  # * 'MinSize'<~Integer> - The minimum size for the Auto Scaling
25
26
  # group.
26
- # * 'Recurrence'<~String> - The time when recurring future actions will start. Start time is specified
27
- # by the user following the Unix cron syntax format. When StartTime and EndTime are specified with
28
- # Recurrence, they form the boundaries of when the recurring action will start and stop.
27
+ # * 'Recurrence'<~String> - The time when recurring future actions
28
+ # will start. Start time is specified by the user following the
29
+ # Unix cron syntax format. When StartTime and EndTime are specified
30
+ # with Recurrence, they form the boundaries of when the recurring
31
+ # action will start and stop.
29
32
  # * 'StartTime'<~DateTime> - The time for this action to start
30
33
  #
31
34
  # ==== Returns
@@ -38,7 +41,7 @@ module Fog
38
41
  # http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_PutScheduledUpdateGroupAction.html
39
42
  #
40
43
  def put_scheduled_update_group_action(auto_scaling_group_name, scheduled_action_name, time=nil, options = {})
41
- # The 'Time' paramenter is now an alias for StartTime and needs to be identical if specified.
44
+ # The 'Time' paramenter is now an alias for StartTime and needs to be identical if specified.
42
45
  time = options['StartTime'].nil? ? time : options['StartTime']
43
46
  if !time.nil?
44
47
  time = time.class == Time ? time.utc.iso8601 : Time.parse(time).utc.iso8601
@@ -67,10 +67,10 @@ module Fog
67
67
  class Mock
68
68
 
69
69
  def set_desired_capacity(auto_scaling_group_name, desired_capacity, options = {})
70
- unless data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
70
+ unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
71
71
  Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - null')
72
72
  end
73
- data[:auto_scaling_groups][auto_scaling_group_name]['DesiredCapacity'] = desired_capacity
73
+ self.data[:auto_scaling_groups][auto_scaling_group_name]['DesiredCapacity'] = desired_capacity
74
74
 
75
75
  response = Excon::Response.new
76
76
  response.status = 200
@@ -41,8 +41,8 @@ module Fog
41
41
  class Mock
42
42
 
43
43
  def set_instance_health(health_status, instance_id, options = {})
44
- unless data[:health_states].include?(health_status)
45
- raise Fog::AWS::AutoScaling::ValidationError.new('Valid instance health states are: [#{data[:health_states].join(", ")}].')
44
+ unless self.data[:health_states].include?(health_status)
45
+ raise Fog::AWS::AutoScaling::ValidationError.new('Valid instance health states are: [#{self.data[:health_states].join(", ")}].')
46
46
  end
47
47
 
48
48
  Fog::Mock.not_implemented
@@ -43,7 +43,7 @@ module Fog
43
43
  class Mock
44
44
 
45
45
  def suspend_processes(auto_scaling_group_name, options = {})
46
- unless data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
46
+ unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
47
47
  raise Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - null')
48
48
  end
49
49
 
@@ -17,22 +17,31 @@ module Fog
17
17
  # * auto_scaling_group_name<~String> - The name of the Auto Scaling
18
18
  # group.
19
19
  # * options<~Hash>:
20
- # * 'AvailabilityZones'<~Array>: Availability zones for the group
21
- # * 'DefaultCooldown'<~Integer> - Amount of time, in seconds, after a
22
- # scaling activity completes before any further trigger-related
23
- # scaling activities can start
24
- # * 'DesiredCapacity'<~Integer> - Desired capacity for the scaling group
25
- # * 'HealthCheckGracePeriod'<~Integer> - Length of time that Auto
26
- # Scaling waits before checking an instance's health status
27
- # * 'HealthCheckType'<~String> - Service of interest for the health
28
- # status check, either "EC2" or "ELB".
29
- # * 'LaunchConfigurationName'<~String> - Name of the launch configuration
30
- # * 'MaxSize'<~Integer> - Maximum size of the Auto Scaling group
31
- # * 'MinSize'<~Integer> - Minimum size of the Auto Scaling group
32
- # * 'PlacementGroup'<~String> - Name of the cluster placement group,
33
- # if applicable
34
- # * 'VPCZoneIdentifier'<~String> - Identifier for the VPC connection,
35
- # if applicable
20
+ # * 'AvailabilityZones'<~Array> - Availability zones for the group.
21
+ # * 'DefaultCooldown'<~Integer> - The amount of time, in seconds,
22
+ # after a scaling activity completes before any further trigger-
23
+ # related scaling activities can start
24
+ # * 'DesiredCapacity'<~Integer> - The desired capacity for the Auto
25
+ # Scaling group.
26
+ # * 'HealthCheckGracePeriod'<~Integer> - The length of time that Auto
27
+ # Scaling waits before checking an instance's health status.The
28
+ # grace period begins when an instance comes into service.
29
+ # * 'HealthCheckType'<~String> - The service of interest for the
30
+ # health status check, either "EC2" for Amazon EC2 or "ELB" for
31
+ # Elastic Load Balancing.
32
+ # * 'LaunchConfigurationName'<~String> - The name of the launch
33
+ # configuration.
34
+ # * 'MaxSize'<~Integer> - The maximum size of the Auto Scaling group.
35
+ # * 'MinSize'<~Integer> - The minimum size of the Auto Scaling group.
36
+ # * 'PlacementGroup'<~String> - The name of the cluster placement
37
+ # group, if applicable.
38
+ # * 'TerminationPolicies'<~Array> - A standalone termination policy
39
+ # or a list of termination policies used to select the instance to
40
+ # terminate. The policies are executed in the order that they are
41
+ # listed.
42
+ # * 'VPCZoneIdentifier'<~String> - The subnet identifier for the
43
+ # Amazon VPC connection, if applicable. You can specify several
44
+ # subnets in a comma-separated list.
36
45
  #
37
46
  # ==== Returns
38
47
  # * response<~Excon::Response>:
@@ -47,6 +56,9 @@ module Fog
47
56
  if availability_zones = options.delete('AvailabilityZones')
48
57
  options.merge!(AWS.indexed_param('AvailabilityZones.member.%d', [*availability_zones]))
49
58
  end
59
+ if termination_policies = options.delete('TerminationPolicies')
60
+ options.merge!(AWS.indexed_param('TerminationPolicies.member.%d', [*termination_policies]))
61
+ end
50
62
  request({
51
63
  'Action' => 'UpdateAutoScalingGroup',
52
64
  'AutoScalingGroupName' => auto_scaling_group_name,
@@ -59,10 +71,10 @@ module Fog
59
71
  class Mock
60
72
 
61
73
  def update_auto_scaling_group(auto_scaling_group_name, options = {})
62
- unless data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
74
+ unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name)
63
75
  raise Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - null')
64
76
  end
65
- data[:auto_scaling_groups][auto_scaling_group_name].merge!(options)
77
+ self.data[:auto_scaling_groups][auto_scaling_group_name].merge!(options)
66
78
 
67
79
  response = Excon::Response.new
68
80
  response.status = 200
@@ -23,6 +23,37 @@ module Fog
23
23
  end
24
24
 
25
25
  end
26
+
27
+ class Mock
28
+
29
+ def delete_distribution(distribution_id, etag)
30
+ distribution = self.data[:distributions][distribution_id]
31
+
32
+ if distribution
33
+ if distribution['ETag'] != etag
34
+ Fog::CDN::AWS::Mock.error(:invalid_if_match_version)
35
+ end
36
+ unless distribution['DistributionConfig']['CallerReference']
37
+ Fog::CDN::AWS::Mock.error(:illegal_update)
38
+ end
39
+ if distribution['DistributionConfig']['Enabled']
40
+ Fog::CDN::AWS::Mock.error(:distribution_not_disabled)
41
+ end
42
+
43
+ self.data[:distributions].delete(distribution_id)
44
+ self.data[:invalidations].delete(distribution_id)
45
+
46
+ response = Excon::Response.new
47
+ response.status = 204
48
+ response.body = "x-amz-request-id: #{Fog::AWS::Mock.request_id}"
49
+ response
50
+ else
51
+ Fog::CDN::AWS::Mock.error(:no_such_distribution)
52
+ end
53
+ end
54
+
55
+ end
56
+
26
57
  end
27
58
  end
28
59
  end
@@ -23,6 +23,36 @@ module Fog
23
23
  end
24
24
 
25
25
  end
26
+
27
+ class Mock
28
+
29
+ def delete_streaming_distribution(distribution_id, etag)
30
+ distribution = self.data[:streaming_distributions][distribution_id]
31
+
32
+ if distribution
33
+ if distribution['ETag'] != etag
34
+ Fog::CDN::AWS::Mock.error(:invalid_if_match_version)
35
+ end
36
+ unless distribution['StreamingDistributionConfig']['CallerReference']
37
+ Fog::CDN::AWS::Mock.error(:illegal_update)
38
+ end
39
+ if distribution['StreamingDistributionConfig']['Enabled']
40
+ Fog::CDN::AWS::Mock.error(:distribution_not_disabled)
41
+ end
42
+
43
+ self.data[:streaming_distributions].delete(distribution_id)
44
+
45
+ response = Excon::Response.new
46
+ response.status = 204
47
+ response.body = "x-amz-request-id: #{Fog::AWS::Mock.request_id}"
48
+ response
49
+ else
50
+ Fog::CDN::AWS::Mock.error(:no_such_streaming_distribution)
51
+ end
52
+ end
53
+
54
+ end
55
+
26
56
  end
27
57
  end
28
58
  end
@@ -52,6 +52,34 @@ module Fog
52
52
  end
53
53
 
54
54
  end
55
+
56
+ class Mock
57
+
58
+ def get_distribution(distribution_id)
59
+ response = Excon::Response.new
60
+
61
+ distribution = self.data[:distributions][distribution_id]
62
+ unless distribution
63
+ Fog::CDN::AWS::Mock.error(:no_such_distribution)
64
+ end
65
+
66
+ if distribution['Status'] == 'InProgress' && (Time.now - Time.parse(distribution['LastModifiedTime']) >= Fog::Mock.delay * 2)
67
+ distribution['Status'] = 'Deployed'
68
+ end
69
+
70
+ etag = Fog::CDN::AWS::Mock.generic_id
71
+ response.status = 200
72
+ response.body = {
73
+ 'InProgressInvalidationBatches' => 0,
74
+ }.merge(distribution.reject { |k,v| k == 'ETag' })
75
+
76
+ response.headers['ETag'] = etag
77
+ distribution['ETag'] = etag
78
+
79
+ response
80
+ end
81
+ end
82
+
55
83
  end
56
84
  end
57
85
  end
@@ -54,6 +54,35 @@ module Fog
54
54
  end
55
55
 
56
56
  end
57
+
58
+ class Mock
59
+
60
+ def get_distribution_list(options = {})
61
+ response = Excon::Response.new
62
+ response.status = 200
63
+
64
+ distributions = self.data[:distributions].values
65
+
66
+ response.body = {
67
+ 'Marker' => Fog::Mock.random_hex(16),
68
+ 'IsTruncated' => false,
69
+ 'MaxItems' => 100,
70
+ 'DistributionSummary' => distributions.map { |d| to_distribution_summary(d) }
71
+ }
72
+
73
+ response
74
+ end
75
+
76
+ private
77
+
78
+ def to_distribution_summary(d)
79
+ {
80
+ 'DomainName' => d['DomainName'],
81
+ 'Id' => d['Id'],
82
+ 'LastModifiedTime' => d['LastModifiedTime']
83
+ }.merge(d['DistributionConfig'])
84
+ end
85
+ end
57
86
  end
58
87
  end
59
88
  end