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,62 @@
1
+ Shindo.tests('AWS::AutoScaling | tag requests', ['aws', 'auto_scaling']) do
2
+
3
+ image_id = { # Ubuntu 12.04 LTS 64-bit EBS
4
+ 'ap-northeast-1' => 'ami-60c77761',
5
+ 'ap-southeast-1' => 'ami-a4ca8df6',
6
+ 'eu-west-1' => 'ami-e1e8d395',
7
+ 'sa-east-1' => 'ami-8cd80691',
8
+ 'us-east-1' => 'ami-a29943cb',
9
+ 'us-west-1' => 'ami-87712ac2',
10
+ 'us-west-2' => 'ami-20800c10'
11
+ }
12
+
13
+ now = Time.now.utc.to_i
14
+ lc_name = "fog-test-#{now}"
15
+ asg_name = "fog-test-#{now}"
16
+
17
+ asg_tag = {
18
+ 'Key' => 'Name',
19
+ 'PropagateAtLaunch' => true,
20
+ 'ResourceId' => asg_name,
21
+ 'ResourceType' => 'auto-scaling-group',
22
+ 'Value' => asg_name
23
+ }
24
+
25
+ lc = Fog::AWS[:auto_scaling].create_launch_configuration(image_id[Fog::AWS[:auto_scaling].region], 't1.micro', lc_name)
26
+ asg = Fog::AWS[:auto_scaling].create_auto_scaling_group(asg_name, "#{Fog::AWS[:auto_scaling].region}a", lc_name, 0, 0, 'Tags' => [asg_tag])
27
+
28
+ tests('raises') do
29
+ tests("#create_or_update_tags(empty)").raises(Fog::AWS::AutoScaling::ValidationError) do
30
+ Fog::AWS[:auto_scaling].create_or_update_tags([])
31
+ end
32
+
33
+ tests("#delete_tags(empty)").raises(Fog::AWS::AutoScaling::ValidationError) do
34
+ Fog::AWS[:auto_scaling].delete_tags([])
35
+ end
36
+ end
37
+
38
+ tests('success') do
39
+ tests("#describe_auto_scaling_groups(#{asg_name}").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_GROUPS) do
40
+ body = Fog::AWS[:auto_scaling].describe_auto_scaling_groups('AutoScalingGroupNames' => asg_name).body
41
+ auto_scaling_group = body['DescribeAutoScalingGroupsResult']['AutoScalingGroups'].first
42
+ returns(true) { auto_scaling_group.has_key?('Tags') }
43
+ returns(true) { auto_scaling_group['Tags'].size == 1 }
44
+ returns(true) { auto_scaling_group['Tags'].first == asg_tag }
45
+ body
46
+ end
47
+
48
+ tests("#describe_tags").formats(AWS::AutoScaling::Formats::DESCRIBE_TAGS) do
49
+ pending if Fog.mocking?
50
+ body = Fog::AWS[:auto_scaling].describe_tags.body
51
+ tags = body['DescribeTagsResult']['Tags']
52
+ returns(true) { tags.any? {|tag| tag == asg_tag} }
53
+ body
54
+ end
55
+
56
+ # TODO: more tests!
57
+ end
58
+
59
+ Fog::AWS[:auto_scaling].delete_auto_scaling_group(asg_name)
60
+ Fog::AWS[:auto_scaling].delete_launch_configuration(lc_name)
61
+
62
+ end
@@ -0,0 +1,252 @@
1
+ Shindo.tests('Fog::CDN[:aws] | CDN requests', ['aws', 'cdn']) do
2
+
3
+ @cf_connection = Fog::CDN[:aws]
4
+
5
+ tests('distributions success') do
6
+
7
+ test('get current ditribution list count') do
8
+
9
+ @count= 0
10
+ response = @cf_connection.get_distribution_list
11
+ if response.status == 200
12
+ @distributions = response.body['DistributionSummary']
13
+ @count = @distributions.count
14
+ end
15
+
16
+ response.status == 200
17
+ end
18
+
19
+ test('create distribution') {
20
+
21
+ result = false
22
+
23
+ response = @cf_connection.post_distribution('S3Origin' => { 'DNSName' => 'test_cdn.s3.amazonaws.com'}, 'Enabled' => true)
24
+ if response.status == 201
25
+ @dist_id = response.body['Id']
26
+ @etag = response.headers['ETag']
27
+ @caller_reference = response.body['DistributionConfig']['CallerReference']
28
+ if (@dist_id.length > 0)
29
+ result = true
30
+ end
31
+ end
32
+
33
+ result
34
+ }
35
+
36
+ test("get info on distribution #{@dist_id}") {
37
+
38
+ result = false
39
+
40
+ response = @cf_connection.get_distribution(@dist_id)
41
+ if response.status == 200
42
+ @etag = response.headers['ETag']
43
+ status = response.body['Status']
44
+ if ((status == 'Deployed') or (status == 'InProgress')) and not @etag.nil?
45
+ result = true
46
+ end
47
+ end
48
+
49
+ result
50
+ }
51
+
52
+ test('list distributions') do
53
+
54
+ result = false
55
+
56
+ response = @cf_connection.get_distribution_list
57
+ if response.status == 200
58
+ distributions = response.body['DistributionSummary']
59
+ if (distributions.count > 0)
60
+ dist = distributions[0]
61
+ dist_id = dist['Id']
62
+ end
63
+ max_items = response.body['MaxItems']
64
+
65
+ if (dist_id.length > 0) and (max_items > 0)
66
+ result = true
67
+ end
68
+
69
+ end
70
+
71
+ result
72
+ end
73
+
74
+ test("invalidate paths") {
75
+
76
+ response = @cf_connection.post_invalidation(@dist_id, ["/test.html", "/path/to/file.html"])
77
+ if response.status == 201
78
+ @invalidation_id = response.body['Id']
79
+ end
80
+
81
+ response.status == 201
82
+ }
83
+
84
+ test("list invalidations") {
85
+
86
+ result = false
87
+
88
+ response = @cf_connection.get_invalidation_list(@dist_id)
89
+ if response.status == 200
90
+ if response.body['InvalidationSummary'].find { |f| f['Id'] == @invalidation_id }
91
+ result = true
92
+ end
93
+ end
94
+
95
+ result
96
+ }
97
+
98
+ test("get invalidation information") {
99
+
100
+ result = false
101
+
102
+ response = @cf_connection.get_invalidation(@dist_id, @invalidation_id)
103
+ if response.status == 200
104
+ paths = response.body['InvalidationBatch']['Path'].sort
105
+ status = response.body['Status']
106
+ if status.length > 0 and paths == [ '/test.html', '/path/to/file.html' ].sort
107
+ result = true
108
+ end
109
+ end
110
+
111
+ result
112
+ }
113
+
114
+ test("disable distribution #{@dist_id} - can take 15 minutes to complete...") {
115
+
116
+ result = false
117
+
118
+ response = @cf_connection.put_distribution_config(@dist_id, @etag, 'S3Origin' => { 'DNSName' => 'test_cdn.s3.amazonaws.com'}, 'Enabled' => false, 'CallerReference' => @caller_reference)
119
+ if response.status == 200
120
+ @etag = response.headers['ETag']
121
+ unless @etag.nil?
122
+ result = true
123
+ end
124
+ end
125
+
126
+ result
127
+ }
128
+
129
+ test("remove distribution #{@dist_id}") {
130
+
131
+ result = true
132
+
133
+ # unfortunately you can delete only after a distribution becomes Deployed
134
+ Fog.wait_for {
135
+ response = @cf_connection.get_distribution(@dist_id)
136
+ @etag = response.headers['ETag']
137
+ response.status == 200 and response.body['Status'] == 'Deployed'
138
+ }
139
+
140
+ response = @cf_connection.delete_distribution(@dist_id, @etag)
141
+ if response.status != 204
142
+ result = false
143
+ end
144
+
145
+ result
146
+ }
147
+ end
148
+
149
+ tests('streaming distributions success') do
150
+
151
+ test('get current streaming ditribution list count') do
152
+
153
+ @count= 0
154
+ response = @cf_connection.get_streaming_distribution_list
155
+ if response.status == 200
156
+ @distributions = response.body['StreamingDistributionSummary']
157
+ @count = @distributions.count
158
+ end
159
+
160
+ response.status == 200
161
+ end
162
+
163
+ test('create distribution') {
164
+
165
+ result = false
166
+
167
+ response = @cf_connection.post_streaming_distribution('S3Origin' => { 'DNSName' => 'test_cdn.s3.amazonaws.com'}, 'Enabled' => true)
168
+ if response.status == 201
169
+ @dist_id = response.body['Id']
170
+ @etag = response.headers['ETag']
171
+ @caller_reference = response.body['StreamingDistributionConfig']['CallerReference']
172
+ if (@dist_id.length > 0)
173
+ result = true
174
+ end
175
+ end
176
+
177
+ result
178
+ }
179
+
180
+ test("get info on distribution #{@dist_id}") {
181
+
182
+ result = false
183
+
184
+ response = @cf_connection.get_streaming_distribution(@dist_id)
185
+ if response.status == 200
186
+ @etag = response.headers['ETag']
187
+ status = response.body['Status']
188
+ if ((status == 'Deployed') or (status == 'InProgress')) and not @etag.nil?
189
+ result = true
190
+ end
191
+ end
192
+
193
+ result
194
+ }
195
+
196
+ test('list streaming distributions') do
197
+
198
+ result = false
199
+
200
+ response = @cf_connection.get_streaming_distribution_list
201
+ if response.status == 200
202
+ distributions = response.body['StreamingDistributionSummary']
203
+ if (distributions.count > 0)
204
+ dist = distributions[0]
205
+ dist_id = dist['Id']
206
+ end
207
+ max_items = response.body['MaxItems']
208
+
209
+ if (dist_id.length > 0) and (max_items > 0)
210
+ result = true
211
+ end
212
+
213
+ end
214
+
215
+ result
216
+ end
217
+
218
+ test("disable distribution #{@dist_id} - can take 15 minutes to complete...") {
219
+
220
+ result = false
221
+
222
+ response = @cf_connection.put_streaming_distribution_config(@dist_id, @etag, 'S3Origin' => { 'DNSName' => 'test_cdn.s3.amazonaws.com'}, 'Enabled' => false, 'CallerReference' => @caller_reference)
223
+ if response.status == 200
224
+ @etag = response.headers['ETag']
225
+ unless @etag.nil?
226
+ result = true
227
+ end
228
+ end
229
+
230
+ result
231
+ }
232
+
233
+ test("remove distribution #{@dist_id}") {
234
+
235
+ result = true
236
+
237
+ # unfortunately you can delete only after a distribution becomes Deployed
238
+ Fog.wait_for {
239
+ response = @cf_connection.get_streaming_distribution(@dist_id)
240
+ @etag = response.headers['ETag']
241
+ response.status == 200 and response.body['Status'] == 'Deployed'
242
+ }
243
+
244
+ response = @cf_connection.delete_streaming_distribution(@dist_id, @etag)
245
+ if response.status != 204
246
+ result = false
247
+ end
248
+
249
+ result
250
+ }
251
+ end
252
+ end
@@ -35,6 +35,10 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
35
35
  'return' => Fog::Boolean,
36
36
  'requestId' => String
37
37
  }
38
+ @create_image_format = {
39
+ 'requestId' => String,
40
+ 'imageId' => String
41
+ }
38
42
 
39
43
  tests('success') do
40
44
  # the result for this is HUGE and relatively uninteresting...
@@ -46,10 +50,37 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
46
50
  if Fog.mocking?
47
51
  @other_account = Fog::Compute::AWS.new(:aws_access_key_id => 'other', :aws_secret_access_key => 'account')
48
52
 
53
+ @server = Fog::Compute[:aws].servers.create
54
+ @server.wait_for{state == 'running'}
55
+ @created_image
56
+ tests("#create_image").formats(@create_image_format) do
57
+ result = Fog::Compute[:aws].create_image(@server.id, 'Fog-Test-Image', 'Fog Test Image', false).body
58
+ @created_image = Fog::Compute[:aws].images.get(result['imageId'])
59
+ result
60
+ end
61
+ tests("#create_image - no reboot").formats(@create_image_format) do
62
+ result = Fog::Compute[:aws].create_image(@server.id, 'Fog-Test-Image', 'Fog Test Image', true).body
63
+ @created_image = Fog::Compute[:aws].images.get(result['imageId'])
64
+ result
65
+ end
66
+ tests("#create_image - automatic ebs image registration").returns(true) do
67
+ create_image_response = Fog::Compute[:aws].create_image(@server.id, 'Fog-Test-Image', 'Fog Test Image')
68
+ Fog::Compute[:aws].images.get(create_image_response.body['imageId']) != nil
69
+ end
70
+ @server.destroy
71
+
49
72
  tests("#register_image").formats(@register_image_format) do
50
73
  @image = Fog::Compute[:aws].register_image('image', 'image', '/dev/sda1').body
51
74
  end
52
75
 
76
+ tests("#register_image - with ebs block device mapping").formats(@register_image_format) do
77
+ @ebs_image = Fog::Compute[:aws].register_image('image', 'image', '/dev/sda1', [ { 'DeviceName' => '/dev/sdh', "SnapshotId" => "snap-123456789", "VolumeSize" => "10G", "DeleteOnTermination" => true}]).body
78
+ end
79
+
80
+ tests("#register_image - with ephemeral block device mapping").formats(@register_image_format) do
81
+ @ephemeral_image = Fog::Compute[:aws].register_image('image', 'image', '/dev/sda1', [ { 'VirtualName' => 'ephemeral0', "DeviceName" => "/dev/sdb"} ]).body
82
+ end
83
+
53
84
  @image_id = @image['imageId']
54
85
  sleep 1
55
86
 
@@ -104,4 +135,4 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
104
135
  Fog::Compute[:aws].modify_image_attribute('ami-00000000', { 'Add.UserId' => ['123456789012'] }).body
105
136
  end
106
137
  end
107
- end
138
+ end
@@ -184,9 +184,9 @@ Shindo.tests('Fog::Compute[:aws] | volume requests', ['aws']) do
184
184
  Fog::Compute[:aws].create_volume(@server.availability_zone, 10, 'VolumeType' => 'io1', 'Iops' => 99)
185
185
  end
186
186
 
187
- # iops invalid value (greater than 1000)
188
- tests("#create_volume('#{@server.availability_zone}', 10, 'VolumeType' => 'io1', 'Iops' => 1001)").raises(Fog::Compute::AWS::Error) do
189
- Fog::Compute[:aws].create_volume(@server.availability_zone, 1000, 'VolumeType' => 'io1', 'Iops' => 1001)
187
+ # iops invalid value (greater than 2000)
188
+ tests("#create_volume('#{@server.availability_zone}', 1024, 'VolumeType' => 'io1', 'Iops' => 2001)").raises(Fog::Compute::AWS::Error) do
189
+ Fog::Compute[:aws].create_volume(@server.availability_zone, 1024, 'VolumeType' => 'io1', 'Iops' => 2001)
190
190
  end
191
191
 
192
192
  @volume.destroy
@@ -0,0 +1,16 @@
1
+ Shindo.tests('AWS::RDS | describe DB events requests',['aws', 'rds']) do
2
+
3
+ tests('success') do
4
+ pending if Fog.mocking?
5
+
6
+ tests(
7
+ '#describe_events'
8
+ ).formats(AWS::RDS::Formats::EVENT_LIST) do
9
+ AWS[:rds].describe_events().body['Events']
10
+ end
11
+ end
12
+
13
+ tests('failure') do
14
+ #TODO: What constitutes a failure here?
15
+ end
16
+ end
@@ -52,6 +52,26 @@ class AWS
52
52
  }
53
53
  })
54
54
 
55
+ DB_SUBNET_GROUP = {
56
+ 'DBSubnetGroupName' => String,
57
+ 'DBSubnetGroupDescription' => String,
58
+ 'SubnetGroupStatus' => String,
59
+ 'VpcId' => String,
60
+ 'Subnets' => [String]
61
+ }
62
+
63
+ CREATE_DB_SUBNET_GROUP = BASIC.merge({
64
+ 'CreateDBSubnetGroupResult' => {
65
+ 'DBSubnetGroup' => DB_SUBNET_GROUP
66
+ }
67
+ })
68
+
69
+ DESCRIBE_DB_SUBNET_GROUPS = BASIC.merge({
70
+ 'DescribeDBSubnetGroupsResult' => {
71
+ 'DBSubnetGroups' => [DB_SUBNET_GROUP]
72
+ }
73
+ })
74
+
55
75
  DESCRIBE_DB_PARAMETER_GROUP = {
56
76
  'ResponseMetadata' => {'RequestId' => String},
57
77
  'DescribeDBParameterGroupsResult' =>{
@@ -203,6 +223,12 @@ class AWS
203
223
  }
204
224
  })
205
225
 
226
+ LIST_TAGS_FOR_RESOURCE = {
227
+ 'ListTagsForResourceResult' => {
228
+ 'TagList' => Fog::Nullable::Hash
229
+ }
230
+ }
231
+
206
232
  end
207
233
 
208
234
  end
@@ -0,0 +1,48 @@
1
+ Shindo.tests('AWS::RDS | subnet group requests', ['aws', 'rds']) do
2
+ # random_differentiator
3
+ # Useful when rapidly re-running tests, so we don't have to wait
4
+ # serveral minutes for deleted VPCs/subnets to disappear
5
+ suffix = rand(65536).to_s(16)
6
+ @subnet_group_name = "fog-test-#{suffix}"
7
+
8
+ vpc_range = rand(245) + 10
9
+ @vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => "10.#{vpc_range}.0.0/16")
10
+
11
+ # Create 4 subnets in this VPC, each one in a different AZ
12
+ subnet_az = 'us-east-1a'
13
+ subnet_range = 8
14
+ @subnets = (1..4).map do
15
+ subnet = Fog::Compute[:aws].create_subnet(@vpc.id, "10.#{vpc_range}.#{subnet_range}.0/24",
16
+ 'AvailabilityZone' => subnet_az).body['subnetSet'].first
17
+ subnet_az = subnet_az.succ
18
+ subnet_range *= 2
19
+ subnet
20
+ end
21
+
22
+ tests('success') do
23
+
24
+ subnet_ids = @subnets.map { |sn| sn['subnetId'] }.to_a
25
+
26
+ tests("#create_db_subnet_group").formats(AWS::RDS::Formats::CREATE_DB_SUBNET_GROUP) do
27
+ result = Fog::AWS[:rds].create_db_subnet_group(@subnet_group_name, subnet_ids, 'A subnet group').body
28
+
29
+ returns(@subnet_group_name) { result['CreateDBSubnetGroupResult']['DBSubnetGroup']['DBSubnetGroupName'] }
30
+ returns('A subnet group') { result['CreateDBSubnetGroupResult']['DBSubnetGroup']['DBSubnetGroupDescription'] }
31
+ returns(@vpc.id) { result['CreateDBSubnetGroupResult']['DBSubnetGroup']['VpcId'] }
32
+ returns(subnet_ids.sort) { result['CreateDBSubnetGroupResult']['DBSubnetGroup']['Subnets'].sort }
33
+
34
+ result
35
+ end
36
+
37
+ tests("#describe_db_subnet_groups").formats(AWS::RDS::Formats::DESCRIBE_DB_SUBNET_GROUPS) do
38
+ Fog::AWS[:rds].describe_db_subnet_groups.body
39
+ end
40
+
41
+ end
42
+
43
+ @subnets.each do |sn|
44
+ Fog::Compute[:aws].delete_subnet(sn['subnetId'])
45
+ end
46
+ @vpc.destroy
47
+
48
+ end