fog 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. data/README.rdoc +2 -9
  2. data/Rakefile +3 -2
  3. data/docs/_layouts/default.html +13 -13
  4. data/docs/about/contributing.markdown +1 -1
  5. data/docs/about/getting_started.markdown +28 -3
  6. data/docs/dns/index.markdown +4 -4
  7. data/docs/index.markdown +2 -10
  8. data/docs/public/css/fog.css +14 -1
  9. data/docs/storage/index.markdown +2 -2
  10. data/fog.gemspec +6 -5
  11. data/lib/fog.rb +1 -1
  12. data/lib/fog/aws.rb +26 -1
  13. data/lib/fog/aws/auto_scaling.rb +3 -1
  14. data/lib/fog/aws/cloud_formation.rb +3 -0
  15. data/lib/fog/aws/cloud_watch.rb +17 -1
  16. data/lib/fog/aws/compute.rb +50 -18
  17. data/lib/fog/aws/elb.rb +4 -2
  18. data/lib/fog/aws/emr.rb +133 -0
  19. data/lib/fog/aws/models/cloud_watch/alarm.rb +12 -0
  20. data/lib/fog/aws/models/cloud_watch/alarm_data.rb +39 -0
  21. data/lib/fog/aws/models/cloud_watch/alarm_datum.rb +66 -0
  22. data/lib/fog/aws/models/cloud_watch/alarm_histories.rb +18 -0
  23. data/lib/fog/aws/models/cloud_watch/alarm_history.rb +16 -0
  24. data/lib/fog/aws/models/cloud_watch/alarms.rb +30 -0
  25. data/lib/fog/aws/models/compute/addresses.rb +1 -1
  26. data/lib/fog/aws/models/compute/key_pairs.rb +1 -1
  27. data/lib/fog/aws/models/compute/security_groups.rb +1 -1
  28. data/lib/fog/aws/models/compute/server.rb +4 -2
  29. data/lib/fog/aws/models/compute/servers.rb +1 -1
  30. data/lib/fog/aws/models/compute/snapshots.rb +1 -1
  31. data/lib/fog/aws/models/compute/spot_request.rb +21 -4
  32. data/lib/fog/aws/models/compute/spot_requests.rb +45 -1
  33. data/lib/fog/aws/models/compute/volumes.rb +1 -1
  34. data/lib/fog/aws/models/elb/load_balancer.rb +2 -0
  35. data/lib/fog/aws/models/storage/file.rb +1 -1
  36. data/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +0 -1
  37. data/lib/fog/aws/parsers/cloud_formation/update_stack.rb +19 -0
  38. data/lib/fog/aws/parsers/cloud_watch/delete_alarms.rb +26 -0
  39. data/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb +40 -0
  40. data/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb +73 -0
  41. data/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb +71 -0
  42. data/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb +26 -0
  43. data/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb +26 -0
  44. data/lib/fog/aws/parsers/cloud_watch/get_metric_statistics.rb +1 -0
  45. data/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb +26 -0
  46. data/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb +26 -0
  47. data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -2
  48. data/lib/fog/aws/parsers/emr/add_instance_groups.rb +28 -0
  49. data/lib/fog/aws/parsers/emr/add_job_flow_steps.rb +17 -0
  50. data/lib/fog/aws/parsers/emr/describe_job_flows.rb +140 -0
  51. data/lib/fog/aws/parsers/emr/modify_instance_groups.rb +17 -0
  52. data/lib/fog/aws/parsers/emr/run_job_flow.rb +19 -0
  53. data/lib/fog/aws/parsers/emr/set_termination_protection.rb +17 -0
  54. data/lib/fog/aws/parsers/emr/terminate_job_flows.rb +17 -0
  55. data/lib/fog/aws/rds.rb +3 -1
  56. data/lib/fog/aws/requests/cloud_formation/create_stack.rb +6 -0
  57. data/lib/fog/aws/requests/cloud_formation/update_stack.rb +62 -0
  58. data/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +30 -0
  59. data/lib/fog/aws/requests/cloud_watch/describe_alarm_history.rb +33 -0
  60. data/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +38 -0
  61. data/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb +39 -0
  62. data/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb +30 -0
  63. data/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb +30 -0
  64. data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +84 -0
  65. data/lib/fog/aws/requests/cloud_watch/set_alarm_state.rb +31 -0
  66. data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +141 -36
  67. data/lib/fog/aws/requests/compute/create_snapshot.rb +2 -3
  68. data/lib/fog/aws/requests/compute/create_tags.rb +5 -3
  69. data/lib/fog/aws/requests/compute/create_volume.rb +0 -1
  70. data/lib/fog/aws/requests/compute/delete_security_group.rb +25 -0
  71. data/lib/fog/aws/requests/compute/delete_tags.rb +3 -4
  72. data/lib/fog/aws/requests/compute/describe_addresses.rb +2 -2
  73. data/lib/fog/aws/requests/compute/describe_availability_zones.rb +5 -2
  74. data/lib/fog/aws/requests/compute/describe_images.rb +6 -9
  75. data/lib/fog/aws/requests/compute/describe_instances.rb +17 -8
  76. data/lib/fog/aws/requests/compute/describe_key_pairs.rb +2 -2
  77. data/lib/fog/aws/requests/compute/describe_regions.rb +2 -2
  78. data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +1 -1
  79. data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
  80. data/lib/fog/aws/requests/compute/describe_snapshots.rb +7 -5
  81. data/lib/fog/aws/requests/compute/describe_volumes.rb +5 -4
  82. data/lib/fog/aws/requests/compute/modify_image_attribute.rb +32 -0
  83. data/lib/fog/aws/requests/compute/modify_instance_attribute.rb +1 -1
  84. data/lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb +1 -1
  85. data/lib/fog/aws/requests/compute/register_image.rb +0 -1
  86. data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +41 -29
  87. data/lib/fog/aws/requests/compute/run_instances.rb +1 -2
  88. data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
  89. data/lib/fog/aws/requests/elb/create_load_balancer_listeners.rb +1 -1
  90. data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
  91. data/lib/fog/aws/requests/elb/describe_instance_health.rb +2 -2
  92. data/lib/fog/aws/requests/elb/describe_load_balancers.rb +3 -3
  93. data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +2 -2
  94. data/lib/fog/aws/requests/emr/add_instance_groups.rb +46 -0
  95. data/lib/fog/aws/requests/emr/add_job_flow_steps.rb +49 -0
  96. data/lib/fog/aws/requests/emr/describe_job_flows.rb +108 -0
  97. data/lib/fog/aws/requests/emr/modify_instance_groups.rb +40 -0
  98. data/lib/fog/aws/requests/emr/run_job_flow.rb +106 -0
  99. data/lib/fog/aws/requests/emr/set_termination_protection.rb +39 -0
  100. data/lib/fog/aws/requests/emr/terminate_job_flows.rb +37 -0
  101. data/lib/fog/aws/requests/iam/get_server_certificate.rb +5 -7
  102. data/lib/fog/aws/requests/iam/upload_server_certificate.rb +1 -0
  103. data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
  104. data/lib/fog/aws/requests/simpledb/select.rb +1 -1
  105. data/lib/fog/aws/requests/storage/copy_object.rb +1 -1
  106. data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
  107. data/lib/fog/aws/requests/storage/hash_to_acl.rb +35 -25
  108. data/lib/fog/aws/ses.rb +1 -1
  109. data/lib/fog/aws/simpledb.rb +2 -0
  110. data/lib/fog/aws/sns.rb +3 -1
  111. data/lib/fog/aws/sqs.rb +4 -2
  112. data/lib/fog/aws/storage.rb +12 -3
  113. data/lib/fog/bin.rb +1 -1
  114. data/lib/fog/bin/aws.rb +8 -4
  115. data/lib/fog/bin/bluebox.rb +2 -2
  116. data/lib/fog/bin/brightbox.rb +1 -1
  117. data/lib/fog/bin/dnsimple.rb +1 -1
  118. data/lib/fog/bin/dnsmadeeasy.rb +1 -1
  119. data/lib/fog/bin/ecloud.rb +1 -1
  120. data/lib/fog/bin/glesys.rb +1 -1
  121. data/lib/fog/bin/go_grid.rb +1 -1
  122. data/lib/fog/bin/google.rb +1 -1
  123. data/lib/fog/bin/libvirt.rb +1 -1
  124. data/lib/fog/bin/linode.rb +2 -2
  125. data/lib/fog/bin/local.rb +1 -1
  126. data/lib/fog/bin/new_servers.rb +1 -1
  127. data/lib/fog/bin/ninefold.rb +2 -2
  128. data/lib/fog/bin/openstack.rb +1 -1
  129. data/lib/fog/bin/rackspace.rb +3 -3
  130. data/lib/fog/bin/slicehost.rb +1 -1
  131. data/lib/fog/bin/stormondemand.rb +1 -1
  132. data/lib/fog/bin/virtual_box.rb +1 -1
  133. data/lib/fog/bin/vmfusion.rb +1 -1
  134. data/lib/fog/bin/voxel.rb +1 -1
  135. data/lib/fog/bin/zerigo.rb +1 -1
  136. data/lib/fog/brightbox/models/compute/account.rb +1 -1
  137. data/lib/fog/compute/models/server.rb +1 -2
  138. data/lib/fog/core/attributes.rb +5 -5
  139. data/lib/fog/core/connection.rb +1 -1
  140. data/lib/fog/core/deprecation.rb +2 -2
  141. data/lib/fog/core/logger.rb +8 -3
  142. data/lib/fog/core/mock.rb +4 -0
  143. data/lib/fog/core/provider.rb +7 -2
  144. data/lib/fog/core/service.rb +8 -2
  145. data/lib/fog/dnsmadeeasy/models/dns/record.rb +3 -2
  146. data/lib/fog/dynect/dns.rb +25 -3
  147. data/lib/fog/ecloud/compute.rb +2 -6
  148. data/lib/fog/go_grid/requests/compute/grid_server_power.rb +1 -1
  149. data/lib/fog/google/models/storage/file.rb +1 -1
  150. data/lib/fog/google/requests/storage/get_object_url.rb +2 -2
  151. data/lib/fog/google/storage.rb +1 -1
  152. data/lib/fog/libvirt/models/compute/uri.rb +7 -3
  153. data/lib/fog/linode/models/compute/server.rb +10 -0
  154. data/lib/fog/ninefold/models/storage/file.rb +8 -6
  155. data/lib/fog/ninefold/models/storage/files.rb +3 -2
  156. data/lib/fog/ninefold/requests/storage/head_namespace.rb +20 -0
  157. data/lib/fog/ninefold/storage.rb +4 -2
  158. data/lib/fog/openstack.rb +4 -3
  159. data/lib/fog/openstack/compute.rb +8 -5
  160. data/lib/fog/openstack/models/compute/server.rb +10 -1
  161. data/lib/fog/openstack/requests/compute/create_server.rb +6 -8
  162. data/lib/fog/rackspace/load_balancers.rb +1 -0
  163. data/lib/fog/rackspace/models/dns/callback.rb +1 -1
  164. data/lib/fog/rackspace/models/dns/record.rb +1 -1
  165. data/lib/fog/rackspace/models/dns/zone.rb +1 -1
  166. data/lib/fog/slicehost/dns.rb +1 -0
  167. data/lib/fog/slicehost/models/dns/record.rb +7 -3
  168. data/lib/fog/slicehost/models/dns/zone.rb +1 -1
  169. data/lib/fog/slicehost/parsers/dns/create_record.rb +8 -2
  170. data/lib/fog/slicehost/parsers/dns/get_record.rb +17 -5
  171. data/lib/fog/slicehost/parsers/dns/get_records.rb +10 -2
  172. data/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
  173. data/lib/fog/slicehost/requests/dns/get_records.rb +7 -8
  174. data/lib/fog/slicehost/requests/dns/update_record.rb +43 -0
  175. data/lib/fog/storm_on_demand/models/compute/balancers.rb +1 -1
  176. data/lib/fog/storm_on_demand/models/compute/configs.rb +1 -1
  177. data/lib/fog/storm_on_demand/models/compute/images.rb +1 -1
  178. data/lib/fog/storm_on_demand/models/compute/servers.rb +1 -1
  179. data/lib/fog/storm_on_demand/models/compute/templates.rb +1 -1
  180. data/lib/fog/terremark/vcloud.rb +1 -1
  181. data/lib/fog/vsphere/compute.rb +40 -23
  182. data/lib/fog/vsphere/models/compute/server.rb +1 -0
  183. data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +36 -4
  184. data/lib/fog/zerigo/dns.rb +14 -3
  185. data/lib/fog/zerigo/models/dns/record.rb +1 -1
  186. data/lib/fog/zerigo/models/dns/records.rb +5 -0
  187. data/lib/fog/zerigo/models/dns/zones.rb +2 -2
  188. data/lib/fog/zerigo/requests/dns/count_hosts.rb +20 -1
  189. data/lib/fog/zerigo/requests/dns/count_zones.rb +12 -1
  190. data/lib/fog/zerigo/requests/dns/create_host.rb +67 -1
  191. data/lib/fog/zerigo/requests/dns/create_zone.rb +44 -1
  192. data/lib/fog/zerigo/requests/dns/delete_host.rb +19 -0
  193. data/lib/fog/zerigo/requests/dns/delete_zone.rb +17 -0
  194. data/lib/fog/zerigo/requests/dns/find_hosts.rb +22 -1
  195. data/lib/fog/zerigo/requests/dns/get_host.rb +18 -1
  196. data/lib/fog/zerigo/requests/dns/get_zone.rb +19 -2
  197. data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +23 -0
  198. data/lib/fog/zerigo/requests/dns/list_hosts.rb +20 -1
  199. data/lib/fog/zerigo/requests/dns/list_zones.rb +15 -0
  200. data/lib/fog/zerigo/requests/dns/update_host.rb +20 -1
  201. data/lib/fog/zerigo/requests/dns/update_zone.rb +20 -1
  202. data/tests/aws/models/cloud_watch/alarm_data_tests.rb +42 -0
  203. data/tests/aws/models/cloud_watch/alarm_history_tests.rb +22 -0
  204. data/tests/aws/models/compute/security_group_tests.rb +15 -10
  205. data/tests/aws/models/elb/model_tests.rb +4 -4
  206. data/tests/aws/requests/cloud_formation/stack_tests.rb +14 -0
  207. data/tests/aws/requests/cloud_watch/list_metrics_test.rb +5 -5
  208. data/tests/aws/requests/compute/image_tests.rb +33 -2
  209. data/tests/aws/requests/compute/instance_tests.rb +16 -1
  210. data/tests/aws/requests/compute/security_group_tests.rb +251 -32
  211. data/tests/aws/requests/compute/tag_tests.rb +42 -2
  212. data/tests/aws/requests/emr/helper.rb +172 -0
  213. data/tests/aws/requests/emr/instance_group_tests.rb +106 -0
  214. data/tests/aws/requests/emr/job_flow_tests.rb +88 -0
  215. data/tests/aws/requests/iam/server_certificate_tests.rb +20 -7
  216. data/tests/aws/requests/storage/bucket_tests.rb +82 -54
  217. data/tests/aws/requests/storage/hash_to_acl_tests.rb +173 -0
  218. data/tests/aws/requests/storage/object_tests.rb +44 -24
  219. data/tests/brightbox/requests/compute/helper.rb +15 -6
  220. data/tests/core/attribute_tests.rb +29 -0
  221. data/tests/core/mocking_tests.rb +60 -0
  222. data/tests/dns/models/record_tests.rb +4 -2
  223. data/tests/dns/models/records_tests.rb +4 -2
  224. data/tests/dns/models/zone_tests.rb +3 -1
  225. data/tests/dns/models/zones_tests.rb +4 -2
  226. data/tests/helper.rb +4 -0
  227. data/tests/rackspace/requests/dns/dns_tests.rb +16 -12
  228. data/tests/rackspace/requests/dns/records_tests.rb +13 -11
  229. data/tests/slicehost/requests/dns/dns_tests.rb +58 -11
  230. data/tests/vsphere/compute_tests.rb +18 -10
  231. data/tests/vsphere/requests/compute/vm_clone_tests.rb +1 -1
  232. metadata +214 -221
@@ -105,20 +105,12 @@ geemus says: "That should give you everything you need to get started, but let m
105
105
 
106
106
  == Contributing
107
107
 
108
- * Find something you would like to work on. For suggestions look for the `easy`, `medium` and `hard` tags in the {issues}[http://github.com/geemus/fog/issues]
108
+ * Find something you would like to work on. For suggestions look for the `easy`, `medium` and `hard` tags in the {issues}[http://github.com/fog/fog/issues]
109
109
  * Fork the project and do your work in a topic branch.
110
110
  * Add shindo tests to prove your code works and run all the tests using `bundle exec rake`.
111
111
  * Rebase your branch against geemus/fog to make sure everything is up to date.
112
112
  * Commit your changes and send a pull request.
113
113
 
114
- == T-Shirts
115
-
116
- Wonder how you can get a lovely fog shirt? Look no further!
117
-
118
- * Blue shirts go to people who have contributed indirectly, great examples are writing blog posts or giving lightning talks.
119
- * Grey shirts and a follow from @fog go to people who have made it on to the {contributors list}[https://github.com/geemus/fog/contributors] by submitting code.
120
- * Black shirts go to people who have made it on to the {collaborators list}[https://github.com/api/v2/json/repos/show/geemus/fog/collaborators] by coercing geemus into adding them.
121
-
122
114
  == Additional Resources
123
115
 
124
116
  {fog.io}[http://fog.io]
@@ -128,6 +120,7 @@ Wonder how you can get a lovely fog shirt? Look no further!
128
120
  http://www.engineyard.com/images/logo.png
129
121
 
130
122
  All new work on fog is sponsored by {Engine Yard}[http://engineyard.com]
123
+
131
124
  == Copyright
132
125
 
133
126
  (The MIT License)
data/Rakefile CHANGED
@@ -203,9 +203,9 @@ task :changelog do
203
203
  changelog << ''
204
204
 
205
205
  require 'multi_json'
206
- github_repo_data = MultiJson.decode(Excon.get('http://github.com/api/v2/json/repos/show/geemus/fog').body)
206
+ github_repo_data = MultiJson.decode(Excon.get('http://github.com/api/v2/json/repos/show/fog/fog').body)
207
207
  data = github_repo_data['repository'].reject {|key, value| !['forks', 'open_issues', 'watchers'].include?(key)}
208
- github_collaborator_data = MultiJson.decode(Excon.get('http://github.com/api/v2/json/repos/show/geemus/fog/collaborators').body)
208
+ github_collaborator_data = MultiJson.decode(Excon.get('http://github.com/api/v2/json/repos/show/fog/fog/collaborators').body)
209
209
  data['collaborators'] = github_collaborator_data['collaborators'].length
210
210
  rubygems_data = MultiJson.decode(Excon.get('https://rubygems.org/api/v1/gems/fog.json').body)
211
211
  data['downloads'] = rubygems_data['downloads']
@@ -250,6 +250,7 @@ task :changelog do
250
250
  'Lincoln Stoll',
251
251
  'Luqman Amjad',
252
252
  'nightshade427',
253
+ 'Patrick Debois',
253
254
  'Wesley Beary'
254
255
  ].include?(committer)
255
256
  next
@@ -35,32 +35,32 @@
35
35
  <dl>
36
36
  <dt>version</dt><dd>vX.Y.Z</dd>
37
37
  <dt>install</dt><dd><code>gem install fog</code></dd>
38
- <dt>source</dt><dd><a href="http://github.com/geemus/fog">geemus/fog</a></dd>
38
+ <dt>source</dt><dd><a href="http://github.com/fog/fog">geemus/fog</a></dd>
39
39
  </dl>
40
40
  </header>
41
41
 
42
- <div id="main">
43
-
44
- {{ content }}
45
-
46
- <h2>Services</h2>
42
+ <nav>
47
43
  <ul>
48
- <li><a href="/cdn">CDN</a></li>
44
+ <li><a href="/">Home</a></li>
45
+ <li><a href="/about/structure.html">Structure</a></li>
46
+ <li><a href="/about/getting_started.html">Getting Started</a></li>
47
+ <li>&nbsp;</li>
48
+ <li><a href="/storage">Storage</a></li>
49
49
  <li><a href="/compute">Compute</a></li>
50
50
  <li><a href="/dns">DNS</a></li>
51
- <li><a href="/storage">Storage</a></li>
52
- {% for post in site.posts %}
53
- <li><a href="{{ post.url }}">{{ post.title }}</a></li>
54
- {% endfor %}
51
+ <li><a href="/cdn">CDN</a></li>
55
52
  </ul>
53
+ </nav>
54
+
55
+ <div id="main">
56
+
57
+ {{ content }}
56
58
 
57
59
  <h2>About</h2>
58
60
  <ul>
59
61
  <li><a href="/">Home</a></li>
60
62
  <li><a href="/about/contributing.html">Contributing</a></li>
61
- <li><a href="/about/getting_started.html">Getting Started</a></li>
62
63
  <li><a href="/about/press.html">Press</a></li>
63
- <li><a href="/about/structure.html">Structure</a></li>
64
64
  <li><a href="/about/supported_services.html">Supported Services</a></li>
65
65
  <li><a href="/about/users.html">Users</a></li>
66
66
  </ul>
@@ -86,7 +86,7 @@ end
86
86
 
87
87
  ## Tests
88
88
 
89
- Now would be a good time to write some tests to make sure what you have written works (and will continue to). I've tried a couple variations on testing in the past, but have settled on consolidated lifetime testing. These vary enough that its hard to give a single simple example, but you can see many examples in "tests/compute/requests/aws":https://github.com/geemus/fog/tree/master/tests/compute/requests/aws/.
89
+ Now would be a good time to write some tests to make sure what you have written works (and will continue to). I've tried a couple variations on testing in the past, but have settled on consolidated lifetime testing. These vary enough that its hard to give a single simple example, but you can see many examples in "tests/compute/requests/aws":https://github.com/fog/fog/tree/master/tests/compute/requests/aws/.
90
90
 
91
91
  ### Highlights:
92
92
  * Reuse the same objects and take them through their whole life cycle (this is much faster, and most of the time if one portion fails the others would anyway).
@@ -65,7 +65,7 @@ After that you should be able to check your directory list in fog or your filesy
65
65
 
66
66
  ## Next Steps
67
67
 
68
- Using the same interface you can also practice working against a real provider (such as Amazon S3). Rather than worrying about signing up for an account right away though, we can use mocks to simulate S3 while we practice.
68
+ Using the same interface you can also practice working against a real provider (such as Amazon S3). Rather than worrying about signing up for an account right away though, we can use mocks to simulate S3 while we practice.
69
69
 
70
70
  This time we will turn on mocking and then, just like before, we will need to make a connection.
71
71
 
@@ -76,8 +76,33 @@ This time we will turn on mocking and then, just like before, we will need to ma
76
76
  :provider => 'AWS'
77
77
  })
78
78
 
79
- You may notice that we used bogus credentials, this is fine since we are just simulating things. To use real S3 you can simply omit `Fog.mock!` and swap in your real credentials.
79
+ You may notice that we used bogus credentials, this is fine since we are just simulating things. To use real S3 you can simply omit Fog.mock! and swap in your real credentials.
80
80
 
81
- Once you have your connection you can go through all the steps you did before, only now you will be working against a real cloud service (or at least a simulated one).
81
+ If you'd like to turn off mocking after turning it on, you can do it at any time and every subsequent connection will be a real connection.
82
+
83
+ # Turn on mocking
84
+ Fog.mock!
85
+
86
+ # Create a mock connection to S3
87
+ storage = Fog::Storage.new({
88
+ :aws_access_key_id => "asdf",
89
+ :aws_secret_access_key => "asdf",
90
+ :provider => "AWS"
91
+ })
92
+
93
+ # Turn off mocking
94
+ Fog.unmock!
95
+
96
+ # Create a real connection to S3
97
+ storage = Fog::Storage.new({
98
+ :aws_access_key_id => "asdf",
99
+ :aws_secret_access_key => "asdf",
100
+ :provider => "AWS"
101
+ })
102
+
103
+ Don't worry about your losing mock data, it stays around until you reset it or until your process exits.
104
+
105
+ # Reset all mock data
106
+ Fog::Mock.reset
82
107
 
83
108
  Congratulations and welcome to the cloud! Continue your journey at [fog.io](http://fog.io)
@@ -41,7 +41,7 @@ Now that you have a zone you will need to update your registrar to let them know
41
41
  With your new zone in hand you can add records as needed. First and foremost you will probably want the 'www' version of your site to point to whatever your ip might be:
42
42
 
43
43
  record = @zone.records.create(
44
- :ip => '1.2.3.4',
44
+ :value => '1.2.3.4',
45
45
  :name => 'example.com',
46
46
  :type => 'A'
47
47
  )
@@ -49,7 +49,7 @@ With your new zone in hand you can add records as needed. First and foremost yo
49
49
  Adding other records is similarly easy, for instance if we want 'www.example.com' to go to the same place, we can use a cname record:
50
50
 
51
51
  record = @zone.records.create(
52
- :ip => 'example.com',
52
+ :value => 'example.com',
53
53
  :name => 'www',
54
54
  :type => 'CNAME'
55
55
  )
@@ -57,7 +57,7 @@ Adding other records is similarly easy, for instance if we want 'www.example.com
57
57
  Or, similarly you might want to have your blog elsewhere:
58
58
 
59
59
  record = @zone.records.create(
60
- :ip => '4.3.2.1',
60
+ :value => '4.3.2.1',
61
61
  :name => 'blog.example.com',
62
62
  :type => 'A'
63
63
  )
@@ -76,4 +76,4 @@ If you already have an account with another service you can just as easily use t
76
76
 
77
77
  ## Go Forth and Resolve
78
78
 
79
- You can see an example of reusing code like this in the <a href="https://github.com/geemus/fog/blob/master/examples/dns_tests.rb">examples folder</a>. Using this makes it easier to give yourself shortcuts to your cloud servers and manage how clients and users access them as well. It is great to have this flexibility so that you can modify your cloud infrastructure as needed while keeping everything ship shape. It also provides a nice way to create custom subdomains for users and just generally round out your cloud solution.
79
+ You can see an example of reusing code like this in the <a href="https://github.com/fog/fog/blob/master/examples/dns_tests.rb">examples folder</a>. Using this makes it easier to give yourself shortcuts to your cloud servers and manage how clients and users access them as well. It is great to have this flexibility so that you can modify your cloud infrastructure as needed while keeping everything ship shape. It also provides a nice way to create custom subdomains for users and just generally round out your cloud solution.
@@ -42,20 +42,12 @@ geemus says: "That should give you everything you need to get started, but let m
42
42
 
43
43
  ## Contributing
44
44
 
45
- * Find something you would like to work on. For suggestions look for the `easy`, `medium` and `hard` tags in the [issues](http://github.com/geemus/fog/issues)
45
+ * Find something you would like to work on. For suggestions look for the `easy`, `medium` and `hard` tags in the [issues](http://github.com/fog/fog/issues)
46
46
  * Fork the project and do your work in a topic branch.
47
47
  * Add shindo tests to prove your code works and run all the tests using `bundle exec rake`.
48
48
  * Rebase your branch against geemus/fog to make sure everything is up to date.
49
49
  * Commit your changes and send a pull request.
50
50
 
51
- ## T-Shirts
52
-
53
- Wonder how you can get a lovely fog shirt? Look no further!
54
-
55
- * Blue shirts go to people who have contributed indirectly, great examples are writing blog posts or giving lightning talks.
56
- * Grey shirts and a follow from @fog go to people who have made it on to the [contributors list](https://github.com/geemus/fog/contributors) by submitting code.
57
- * Black shirts go to people who have made it on to the [collaborators list](https://github.com/api/v2/json/repos/show/geemus/fog/collaborators) by coercing geemus into adding them (geemus is currently the only member of this list).
58
-
59
51
  ## Resources
60
52
 
61
53
  Enjoy, and let me know what I can do to continue improving fog!
@@ -65,7 +57,7 @@ Enjoy, and let me know what I can do to continue improving fog!
65
57
  * Stay up to date by following [@fog](http://twitter.com/fog) and/or [@geemus](http://twitter.com/geemus) on Twitter.
66
58
  * Get and give help on the [#ruby-fog](irc://irc.freenode.net/ruby-fog) irc channel on Freenode
67
59
  * Follow release notes and discussions on the [mailing list](http://groups.google.com/group/ruby-fog)
68
- * Report bugs or find tasks to help with in the [issues](http://github.com/geemus/fog/issues)
60
+ * Report bugs or find tasks to help with in the [issues](http://github.com/fog/fog/issues)
69
61
  * Learn about [contributing](/about/contributing.html)
70
62
  * See where fog is used and let the world know how you use it [in the wild](/about/users.html)
71
63
  * Check out blog posts and other mentions in the [press](/about/press.html)
@@ -56,7 +56,7 @@ header dl dt {
56
56
  font-weight: bold;
57
57
  }
58
58
 
59
- #main {
59
+ nav, #main {
60
60
  background-color: #FFF;
61
61
  -moz-border-radius: 0.5em;
62
62
  border-radius: 0.5em;
@@ -66,6 +66,19 @@ header dl dt {
66
66
  margin-bottom: 2em;
67
67
  }
68
68
 
69
+ nav {
70
+ padding: 1em;
71
+ }
72
+
73
+ nav li {
74
+ display: inline;
75
+ padding-left: 2em;
76
+ }
77
+
78
+ nav li a {
79
+ font-size: 1.5em;
80
+ }
81
+
69
82
  footer {
70
83
  background-color: #A0C0E1;
71
84
  border-color: #70A1D2;
@@ -5,13 +5,13 @@ title: Storage
5
5
 
6
6
  Having Ruby experience makes you hirable; but how can you stand out? You need to demonstrate your abilities. What better way than using Ruby and "the cloud" to store and serve your resume!
7
7
 
8
- In this blog post you will learn to use <a href="http://github.com/geemus/fog">fog</a> - the cloud computing library - to upload your resume to Amazon's <a href="http://aws.amazon.com/s3/">Simple Storage Service</a> (S3), Rackspace's <a href="http://www.rackspacecloud.com/cloud_hosting_products/files">CloudFiles</a> or Google's <a href="http://code.google.com/apis/storage/">Storage for Developers</a>.
8
+ In this blog post you will learn to use <a href="http://github.com/fog/fog">fog</a> - the cloud computing library - to upload your resume to Amazon's <a href="http://aws.amazon.com/s3/">Simple Storage Service</a> (S3), Rackspace's <a href="http://www.rackspacecloud.com/cloud_hosting_products/files">CloudFiles</a> or Google's <a href="http://code.google.com/apis/storage/">Storage for Developers</a>.
9
9
 
10
10
  Here's my out of date resume stored on <a href="http://geemus.s3.amazonaws.com/resume.html">S3</a>, <a href="http://c0023559.cdn2.cloudfiles.rackspacecloud.com/resume.html">CloudFiles</a> and <a href="https://geemus.commondatastorage.googleapis.com/resume.html">Google Storage</a>; programmatically stored in the cloud using this tutorial. NOTE: my boss would like me to add that I'm not currently looking for a new gig ;)
11
11
 
12
12
  Check out those cloud-specific URLs! You could put all three in your job application, add the Ruby source for how you did it, and have your choice of Ruby jobs for being so awesome!
13
13
 
14
- How? The all-clouds-in-one library of choice is <a href="https://github.com/geemus/fog">fog</a>.
14
+ How? The all-clouds-in-one library of choice is <a href="https://github.com/fog/fog">fog</a>.
15
15
 
16
16
  ## Installing fog
17
17
 
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  ## If your rubyforge_project name is different, then edit it and comment out
7
7
  ## the sub! line in the Rakefile
8
8
  s.name = 'fog'
9
- s.version = '1.0.0'
10
- s.date = '2011-09-29'
9
+ s.version = '1.1.0'
10
+ s.date = '2011-11-11'
11
11
  s.rubyforge_project = 'fog'
12
12
 
13
13
  ## Make sure your summary is short. The description may be as long
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  ## a custom homepage, consider using your GitHub URL or the like.
21
21
  s.authors = ["geemus (Wesley Beary)"]
22
22
  s.email = 'geemus@gmail.com'
23
- s.homepage = 'http://github.com/geemus/fog'
23
+ s.homepage = 'http://github.com/fog/fog'
24
24
 
25
25
  ## This sections is only necessary if you have C extensions.
26
26
  # s.require_paths << 'ext'
@@ -37,12 +37,12 @@ Gem::Specification.new do |s|
37
37
  ## List your runtime dependencies here. Runtime dependencies are those
38
38
  ## that are needed for an end user to actually USE your code.
39
39
  s.add_dependency('builder')
40
- s.add_dependency('excon', '~>0.7.3')
40
+ s.add_dependency('excon', '~>0.7.4')
41
41
  s.add_dependency('formatador', '~>0.2.0')
42
42
  s.add_dependency('multi_json', '~>1.0.3')
43
43
  s.add_dependency('mime-types')
44
44
  s.add_dependency('net-scp', '~>1.0.4')
45
- s.add_dependency('net-ssh', '~>2.1.4')
45
+ s.add_dependency('net-ssh', '>=2.2.1')
46
46
  s.add_dependency('nokogiri', '~>1.5.0')
47
47
  s.add_dependency('ruby-hmac')
48
48
 
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
50
50
  ## those that are only needed during development
51
51
  s.add_development_dependency('jekyll')
52
52
  s.add_development_dependency('rake')
53
+ s.add_development_dependency('rbvmomi')
53
54
  s.add_development_dependency('rdoc')
54
55
  s.add_development_dependency('rspec', '~>1.3.1')
55
56
  s.add_development_dependency('shindo', '~>0.3.4')
data/lib/fog.rb CHANGED
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), 'fog', 'core')
3
3
  module Fog
4
4
 
5
5
  unless const_defined?(:VERSION)
6
- VERSION = '1.0.0'
6
+ VERSION = '1.1.0'
7
7
  end
8
8
 
9
9
  end
@@ -13,6 +13,7 @@ module Fog
13
13
  service(:dns, 'aws/dns', 'DNS')
14
14
  service(:elasticache, 'aws/elasticache', 'Elasticache')
15
15
  service(:elb, 'aws/elb', 'ELB')
16
+ service(:emr, 'aws/emr', 'EMR')
16
17
  service(:iam, 'aws/iam', 'IAM')
17
18
  service(:rds, 'aws/rds', 'RDS')
18
19
  service(:ses, 'aws/ses', 'SES')
@@ -27,10 +28,34 @@ module Fog
27
28
  key << '.%d'
28
29
  end
29
30
  [*values].each_with_index do |value, index|
30
- params[format(key, index + 1)] = value
31
+ if value.respond_to?('keys')
32
+ k = format(key, index + 1)
33
+ value.each do | vkey, vvalue |
34
+ params["#{k}.#{vkey}"] = vvalue
35
+ end
36
+ else
37
+ params[format(key, index + 1)] = value
38
+ end
31
39
  end
32
40
  params
33
41
  end
42
+
43
+ def self.serialize_keys(key, value, options = {})
44
+ case value
45
+ when Hash
46
+ value.each do | k, v |
47
+ options.merge!(serialize_keys("#{key}.#{k}", v))
48
+ end
49
+ return options
50
+ when Array
51
+ value.each_with_index do | it, idx |
52
+ options.merge!(serialize_keys("#{key}.member.#{(idx + 1)}", it))
53
+ end
54
+ return options
55
+ else
56
+ return {key => value}
57
+ end
58
+ end
34
59
 
35
60
  def self.indexed_filters(filters)
36
61
  params = {}
@@ -88,6 +88,8 @@ module Fog
88
88
  'autoscaling.us-east-1.amazonaws.com'
89
89
  when 'us-west-1'
90
90
  'autoscaling.us-west-1.amazonaws.com'
91
+ when 'us-west-2'
92
+ 'autoscaling.us-west-2.amazonaws.com'
91
93
  else
92
94
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
93
95
  end
@@ -204,7 +206,7 @@ module Fog
204
206
 
205
207
  @region = options[:region] || 'us-east-1'
206
208
 
207
- unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1'].include?(@region)
209
+ unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
208
210
  raise ArgumentError, "Unknown region: #{@region.inspect}"
209
211
  end
210
212
 
@@ -9,6 +9,7 @@ module Fog
9
9
 
10
10
  request_path 'fog/aws/requests/cloud_formation'
11
11
  request :create_stack
12
+ request :update_stack
12
13
  request :delete_stack
13
14
  request :describe_stack_events
14
15
  request :describe_stack_resources
@@ -64,6 +65,8 @@ module Fog
64
65
  'cloudformation.us-east-1.amazonaws.com'
65
66
  when 'us-west-1'
66
67
  'cloudformation.us-west-1.amazonaws.com'
68
+ when 'us-west-2'
69
+ 'cloudformation.us-west-2.amazonaws.com'
67
70
  else
68
71
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
69
72
  end
@@ -13,12 +13,26 @@ module Fog
13
13
  request :list_metrics
14
14
  request :get_metric_statistics
15
15
  request :put_metric_data
16
+ request :describe_alarms
17
+ request :put_metric_alarm
18
+ request :delete_alarms
19
+ request :describe_alarm_history
20
+ request :enable_alarm_actions
21
+ request :disable_alarm_actions
22
+ request :describe_alarms_for_metric
23
+ request :set_alarm_state
16
24
 
17
25
  model_path 'fog/aws/models/cloud_watch'
18
26
  model :metric
19
27
  collection :metrics
20
28
  model :metric_statistic
21
29
  collection :metric_statistics
30
+ model :alarm_datum
31
+ collection :alarm_data
32
+ model :alarm_history
33
+ collection :alarm_histories
34
+ model :alarm
35
+ collection :alarms
22
36
 
23
37
  class Mock
24
38
 
@@ -43,7 +57,7 @@ module Fog
43
57
  #
44
58
  # ==== Parameters
45
59
  # * options<~Hash> - config arguments for connection. Defaults to {}.
46
- # * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1', 'ap-southeast-1', 'ap-northeast-1']
60
+ # * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'ap-southeast-1', 'ap-northeast-1']
47
61
  #
48
62
  # ==== Returns
49
63
  # * CloudWatch object with connection to AWS.
@@ -65,6 +79,8 @@ module Fog
65
79
  'monitoring.us-east-1.amazonaws.com'
66
80
  when 'us-west-1'
67
81
  'monitoring.us-west-1.amazonaws.com'
82
+ when 'us-west-2'
83
+ 'monitoring.us-west-2.amazonaws.com'
68
84
  else
69
85
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
70
86
  end
@@ -93,7 +93,7 @@ module Fog
93
93
  class Real
94
94
 
95
95
  def modify_image_attributes(*params)
96
- Fog::Logger.warning("modify_image_attributes is deprecated, use modify_image_attribute instead [light_black](#{caller.first})[/]")
96
+ Fog::Logger.deprecation("modify_image_attributes is deprecated, use modify_image_attribute instead [light_black](#{caller.first})[/]")
97
97
  modify_image_attribute(*params)
98
98
  end
99
99
 
@@ -103,12 +103,17 @@ module Fog
103
103
 
104
104
  def self.data
105
105
  @data ||= Hash.new do |hash, region|
106
- owner_id = Fog::AWS::Mock.owner_id
107
106
  hash[region] = Hash.new do |region_hash, key|
107
+ owner_id = Fog::AWS::Mock.owner_id
108
108
  region_hash[key] = {
109
109
  :deleted_at => {},
110
110
  :addresses => {},
111
111
  :images => {},
112
+ :image_launch_permissions => Hash.new do |permissions_hash, image_key|
113
+ permissions_hash[image_key] = {
114
+ :users => []
115
+ }
116
+ end,
112
117
  :instances => {},
113
118
  :reserved_instances => {},
114
119
  :key_pairs => {},
@@ -147,7 +152,10 @@ module Fog
147
152
  },
148
153
  :snapshots => {},
149
154
  :volumes => {},
150
- :tags => {}
155
+ :tags => {},
156
+ :tag_sets => Hash.new do |tag_set_hash, resource_id|
157
+ tag_set_hash[resource_id] = {}
158
+ end
151
159
  }
152
160
  end
153
161
  end
@@ -162,41 +170,63 @@ module Fog
162
170
 
163
171
  @region = options[:region] || 'us-east-1'
164
172
 
165
- unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1'].include?(@region)
173
+ unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
166
174
  raise ArgumentError, "Unknown region: #{@region.inspect}"
167
175
  end
168
176
  end
169
177
 
178
+ def region_data
179
+ self.class.data[@region]
180
+ end
181
+
170
182
  def data
171
- self.class.data[@region][@aws_access_key_id]
183
+ self.region_data[@aws_access_key_id]
172
184
  end
173
185
 
174
186
  def reset_data
175
- self.class.data[@region].delete(@aws_access_key_id)
187
+ self.region_data.delete(@aws_access_key_id)
188
+ end
189
+
190
+ def visible_images
191
+ images = self.data[:images].values.inject({}) do |h, image|
192
+ h.update(image['imageId'] => image)
193
+ end
194
+
195
+ self.region_data.each do |aws_access_key_id, data|
196
+ data[:image_launch_permissions].each do |image_id, list|
197
+ if list[:users].include?(self.data[:owner_id])
198
+ images.update(image_id => data[:images][image_id])
199
+ end
200
+ end
201
+ end
202
+
203
+ images
176
204
  end
177
205
 
178
- def apply_tag_filters(resources, filters)
206
+ def apply_tag_filters(resources, filters, resource_id_key)
207
+ tag_set_fetcher = lambda {|resource| self.data[:tag_sets][resource[resource_id_key]] }
208
+
179
209
  # tag-key: match resources tagged with this key (any value)
180
210
  if filters.has_key?('tag-key')
181
211
  value = filters.delete('tag-key')
182
- resources = resources.select{|r| r['tagSet'].has_key?(value)}
212
+ resources = resources.select{|r| tag_set_fetcher[r].has_key?(value)}
183
213
  end
184
-
214
+
185
215
  # tag-value: match resources tagged with this value (any key)
186
216
  if filters.has_key?('tag-value')
187
217
  value = filters.delete('tag-value')
188
- resources = resources.select{|r| r['tagSet'].values.include?(value)}
218
+ resources = resources.select{|r| tag_set_fetcher[r].values.include?(value)}
189
219
  end
190
-
191
- # tag:key: match resources taged with a key-value pair. Value may be an array, which is OR'd.
220
+
221
+ # tag:key: match resources tagged with a key-value pair. Value may be an array, which is OR'd.
192
222
  tag_filters = {}
193
- filters.keys.each do |key|
223
+ filters.keys.each do |key|
194
224
  tag_filters[key.gsub('tag:', '')] = filters.delete(key) if /^tag:/ =~ key
195
225
  end
196
226
  for tag_key, tag_value in tag_filters
197
- resources = resources.select{|r| tag_value.include?(r['tagSet'][tag_key])}
227
+ resources = resources.select{|r| tag_value.include?(tag_set_fetcher[r][tag_key])}
198
228
  end
199
-
229
+
200
230
  resources
201
231
  end
202
232
  end
@@ -206,7 +236,7 @@ module Fog
206
236
  # Initialize connection to EC2
207
237
  #
208
238
  # ==== Notes
209
- # options parameter must include values for :aws_access_key_id and
239
+ # options parameter must include values for :aws_access_key_id and
210
240
  # :aws_secret_access_key in order to create a connection
211
241
  #
212
242
  # ==== Examples
@@ -218,7 +248,7 @@ module Fog
218
248
  # ==== Parameters
219
249
  # * options<~Hash> - config arguments for connection. Defaults to {}.
220
250
  # * region<~String> - optional region to use, in
221
- # ['eu-west-1', 'us-east-1', 'us-west-1', 'ap-northeast-1', 'ap-southeast-1']
251
+ # ['eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-southeast-1']
222
252
  #
223
253
  # ==== Returns
224
254
  # * EC2 object with connection to aws.
@@ -249,6 +279,8 @@ module Fog
249
279
  'ec2.us-east-1.amazonaws.com'
250
280
  when 'us-west-1'
251
281
  'ec2.us-west-1.amazonaws.com'
282
+ when 'us-west-2'
283
+ 'ec2.us-west-2.amazonaws.com'
252
284
  else
253
285
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
254
286
  end
@@ -265,7 +297,7 @@ module Fog
265
297
  end
266
298
 
267
299
  private
268
-
300
+
269
301
  def request(params)
270
302
  idempotent = params.delete(:idempotent)
271
303
  parser = params.delete(:parser)