Browse files

merged with upstream master

  • Loading branch information...
2 parents b65167e + 4aa1441 commit 44c5c6ec8ac65ed2f1725b4b5a259a7989cee161 @pastorius pastorius committed Nov 16, 2012
Showing with 2,707 additions and 882 deletions.
  1. +2 −2 .gitignore
  2. +8 −9 README.md
  3. +18 −19 Rakefile
  4. +1 −1 docs/dns/index.markdown
  5. +8 −3 docs/index.markdown
  6. +1 −1 fog.gemspec
  7. +1 −1 lib/fog/aws/auto_scaling.rb
  8. +1 −1 lib/fog/aws/cloud_watch.rb
  9. +2 −1 lib/fog/aws/compute.rb
  10. +1 −1 lib/fog/aws/elb.rb
  11. +2 −0 lib/fog/aws/models/compute/server.rb
  12. +0 −1 lib/fog/aws/models/compute/volume.rb
  13. +3 −1 lib/fog/aws/parsers/compute/describe_instances.rb
  14. +1 −1 lib/fog/aws/parsers/compute/describe_reserved_instances_offerings.rb
  15. +2 −2 lib/fog/aws/rds.rb
  16. +3 −0 lib/fog/aws/requests/compute/describe_availability_zones.rb
  17. +11 −8 lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb
  18. +51 −0 lib/fog/aws/requests/compute/modify_volume_attribute.rb
  19. +1 −0 lib/fog/aws/requests/dns/change_resource_record_sets.rb
  20. +1 −1 lib/fog/aws/sqs.rb
  21. +1 −3 lib/fog/bluebox/requests/compute/create_block.rb
  22. +23 −11 lib/fog/brightbox/compute.rb
  23. +2 −1 lib/fog/brightbox/models/compute/server.rb
  24. +9 −2 lib/fog/brightbox/requests/compute/activate_console_server.rb
  25. +11 −2 lib/fog/brightbox/requests/compute/add_listeners_load_balancer.rb
  26. +11 −2 lib/fog/brightbox/requests/compute/add_nodes_load_balancer.rb
  27. +9 −11 lib/fog/brightbox/requests/compute/add_servers_server_group.rb
  28. +11 −2 lib/fog/brightbox/requests/compute/apply_to_firewall_policy.rb
  29. +11 −2 lib/fog/brightbox/requests/compute/create_api_client.rb
  30. +11 −2 lib/fog/brightbox/requests/compute/create_application.rb
  31. +11 −1 lib/fog/brightbox/requests/compute/create_cloud_ip.rb
  32. +13 −2 lib/fog/brightbox/requests/compute/create_firewall_policy.rb
  33. +17 −2 lib/fog/brightbox/requests/compute/create_firewall_rule.rb
  34. +18 −2 lib/fog/brightbox/requests/compute/create_image.rb
  35. +14 −2 lib/fog/brightbox/requests/compute/create_load_balancer.rb
  36. +17 −2 lib/fog/brightbox/requests/compute/create_server.rb
  37. +11 −2 lib/fog/brightbox/requests/compute/create_server_group.rb
  38. +9 −2 lib/fog/brightbox/requests/compute/destroy_api_client.rb
  39. +9 −2 lib/fog/brightbox/requests/compute/destroy_application.rb
  40. +9 −2 lib/fog/brightbox/requests/compute/destroy_cloud_ip.rb
  41. +9 −2 lib/fog/brightbox/requests/compute/destroy_firewall_policy.rb
  42. +9 −2 lib/fog/brightbox/requests/compute/destroy_firewall_rule.rb
  43. +9 −2 lib/fog/brightbox/requests/compute/destroy_image.rb
  44. +9 −2 lib/fog/brightbox/requests/compute/destroy_load_balancer.rb
  45. +9 −2 lib/fog/brightbox/requests/compute/destroy_server.rb
  46. +9 −2 lib/fog/brightbox/requests/compute/destroy_server_group.rb
  47. +7 −15 lib/fog/brightbox/requests/compute/get_account.rb
  48. +9 −2 lib/fog/brightbox/requests/compute/get_api_client.rb
  49. +9 −2 lib/fog/brightbox/requests/compute/get_application.rb
  50. +1 −3 lib/fog/brightbox/requests/compute/get_authenticated_user.rb
  51. +9 −2 lib/fog/brightbox/requests/compute/get_cloud_ip.rb
  52. +9 −2 lib/fog/brightbox/requests/compute/get_firewall_policy.rb
  53. +9 −2 lib/fog/brightbox/requests/compute/get_firewall_rule.rb
  54. +9 −2 lib/fog/brightbox/requests/compute/get_image.rb
  55. +9 −2 lib/fog/brightbox/requests/compute/get_interface.rb
  56. +9 −2 lib/fog/brightbox/requests/compute/get_load_balancer.rb
  57. +1 −5 lib/fog/brightbox/requests/compute/get_scoped_account.rb
  58. +9 −2 lib/fog/brightbox/requests/compute/get_server.rb
  59. +9 −2 lib/fog/brightbox/requests/compute/get_server_group.rb
  60. +9 −2 lib/fog/brightbox/requests/compute/get_server_type.rb
  61. +7 −15 lib/fog/brightbox/requests/compute/get_user.rb
  62. +9 −2 lib/fog/brightbox/requests/compute/get_zone.rb
  63. +6 −2 lib/fog/brightbox/requests/compute/list_accounts.rb
  64. +8 −2 lib/fog/brightbox/requests/compute/list_api_clients.rb
  65. +8 −2 lib/fog/brightbox/requests/compute/list_applications.rb
  66. +8 −2 lib/fog/brightbox/requests/compute/list_cloud_ips.rb
  67. +8 −2 lib/fog/brightbox/requests/compute/list_firewall_policies.rb
  68. +8 −2 lib/fog/brightbox/requests/compute/list_images.rb
  69. +8 −2 lib/fog/brightbox/requests/compute/list_load_balancers.rb
  70. +8 −2 lib/fog/brightbox/requests/compute/list_server_groups.rb
  71. +8 −2 lib/fog/brightbox/requests/compute/list_server_types.rb
  72. +8 −2 lib/fog/brightbox/requests/compute/list_servers.rb
  73. +8 −2 lib/fog/brightbox/requests/compute/list_users.rb
  74. +8 −2 lib/fog/brightbox/requests/compute/list_zones.rb
  75. +11 −2 lib/fog/brightbox/requests/compute/map_cloud_ip.rb
  76. +10 −12 lib/fog/brightbox/requests/compute/move_servers_server_group.rb
  77. +11 −2 lib/fog/brightbox/requests/compute/remove_firewall_policy.rb
  78. +11 −2 lib/fog/brightbox/requests/compute/remove_listeners_load_balancer.rb
  79. +11 −2 lib/fog/brightbox/requests/compute/remove_nodes_load_balancer.rb
  80. +9 −10 lib/fog/brightbox/requests/compute/remove_servers_server_group.rb
  81. +11 −1 lib/fog/brightbox/requests/compute/reset_ftp_password_account.rb
  82. +13 −1 lib/fog/brightbox/requests/compute/reset_secret_api_client.rb
  83. +9 −2 lib/fog/brightbox/requests/compute/reset_secret_application.rb
  84. +9 −2 lib/fog/brightbox/requests/compute/shutdown_server.rb
  85. +9 −2 lib/fog/brightbox/requests/compute/snapshot_server.rb
  86. +9 −2 lib/fog/brightbox/requests/compute/start_server.rb
  87. +9 −2 lib/fog/brightbox/requests/compute/stop_server.rb
  88. +9 −2 lib/fog/brightbox/requests/compute/unmap_cloud_ip.rb
  89. +32 −34 lib/fog/brightbox/requests/compute/update_account.rb
  90. +12 −2 lib/fog/brightbox/requests/compute/update_api_client.rb
  91. +12 −2 lib/fog/brightbox/requests/compute/update_application.rb
  92. +13 −2 lib/fog/brightbox/requests/compute/update_cloud_ip.rb
  93. +16 −1 lib/fog/brightbox/requests/compute/update_firewall_rule.rb
  94. +17 −2 lib/fog/brightbox/requests/compute/update_image.rb
  95. +15 −2 lib/fog/brightbox/requests/compute/update_load_balancer.rb
  96. +12 −19 lib/fog/brightbox/requests/compute/update_scoped_account.rb
  97. +12 −2 lib/fog/brightbox/requests/compute/update_server.rb
  98. +12 −2 lib/fog/brightbox/requests/compute/update_server_group.rb
  99. +15 −2 lib/fog/brightbox/requests/compute/update_user.rb
  100. +1 −1 lib/fog/cloudstack/models/compute/server.rb
  101. +13 −2 lib/fog/google/storage.rb
  102. +2 −2 lib/fog/libvirt/requests/compute/list_domains.rb
  103. +1 −0 lib/fog/openstack.rb
  104. +1 −0 lib/fog/openstack/compute.rb
  105. +1 −0 lib/fog/openstack/identity.rb
  106. +1 −0 lib/fog/openstack/requests/compute/list_tenants.rb
  107. +1 −0 lib/fog/openstack/volume.rb
  108. +27 −0 lib/fog/rackspace/models/compute_v2/server.rb
  109. +8 −0 lib/fog/rackspace/models/compute_v2/servers.rb
  110. +14 −1 lib/fog/rackspace/models/dns/record.rb
  111. +8 −0 lib/fog/rackspace/models/storage/file.rb
  112. +3 −0 lib/fog/rackspace/requests/compute_v2/create_server.rb
  113. +74 −8 lib/fog/vsphere/compute.rb
  114. +31 −0 lib/fog/vsphere/models/compute/cluster.rb
  115. +26 −0 lib/fog/vsphere/models/compute/clusters.rb
  116. +35 −0 lib/fog/vsphere/models/compute/datacenter.rb
  117. +23 −0 lib/fog/vsphere/models/compute/datacenters.rb
  118. +24 −0 lib/fog/vsphere/models/compute/datastore.rb
  119. +25 −0 lib/fog/vsphere/models/compute/datastores.rb
  120. +28 −0 lib/fog/vsphere/models/compute/folder.rb
  121. +27 −0 lib/fog/vsphere/models/compute/folders.rb
  122. +39 −0 lib/fog/vsphere/models/compute/interface.rb
  123. +33 −0 lib/fog/vsphere/models/compute/interfaces.rb
  124. +21 −0 lib/fog/vsphere/models/compute/network.rb
  125. +25 −0 lib/fog/vsphere/models/compute/networks.rb
  126. +23 −0 lib/fog/vsphere/models/compute/resource_pool.rb
  127. +26 −0 lib/fog/vsphere/models/compute/resource_pools.rb
  128. +70 −12 lib/fog/vsphere/models/compute/server.rb
  129. +16 −20 lib/fog/vsphere/models/compute/servers.rb
  130. +13 −0 lib/fog/vsphere/models/compute/template.rb
  131. +23 −0 lib/fog/vsphere/models/compute/templates.rb
  132. +45 −0 lib/fog/vsphere/models/compute/volume.rb
  133. +33 −0 lib/fog/vsphere/models/compute/volumes.rb
  134. +114 −0 lib/fog/vsphere/requests/compute/create_vm.rb
  135. +0 −34 lib/fog/vsphere/requests/compute/datacenters.rb
  136. +0 −41 lib/fog/vsphere/requests/compute/find_vm_by_ref.rb
  137. +25 −0 lib/fog/vsphere/requests/compute/get_cluster.rb
  138. +29 −0 lib/fog/vsphere/requests/compute/get_datacenter.rb
  139. +25 −0 lib/fog/vsphere/requests/compute/get_datastore.rb
  140. +73 −0 lib/fog/vsphere/requests/compute/get_folder.rb
  141. +25 −0 lib/fog/vsphere/requests/compute/get_network.rb
  142. +26 −0 lib/fog/vsphere/requests/compute/get_resource_pool.rb
  143. +62 −0 lib/fog/vsphere/requests/compute/get_virtual_machine.rb
  144. +37 −0 lib/fog/vsphere/requests/compute/list_clusters.rb
  145. +34 −0 lib/fog/vsphere/requests/compute/list_datacenters.rb
  146. +40 −0 lib/fog/vsphere/requests/compute/list_datastores.rb
  147. +45 −0 lib/fog/vsphere/requests/compute/list_folders.rb
  148. +38 −0 lib/fog/vsphere/requests/compute/list_networks.rb
  149. +39 −0 lib/fog/vsphere/requests/compute/list_resource_pools.rb
  150. +132 −166 lib/fog/vsphere/requests/compute/list_virtual_machines.rb
  151. +52 −0 lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
  152. +51 −0 lib/fog/vsphere/requests/compute/list_vm_volumes.rb
  153. +6 −8 lib/fog/vsphere/requests/compute/vm_clone.rb
  154. +0 −97 lib/fog/vsphere/requests/compute/vm_create.rb
  155. +1 −8 lib/fog/vsphere/requests/compute/vm_destroy.rb
  156. +1 −2 lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb
  157. +1 −0 tests/aws/requests/auto_scaling/notification_configuration_tests.rb
  158. +1 −0 tests/aws/requests/auto_scaling/tag_tests.rb
  159. +2 −0 tests/aws/requests/compute/instance_tests.rb
  160. +8 −0 tests/aws/requests/compute/volume_tests.rb
  161. +17 −3 tests/dns/models/record_tests.rb
  162. +6 −0 tests/rackspace/models/compute_v2/servers_tests.rb
  163. +127 −63 tests/rackspace/models/storage/file_tests.rb
  164. +12 −26 tests/rackspace/requests/dns/helper.rb
  165. +3 −3 tests/vsphere/compute_tests.rb
  166. +1 −2 tests/vsphere/models/compute/server_tests.rb
  167. +0 −26 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
  168. +5 −13 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
  169. +2 −2 tests/vsphere/requests/compute/vm_clone_tests.rb
  170. +0 −20 tests/vsphere/requests/compute/vm_create_tests.rb
View
4 .gitignore
@@ -6,17 +6,17 @@
.bundle
.DS_Store
.idea
+.yardoc
/tests/.fog
bin/*
!bin/fog
-!bin/rdoc
.fog
coverage
doc/*
docs/_site/*
docs/about/supported_services.markdown
Gemfile.lock
-rdoc
+yardoc
pkg
spec/credentials.yml
vendor/*
View
17 README.md
@@ -7,6 +7,7 @@ fog is the Ruby cloud computing library, top to bottom:
* Mocks make testing and integrating a breeze.
[![Build Status](https://secure.travis-ci.org/fog/fog.png?branch=master)](http://travis-ci.org/fog/fog)
+[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/fog/fog)
## Getting Started
@@ -112,23 +113,21 @@ geemus says: "That should give you everything you need to get started, but let m
## Contributing
-* Find something you would like to work on. For suggestions look for the `easy`, `medium` and `hard` tags in the [issues](https://github.com/fog/fog/issues)
+* Find something you would like to work on.
+ * Look for anything you can help with in the [issue tracker](https://github.com/fog/fog/issues).
+ * Look at the [code quality metrics](https://codeclimate.com/github/fog/fog) for anything you can help clean up.
+ * Or anything else!
* Fork the project and do your work in a topic branch.
-* Add a config at `~/.fog` for the component you want to test.
+ * Make sure your changes will work on both Ruby 1.8.7 and Ruby 1.9
+* Add a config at `tests/.fog` for the component you want to test.
* Add shindo tests to prove your code works and run all the tests using `bundle exec rake`.
-* Rebase your branch against fog/fog to make sure everything is up to date.
+* Rebase your branch against `fog/fog` to make sure everything is up to date.
* Commit your changes and send a pull request.
## Additional Resources
[fog.io](http://fog.io)
-## Sponsorship
-
-![Engine Yard](http://www.engineyard.com/images/logo.png)
-
-All new work on fog is sponsored by [Engine Yard](http://engineyard.com)
-
## Copyright
(The MIT License)
View
37 Rakefile
@@ -1,8 +1,8 @@
require 'bundler/setup'
require 'date'
require 'rubygems'
-require 'rdoc/task'
require 'rubygems/package_task'
+require 'yard'
require File.dirname(__FILE__) + '/lib/fog'
#############################################################################
@@ -116,14 +116,6 @@ task :nuke do
end
end
-require 'rdoc/task'
-RDoc::Task.new do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "#{name} #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
-
desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -r ./lib/#{name}.rb"
@@ -182,6 +174,13 @@ task :validate do
end
end
+# Include Yard tasks for rake yard
+YARDOC_LOCATION = "doc"
+YARD::Rake::YardocTask.new do |t|
+ t.files = ['lib/**/*.rb', "README"]
+ t.options = ["--output-dir", YARDOC_LOCATION, "--title", "#{name} #{version}"]
+end
+
task :changelog do
timestamp = Time.now.utc.strftime('%m/%d/%Y')
sha = `git log | head -1`.split(' ').last
@@ -271,7 +270,7 @@ end
task :docs do
Rake::Task[:supported_services_docs].invoke
Rake::Task[:upload_fog_io].invoke
- Rake::Task[:upload_rdoc].invoke
+ Rake::Task[:upload_yardoc].invoke
# connect to storage provider
Fog.credential = :geemus
@@ -397,18 +396,18 @@ task :upload_fog_io do
Formatador.redisplay("Uploaded docs/_site\n")
end
-task :upload_rdoc do
+task :upload_yardoc do
# connect to storage provider
Fog.credential = :geemus
storage = Fog::Storage.new(:provider => 'AWS')
directory = storage.directories.new(:key => 'fog.io')
- # write rdoc files to versioned 'folder'
- Rake::Task[:rdoc].invoke
- for file_path in Dir.glob('rdoc/**/*')
+ # write doc files to versioned 'folder'
+ Rake::Task[:yard].invoke
+ for file_path in Dir.glob("#{YARDOC_LOCATION}/**/*")
next if File.directory?(file_path)
- file_name = file_path.gsub('rdoc/', '')
- key = '' << version << '/rdoc/' << file_name
+ file_name = file_path.gsub("#{YARDOC_LOCATION}/", '')
+ key = '' << version << "/#{YARDOC_LOCATION}/" << file_name
Formatador.redisplay(' ' * 128)
Formatador.redisplay("Uploading [bold]#{key}[/]")
directory.files.create(
@@ -419,12 +418,12 @@ task :upload_rdoc do
end
Formatador.redisplay(' ' * 128)
directory.files.create(
- :body => redirecter("#{version}/rdoc/index.html"),
+ :body => redirecter("#{version}/#{YARDOC_LOCATION}/index.html"),
:content_type => 'text/html',
- :key => 'latest/rdoc/index.html',
+ :key => "latest/#{YARDOC_LOCATION}/index.html",
:public => true
)
- Formatador.redisplay("Uploaded rdoc\n")
+ Formatador.redisplay("Uploaded yardoc\n")
end
def redirecter(path)
View
2 docs/dns/index.markdown
@@ -76,4 +76,4 @@ If you already have an account with another service you can just as easily use t
## Go Forth and Resolve
-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.
+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.
View
11 docs/index.markdown
@@ -42,18 +42,23 @@ geemus says: "That should give you everything you need to get started, but let m
## Contributing
-* 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)
+* Find something you would like to work on.
+ * Look for anything you can help with in the [issue tracker](https://github.com/fog/fog/issues).
+ * Look at the [code quality metrics](https://codeclimate.com/github/fog/fog) for anything you can help clean up.
+ * Or anything else!
* Fork the project and do your work in a topic branch.
+ * Make sure your changes will work on both Ruby 1.8.7 and Ruby 1.9.
+* Add a config at `tests/.fog` for the component you want to test.
* Add shindo tests to prove your code works and run all the tests using `bundle exec rake`.
-* Rebase your branch against fog/fog to make sure everything is up to date.
+* Rebase your branch against `fog/fog` to make sure everything is up to date.
* Commit your changes and send a pull request.
## Resources
Enjoy, and let me know what I can do to continue improving fog!
* Work through the [fog tutorial](https://github.com/downloads/geemus/learn_fog/learn_fog.tar.gz)
-* Read fog's [API documentation](/rdoc)
+* Read fog's [API documentation](/doc)
* Stay up to date by following [@fog](http://twitter.com/fog) and/or [@geemus](http://twitter.com/geemus) on Twitter.
* Get and give help on the [#ruby-fog](irc://irc.freenode.net/ruby-fog) irc channel on Freenode
* Follow release notes and discussions on the [mailing list](http://groups.google.com/group/ruby-fog)
View
2 fog.gemspec
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('jekyll')
s.add_development_dependency('rake')
s.add_development_dependency('rbvmomi')
- s.add_development_dependency('rdoc')
+ s.add_development_dependency('yard')
s.add_development_dependency('thor')
s.add_development_dependency('rspec', '~>1.3.1')
s.add_development_dependency('rbovirt', '>=0.0.11')
View
2 lib/fog/aws/auto_scaling.rb
@@ -258,7 +258,7 @@ def initialize(options={})
setup_credentials(options)
@region = options[:region] || 'us-east-1'
- unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
+ unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
View
2 lib/fog/aws/cloud_watch.rb
@@ -55,7 +55,7 @@ def initialize(options={})
@region = options[:region] || 'us-east-1'
- unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
+ unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
View
3 lib/fog/aws/compute.rb
@@ -113,6 +113,7 @@ class AWS < Fog::Service
request :modify_instance_attribute
request :modify_network_interface_attribute
request :modify_snapshot_attribute
+ request :modify_volume_attribute
request :purchase_reserved_instances_offering
request :reboot_instances
request :release_address
@@ -220,7 +221,7 @@ def initialize(options={})
setup_credentials(options)
@region = options[:region] || 'us-east-1'
- unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
+ unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
View
2 lib/fog/aws/elb.rb
@@ -81,7 +81,7 @@ def initialize(options={})
@region = options[:region] || 'us-east-1'
- unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
+ unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
View
2 lib/fog/aws/models/compute/server.rb
@@ -60,6 +60,8 @@ def initialize(attributes={})
'ami-5e0fa45f'
when 'ap-southeast-1'
'ami-f092eca2'
+ when 'ap-southeast-2'
+ 'ami-fb8611c1' # Ubuntu 12.04 LTS 64bit (EBS)
when 'eu-west-1'
'ami-3d1f2b49'
when 'sa-east-1'
View
1 lib/fog/aws/models/compute/volume.rb
@@ -125,7 +125,6 @@ def detach(force = false)
end
end
-
end
end
end
View
4 lib/fog/aws/parsers/compute/describe_instances.rb
@@ -41,7 +41,9 @@ def end_element(name)
when *@contexts
@context.pop
when 'code'
- @instance[@context.last][name] = value.to_i
+ @instance[@context.last][name] = @context.last == 'stateReason' ? value : value.to_i
+ when 'message'
+ @instance[@context.last][name] = value
when 'deleteOnTermination'
@block_device_mapping[name] = (value == 'true')
when 'deviceName', 'status', 'volumeId'
View
2 lib/fog/aws/parsers/compute/describe_reserved_instances_offerings.rb
@@ -12,7 +12,7 @@ def reset
def end_element(name)
case name
- when 'availabilityZone', 'currencyCode', 'instanceType', 'instanceTenancy', 'productDescription', 'reservedInstancesOfferingId'
+ when 'availabilityZone', 'currencyCode', 'instanceType', 'offeringType', 'instanceTenancy', 'productDescription', 'reservedInstancesOfferingId'
@reserved_instances_offering[name] = value
when 'duration'
@reserved_instances_offering[name] = value.to_i
View
4 lib/fog/aws/rds.rb
@@ -101,7 +101,7 @@ def initialize(options={})
@use_iam_profile = options[:use_iam_profile]
@region = options[:region] || 'us-east-1'
- unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
+ unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
@@ -158,7 +158,7 @@ def initialize(options={})
end
def owner_id
- @owner_id ||= Fog::AWS[:rds].security_groups.get('default').owner_id
+ @owner_id ||= security_groups.get('default').owner_id
end
def reload
View
3 lib/fog/aws/requests/compute/describe_availability_zones.rb
@@ -71,6 +71,9 @@ def describe_availability_zones(filters = {})
{"messageSet" => [], "regionName" => "ap-southeast-1", "zoneName" => "ap-southeast-1a", "zoneState" => "available"},
{"messageSet" => [], "regionName" => "ap-southeast-1", "zoneName" => "ap-southeast-1b", "zoneState" => "available"},
+
+ {"messageSet" => [], "regionName" => "ap-southeast-2", "zoneName" => "ap-southeast-2a", "zoneState" => "available"},
+ {"messageSet" => [], "regionName" => "ap-southeast-2", "zoneName" => "ap-southeast-2b", "zoneState" => "available"},
]
availability_zone_info = all_zones.select { |zoneinfo| zoneinfo["regionName"] == @region }
View
19 lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb
@@ -18,7 +18,9 @@ class Real
# * 'availabilityZone'<~String> - availability zone of offering
# * 'duration'<~Integer> - duration, in seconds, of offering
# * 'fixedPrice'<~Float> - purchase price of offering
+ # * 'includeMarketplace'<~Boolean> - whether or not to include marketplace offerings
# * 'instanceType'<~String> - instance type of offering
+ # * 'offeringType'<~String> - type of offering, in ['Heavy Utilization', 'Medium Utilization', 'Light Utilization']
# * 'productDescription'<~String> - description of offering
# * 'reservedInstancesOfferingId'<~String> - id of offering
# * 'usagePrice'<~Float> - usage price of offering, per hour
@@ -41,14 +43,15 @@ def describe_reserved_instances_offerings(filters = {})
self.data[:reserved_instances_offerings] ||= [{
'reservedInstancesOfferingId' => Fog::AWS::Mock.reserved_instances_offering_id,
- 'instanceType' => 'm1.small',
- 'availabilityZone' => 'us-east-1d',
- 'duration' => 31536000,
- 'fixedPrice' => 350.0,
- 'usagePrice' => 0.03,
- 'productDescription' => 'Linux/UNIX',
- 'instanceTenancy' => 'default',
- 'currencyCode' => 'USD'
+ 'instanceType' => 'm1.small',
+ 'availabilityZone' => 'us-east-1d',
+ 'duration' => 31536000,
+ 'fixedPrice' => 350.0,
+ 'offeringType' => 'Medium Utilization',
+ 'usagePrice' => 0.03,
+ 'productDescription' => 'Linux/UNIX',
+ 'instanceTenancy' => 'default',
+ 'currencyCode' => 'USD'
}]
response.body = {
View
51 lib/fog/aws/requests/compute/modify_volume_attribute.rb
@@ -0,0 +1,51 @@
+module Fog
+ module Compute
+ class AWS
+ class Real
+
+ require 'fog/aws/parsers/compute/basic'
+
+ # Modifies a volume attribute.
+ #
+ # ==== Parameters
+ # * volume_id<~String> - The ID of the volume.
+ # * auto_enable_io_value<~Boolean> - This attribute exists to auto-enable the I/O operations to the volume.
+ #
+ # ==== Returns
+ # * response<~Excon::Response>:
+ # * body<~Hash>:
+ # * 'requestId'<~String> - Id of request
+ # * 'return'<~Boolean> - success?
+ #
+ # {Amazon API Reference}[http://http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyVolumeAttribute.html]
+ def modify_volume_attribute(volume_id=nil, auto_enable_io_value=false)
+ request(
+ 'Action' => 'ModifyVolumeAttribute',
+ 'VolumeId' => volume_id,
+ 'AutoEnableIO.Value' => auto_enable_io_value,
+ :idempotent => true,
+ :parser => Fog::Parsers::Compute::AWS::Basic.new
+ )
+ end
+
+ end
+
+ class Mock
+
+ def modify_volume_attribute(volume_id=nil, auto_enable_io_value=false)
+ response = Excon::Response.new
+ if volume = self.data[:volumes][volume_id]
+ response.status = 200
+ response.body = {
+ 'requestId' => Fog::AWS::Mock.request_id,
+ 'return' => true
+ }
+ response
+ else
+ raise Fog::Compute::AWS::NotFound.new("The volume '#{volume_id}' does not exist.")
+ end
+ end
+ end
+ end
+ end
+end
View
1 lib/fog/aws/requests/dns/change_resource_record_sets.rb
@@ -198,6 +198,7 @@ def self.elb_hosted_zone_mapping
@elb_hosted_zone_mapping ||= {
"ap-northeast-1" => "Z2YN17T5R711GT",
"ap-southeast-1" => "Z1WI8VXHPB1R38",
+ "ap-southeast-2" => "Z2999QAZ9SRTIC",
"eu-west-1" => "Z3NF1Z3NOM5OY2",
"sa-east-1" => "Z2ES78Y61JGQKS",
"us-east-1" => "Z3DZXE0Q79N41H",
View
2 lib/fog/aws/sqs.rb
@@ -40,7 +40,7 @@ def initialize(options={})
setup_credentials(options)
@region = options[:region] || 'us-east-1'
- unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
+ unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
raise ArgumentError, "Unknown region: #{@region.inspect}"
end
end
View
4 lib/fog/bluebox/requests/compute/create_block.rb
@@ -30,14 +30,12 @@ def create_block(product_id, template_id, location_id, options = {})
'location' => location_id
}
- body = URI.encode options.map {|k,v| "#{k}=#{v}"}.join('&')
-
request(
:expects => 200,
:method => 'POST',
:path => '/api/blocks.json',
:query => query,
- :body => URI.encode(body)
+ :body => options.map {|k,v| "#{CGI.escape(k)}=#{CGI.escape(v)}"}.join('&')
)
end
View
34 lib/fog/brightbox/compute.rb
@@ -176,27 +176,39 @@ def initialize(options)
@connection = Fog::Connection.new(@api_url, @persistent, @connection_options)
end
- def request(method, url, expected_responses, options = {})
+ # Makes an API request to the given path using passed options or those
+ # set with the service setup
+ #
+ # @todo Standard Fog behaviour is to return the Excon::Response but
+ # this was unintentionally changed to be the Hash version of the
+ # data in the body. This loses access to some details and should
+ # be corrected in a backwards compatible manner
+ #
+ # @param [String] method HTTP method to use for the request
+ # @param [String] path The absolute path for the request
+ # @param [Array<Fixnum>] expected_responses HTTP response codes that have been successful
+ # @param [Hash] parameters Keys and values for JSON
+ # @option parameters [String] :account_id The scoping account if required
+ #
+ # @return [Hash]
+ def request(method, path, expected_responses, parameters = {})
request_options = {
:method => method.to_s.upcase,
- :path => url,
+ :path => path,
:expects => expected_responses
}
- options[:account_id] = @brightbox_account if options[:account_id].nil? && @brightbox_account
- request_options[:body] = Fog::JSON.encode(options) unless options.empty?
+ parameters[:account_id] = @brightbox_account if parameters[:account_id].nil? && @brightbox_account
+ request_options[:body] = Fog::JSON.encode(parameters) unless parameters.empty?
make_request(request_options)
end
# Returns the scoped account being used for requests
#
- # API Clients:: This is the owning account
- # User Apps:: This is the account specified by either +account_id+
- # option on a connection or the +brightbox_account+
- # setting in your configuration
- #
- # === Returns:
+ # * For API clients this is the owning account
+ # * For User applications this is the account specified by either +account_id+
+ # option on a connection or the +brightbox_account+ setting in your configuration
#
- # <tt>Fog::Compute::Brightbox::Account</tt>
+ # @return [Fog::Compute::Brightbox::Account]
#
def account
Fog::Compute::Brightbox::Account.new(get_scoped_account)
View
3 lib/fog/brightbox/models/compute/server.rb
@@ -184,9 +184,10 @@ def hard_reboot
# Soft reboots often timeout if the OS missed the request so we do more
# error checking trying to detect the timeout
#
- # @fixme - Using side effect of wait_for's (evaluated block) to detect timeouts
+ # @todo Needs cleaner error handling when the OS times out
def soft_reboot
shutdown
+ # FIXME Using side effect of wait_for's (evaluated block) to detect timeouts
if wait_for(20) { ! ready? }
# Server is now down, start it up again
start
View
11 lib/fog/brightbox/requests/compute/activate_console_server.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Enable console access via VNC to the server for 15 minutes.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#server_activate_console_server
+ #
def activate_console_server(identifier)
return nil if identifier.nil? || identifier == ""
request("post", "/1.0/servers/#{identifier}/activate_console", [202])
@@ -11,4 +18,4 @@ def activate_console_server(identifier)
end
end
end
-end
+end
View
13 lib/fog/brightbox/requests/compute/add_listeners_load_balancer.rb
@@ -2,7 +2,16 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Adds a number of listeners to the load balancer to enable balancing across nodes for those settings.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ # @param [Hash] options
+ # @option options [Array] :listeners Array of Listener parameters. Timeout is optional and specified in milliseconds.
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#load_balancer_add_listeners_load_balancer
+ #
def add_listeners_load_balancer(identifier, options)
return nil if identifier.nil? || identifier == ""
request("post", "/1.0/load_balancers/#{identifier}/add_listeners", [202], options)
@@ -11,4 +20,4 @@ def add_listeners_load_balancer(identifier, options)
end
end
end
-end
+end
View
13 lib/fog/brightbox/requests/compute/add_nodes_load_balancer.rb
@@ -2,7 +2,16 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Add a number of nodes to the load balancer
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ # @param [Hash] options
+ # @option options [Array] :nodes Array of Node parameters
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#load_balancer_add_nodes_load_balancer
+ #
def add_nodes_load_balancer(identifier, options)
return nil if identifier.nil? || identifier == ""
request("post", "/1.0/load_balancers/#{identifier}/add_nodes", [202], options)
@@ -11,4 +20,4 @@ def add_nodes_load_balancer(identifier, options)
end
end
end
-end
+end
View
20 lib/fog/brightbox/requests/compute/add_servers_server_group.rb
@@ -2,20 +2,18 @@ module Fog
module Compute
class Brightbox
class Real
-
- # Add a number of servers to a server group
+ # Add a number of servers to the server group.
#
- # >> Compute[:brightbox].add_servers_server_group "grp-12345", :servers => [{:server => "srv-abcde"}]
+ # @param [String] identifier Unique reference to identify the resource
+ # @param [Hash] options
+ # @option options [Array<Hash>] :servers Array of Hashes containing `{"server" => server_id}` for each server to add
#
- # == Parameters:
- # * identifier (String) - The identifier of the server group to add to
- # * options
- # * servers (Array) - An Array of Hashes containing {"server" => server_id} for each server to add
- # [\[{"server" => "srv-abcde"}, {"server" => "srv-fghij"}\]]
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
#
- # == Returns:
+ # @see https://api.gb1.brightbox.com/1.0/#server_group_add_servers_server_group
#
- # A Ruby hash of the server response
+ # @example
+ # Compute[:brightbox].add_servers_server_group "grp-12345", :servers => [{"server" => "srv-abcde"}, {"server" => "srv-fghij"}]
#
def add_servers_server_group(identifier, options)
return nil if identifier.nil? || identifier == ""
@@ -25,4 +23,4 @@ def add_servers_server_group(identifier, options)
end
end
end
-end
+end
View
13 lib/fog/brightbox/requests/compute/apply_to_firewall_policy.rb
@@ -2,7 +2,16 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Applies firewall policy to given server group
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ # @param [Hash] options
+ # @option options [String] :server_group Server Group to apply to
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#firewall_policy_apply_to_firewall_policy
+ #
def apply_to_firewall_policy(identifier, options)
return nil if identifier.nil? || identifier == ""
request("post", "/1.0/firewall_policies/#{identifier}/apply_to", [202], options)
@@ -11,4 +20,4 @@ def apply_to_firewall_policy(identifier, options)
end
end
end
-end
+end
View
13 lib/fog/brightbox/requests/compute/create_api_client.rb
@@ -2,12 +2,21 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Create a new API client for the account.
+ #
+ # @param [Hash] options
+ # @option options [String] :name
+ # @option options [String] :description
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#api_client_create_api_client
+ #
def create_api_client(options)
request("post", "/1.0/api_clients", [201], options)
end
end
end
end
-end
+end
View
13 lib/fog/brightbox/requests/compute/create_application.rb
@@ -2,12 +2,21 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Create a new application for the user.
+ #
+ # @param [Hash] options
+ # @option options [String] :name
+ # @option options [String] :description
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#application_create_application
+ #
def create_application(options)
request("post", "/1.0/applications", [201], options)
end
end
end
end
-end
+end
View
12 lib/fog/brightbox/requests/compute/create_cloud_ip.rb
@@ -2,7 +2,17 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Requests a new cloud IP address for the account.
+ #
+ # @param [Hash] options
+ # @option options [String] :reverse_dns Reverse DNS hostname
+ # @option options [String] :name Name for Cloud IP
+ # @option options [Array] :port_translators Port on which external clients connect and port on which your service is listening.
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#cloud_ip_create_cloud_ip
+ #
def create_cloud_ip(options = {})
request("post", "/1.0/cloud_ips", [201], options)
end
View
15 lib/fog/brightbox/requests/compute/create_firewall_policy.rb
@@ -2,12 +2,23 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Create a new firewall policy for the account.
+ #
+ # Optionally applying to a server group at creation time.
+ #
+ # @param [Hash] options
+ # @option options [String] :server_group
+ # @option options [String] :name Editable label
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#firewall_policy_create_firewall_policy
+ #
def create_firewall_policy(options)
request("post", "/1.0/firewall_policies", [201], options)
end
end
end
end
-end
+end
View
19 lib/fog/brightbox/requests/compute/create_firewall_rule.rb
@@ -2,12 +2,27 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Create a new firewall rule for a firewall policy.
+ #
+ # @param [Hash] options
+ # @option options [String] :firewall_policy
+ # @option options [String] :protocol
+ # @option options [String] :source Required unless destination is set.
+ # @option options [String] :source_port
+ # @option options [String] :destination Required unless source is set
+ # @option options [String] :destination_port
+ # @option options [String] :icmp_type_name
+ # @option options [String] :description
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#firewall_rule_create_firewall_rule
+ #
def create_firewall_rule(options)
request("post", "/1.0/firewall_rules", [202], options)
end
end
end
end
-end
+end
View
20 lib/fog/brightbox/requests/compute/create_image.rb
@@ -2,12 +2,28 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Create a new image for the account by registering it against an image stored within the Brightbox cloud image library.
+ #
+ # The disk image must be in place before you can attempt to create a reference in the API.
+ #
+ # @param [Hash] options
+ # @option options [String] :source Filename of the image file uploaded to /incoming via FTP
+ # @option options [String] :arch OS architecture this image is built for
+ # @option options [String] :name Name for this image. If no name is specified, a name will be autogenerated based on the source filename &amp; current time. Can be modified later.
+ # @option options [String] :username Username for the image
+ # @option options [Boolean] :public
+ # @option options [Boolean] :compatibility_mode
+ # @option options [String] :description
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#image_create_image
+ #
def create_image(options)
request("post", "/1.0/images", [201], options)
end
end
end
end
-end
+end
View
16 lib/fog/brightbox/requests/compute/create_load_balancer.rb
@@ -2,12 +2,24 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Create a new load balancer for the account.
+ #
+ # @param [Hash] options
+ # @option options [String] :name Editable label
+ # @option options [Array] :nodes Array of Node parameters
+ # @option options [String] :policy Method of Load balancing to use
+ # @option options [Array] :listeners What port to listen on, port to pass through to and protocol (tcp, http or http+ws) of listener. Timeout is optional and specified in milliseconds (default is 50000).
+ # @option options [String] :healthcheck Healthcheck options - only "port" and "type" required
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#load_balancer_create_load_balancer
+ #
def create_load_balancer(options)
request("post", "/1.0/load_balancers", [202], options)
end
end
end
end
-end
+end
View
19 lib/fog/brightbox/requests/compute/create_server.rb
@@ -2,12 +2,27 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Create a new server for the account based on the required disk image.
+ #
+ # Optionally can setup the type of server, zone to locate it, groups to join and custom metadata.
+ #
+ # @param [Hash] options
+ # @option options [String] :image
+ # @option options [String] :name Editable label
+ # @option options [String] :server_type
+ # @option options [String] :zone Zone in which to create new Server
+ # @option options [String] :user_data
+ # @option options [Array] :server_groups Array of server groups to add server to
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#server_create_server
+ #
def create_server(options)
request("post", "/1.0/servers", [202], options)
end
end
end
end
-end
+end
View
13 lib/fog/brightbox/requests/compute/create_server_group.rb
@@ -2,12 +2,21 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Create a new server group for the account.
+ #
+ # @param [Hash] options
+ # @option options [String] :name Editable user label
+ # @option options [String] :description Editable user description
+ #
+ # @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#server_group_create_server_group
+ #
def create_server_group(options)
request("post", "/1.0/server_groups", [202], options)
end
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_api_client.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Destroy the API client.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#api_client_destroy_api_client
+ #
def destroy_api_client(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/api_clients/#{identifier}", [200])
@@ -11,4 +18,4 @@ def destroy_api_client(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_application.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Destroy the application.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#application_destroy_application
+ #
def destroy_application(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/applications/#{identifier}", [200])
@@ -11,4 +18,4 @@ def destroy_application(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_cloud_ip.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Release the cloud IP address from the account's ownership.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#cloud_ip_destroy_cloud_ip
+ #
def destroy_cloud_ip(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/cloud_ips/#{identifier}", [200])
@@ -11,4 +18,4 @@ def destroy_cloud_ip(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_firewall_policy.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Destroy the firewall policy if not in use.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#firewall_policy_destroy_firewall_policy
+ #
def destroy_firewall_policy(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/firewall_policies/#{identifier}", [202])
@@ -11,4 +18,4 @@ def destroy_firewall_policy(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_firewall_rule.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Destroy the firewall rule.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#firewall_rule_destroy_firewall_rule
+ #
def destroy_firewall_rule(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/firewall_rules/#{identifier}", [202])
@@ -11,4 +18,4 @@ def destroy_firewall_rule(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_image.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Destroy the image.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#image_destroy_image
+ #
def destroy_image(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/images/#{identifier}", [202])
@@ -11,4 +18,4 @@ def destroy_image(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_load_balancer.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Destroy the LoadBalancer
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#load_balancer_destroy_load_balancer
+ #
def destroy_load_balancer(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/load_balancers/#{identifier}", [202])
@@ -11,4 +18,4 @@ def destroy_load_balancer(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_server.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Destroy the server and free up the resources.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#server_destroy_server
+ #
def destroy_server(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/servers/#{identifier}", [202])
@@ -11,4 +18,4 @@ def destroy_server(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/destroy_server_group.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Destroy the server group if not in use.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#server_group_destroy_server_group
+ #
def destroy_server_group(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/server_groups/#{identifier}", [202])
@@ -11,4 +18,4 @@ def destroy_server_group(identifier)
end
end
end
-end
+end
View
22 lib/fog/brightbox/requests/compute/get_account.rb
@@ -2,25 +2,17 @@ module Fog
module Compute
class Brightbox
class Real
- # Requests details about an account from the API
+ # Get full details of the account.
#
- # === Parameters:
+ # @overload get_account(identifier)
+ # @param [String] identifier Unique reference to identify the resource
#
- # <tt>identifier <String></tt>:: The identifier to request (Default is +nil+)
+ # @overload get_account()
+ # @deprecated Use {Fog::Compute::Brightbox::Real#get_scoped_account} instead
#
- # === Returns:
+ # @return [Hash] The JSON response parsed to a Hash
#
- # <tt>Hash</tt>:: The JSON response parsed to a Hash
- #
- # === Notes:
- #
- # This also supports a deprecated form where if an identifier is not
- # passed then the scoping account is returned instead. This should not
- # be used in new code. Use #get_scoped_account instead.
- #
- # === Reference:
- #
- # https://api.gb1.brightbox.com/1.0/#account_get_account
+ # @see https://api.gb1.brightbox.com/1.0/#account_get_account
#
def get_account(identifier = nil)
if identifier.nil? || identifier.empty?
View
11 lib/fog/brightbox/requests/compute/get_api_client.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the API client.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#api_client_get_api_client
+ #
def get_api_client(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/api_clients/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_api_client(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/get_application.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the application.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#application_get_application
+ #
def get_application(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/applications/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_application(identifier)
end
end
end
-end
+end
View
4 lib/fog/brightbox/requests/compute/get_authenticated_user.rb
@@ -4,9 +4,7 @@ class Brightbox
class Real
# Requests details about authenticated user from the API
#
- # === Returns:
- #
- # <tt>Hash</tt>:: The JSON response parsed to a Hash
+ # @return [Hash] The JSON response parsed to a Hash
#
def get_authenticated_user
request("get", "/1.0/user", [200])
View
11 lib/fog/brightbox/requests/compute/get_cloud_ip.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the cloud IP address.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#cloud_ip_get_cloud_ip
+ #
def get_cloud_ip(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/cloud_ips/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_cloud_ip(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/get_firewall_policy.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get details of the firewall policy
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#firewall_policy_get_firewall_policy
+ #
def get_firewall_policy(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/firewall_policies/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_firewall_policy(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/get_firewall_rule.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the firewall rule.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#firewall_rule_get_firewall_rule
+ #
def get_firewall_rule(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/firewall_rules/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_firewall_rule(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/get_image.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the image.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#image_get_image
+ #
def get_image(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/images/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_image(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/get_interface.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the interface.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#interface_get_interface
+ #
def get_interface(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/interfaces/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_interface(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/get_load_balancer.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the load balancer.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#load_balancer_get_load_balancer
+ #
def get_load_balancer(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/load_balancers/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_load_balancer(identifier)
end
end
end
-end
+end
View
6 lib/fog/brightbox/requests/compute/get_scoped_account.rb
@@ -2,13 +2,9 @@ module Fog
module Compute
class Brightbox
class Real
-
# Requests details about currently scoped account
#
- # === Returns:
- #
- # <tt>Hash</tt>:: The JSON response parsed to a Hash
- #
+ # @return [Hash] The JSON response parsed to a Hash
def get_scoped_account
request("get", "/1.0/account", [200])
end
View
11 lib/fog/brightbox/requests/compute/get_server.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the server.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#server_get_server
+ #
def get_server(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/servers/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_server(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/get_server_group.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get details of the server group.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#server_group_get_server_group
+ #
def get_server_group(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/server_groups/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_server_group(identifier)
end
end
end
-end
+end
View
11 lib/fog/brightbox/requests/compute/get_server_type.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the server type.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#server_type_get_server_type
+ #
def get_server_type(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/server_types/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_server_type(identifier)
end
end
end
-end
+end
View
22 lib/fog/brightbox/requests/compute/get_user.rb
@@ -2,25 +2,17 @@ module Fog
module Compute
class Brightbox
class Real
- # Requests details about a user from the API
+ # Get full details of the user.
#
- # === Parameters:
+ # @overload get_user(identifier)
+ # @param [String] identifier Unique reference to identify the resource
#
- # <tt>identifier <String></tt>:: The identifier to request (Default is +nil+)
+ # @overload get_user()
+ # @deprecated Use {Fog::Compute::Brightbox::Real#get_authenticated_user} instead
#
- # === Returns:
+ # @return [Hash] The JSON response parsed to a Hash
#
- # <tt>Hash</tt>:: The JSON response parsed to a Hash
- #
- # === Notes:
- #
- # This also supports a deprecated form where if an identifier is not
- # passed then the requesting user is returned instead. This should not
- # be used in new code. Use #get_authenticated_user instead.
- #
- # === Reference:
- #
- # https://api.gb1.brightbox.com/1.0/#user_get_user
+ # @see https://api.gb1.brightbox.com/1.0/#user_get_user
#
def get_user(identifier = nil)
if identifier.nil? || identifier == ""
View
11 lib/fog/brightbox/requests/compute/get_zone.rb
@@ -2,7 +2,14 @@ module Fog
module Compute
class Brightbox
class Real
-
+ # Get full details of the zone.
+ #
+ # @param [String] identifier Unique reference to identify the resource
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#zone_get_zone
+ #
def get_zone(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/zones/#{identifier}", [200])
@@ -11,4 +18,4 @@ def get_zone(identifier)
end
end
end
-end
+end
View
8 lib/fog/brightbox/requests/compute/list_accounts.rb
@@ -2,12 +2,16 @@ module Fog
module Compute
class Brightbox
class Real
-
+ #
+ # @return [Hash] The JSON response parsed to a Hash
+ #
+ # @see https://api.gb1.brightbox.com/1.0/#account_list_accounts
+ #
def list_accounts
request("get", "/1.0/accounts", [200])
end
end
end
end