brightbox-cli 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. data/README +13 -17
  2. data/README.rdoc +13 -17
  3. data/brightbox-cli.gemspec +1 -1
  4. data/lib/brightbox-cli/accounts.rb +7 -0
  5. data/lib/brightbox-cli/api.rb +3 -0
  6. data/lib/brightbox-cli/commands/config-client-list.rb +1 -1
  7. data/lib/brightbox-cli/commands/firewall-rules-create.rb +4 -0
  8. data/lib/brightbox-cli/commands/firewall-rules-update.rb +49 -0
  9. data/lib/brightbox-cli/commands/groups-show.rb +1 -1
  10. data/lib/brightbox-cli/commands/groups-update.rb +3 -1
  11. data/lib/brightbox-cli/commands/images-destroy.rb +1 -1
  12. data/lib/brightbox-cli/commands/images-list.rb +9 -3
  13. data/lib/brightbox-cli/commands/images-register.rb +1 -1
  14. data/lib/brightbox-cli/commands/images-update.rb +3 -1
  15. data/lib/brightbox-cli/commands/lbs-update.rb +4 -2
  16. data/lib/brightbox-cli/commands/{servers-activate-cloud.rb → servers-activate-console.rb} +2 -1
  17. data/lib/brightbox-cli/commands/servers-update.rb +2 -1
  18. data/lib/brightbox-cli/config.rb +17 -2
  19. data/lib/brightbox-cli/detailed_server.rb +1 -1
  20. data/lib/brightbox-cli/firewall_rule.rb +6 -0
  21. data/lib/brightbox-cli/gli_global_hooks.rb +8 -1
  22. data/lib/brightbox-cli/images.rb +22 -1
  23. data/lib/brightbox-cli/nilable_hash.rb +7 -0
  24. data/lib/brightbox-cli/server_groups.rb +0 -6
  25. data/lib/brightbox-cli/servers.rb +6 -2
  26. data/lib/brightbox-cli/tables.rb +13 -0
  27. data/lib/brightbox-cli/vendor/fog/README.rdoc +2 -9
  28. data/lib/brightbox-cli/vendor/fog/Rakefile +3 -2
  29. data/lib/brightbox-cli/vendor/fog/changelog.txt +213 -0
  30. data/lib/brightbox-cli/vendor/fog/docs/_layouts/default.html +1 -1
  31. data/lib/brightbox-cli/vendor/fog/docs/about/contributing.markdown +1 -1
  32. data/lib/brightbox-cli/vendor/fog/docs/about/getting_started.markdown +28 -3
  33. data/lib/brightbox-cli/vendor/fog/docs/dns/index.markdown +1 -1
  34. data/lib/brightbox-cli/vendor/fog/docs/index.markdown +2 -10
  35. data/lib/brightbox-cli/vendor/fog/docs/storage/index.markdown +2 -2
  36. data/lib/brightbox-cli/vendor/fog/fog.gemspec +6 -5
  37. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/auto_scaling.rb +3 -1
  38. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/cloud_formation.rb +3 -0
  39. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/cloud_watch.rb +3 -1
  40. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/compute.rb +5 -3
  41. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/elb.rb +4 -2
  42. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/emr.rb +133 -0
  43. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/addresses.rb +1 -1
  44. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/key_pairs.rb +1 -1
  45. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/security_groups.rb +1 -1
  46. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/server.rb +4 -2
  47. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/servers.rb +1 -1
  48. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/snapshots.rb +1 -1
  49. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/spot_request.rb +21 -4
  50. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/spot_requests.rb +45 -1
  51. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/volumes.rb +1 -1
  52. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/elb/load_balancer.rb +2 -0
  53. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/storage/file.rb +1 -1
  54. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +0 -1
  55. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/update_stack.rb +19 -0
  56. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/add_instance_groups.rb +28 -0
  57. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/add_job_flow_steps.rb +17 -0
  58. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/describe_job_flows.rb +140 -0
  59. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/modify_instance_groups.rb +17 -0
  60. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/run_job_flow.rb +19 -0
  61. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/set_termination_protection.rb +17 -0
  62. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/terminate_job_flows.rb +17 -0
  63. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/rds.rb +3 -1
  64. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cloud_formation/create_stack.rb +6 -0
  65. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cloud_formation/update_stack.rb +62 -0
  66. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +141 -36
  67. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/delete_security_group.rb +25 -0
  68. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/delete_tags.rb +1 -1
  69. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_addresses.rb +2 -2
  70. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_availability_zones.rb +5 -2
  71. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_images.rb +1 -1
  72. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_instances.rb +15 -6
  73. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_key_pairs.rb +2 -2
  74. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_regions.rb +2 -2
  75. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_reserved_instances.rb +1 -1
  76. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
  77. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_snapshots.rb +4 -4
  78. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_volumes.rb +2 -2
  79. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/modify_instance_attribute.rb +1 -1
  80. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +41 -29
  81. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/elb/describe_load_balancers.rb +3 -3
  82. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +1 -1
  83. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/add_instance_groups.rb +46 -0
  84. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/add_job_flow_steps.rb +49 -0
  85. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/describe_job_flows.rb +108 -0
  86. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/modify_instance_groups.rb +40 -0
  87. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/run_job_flow.rb +106 -0
  88. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/set_termination_protection.rb +39 -0
  89. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/terminate_job_flows.rb +37 -0
  90. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
  91. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/simpledb/select.rb +1 -1
  92. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/acl_utils.rb +62 -0
  93. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/get_bucket_acl.rb +7 -1
  94. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/get_object_acl.rb +7 -1
  95. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
  96. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/put_bucket_acl.rb +2 -2
  97. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/put_object_acl.rb +1 -1
  98. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/ses.rb +1 -1
  99. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/simpledb.rb +2 -0
  100. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/sns.rb +3 -1
  101. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/sqs.rb +4 -2
  102. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/storage.rb +10 -2
  103. data/lib/brightbox-cli/vendor/fog/lib/fog/aws.rb +26 -1
  104. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/aws.rb +8 -4
  105. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/bluebox.rb +2 -2
  106. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/brightbox.rb +1 -1
  107. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/dnsimple.rb +1 -1
  108. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/dnsmadeeasy.rb +1 -1
  109. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/ecloud.rb +1 -1
  110. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/glesys.rb +1 -1
  111. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/go_grid.rb +1 -1
  112. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/google.rb +1 -1
  113. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/libvirt.rb +1 -1
  114. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/linode.rb +2 -2
  115. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/local.rb +1 -1
  116. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/new_servers.rb +1 -1
  117. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/ninefold.rb +2 -2
  118. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/openstack.rb +1 -1
  119. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/rackspace.rb +3 -3
  120. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/slicehost.rb +1 -1
  121. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/stormondemand.rb +1 -1
  122. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/virtual_box.rb +1 -1
  123. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/vmfusion.rb +1 -1
  124. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/voxel.rb +1 -1
  125. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/zerigo.rb +1 -1
  126. data/lib/brightbox-cli/vendor/fog/lib/fog/bin.rb +1 -1
  127. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/compute.rb +2 -0
  128. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/cloud_ip.rb +10 -2
  129. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/server.rb +11 -3
  130. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/server_group.rb +9 -0
  131. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/requests/compute/update_firewall_rule.rb +13 -0
  132. data/lib/brightbox-cli/vendor/fog/lib/fog/core/connection.rb +1 -1
  133. data/lib/brightbox-cli/vendor/fog/lib/fog/core/credentials.rb +3 -3
  134. data/lib/brightbox-cli/vendor/fog/lib/fog/core/deprecation.rb +2 -2
  135. data/lib/brightbox-cli/vendor/fog/lib/fog/core/logger.rb +8 -3
  136. data/lib/brightbox-cli/vendor/fog/lib/fog/core/mock.rb +4 -0
  137. data/lib/brightbox-cli/vendor/fog/lib/fog/core/provider.rb +7 -2
  138. data/lib/brightbox-cli/vendor/fog/lib/fog/core/service.rb +8 -2
  139. data/lib/brightbox-cli/vendor/fog/lib/fog/dnsmadeeasy/models/dns/record.rb +3 -2
  140. data/lib/brightbox-cli/vendor/fog/lib/fog/dynect/dns.rb +25 -3
  141. data/lib/brightbox-cli/vendor/fog/lib/fog/ecloud/compute.rb +1 -1
  142. data/lib/brightbox-cli/vendor/fog/lib/fog/go_grid/requests/compute/grid_server_power.rb +1 -1
  143. data/lib/brightbox-cli/vendor/fog/lib/fog/google/models/storage/file.rb +1 -1
  144. data/lib/brightbox-cli/vendor/fog/lib/fog/google/requests/storage/get_object_url.rb +2 -2
  145. data/lib/brightbox-cli/vendor/fog/lib/fog/google/storage.rb +1 -1
  146. data/lib/brightbox-cli/vendor/fog/lib/fog/ninefold/models/storage/file.rb +8 -6
  147. data/lib/brightbox-cli/vendor/fog/lib/fog/ninefold/models/storage/files.rb +3 -2
  148. data/lib/brightbox-cli/vendor/fog/lib/fog/ninefold/requests/storage/head_namespace.rb +20 -0
  149. data/lib/brightbox-cli/vendor/fog/lib/fog/ninefold/storage.rb +4 -2
  150. data/lib/brightbox-cli/vendor/fog/lib/fog/openstack/models/compute/server.rb +7 -1
  151. data/lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/create_server.rb +6 -11
  152. data/lib/brightbox-cli/vendor/fog/lib/fog/rackspace/load_balancers.rb +1 -0
  153. data/lib/brightbox-cli/vendor/fog/lib/fog/rackspace/models/dns/callback.rb +1 -1
  154. data/lib/brightbox-cli/vendor/fog/lib/fog/rackspace/models/dns/record.rb +1 -1
  155. data/lib/brightbox-cli/vendor/fog/lib/fog/rackspace/models/dns/zone.rb +1 -1
  156. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/dns.rb +1 -0
  157. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/models/dns/record.rb +7 -3
  158. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/models/dns/zone.rb +1 -1
  159. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/parsers/dns/create_record.rb +8 -2
  160. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/parsers/dns/get_record.rb +17 -5
  161. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/parsers/dns/get_records.rb +10 -2
  162. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
  163. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/get_records.rb +7 -8
  164. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb +43 -0
  165. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/balancers.rb +1 -1
  166. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/configs.rb +1 -1
  167. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/images.rb +1 -1
  168. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/servers.rb +1 -1
  169. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/templates.rb +1 -1
  170. data/lib/brightbox-cli/vendor/fog/lib/fog/terremark/vcloud.rb +1 -1
  171. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/compute.rb +41 -23
  172. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/models/compute/server.rb +19 -0
  173. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/models/compute/servers.rb +8 -2
  174. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/requests/compute/datacenters.rb +34 -0
  175. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +83 -10
  176. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/requests/compute/vm_clone.rb +76 -37
  177. data/lib/brightbox-cli/vendor/fog/lib/fog.rb +1 -1
  178. data/lib/brightbox-cli/vendor/fog/tests/aws/models/cloud_watch/alarm_data_tests.rb +8 -6
  179. data/lib/brightbox-cli/vendor/fog/tests/aws/models/cloud_watch/alarm_history_tests.rb +3 -1
  180. data/lib/brightbox-cli/vendor/fog/tests/aws/models/compute/security_group_tests.rb +15 -10
  181. data/lib/brightbox-cli/vendor/fog/tests/aws/models/elb/model_tests.rb +4 -4
  182. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/cloud_formation/stack_tests.rb +14 -0
  183. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/compute/instance_tests.rb +16 -1
  184. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/compute/security_group_tests.rb +251 -32
  185. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/compute/tag_tests.rb +2 -2
  186. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/emr/helper.rb +172 -0
  187. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/emr/instance_group_tests.rb +106 -0
  188. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/emr/job_flow_tests.rb +88 -0
  189. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/storage/acl_utils_tests.rb +209 -0
  190. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/storage/bucket_tests.rb +80 -55
  191. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/storage/object_tests.rb +42 -24
  192. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/account_tests.rb +11 -6
  193. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/api_client_tests.rb +23 -12
  194. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/cloud_ip_tests.rb +29 -20
  195. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/helper.rb +70 -14
  196. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/image_tests.rb +17 -14
  197. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/interface_tests.rb +3 -2
  198. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/load_balancer_tests.rb +57 -11
  199. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/server_group_tests.rb +29 -22
  200. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/server_tests.rb +38 -21
  201. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/server_type_tests.rb +7 -6
  202. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/user_tests.rb +11 -16
  203. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/zone_tests.rb +7 -6
  204. data/lib/brightbox-cli/vendor/fog/tests/compute/helper.rb +1 -1
  205. data/lib/brightbox-cli/vendor/fog/tests/core/credential_tests.rb +2 -2
  206. data/lib/brightbox-cli/vendor/fog/tests/core/mocking_tests.rb +60 -0
  207. data/lib/brightbox-cli/vendor/fog/tests/dns/models/record_tests.rb +4 -2
  208. data/lib/brightbox-cli/vendor/fog/tests/dns/models/records_tests.rb +4 -2
  209. data/lib/brightbox-cli/vendor/fog/tests/dns/models/zone_tests.rb +3 -1
  210. data/lib/brightbox-cli/vendor/fog/tests/dns/models/zones_tests.rb +4 -2
  211. data/lib/brightbox-cli/vendor/fog/tests/glesys/requests/compute/helper.rb +4 -2
  212. data/lib/brightbox-cli/vendor/fog/tests/glesys/requests/compute/server_tests.rb +1 -1
  213. data/lib/brightbox-cli/vendor/fog/tests/helper.rb +4 -0
  214. data/lib/brightbox-cli/vendor/fog/tests/rackspace/requests/dns/dns_tests.rb +16 -12
  215. data/lib/brightbox-cli/vendor/fog/tests/rackspace/requests/dns/records_tests.rb +13 -11
  216. data/lib/brightbox-cli/vendor/fog/tests/slicehost/requests/dns/dns_tests.rb +58 -11
  217. data/lib/brightbox-cli/vendor/fog/tests/vsphere/compute_tests.rb +18 -10
  218. data/lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/vm_clone_tests.rb +3 -7
  219. data/lib/brightbox-cli/version.rb +1 -1
  220. data/lib/brightbox_cli.rb +1 -0
  221. data/spec/fixtures/vcr_cassettes/list_server_groups.yml +37 -6
  222. data/spec/nilable_hash_spec.rb +30 -0
  223. metadata +48 -18
  224. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/hash_to_acl.rb +0 -44
@@ -57,7 +57,7 @@ module Fog
57
57
 
58
58
  def all(filters = filters)
59
59
  unless filters.is_a?(Hash)
60
- Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('group-name' => []) instead [light_black](#{caller.first})[/]")
60
+ Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('group-name' => []) instead [light_black](#{caller.first})[/]")
61
61
  filters = {'group-name' => [*filters]}
62
62
  end
63
63
  self.filters = filters
@@ -169,8 +169,10 @@ module Fog
169
169
  data = connection.run_instances(image_id, 1, 1, options)
170
170
  merge_attributes(data.body['instancesSet'].first)
171
171
 
172
- if self.tags
173
- for key, value in self.tags
172
+ if tags = self.tags
173
+ # expect eventual consistency
174
+ Fog.wait_for { self.reload rescue nil }
175
+ for key, value in (self.tags = tags)
174
176
  connection.tags.create(
175
177
  :key => key,
176
178
  :resource_id => self.identity,
@@ -57,7 +57,7 @@ module Fog
57
57
 
58
58
  def all(filters = self.filters)
59
59
  unless filters.is_a?(Hash)
60
- Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('instance-id' => []) instead [light_black](#{caller.first})[/]")
60
+ Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('instance-id' => []) instead [light_black](#{caller.first})[/]")
61
61
  filters = {'instance-id' => [*filters]}
62
62
  end
63
63
  self.filters = filters
@@ -19,7 +19,7 @@ module Fog
19
19
 
20
20
  def all(filters = filters, options = {})
21
21
  unless filters.is_a?(Hash)
22
- Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
22
+ Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
23
23
  filters = {'snapshot-id' => [*filters]}
24
24
  end
25
25
  self.filters = filters
@@ -55,6 +55,27 @@ module Fog
55
55
  super
56
56
  end
57
57
 
58
+ def destroy
59
+ requires :id
60
+
61
+ connection.cancel_spot_instance_requests(id)
62
+ true
63
+ end
64
+
65
+ def key_pair
66
+ requires :key_name
67
+
68
+ connection.key_pairs.all(key_name).first
69
+ end
70
+
71
+ def key_pair=(new_keypair)
72
+ self.key_name = new_keypair && new_keypair.name
73
+ end
74
+
75
+ def ready?
76
+ state == 'active'
77
+ end
78
+
58
79
  def save
59
80
  requires :image_id, :flavor_id, :price
60
81
 
@@ -83,10 +104,6 @@ module Fog
83
104
  merge_attributes( spot_instance_request )
84
105
  end
85
106
 
86
- def ready?
87
- state == 'active'
88
- end
89
-
90
107
  end
91
108
  end
92
109
  end
@@ -17,7 +17,7 @@ module Fog
17
17
 
18
18
  def all(filters = self.filters)
19
19
  unless filters.is_a?(Hash)
20
- Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('spot-instance-request-id' => []) instead [light_black](#{caller.first})[/]")
20
+ Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('spot-instance-request-id' => []) instead [light_black](#{caller.first})[/]")
21
21
  filters = {'spot-instance-request-id' => [*filters]}
22
22
  end
23
23
  self.filters = filters
@@ -34,6 +34,50 @@ module Fog
34
34
  )
35
35
  end
36
36
 
37
+ def bootstrap(new_attributes = {})
38
+ spot_request = connection.spot_requests.new(new_attributes)
39
+
40
+ unless new_attributes[:key_name]
41
+ # first or create fog_#{credential} keypair
42
+ name = Fog.respond_to?(:credential) && Fog.credential || :default
43
+ unless spot_request.key_pair = connection.key_pairs.get("fog_#{name}")
44
+ spot_request.key_pair = connection.key_pairs.create(
45
+ :name => "fog_#{name}",
46
+ :public_key => server.public_key
47
+ )
48
+ end
49
+ end
50
+
51
+ # make sure port 22 is open in the first security group
52
+ security_group = connection.security_groups.get(spot_request.groups.first)
53
+ authorized = security_group.ip_permissions.detect do |ip_permission|
54
+ ip_permission['ipRanges'].first && ip_permission['ipRanges'].first['cidrIp'] == '0.0.0.0/0' &&
55
+ ip_permission['fromPort'] == 22 &&
56
+ ip_permission['ipProtocol'] == 'tcp' &&
57
+ ip_permission['toPort'] == 22
58
+ end
59
+ unless authorized
60
+ security_group.authorize_port_range(22..22)
61
+ end
62
+
63
+ spot_request.save
64
+ spot_request.wait_for { ready? }
65
+ Fog.wait_for { server = connection.servers.get(spot_request.instance_id) }
66
+ server = connection.servers.get(spot_request.instance_id)
67
+ if spot_request.tags
68
+ for key, value in spot_request.tags
69
+ connection.tags.create(
70
+ :key => key,
71
+ :resource_id => spot_request.instance_id,
72
+ :value => value
73
+ )
74
+ end
75
+ end
76
+ server.wait_for { ready? }
77
+ server.setup(:key_data => [server.private_key])
78
+ server
79
+ end
80
+
37
81
  def get(spot_request_id)
38
82
  if spot_request_id
39
83
  self.class.new(:connection => connection).all('spot-instance-request-id' => spot_request_id).first
@@ -64,7 +64,7 @@ module Fog
64
64
 
65
65
  def all(filters = filters)
66
66
  unless filters.is_a?(Hash)
67
- Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('volume-id' => []) instead [light_black](#{caller.first})[/]")
67
+ Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('volume-id' => []) instead [light_black](#{caller.first})[/]")
68
68
  filters = {'volume-id' => [*filters]}
69
69
  end
70
70
  self.filters = filters
@@ -12,6 +12,8 @@ module Fog
12
12
  attribute :health_check, :aliases => 'HealthCheck'
13
13
  attribute :instances, :aliases => 'Instances'
14
14
  attribute :source_group, :aliases => 'SourceSecurityGroup'
15
+ attribute :hosted_zone_name, :aliases => 'CanonicalHostedZoneName'
16
+ attribute :hosted_zone_name_id, :aliases => 'CanonicalHostedZoneNameID'
15
17
 
16
18
  def initialize(attributes={})
17
19
  attributes[:availability_zones] ||= attributes['AvailabilityZones'] || %w(us-east-1a us-east-1b us-east-1c us-east-1d)
@@ -104,7 +104,7 @@ module Fog
104
104
  def save(options = {})
105
105
  requires :body, :directory, :key
106
106
  if options != {}
107
- Fog::Logger.warning("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
107
+ Fog::Logger.deprecation("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
108
108
  end
109
109
  options['x-amz-acl'] ||= @acl if @acl
110
110
  options['Cache-Control'] = cache_control if cache_control
@@ -15,7 +15,6 @@ module Fog
15
15
  end
16
16
 
17
17
  def end_element(name)
18
- puts name
19
18
  case name
20
19
  when 'InvalidationSummary'
21
20
  @response['InvalidationSummary'] << @invalidation_summary
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module CloudFormation
5
+
6
+ class UpdateStack < Fog::Parsers::Base
7
+
8
+ def end_element(name)
9
+ case name
10
+ when 'RequestId', 'StackId'
11
+ @response[name] = value
12
+ end
13
+ end
14
+
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module EMR
5
+
6
+ class AddInstanceGroups < Fog::Parsers::Base
7
+
8
+ def start_element(name, attrs = [])
9
+ super
10
+ case name
11
+ when 'InstanceGroupIds'
12
+ @response['InstanceGroupIds'] = []
13
+ end
14
+ end
15
+
16
+ def end_element(name)
17
+ case name
18
+ when 'JobFlowId'
19
+ @response[name] = value
20
+ when 'member'
21
+ @response['InstanceGroupIds'] << value
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module EMR
5
+
6
+ class AddJobFlowSteps < Fog::Parsers::Base
7
+ def end_element(name)
8
+ case name
9
+ when 'RequestId'
10
+ @response[name] = value
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,140 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module EMR
5
+
6
+ class DescribeJobFlows < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @context = []
10
+ @contexts = ['BootstrapActions', 'ExecutionStatusDetail', 'Instances', 'Steps', 'InstanceGroups', 'Args']
11
+
12
+ @response = { 'JobFlows' => [] }
13
+ @bootstrap_actions = {'ScriptBootstrapActionConfig' => {'Args' => []}}
14
+ @instance = { 'InstanceGroups' => [], 'Placement' => {}}
15
+ @step = {
16
+ 'ExecutionStatusDetail' => {},
17
+ 'StepConfig' => {
18
+ 'HadoopJarStepConfig' => {
19
+ 'Args' => [],
20
+ 'Properties' => []
21
+ }
22
+ }
23
+ }
24
+ @flow = {'Instances' => [], 'ExecutionStatusDetail' => {}, 'BootstrapActions' => [], 'Steps' => []}
25
+ @instance_group_detail = {}
26
+ @execution_status_detail = {}
27
+ end
28
+
29
+ def start_element(name, attrs = [])
30
+ super
31
+ if @contexts.include?(name)
32
+ @context.push(name)
33
+ end
34
+ end
35
+
36
+ def end_element(name)
37
+ if @context.last == 'BootstrapActions'
38
+ case name
39
+ when 'Name'
40
+ @bootstrap_actions[name] = value
41
+ when 'Path'
42
+ @bootstrap_actions['ScriptBootstrapActionConfig'][name] = value
43
+ when 'BootstrapActions'
44
+ @flow['BootstrapActions'] = @bootstrap_actions
45
+ @bootstrap_actions = {'ScriptBootstrapActionConfig' => {'Args' => []}}
46
+ end
47
+ end
48
+
49
+ if @context.last == 'ExecutionStatusDetail'
50
+ case name
51
+ when 'CreationDateTime', 'EndDateTime', 'LastStateChangeReason',
52
+ 'ReadyDateTime', 'StartDateTime', 'State'
53
+ @execution_status_detail[name] = value
54
+ when 'ExecutionStatusDetail'
55
+ if @context.include?('Steps')
56
+ @step['ExecutionStatusDetail'] = @execution_status_detail
57
+ else
58
+ @flow['ExecutionStatusDetail'] = @execution_status_detail
59
+ end
60
+ @execution_status_detail = {}
61
+ end
62
+ end
63
+
64
+ if @context.last == 'Instances'
65
+ case name
66
+ when 'AvailabilityZone'
67
+ @instance['Placement'][name] = value
68
+ when 'Ec2KeyName', 'HadoopVersion', 'InstanceCount', 'KeepJobFlowAliveWhenNoSteps',
69
+ 'MasterInstanceId', 'MasterInstanceType', 'MasterPublicDnsName', 'NormalizedInstanceHours',
70
+ 'SlaveInstanceType', 'TerminationProtected'
71
+ @instance[name] = value
72
+ when 'member'
73
+ @instance['InstanceGroups'] << @instance_group_detail
74
+ @instance_group_detail = {}
75
+ when 'Instances'
76
+ @flow['Instances'] = @instance
77
+ @instance = { 'InstanceGroups' => [], 'Placement' => {}}
78
+ end
79
+ end
80
+
81
+ if @context.last == 'InstanceGroups'
82
+ case name
83
+ when 'member'
84
+ @instance['InstanceGroups'] << @instance_group_detail
85
+ @instance_group_detail = {}
86
+ else
87
+ @instance_group_detail[name] = value
88
+ end
89
+ end
90
+
91
+ if @context.last == 'Args'
92
+ if name == 'member'
93
+ if @context.include?('Steps')
94
+ @step['StepConfig']['HadoopJarStepConfig']['Args'] << value.strip
95
+ else
96
+ @bootstrap_actions['ScriptBootstrapActionConfig']['Args'] << value
97
+ end
98
+ end
99
+ end
100
+
101
+ if @context.last == 'Steps'
102
+ case name
103
+ when 'ActionOnFailure', 'Name'
104
+ @step[name] = value
105
+ when 'Jar', 'MainClass'
106
+ @step['StepConfig']['HadoopJarStepConfig'][name] = value
107
+ when 'member'
108
+ @flow['Steps'] << @step
109
+ @step = {
110
+ 'ExecutionStatusDetail' => {},
111
+ 'StepConfig' => {
112
+ 'HadoopJarStepConfig' => {
113
+ 'Args' => [],
114
+ 'Properties' => []
115
+ }
116
+ }
117
+ }
118
+ end
119
+ end
120
+
121
+ if @context.empty?
122
+ case name
123
+ when 'AmiVersion', 'JobFlowId', 'LogUri', 'Name'
124
+ @flow[name] = value
125
+ when 'member'
126
+ @response['JobFlows'] << @flow
127
+ @flow = {'Instances' => [], 'ExecutionStatusDetail' => {}, 'BootstrapActions' => [], 'Steps' => []}
128
+ end
129
+ end
130
+
131
+ if @context.last == name
132
+ @context.pop
133
+ end
134
+ end
135
+ end
136
+
137
+ end
138
+ end
139
+ end
140
+ end
@@ -0,0 +1,17 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module EMR
5
+
6
+ class ModifyInstanceGroups < Fog::Parsers::Base
7
+ def end_element(name)
8
+ case name
9
+ when 'RequestId'
10
+ @response[name] = value
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module EMR
5
+
6
+ class RunJobFlow < Fog::Parsers::Base
7
+ def end_element(name)
8
+ case name
9
+ when 'JobFlowId'
10
+ @response[name] = value
11
+ when 'RequestId'
12
+ @response[name] = value
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module EMR
5
+
6
+ class SetTerminationProtection < Fog::Parsers::Base
7
+ def end_element(name)
8
+ case name
9
+ when 'RequestId'
10
+ @response[name] = value
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module EMR
5
+
6
+ class TerminateJobFlows < Fog::Parsers::Base
7
+ def end_element(name)
8
+ case name
9
+ when 'RequestId'
10
+ @response[name] = value
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -79,7 +79,7 @@ module Fog
79
79
  #
80
80
  # ==== Parameters
81
81
  # * options<~Hash> - config arguments for connection. Defaults to {}.
82
- # * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1'i, 'ap-southeast-1']
82
+ # * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'ap-southeast-1']
83
83
  #
84
84
  # ==== Returns
85
85
  # * ELB object with connection to AWS.
@@ -101,6 +101,8 @@ module Fog
101
101
  'rds.us-east-1.amazonaws.com'
102
102
  when 'us-west-1'
103
103
  'rds.us-west-1.amazonaws.com'
104
+ when 'us-west-2'
105
+ 'rds.us-west-2.amazonaws.com'
104
106
  else
105
107
  raise ArgumentError, "Unknown region: #{options[:region].inspect}"
106
108
  end
@@ -17,6 +17,8 @@ module Fog
17
17
  # * NotificationARNs<~Array>: List of SNS topics to publish events to
18
18
  # * Parameters<~Hash>: Hash of providers to supply to template
19
19
  # * TimeoutInMinutes<~Integer>: Minutes to wait before status is set to CREATE_FAILED
20
+ # * Capabilities<~Array>: List of capabilties the stack is granted. Currently CAPABILITY_IAM
21
+ # for allowing the creation of IAM resources
20
22
  #
21
23
  # ==== Returns
22
24
  # * response<~Excon::Response>:
@@ -58,6 +60,10 @@ module Fog
58
60
  if options['TimeoutInMinutes']
59
61
  params['TimeoutInMinutes'] = options['TimeoutInMinutes']
60
62
  end
63
+
64
+ if options['Capabilities']
65
+ params.merge!(Fog::AWS.indexed_param("Capabilities.member", [*options['Capabilities']]))
66
+ end
61
67
 
62
68
  request({
63
69
  'Action' => 'CreateStack',
@@ -0,0 +1,62 @@
1
+ module Fog
2
+ module AWS
3
+ class CloudFormation
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/cloud_formation/update_stack'
7
+
8
+ # Update a stack
9
+ #
10
+ # ==== Parameters
11
+ # * stack_name<~String>: name of the stack to update
12
+ # * options<~Hash>:
13
+ # * TemplateBody<~String>: structure containing the template body
14
+ # or (one of the two Template parameters is required)
15
+ # * TemplateURL<~String>: URL of file containing the template body
16
+ # * Parameters<~Hash>: Hash of providers to supply to template
17
+ # * Capabilities<~Array>: List of capabilties the stack is granted. Currently CAPABILITY_IAM
18
+ # for allowing the creation of IAM resources
19
+ #
20
+ # ==== Returns
21
+ # * response<~Excon::Response>:
22
+ # * body<~Hash>:
23
+ # * 'StackId'<~String> - Id of the stack being updated
24
+ #
25
+ # ==== See Also
26
+ # http://docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_UpdateStack.html
27
+ #
28
+ def update_stack(stack_name, options = {})
29
+ params = {
30
+ 'StackName' => stack_name,
31
+ }
32
+
33
+ if options['Parameters']
34
+ options['Parameters'].keys.each_with_index do |key, index|
35
+ index += 1 # params are 1-indexed
36
+ params.merge!({
37
+ "Parameters.member.#{index}.ParameterKey" => key,
38
+ "Parameters.member.#{index}.ParameterValue" => options['Parameters'][key]
39
+ })
40
+ end
41
+ end
42
+
43
+ if options['TemplateBody']
44
+ params['TemplateBody'] = options['TemplateBody']
45
+ elsif options['TemplateURL']
46
+ params['TemplateURL'] = options['TemplateURL']
47
+ end
48
+
49
+ if options['Capabilities']
50
+ params.merge!(Fog::AWS.indexed_param("Capabilities.member", [*options['Capabilities']]))
51
+ end
52
+
53
+ request({
54
+ 'Action' => 'UpdateStack',
55
+ :parser => Fog::Parsers::AWS::CloudFormation::UpdateStack.new
56
+ }.merge!(params))
57
+ end
58
+
59
+ end
60
+ end
61
+ end
62
+ end