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
@@ -172,11 +172,17 @@ module Fog
172
172
  end
173
173
 
174
174
  def recognized
175
- @recognized ||= []
175
+ @recognized ||= [:connection_options]
176
176
  end
177
177
 
178
178
  def validate_options(options)
179
- missing = requirements - options.keys
179
+ keys = []
180
+ for key, value in options
181
+ unless value.nil?
182
+ keys << key
183
+ end
184
+ end
185
+ missing = requirements - keys
180
186
  unless missing.empty?
181
187
  raise ArgumentError, "Missing required arguments: #{missing.join(', ')}"
182
188
  end
@@ -58,11 +58,12 @@ module Fog
58
58
 
59
59
  if id.nil?
60
60
  data = connection.create_record(zone.domain, name, type, value, options).body
61
+ merge_attributes(data)
61
62
  else
62
- data = connection.update_record(zone.domain, id, options).body
63
+ options.merge!(:name => name, :type => type, :data => value)
64
+ connection.update_record(zone.domain, id, options).body
63
65
  end
64
66
 
65
- merge_attributes(data)
66
67
  true
67
68
  end
68
69
 
@@ -26,6 +26,8 @@ module Fog
26
26
  request :post_zone
27
27
  request :put_zone
28
28
 
29
+ class JobIncomplete < Error; end
30
+
29
31
  class Mock
30
32
  def initialize(options={})
31
33
  @dynect_customer = options[:dynect_customer]
@@ -80,18 +82,23 @@ module Fog
80
82
 
81
83
  def request(params)
82
84
  begin
85
+ # any request could redirect to a job
86
+ params[:expects] = Array(params[:expects]) | [307]
87
+
83
88
  params[:headers] ||= {}
84
89
  params[:headers]['Content-Type'] = 'application/json'
85
90
  params[:headers]['API-Version'] = @version
86
91
  params[:headers]['Auth-Token'] = auth_token unless params[:path] == "Session"
87
- params[:path] = "#{@path}/#{params[:path]}"
92
+ params[:path] = "#{@path}/#{params[:path]}" unless params[:path] =~ %r{^#{Regexp.escape(@path)}/}
88
93
  response = @connection.request(params.merge!({:host => @host}))
89
94
 
90
- unless response.body.empty?
95
+ if response.status == 307
96
+ response = poll_job(response)
97
+ elsif !response.body.empty?
91
98
  response.body = MultiJson.decode(response.body)
92
99
  end
93
- response
94
100
 
101
+ response
95
102
  rescue Excon::Errors::HTTPStatusError => error
96
103
  if @auth_token && error.message =~ /login: (Bad or expired credentials|inactivity logout)/
97
104
  @auth_token = nil
@@ -103,6 +110,21 @@ module Fog
103
110
 
104
111
  response
105
112
  end
113
+
114
+ def poll_job(response, time_to_wait = 10)
115
+ job_location = response.headers['Location']
116
+
117
+ Fog.wait_for(time_to_wait) do
118
+ response = request(:expects => 200, :method => :get, :path => job_location)
119
+ response.body['status'] != 'incomplete'
120
+ end
121
+
122
+ if response.body['status'] == 'incomplete'
123
+ raise JobIncomplete.new("Job #{response.body['job_id']} is still incomplete")
124
+ end
125
+
126
+ response
127
+ end
106
128
  end
107
129
 
108
130
  end
@@ -1061,7 +1061,7 @@ module Fog
1061
1061
  end
1062
1062
 
1063
1063
  def self.data_reset
1064
- Fog::Logger.warning("#{self} => #data_reset is deprecated, use #reset instead [light_black](#{caller.first})[/]")
1064
+ Fog::Logger.deprecation("#{self} => #data_reset is deprecated, use #reset instead [light_black](#{caller.first})[/]")
1065
1065
  self.reset
1066
1066
  end
1067
1067
 
@@ -16,7 +16,7 @@ module Fog
16
16
  def grid_server_power(server, power)
17
17
  request(
18
18
  :path => 'grid/server/power',
19
- :query => {'server' => server}
19
+ :query => {'server' => server, 'power' => power}
20
20
  )
21
21
  end
22
22
 
@@ -106,7 +106,7 @@ module Fog
106
106
  def save(options = {})
107
107
  requires :body, :directory, :key
108
108
  if options != {}
109
- Fog::Logger.warning("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
109
+ Fog::Logger.deprecation("options param is deprecated, use acl= instead [light_black](#{caller.first})[/]")
110
110
  end
111
111
  options['x-goog-acl'] ||= @acl if @acl
112
112
  options['Cache-Control'] = cache_control if cache_control
@@ -18,7 +18,7 @@ module Fog
18
18
  # http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_QSAuth.html
19
19
 
20
20
  def get_object_url(bucket_name, object_name, expires)
21
- Fog::Logger.warning("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
21
+ Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
22
22
  get_object_https_url(bucket_name, object_name, expires)
23
23
  end
24
24
 
@@ -27,7 +27,7 @@ module Fog
27
27
  class Mock # :nodoc:all
28
28
 
29
29
  def get_object_url(bucket_name, object_name, expires)
30
- Fog::Logger.warning("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
30
+ Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_url} is deprecated, use ##{get_object_https_url} instead[/] [light_black](#{caller.first})")
31
31
  get_object_https_url(bucket_name, object_name, expires)
32
32
  end
33
33
 
@@ -45,7 +45,7 @@ module Fog
45
45
  end
46
46
 
47
47
  def url(params, expires)
48
- Fog::Logger.warning("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
48
+ Fog::Logger.deprecation("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
49
49
  https_url(params, expires)
50
50
  end
51
51
 
@@ -13,7 +13,7 @@ module Fog
13
13
  attribute :objectid, :aliases => :ObjectID
14
14
 
15
15
  def body
16
- attributes[:body] ||= if last_modified
16
+ attributes[:body] ||= if objectid
17
17
  collection.get(identity).body
18
18
  else
19
19
  ''
@@ -73,13 +73,15 @@ module Fog
73
73
  options[:headers] ||= {}
74
74
  options[:headers]['Content-Type'] = content_type if content_type
75
75
  options[:body] = body
76
- if objectid
77
- # pre-existing file, do a PUT
78
- data = connection.put_namespace(ns, options)
79
- else
80
- # new file, POST
76
+ begin
81
77
  data = connection.post_namespace(ns, options)
82
78
  self.objectid = data.headers['location'].split('/')[-1]
79
+ rescue => error
80
+ if error.message =~ /The resource you are trying to create already exists./
81
+ data = connection.put_namespace(ns, options)
82
+ else
83
+ raise error
84
+ end
83
85
  end
84
86
  # merge_attributes(data.headers)
85
87
  true
@@ -51,12 +51,13 @@ module Fog
51
51
 
52
52
  def head(key, options = {})
53
53
  requires :directory
54
- data = connection.head_object(directory.key, key)
54
+ data = connection.head_namespace(directory.key + key, :parse => false)
55
55
  file_data = data.headers.merge({
56
+ :body => data.body,
56
57
  :key => key
57
58
  })
58
59
  new(file_data)
59
- rescue Fog::Storage::Rackspace::NotFound
60
+ rescue Fog::Storage::Ninefold::NotFound
60
61
  nil
61
62
  end
62
63
 
@@ -0,0 +1,20 @@
1
+ module Fog
2
+ module Storage
3
+ class Ninefold
4
+ class Real
5
+
6
+ def head_namespace(namespace = '', options = {})
7
+ options = options.reject {|key, value| value.nil?}
8
+ request({
9
+ :expects => 200,
10
+ :method => 'HEAD',
11
+ :path => "namespace/" + namespace,
12
+ :query => {},
13
+ :parse => true
14
+ }.merge(options))
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -20,6 +20,7 @@ module Fog
20
20
  request_path 'fog/ninefold/requests/storage'
21
21
  # request :delete_container
22
22
  request :get_namespace
23
+ request :head_namespace
23
24
  request :post_namespace
24
25
  request :put_namespace
25
26
  request :delete_namespace
@@ -107,9 +108,10 @@ module Fog
107
108
 
108
109
  customheaders = {}
109
110
  params[:headers].each { |key,value|
110
- if key == "x-emc-date"
111
+ case key
112
+ when 'x-emc-date', 'x-emc-signature'
111
113
  #skip
112
- elsif key =~ /^x-emc-/
114
+ when /^x-emc-/
113
115
  customheaders[ key.downcase ] = value
114
116
  end
115
117
  }
@@ -21,6 +21,7 @@ module Fog
21
21
  attribute :accessIPv4
22
22
  attribute :accessIPv6
23
23
  attribute :availability_zone
24
+ attribute :user_data_encoded
24
25
  attribute :state, :aliases => 'status'
25
26
 
26
27
  attr_reader :password
@@ -47,6 +48,10 @@ module Fog
47
48
  metadata.load(metas)
48
49
  end
49
50
 
51
+ def user_data=(ascii_userdata)
52
+ self.user_data_encoded = [ascii_userdata].pack('m')
53
+ end
54
+
50
55
  def destroy
51
56
  requires :id
52
57
  connection.delete_server(id)
@@ -155,7 +160,8 @@ module Fog
155
160
  'personality' => personality,
156
161
  'accessIPv4' => accessIPv4,
157
162
  'accessIPv6' => accessIPv6,
158
- 'availability_zone' => availability_zone
163
+ 'availability_zone' => availability_zone,
164
+ 'user_data' => user_data_encoded
159
165
  }
160
166
  options = options.reject {|key, value| value.nil?}
161
167
  data = connection.create_server(name, image_ref, flavor_ref, options)
@@ -12,15 +12,12 @@ module Fog
12
12
  }
13
13
  }
14
14
 
15
- if options['metadata']
16
- data['server']['metadata'] = options['metadata']
17
- end
18
- if options['accessIPv4']
19
- data['server']['accessIPv4'] = options['accessIPv4']
20
- end
21
- if options['accessIPv6']
22
- data['server']['accessIPv6'] = options['accessIPv6']
15
+ vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6',
16
+ 'availability_zone', 'user_data']
17
+ vanilla_options.select{|o| options[o]}.each do |key|
18
+ data['server'][key] = options[key]
23
19
  end
20
+
24
21
  if options['personality']
25
22
  data['server']['personality'] = []
26
23
  for file in options['personality']
@@ -30,9 +27,7 @@ module Fog
30
27
  }
31
28
  end
32
29
  end
33
- if options['availability_zone']
34
- data['server']['availability_zone'] = options['availability_zone']
35
- end
30
+
36
31
  request(
37
32
  :body => MultiJson.encode(data),
38
33
  :expects => [200, 202],
@@ -16,6 +16,7 @@ module Fog
16
16
  requires :rackspace_api_key, :rackspace_username
17
17
  recognizes :rackspace_auth_url
18
18
  recognizes :rackspace_auth_token
19
+ recognizes :rackspace_lb_endpoint
19
20
 
20
21
  model_path 'fog/rackspace/models/load_balancers'
21
22
  collection :load_balancers
@@ -11,7 +11,7 @@ module Fog
11
11
  response = nil
12
12
  Fog.wait_for(timeout, interval) do
13
13
  response = connection.callback job_id
14
- if response.status != 202
14
+ if response.body['status'] != 'RUNNING'
15
15
  true
16
16
  elsif retries == 0
17
17
  raise Fog::Errors::Error.new("Wait on job #{job_id} took too long")
@@ -51,7 +51,7 @@ module Fog
51
51
  }
52
52
 
53
53
  response = wait_for_job connection.add_records(@zone.identity, [options]).body['jobId']
54
- merge_attributes(response.body['records'].first)
54
+ merge_attributes(response.body['response']['records'].select {|record| record['name'] == self.name && record['type'] == self.type && record['data'] == self.value}.first)
55
55
  true
56
56
  end
57
57
 
@@ -52,7 +52,7 @@ module Fog
52
52
  response = connection.create_domains([data])
53
53
 
54
54
  response = wait_for_job response.body['jobId']
55
- merge_attributes(response.body['domains'].first)
55
+ merge_attributes(response.body['response']['domains'].select {|domain| domain['name'] == self.domain}.first)
56
56
  end
57
57
 
58
58
  def update
@@ -23,6 +23,7 @@ module Fog
23
23
  request :get_records
24
24
  request :get_zone
25
25
  request :get_zones
26
+ request :update_record
26
27
 
27
28
  class Mock
28
29
 
@@ -12,7 +12,7 @@ module Fog
12
12
  identity :id
13
13
 
14
14
  attribute :active
15
- attribute :value, :aliases => 'ip'
15
+ attribute :value, :aliases => ['ip', 'data']
16
16
  attribute :name
17
17
  attribute :description, :aliases => 'aux'
18
18
  attribute :ttl
@@ -45,13 +45,17 @@ module Fog
45
45
  end
46
46
 
47
47
  def save
48
- raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
48
+
49
49
  requires :name, :type, :value, :zone
50
50
  options = {}
51
51
  options[:active] = active ? 'Y' : 'N'
52
52
  options[:aux] = description if description
53
53
  options[:ttl] = ttl if ttl
54
- data = connection.create_record(type, zone.id, name, value, options)
54
+ if identity
55
+ data = connection.update_record(identity, type, zone.id, name, value, options)
56
+ else
57
+ data = connection.create_record(type, zone.id, name, value, options)
58
+ end
55
59
  merge_attributes(data.body)
56
60
  true
57
61
  end
@@ -39,7 +39,7 @@ module Fog
39
39
  Fog::DNS::Slicehost::Records.new(
40
40
  :zone => self,
41
41
  :connection => connection
42
- )
42
+ ).all
43
43
  end
44
44
  end
45
45
 
@@ -11,9 +11,15 @@ module Fog
11
11
 
12
12
  def end_element(name)
13
13
  case name
14
- when 'zone-id', 'ttl', 'id'
14
+ when 'zone_id'
15
+ @response["zone-id"] = value.to_i
16
+ when 'record_type'
17
+ @response["record-type"] = value
18
+ when 'ttl', 'id'
15
19
  @response[name] = value.to_i
16
- when 'record-type', 'name', 'data', 'active', 'aux'
20
+ when 'value'
21
+ @response["data"] = value
22
+ when 'name', 'data', 'active', 'aux'
17
23
  @response[name] = value
18
24
  end
19
25
  end
@@ -6,15 +6,27 @@ module Fog
6
6
  class GetRecord < Fog::Parsers::Base
7
7
 
8
8
  def reset
9
+ @record = {}
9
10
  @response = { }
10
11
  end
11
12
 
12
13
  def end_element(name)
13
14
  case name
14
- when 'zone-id', 'ttl'
15
- @response[name] = value.to_i
16
- when 'record-type', 'name', 'data', 'active', 'aux'
17
- @response[name] = value
15
+ when 'id'
16
+ @record["id"] = value.to_i
17
+ when 'zone-id'
18
+ @record["zone_id"] = value.to_i
19
+ when 'record-type'
20
+ @record["record_type"] = value
21
+ when 'ttl'
22
+ @record[name] = value.to_i
23
+ when 'data'
24
+ @record["value"] = value
25
+ when 'name', 'active', 'aux'
26
+ @record[name] = value
27
+ when 'record'
28
+ @response = @record
29
+ @record = {}
18
30
  end
19
31
  end
20
32
 
@@ -23,4 +35,4 @@ module Fog
23
35
  end
24
36
  end
25
37
  end
26
- end
38
+ end
@@ -12,9 +12,17 @@ module Fog
12
12
 
13
13
  def end_element(name)
14
14
  case name
15
- when 'zone-id', 'ttl'
15
+ when 'id'
16
+ @record["id"] = value.to_i
17
+ when 'zone-id'
18
+ @record["zone_id"] = value.to_i
19
+ when 'record-type'
20
+ @record["record_type"] = value
21
+ when 'ttl'
16
22
  @record[name] = value.to_i
17
- when 'record-type', 'name', 'data', 'active', 'aux'
23
+ when 'data'
24
+ @record["value"] = value
25
+ when 'name', 'active', 'aux'
18
26
  @record[name] = value
19
27
  when 'record'
20
28
  @response['records'] << @record
@@ -21,7 +21,7 @@ module Fog
21
21
  request(
22
22
  :expects => 200,
23
23
  :method => 'GET',
24
- :parser => Fog::Parsers::DNS::Slicehost::GetRecords.new,
24
+ :parser => Fog::Parsers::DNS::Slicehost::GetRecord.new,
25
25
  :path => "records/#{record_id}.xml"
26
26
  )
27
27
  end
@@ -10,14 +10,13 @@ module Fog
10
10
  # ==== Returns
11
11
  # * response<~Excon::Response>:
12
12
  # * body<~Array>:
13
- # * 'addresses'<~Array> - Ip addresses for the slice
14
- # * 'backup-id'<~Integer> - Id of backup slice was booted from
15
- # * 'flavor_id'<~Integer> - Id of flavor slice was booted from
16
- # * 'id'<~Integer> - Id of the slice
17
- # * 'image-id'<~Integer> - Id of image slice was booted from
18
- # * 'name'<~String> - Name of the slice
19
- # * 'progress'<~Integer> - Progress of current action, in percentage
20
- # * 'status'<~String> - Current status of the slice
13
+ # * 'name'<~String> - Record NAME field (e.g. "example.org." or "www")
14
+ # * 'data'<~String> - Data contained by the record (e.g. an IP address, for A records)
15
+ # * 'record_type'<~String> - Type of record (A, CNAME, TXT, etc)
16
+ # * 'aux'<~String> - Aux data for the record, for those types which have it (e.g. TXT)
17
+ # * 'zone_id'<~Integer> - zone ID to which this record belongs
18
+ # * 'active'<~String> - whether this record is active in the Slicehost DNS (Y for yes, N for no)
19
+ # * 'ttl'<~Integer> - TTL in seconds
21
20
  def get_records
22
21
  request(
23
22
  :expects => 200,
@@ -0,0 +1,43 @@
1
+ module Fog
2
+ module DNS
3
+ class Slicehost
4
+ class Real
5
+
6
+ #require 'fog/slicehost/parsers/dns/update_record'
7
+
8
+ # Get an individual DNS record from the specified zone
9
+ #
10
+ # ==== Returns
11
+ # * response<~Excon::Response>:
12
+ # * body<~Hash>:
13
+ # * 'record_type'<~String> - type of DNS record to create (A, CNAME, etc)
14
+ # * 'zone_id'<~Integer> - ID of the zone to update
15
+ # * 'name'<~String> - host name this DNS record is for
16
+ # * 'data'<~String> - data for the DNS record (ie for an A record, the IP address)
17
+ # * 'ttl'<~Integer> - time to live in seconds
18
+ # * 'active'<~String> - whether this record is active or not ('Y' or 'N')
19
+ # * 'aux'<~String> - extra data required by the record
20
+ def update_record(record_id, record_type, zone_id, name, data, options = {})
21
+ optional_tags= ''
22
+ options.each { |option, value|
23
+ case option
24
+ when :ttl
25
+ optional_tags+= "<ttl type='integer'>#{value}</ttl>"
26
+ when :active
27
+ optional_tags+= "<active>#{value}</active>"
28
+ when :aux
29
+ optional_tags+= "<aux>#{value}</aux>"
30
+ end
31
+ }
32
+ request(
33
+ :body => %Q{<?xml version="1.0" encoding="UTF-8"?><record><record_type>#{record_type}</record_type><zone_id type="integer">#{zone_id}</zone_id><name>#{name}</name><data>#{data}</data>#{optional_tags}</record>},
34
+ :expects => 200,
35
+ :method => 'PUT',
36
+ :path => "records/#{record_id}.xml"
37
+ )
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
@@ -10,7 +10,7 @@ module Fog
10
10
  model Fog::Compute::StormOnDemand::Balancer
11
11
 
12
12
  def all
13
- data = connection.list_balancers.body['loadbalancers']
13
+ data = connection.list_balancers.body['items']
14
14
  load(data)
15
15
  end
16
16
 
@@ -10,7 +10,7 @@ module Fog
10
10
  model Fog::Compute::StormOnDemand::Config
11
11
 
12
12
  def all
13
- data = connection.list_configs.body['configs']
13
+ data = connection.list_configs.body['items']
14
14
  load(data)
15
15
  end
16
16
 
@@ -10,7 +10,7 @@ module Fog
10
10
  model Fog::Compute::StormOnDemand::Image
11
11
 
12
12
  def all
13
- data = connection.list_images.body['images']
13
+ data = connection.list_images.body['items']
14
14
  load(data)
15
15
  end
16
16
 
@@ -10,7 +10,7 @@ module Fog
10
10
  model Fog::Compute::StormOnDemand::Server
11
11
 
12
12
  def all
13
- data = connection.list_servers.body['servers']
13
+ data = connection.list_servers.body['items']
14
14
  load(data)
15
15
  end
16
16
 
@@ -10,7 +10,7 @@ module Fog
10
10
  model Fog::Compute::StormOnDemand::Template
11
11
 
12
12
  def all
13
- data = connection.list_templates.body['templates']
13
+ data = connection.list_templates.body['items']
14
14
  load(data)
15
15
  end
16
16
 
@@ -15,7 +15,7 @@ module Fog
15
15
  extend Fog::Terremark::Shared
16
16
 
17
17
  def self.new(options={})
18
- Fog::Logger.warning("Fog::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe [light_black](#{caller.first})[/]")
18
+ Fog::Logger.deprecation("Fog::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe [light_black](#{caller.first})[/]")
19
19
 
20
20
  unless @required
21
21
  shared_requires