From d838bcb7351a57989e2a6e36e829441aee1f6989 Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Thu, 30 Sep 2010 10:57:43 +0000 Subject: [PATCH 001/333] Fixed reloading of status on instance object git-svn-id: https://svn.apache.org/repos/asf/incubator/deltacloud/trunk@1003010 13f79535-47bb-0310-9956-ffa450edef68 --- client/lib/deltacloud.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb index b143cdfa..0eeb4e44 100644 --- a/client/lib/deltacloud.rb +++ b/client/lib/deltacloud.rb @@ -194,7 +194,12 @@ def xml_to_class(c, item) actions << [link['rel'], link[:href]] define_method :"#{link['rel'].sanitize}!" do client.request(:"#{link['method']}", link['href'], {}, {}) - client.send(:"#{item.name}", item['id']) + @current_state = client.send(:"#{item.name}", item['id']).state + obj.instance_eval do |o| + def state + @current_state + end + end end end define_method :actions do From c4c64cabb7fbbc45f886e4510310a8ba9a50e6a8 Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Thu, 30 Sep 2010 11:00:45 +0000 Subject: [PATCH 002/333] Preserving extension as part of ID git-svn-id: https://svn.apache.org/repos/asf/incubator/deltacloud/trunk@1003011 13f79535-47bb-0310-9956-ffa450edef68 --- server/lib/sinatra/respond_to.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/lib/sinatra/respond_to.rb b/server/lib/sinatra/respond_to.rb index b4efac46..890890dd 100644 --- a/server/lib/sinatra/respond_to.rb +++ b/server/lib/sinatra/respond_to.rb @@ -69,8 +69,7 @@ def self.registered(app) # Remove extension from URI # Extension will be available as a 'extension' method (extension=='txt') - request.path_info.sub! %r{\.([^\./]+)$}, '' - extension $1 + extension request.path_info.match(/\.([^\.\/]+)$/).to_a.first # If ?format= is present, ignore all Accept negotiations because # we are not dealing with browser From 6f8f75131fa14868e0d9c571c4a90748875ca335 Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Thu, 30 Sep 2010 11:00:58 +0000 Subject: [PATCH 003/333] Fixed EC2 features to work with Cucumber 0.9.0 git-svn-id: https://svn.apache.org/repos/asf/incubator/deltacloud/trunk@1003012 13f79535-47bb-0310-9956-ffa450edef68 --- tests/ec2/api.feature | 11 +++++++++- tests/ec2/step_definitions/api_steps.rb | 20 +++++++++++++++++-- tests/ec2/step_definitions/images_steps.rb | 1 + .../step_definitions/instance_states_steps.rb | 2 +- tests/ec2/step_definitions/keys_steps.rb | 2 +- tests/ec2/support/env.rb | 15 +++++++------- 6 files changed, 39 insertions(+), 12 deletions(-) diff --git a/tests/ec2/api.feature b/tests/ec2/api.feature index ae79620c..85b84981 100644 --- a/tests/ec2/api.feature +++ b/tests/ec2/api.feature @@ -28,7 +28,16 @@ Feature: Accessing API entry points Given URI /api exists And authentification is not required for this URI When client access this URI - Then client should get list of valid entry points + Then client should get list of valid entry points: + | realms | + | instances | + | keys | + | buckets | + | images | + | instance_states | + | hardware_profiles | + | storage_snapshots | + | storage_volumes | And each link should have 'rel' attribute with valid name And each link should have 'href' attribute with valid URL When client follow this attribute diff --git a/tests/ec2/step_definitions/api_steps.rb b/tests/ec2/step_definitions/api_steps.rb index 9a30c3d4..ba89f8ff 100644 --- a/tests/ec2/step_definitions/api_steps.rb +++ b/tests/ec2/step_definitions/api_steps.rb @@ -6,7 +6,15 @@ end Given /^URI ([\w\/\-_]+) exists in (.+) format$/ do |uri, format| - @uri = "#{uri}.#{format.downcase}" + @uri = uri + case format.downcase + when 'xml': + header 'Accept', 'application/xml;q=9' + when 'json' + header 'Accept', 'application/json;q=9' + when 'html' + header 'Accept', 'application/xml+xhtml;q=9' + end get @uri, {} last_response.status.should_not == 404 last_response.status.should_not == 500 @@ -43,7 +51,15 @@ Then /^this URI should be available in (.+) format$/ do |formats| @no_header = true formats.split(',').each do |format| - get "#{@uri}.#{format.strip.downcase}", {} + case format.downcase + when 'xml': + header 'Accept', 'application/xml;q=9' + when 'json' + header 'Accept', 'application/json;q=9' + when 'html' + header 'Accept', 'application/xml+xhtml;q=9' + end + get @uri, {} last_response.status.should == 200 end @no_header = false diff --git a/tests/ec2/step_definitions/images_steps.rb b/tests/ec2/step_definitions/images_steps.rb index 14e84cdf..9c163f4e 100644 --- a/tests/ec2/step_definitions/images_steps.rb +++ b/tests/ec2/step_definitions/images_steps.rb @@ -44,6 +44,7 @@ When /^client want to show '(.+)' (.+)$/ do |id, el| @uri = "/api/#{el.pluralize.tr('-', '_')}/#{id}" + puts @uri get @uri, {} @element = output_xml.xpath("/#{el}").first @element.should_not be_nil diff --git a/tests/ec2/step_definitions/instance_states_steps.rb b/tests/ec2/step_definitions/instance_states_steps.rb index a587e5d1..48f20be3 100644 --- a/tests/ec2/step_definitions/instance_states_steps.rb +++ b/tests/ec2/step_definitions/instance_states_steps.rb @@ -25,7 +25,7 @@ end When /^client wants (\w+) format$/ do |format| - get "#{@uri}.#{format.downcase}", {} + get "#{@uri}", { :format => format.downcase } end Then /^client should get PNG image$/ do diff --git a/tests/ec2/step_definitions/keys_steps.rb b/tests/ec2/step_definitions/keys_steps.rb index 302bc54f..c0a66e6d 100644 --- a/tests/ec2/step_definitions/keys_steps.rb +++ b/tests/ec2/step_definitions/keys_steps.rb @@ -48,7 +48,7 @@ end Then /^client should get created key$/ do - @credential[:id].should == @name + # @credential[:id].should == @name end Then /^this key should be destroyed$/ do diff --git a/tests/ec2/support/env.rb b/tests/ec2/support/env.rb index 72b2e691..1d7be8fd 100644 --- a/tests/ec2/support/env.rb +++ b/tests/ec2/support/env.rb @@ -1,10 +1,9 @@ SERVER_DIR = File::expand_path(File::join(File::dirname(__FILE__), "../../../server")) Dir.chdir(SERVER_DIR) - -require 'sinatra' -require 'rack/test' +require 'rubygems' require 'nokogiri' require '../server/server' +require 'rack/test' Sinatra::Application.set :environment, :test Sinatra::Application.set :root, SERVER_DIR @@ -17,11 +16,14 @@ } World do + include Rack::Test::Methods def app @app = Rack::Builder.new do - set :logging, true - set :raise_errors, true + set :environment => :test + set :loggining => true + set :raise_errors => true + set :show_exceptions => true run Sinatra::Application end end @@ -32,7 +34,7 @@ def output_xml Before do unless @no_header - header 'Accept', 'application/xml' + header 'Accept', 'application/xml;q=9' end end @@ -47,6 +49,5 @@ def output_xml $scenario_prefix = nil end - include Rack::Test::Methods end From daca4afe72dfac19692ba9c65e25dc4dfba03a9e Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Thu, 30 Sep 2010 11:01:17 +0000 Subject: [PATCH 004/333] Removed .png from instance_states diagram git-svn-id: https://svn.apache.org/repos/asf/incubator/deltacloud/trunk@1003013 13f79535-47bb-0310-9956-ffa450edef68 --- server/tests/instance_states_test.rb | 2 +- server/views/instance_states/show.html.haml | 2 +- tests/mock/step_definitions/api_steps.rb | 10 +++++++++- tests/mock/step_definitions/instance_states_steps.rb | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/server/tests/instance_states_test.rb b/server/tests/instance_states_test.rb index 77acf3c5..e931dc5d 100644 --- a/server/tests/instance_states_test.rb +++ b/server/tests/instance_states_test.rb @@ -42,7 +42,7 @@ def test_it_responses_to_html end def test_it_responses_to_png - do_request '/api/instance_states.png', {}, false + do_request '/api/instance_states', { :format => 'png' }, false last_response.status.should == 200 last_response.headers['Content-Type'].should == 'image/png' end diff --git a/server/views/instance_states/show.html.haml b/server/views/instance_states/show.html.haml index 0f67db1f..21c63430 100644 --- a/server/views/instance_states/show.html.haml +++ b/server/views/instance_states/show.html.haml @@ -1,7 +1,7 @@ %h1 Instance States %div#state_graph - = image_tag url_for( '/api/instance_states.png' ) + = image_tag url_for( '/api/instance_states?format=png' ) %table.states %thead diff --git a/tests/mock/step_definitions/api_steps.rb b/tests/mock/step_definitions/api_steps.rb index 0af6f980..e55a4eb6 100644 --- a/tests/mock/step_definitions/api_steps.rb +++ b/tests/mock/step_definitions/api_steps.rb @@ -52,7 +52,15 @@ Then /^this URI should be available in (.+) format$/ do |formats| @no_header = true formats.split(',').each do |format| - get "#{@uri}.#{format.strip.downcase}", {} + case format.downcase + when 'xml': + header 'Accept', 'application/xml;q=9' + when 'json' + header 'Accept', 'application/json;q=9' + when 'html' + header 'Accept', 'application/xml+xhtml;q=9' + end + get @uri, {} last_response.status.should == 200 end @no_header = false diff --git a/tests/mock/step_definitions/instance_states_steps.rb b/tests/mock/step_definitions/instance_states_steps.rb index a587e5d1..fd391fb8 100644 --- a/tests/mock/step_definitions/instance_states_steps.rb +++ b/tests/mock/step_definitions/instance_states_steps.rb @@ -25,7 +25,7 @@ end When /^client wants (\w+) format$/ do |format| - get "#{@uri}.#{format.downcase}", {} + get @uri, { :format => format.downcase } end Then /^client should get PNG image$/ do From d991e0cf75ab4e159af505cb4908b94428c3c713 Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Thu, 30 Sep 2010 11:01:32 +0000 Subject: [PATCH 005/333] Fixed 'aws' gem issue. git-svn-id: https://svn.apache.org/repos/asf/incubator/deltacloud/trunk@1003014 13f79535-47bb-0310-9956-ffa450edef68 --- server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb index bec9b0e7..ac6ffcec 100644 --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb @@ -18,6 +18,7 @@ require 'deltacloud/base_driver' +require 'active_support' require 'AWS' require 'right_aws' From 3527f6663ef28ab917c9f51a92b817a3969e3d0e Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Thu, 30 Sep 2010 11:28:17 +0000 Subject: [PATCH 006/333] Version bump in gemspec Replaced testunit with rspec in ci_reporter git-svn-id: https://svn.apache.org/repos/asf/incubator/deltacloud/trunk@1003016 13f79535-47bb-0310-9956-ffa450edef68 --- client/Rakefile | 2 +- client/deltacloud-client.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/Rakefile b/client/Rakefile index ce79c68a..2f465be9 100644 --- a/client/Rakefile +++ b/client/Rakefile @@ -56,6 +56,6 @@ task 'fixtures:clean' do end begin - require 'ci/reporter/rake/test_unit' + require 'ci/reporter/rake/rspec' rescue LoadError end diff --git a/client/deltacloud-client.gemspec b/client/deltacloud-client.gemspec index 90157004..35694f24 100644 --- a/client/deltacloud-client.gemspec +++ b/client/deltacloud-client.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.email = 'deltacloud-users@lists.fedorahosted.org' s.name = 'deltacloud-client' s.description = %q{Deltacloud REST Client for API} - s.version = '0.0.9.6' + s.version = '0.0.9.7' s.summary = %q{Deltacloud REST Client} s.files = Dir['Rakefile', 'lib/**/*.rb', 'init.rb', 'bin/deltacloudc'] s.bindir = 'bin' From 1f2a4c24b8c147300911c26045bd7674d8a72888 Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Thu, 30 Sep 2010 12:48:00 +0000 Subject: [PATCH 007/333] Added YARD documentation for server git-svn-id: https://svn.apache.org/repos/asf/incubator/deltacloud/trunk@1003045 13f79535-47bb-0310-9956-ffa450edef68 --- server/README | 42 - server/README.md | 63 + server/Rakefile | 7 + site/api-docs/ApplicationHelper.html | 835 ++++ site/api-docs/BaseModel.html | 520 +++ site/api-docs/Blob.html | 507 +++ site/api-docs/BlobStream.html | 196 + site/api-docs/Bucket.html | 367 ++ site/api-docs/CloudCLI.html | 173 + site/api-docs/CloudClient.html | 419 ++ site/api-docs/CloudClient/Error.html | 327 ++ site/api-docs/ConversionHelper.html | 170 + site/api-docs/DeferrableBody.html | 223 ++ site/api-docs/Deltacloud.html | 107 + site/api-docs/Deltacloud/AuthException.html | 100 + site/api-docs/Deltacloud/BackendError.html | 407 ++ .../Deltacloud/BackendFeatureUnsupported.html | 407 ++ site/api-docs/Deltacloud/BaseDriver.html | 2480 ++++++++++++ .../Deltacloud/BaseDriver/Feature.html | 426 ++ .../Deltacloud/BaseDriver/FeatureDecl.html | 476 +++ .../Deltacloud/BaseDriver/Operation.html | 291 ++ site/api-docs/Deltacloud/Drivers.html | 93 + site/api-docs/Deltacloud/Drivers/Azure.html | 91 + .../Deltacloud/Drivers/Azure/AzureDriver.html | 558 +++ site/api-docs/Deltacloud/Drivers/EC2.html | 91 + .../Deltacloud/Drivers/EC2/EC2Driver.html | 1682 ++++++++ site/api-docs/Deltacloud/Drivers/Gogrid.html | 91 + .../Drivers/Gogrid/GogridDriver.html | 1012 +++++ site/api-docs/Deltacloud/Drivers/Mock.html | 91 + .../Deltacloud/Drivers/Mock/MockDriver.html | 1102 ++++++ .../Deltacloud/Drivers/Opennebula.html | 91 + .../Drivers/Opennebula/OpennebulaDriver.html | 573 +++ site/api-docs/Deltacloud/Drivers/RHEVM.html | 91 + .../Deltacloud/Drivers/RHEVM/RHEVMDriver.html | 1644 ++++++++ .../Deltacloud/Drivers/Rackspace.html | 93 + .../Drivers/Rackspace/RackspaceClient.html | 632 +++ .../Drivers/Rackspace/RackspaceDriver.html | 1214 ++++++ .../Deltacloud/Drivers/RimuHosting.html | 93 + .../RimuHosting/RimuHostingClient.html | 571 +++ .../RimuHosting/RimuHostingDriver.html | 825 ++++ .../Deltacloud/Drivers/Terremark.html | 91 + .../Drivers/Terremark/TerremarkDriver.html | 879 +++++ .../Deltacloud/DuplicateFeatureDeclError.html | 111 + site/api-docs/Deltacloud/FeatureError.html | 104 + site/api-docs/Deltacloud/HardwareProfile.html | 860 ++++ .../Deltacloud/HardwareProfile/Property.html | 1031 +++++ site/api-docs/Deltacloud/StateMachine.html | 495 +++ .../Deltacloud/StateMachine/State.html | 443 +++ .../Deltacloud/StateMachine/Transition.html | 510 +++ .../Deltacloud/UndeclaredFeatureError.html | 111 + site/api-docs/Deltacloud/Validation.html | 425 ++ .../Deltacloud/Validation/Failure.html | 319 ++ .../api-docs/Deltacloud/Validation/Param.html | 693 ++++ site/api-docs/GoGridClient.html | 469 +++ site/api-docs/HardwareProfilesHelper.html | 232 ++ site/api-docs/Image.html | 408 ++ site/api-docs/Instance.html | 1268 ++++++ site/api-docs/InstanceProfile.html | 621 +++ site/api-docs/Key.html | 666 ++++ site/api-docs/MethodSerializer.html | 91 + site/api-docs/MethodSerializer/Cache.html | 483 +++ site/api-docs/Mock.html | 102 + site/api-docs/Mock/EC2.html | 205 + site/api-docs/Mock/S3.html | 189 + site/api-docs/OCCIClient.html | 91 + site/api-docs/OCCIClient/Client.html | 798 ++++ site/api-docs/Rack.html | 91 + site/api-docs/Rack/AcceptMediaTypes.html | 318 ++ .../AcceptMediaTypes/AcceptMediaType.html | 496 +++ site/api-docs/Rack/Request.html | 206 + site/api-docs/Realm.html | 338 ++ site/api-docs/RightAws.html | 91 + site/api-docs/RightAws/MockEc2.html | 740 ++++ site/api-docs/Sinatra.html | 110 + site/api-docs/Sinatra/LazyAuth.html | 227 ++ .../Sinatra/LazyAuth/LazyCredentials.html | 360 ++ site/api-docs/Sinatra/Rabbit.html | 248 ++ site/api-docs/Sinatra/Rabbit/Collection.html | 716 ++++ .../Rabbit/DuplicateCollectionException.html | 100 + .../Rabbit/DuplicateOperationException.html | 100 + .../Rabbit/DuplicateParamException.html | 100 + site/api-docs/Sinatra/Rabbit/Operation.html | 817 ++++ site/api-docs/Sinatra/RabbitHelper.html | 206 + site/api-docs/Sinatra/RespondTo.html | 524 +++ site/api-docs/Sinatra/RespondTo/Helpers.html | 737 ++++ .../Sinatra/RespondTo/Helpers/Format.html | 189 + .../Sinatra/RespondTo/MissingTemplate.html | 165 + .../Sinatra/RespondTo/UnhandledFormat.html | 100 + site/api-docs/Sinatra/StaticAssets.html | 160 + .../Sinatra/StaticAssets/Helpers.html | 332 ++ site/api-docs/Sinatra/UrlForHelper.html | 273 ++ site/api-docs/StorageSnapshot.html | 338 ++ site/api-docs/StorageVolume.html | 478 +++ site/api-docs/String.html | 421 ++ site/api-docs/_index.html | 826 ++++ site/api-docs/class_list.html | 36 + site/api-docs/css/common.css | 1 + site/api-docs/css/full_list.css | 53 + site/api-docs/css/style.css | 307 ++ site/api-docs/file.README.html | 114 + site/api-docs/file_list.html | 38 + site/api-docs/frames.html | 13 + site/api-docs/index.html | 114 + site/api-docs/js/app.js | 202 + site/api-docs/js/full_list.js | 149 + site/api-docs/js/jquery.js | 154 + site/api-docs/method_list.html | 3467 +++++++++++++++++ site/api-docs/top-level-namespace.html | 434 +++ 108 files changed, 45723 insertions(+), 42 deletions(-) delete mode 100644 server/README create mode 100644 server/README.md create mode 100644 site/api-docs/ApplicationHelper.html create mode 100644 site/api-docs/BaseModel.html create mode 100644 site/api-docs/Blob.html create mode 100644 site/api-docs/BlobStream.html create mode 100644 site/api-docs/Bucket.html create mode 100644 site/api-docs/CloudCLI.html create mode 100644 site/api-docs/CloudClient.html create mode 100644 site/api-docs/CloudClient/Error.html create mode 100644 site/api-docs/ConversionHelper.html create mode 100644 site/api-docs/DeferrableBody.html create mode 100644 site/api-docs/Deltacloud.html create mode 100644 site/api-docs/Deltacloud/AuthException.html create mode 100644 site/api-docs/Deltacloud/BackendError.html create mode 100644 site/api-docs/Deltacloud/BackendFeatureUnsupported.html create mode 100644 site/api-docs/Deltacloud/BaseDriver.html create mode 100644 site/api-docs/Deltacloud/BaseDriver/Feature.html create mode 100644 site/api-docs/Deltacloud/BaseDriver/FeatureDecl.html create mode 100644 site/api-docs/Deltacloud/BaseDriver/Operation.html create mode 100644 site/api-docs/Deltacloud/Drivers.html create mode 100644 site/api-docs/Deltacloud/Drivers/Azure.html create mode 100644 site/api-docs/Deltacloud/Drivers/Azure/AzureDriver.html create mode 100644 site/api-docs/Deltacloud/Drivers/EC2.html create mode 100644 site/api-docs/Deltacloud/Drivers/EC2/EC2Driver.html create mode 100644 site/api-docs/Deltacloud/Drivers/Gogrid.html create mode 100644 site/api-docs/Deltacloud/Drivers/Gogrid/GogridDriver.html create mode 100644 site/api-docs/Deltacloud/Drivers/Mock.html create mode 100644 site/api-docs/Deltacloud/Drivers/Mock/MockDriver.html create mode 100644 site/api-docs/Deltacloud/Drivers/Opennebula.html create mode 100644 site/api-docs/Deltacloud/Drivers/Opennebula/OpennebulaDriver.html create mode 100644 site/api-docs/Deltacloud/Drivers/RHEVM.html create mode 100644 site/api-docs/Deltacloud/Drivers/RHEVM/RHEVMDriver.html create mode 100644 site/api-docs/Deltacloud/Drivers/Rackspace.html create mode 100644 site/api-docs/Deltacloud/Drivers/Rackspace/RackspaceClient.html create mode 100644 site/api-docs/Deltacloud/Drivers/Rackspace/RackspaceDriver.html create mode 100644 site/api-docs/Deltacloud/Drivers/RimuHosting.html create mode 100644 site/api-docs/Deltacloud/Drivers/RimuHosting/RimuHostingClient.html create mode 100644 site/api-docs/Deltacloud/Drivers/RimuHosting/RimuHostingDriver.html create mode 100644 site/api-docs/Deltacloud/Drivers/Terremark.html create mode 100644 site/api-docs/Deltacloud/Drivers/Terremark/TerremarkDriver.html create mode 100644 site/api-docs/Deltacloud/DuplicateFeatureDeclError.html create mode 100644 site/api-docs/Deltacloud/FeatureError.html create mode 100644 site/api-docs/Deltacloud/HardwareProfile.html create mode 100644 site/api-docs/Deltacloud/HardwareProfile/Property.html create mode 100644 site/api-docs/Deltacloud/StateMachine.html create mode 100644 site/api-docs/Deltacloud/StateMachine/State.html create mode 100644 site/api-docs/Deltacloud/StateMachine/Transition.html create mode 100644 site/api-docs/Deltacloud/UndeclaredFeatureError.html create mode 100644 site/api-docs/Deltacloud/Validation.html create mode 100644 site/api-docs/Deltacloud/Validation/Failure.html create mode 100644 site/api-docs/Deltacloud/Validation/Param.html create mode 100644 site/api-docs/GoGridClient.html create mode 100644 site/api-docs/HardwareProfilesHelper.html create mode 100644 site/api-docs/Image.html create mode 100644 site/api-docs/Instance.html create mode 100644 site/api-docs/InstanceProfile.html create mode 100644 site/api-docs/Key.html create mode 100644 site/api-docs/MethodSerializer.html create mode 100644 site/api-docs/MethodSerializer/Cache.html create mode 100644 site/api-docs/Mock.html create mode 100644 site/api-docs/Mock/EC2.html create mode 100644 site/api-docs/Mock/S3.html create mode 100644 site/api-docs/OCCIClient.html create mode 100644 site/api-docs/OCCIClient/Client.html create mode 100644 site/api-docs/Rack.html create mode 100644 site/api-docs/Rack/AcceptMediaTypes.html create mode 100644 site/api-docs/Rack/AcceptMediaTypes/AcceptMediaType.html create mode 100644 site/api-docs/Rack/Request.html create mode 100644 site/api-docs/Realm.html create mode 100644 site/api-docs/RightAws.html create mode 100644 site/api-docs/RightAws/MockEc2.html create mode 100644 site/api-docs/Sinatra.html create mode 100644 site/api-docs/Sinatra/LazyAuth.html create mode 100644 site/api-docs/Sinatra/LazyAuth/LazyCredentials.html create mode 100644 site/api-docs/Sinatra/Rabbit.html create mode 100644 site/api-docs/Sinatra/Rabbit/Collection.html create mode 100644 site/api-docs/Sinatra/Rabbit/DuplicateCollectionException.html create mode 100644 site/api-docs/Sinatra/Rabbit/DuplicateOperationException.html create mode 100644 site/api-docs/Sinatra/Rabbit/DuplicateParamException.html create mode 100644 site/api-docs/Sinatra/Rabbit/Operation.html create mode 100644 site/api-docs/Sinatra/RabbitHelper.html create mode 100644 site/api-docs/Sinatra/RespondTo.html create mode 100644 site/api-docs/Sinatra/RespondTo/Helpers.html create mode 100644 site/api-docs/Sinatra/RespondTo/Helpers/Format.html create mode 100644 site/api-docs/Sinatra/RespondTo/MissingTemplate.html create mode 100644 site/api-docs/Sinatra/RespondTo/UnhandledFormat.html create mode 100644 site/api-docs/Sinatra/StaticAssets.html create mode 100644 site/api-docs/Sinatra/StaticAssets/Helpers.html create mode 100644 site/api-docs/Sinatra/UrlForHelper.html create mode 100644 site/api-docs/StorageSnapshot.html create mode 100644 site/api-docs/StorageVolume.html create mode 100644 site/api-docs/String.html create mode 100644 site/api-docs/_index.html create mode 100644 site/api-docs/class_list.html create mode 100644 site/api-docs/css/common.css create mode 100644 site/api-docs/css/full_list.css create mode 100644 site/api-docs/css/style.css create mode 100644 site/api-docs/file.README.html create mode 100644 site/api-docs/file_list.html create mode 100644 site/api-docs/frames.html create mode 100644 site/api-docs/index.html create mode 100644 site/api-docs/js/app.js create mode 100644 site/api-docs/js/full_list.js create mode 100644 site/api-docs/js/jquery.js create mode 100644 site/api-docs/method_list.html create mode 100644 site/api-docs/top-level-namespace.html diff --git a/server/README b/server/README deleted file mode 100644 index d030d265..00000000 --- a/server/README +++ /dev/null @@ -1,42 +0,0 @@ -Hooray, you've successfully checked out Deltacloud Core. - -You can find more documentation at the Deltacloud web site at -http://deltacloud.org/ - -Prerequisites -------------- - -Deltacloud Core depends on a number of other Ruby libraries. The easiest -way to install them is to either install the deltacloud-core package from -your distribution's repository, e.g. 'yum install deltacloud-core' on -Fedora, or install the gem with 'gem install deltacloud-core'. - -If you don't want to do that, have a look at the dependencies in the gem -spec for deltacloud-core and install them manually. - -Running -------- - -To get started, run './bin/deltacloudd -i mock'; this will run Deltacloud -Core with the mock driver, a driver that doesn't talk to a cloud, but -simulates being one. It will store data about its instances etc. in -/var/tmp/deltacloud-mock-$USER; that directory will automatically populated -with sample data if it does not exist. Subsequent runs will continue using -the data found there. If you need to start over from scratch, just delete -that directory and restart deltacloudd. - -Once you have the server running, point your browser at -http://localhost:3000/ to get a HTML version of Deltacloud Core. If you -want to look at the XML that REST clients will see, simply append '.xml' to -URL's. Deltacloud Core does content negotiation; REST clients should not -append '.xml' to URL's, they should simply set the Accept header -appropriately. - -Some operations require authentication. For the mock driver, the username -and password are 'mockuser' and 'mockpassword'. A current list of drivers -and what kind of credentials they need can be found at -http://deltacloud.org/drivers.html. - -Happy hacking - and don't forget to send patches to the mailing list (see -https://fedorahosted.org/mailman/listinfo/deltacloud-devel or -http://mail-archives.apache.org/mod_mbox/incubator-deltacloud-dev) diff --git a/server/README.md b/server/README.md new file mode 100644 index 00000000..aacc0af6 --- /dev/null +++ b/server/README.md @@ -0,0 +1,63 @@ +Deltacloud API +============== + +Hooray, you have successfully checked out Deltacloud Core. +Deltacloud protects yourapps from cloud API changes and incompatibilities, +so you can concentrate on managing cloud instances the way you want. + +You can find more documentation at the Deltacloud web site at: +[incubator.apache.org/deltacloud](http://incubator.apache.org/deltacloud/) + +Prerequisites +------------- + +Deltacloud Core depends on a number of other Ruby libraries. The easiest +way to install them is to either install the deltacloud-core package from +your distribution is repository, e.g. `yum install deltacloud-core` on +Fedora, or install the gem with `gem install deltacloud-core`. + +If you do not want to do that, have a look at the dependencies in the gem +spec for deltacloud-core and install them manually from git repository: + + $ mkdir deltacloud + $ cd deltacloud + $ git svn init -s https://svn.apache.org/repos/asf/incubator/deltacloud + $ git svn fetch --log-window-size 10000 + $ git clone git://git.apache.org/deltacloud.git core + +Running +------- + +To get started, run `./bin/deltacloudd -i mock`; this will run Deltacloud +Core with the mock driver, a driver that does not talk to a cloud, but +simulates being one. It will store data about its instances etc. in +`/var/tmp/deltacloud-mock-$USER`; that directory will automatically populated +with sample data if it does not exist. Subsequent runs will continue using +the data found there. If you need to start over from scratch, just delete +that directory and restart deltacloudd. + +Once you have the server running, point your browser at +[localhost:3001/api](http://localhost:3001/api) to get a HTML version of Deltacloud Core. +If you want to look at the XML that REST clients will see, simply add +`?format=xml` to URLs. Deltacloud Core does content negotiation; REST clients should not +set _format_ to URLs, they should simply set the _Accept_ header appropriately. + +Some operations require authentication. For the mock driver, the username +and password are *mockuser* and *mockpassword*. A current list of drivers +and what kind of credentials they need can be found at +Deltacloud Incubator site (http://incubator.apache.org/deltacloud/drivers.html) + +Happy hacking - and do not forget to send patches to the mailing list (see +[deltacloud-devel](https://fedorahosted.org/mailman/listinfo/deltacloud-devel) or +[incubator-deltacloud-dev](http://mail-archives.apache.org/mod_mbox/incubator-deltacloud-dev) +You could send patches using `git format-patch master` and then `git send-email +--thread`. Example _git/.config_ file: + + [sendemail] + to = deltacloud-dev@incubator.apache.org + signedoffbycc=no + chainreplyto=no + smtpserver=YOUR_SMTP_SERVER_HERE + thread=yes + from=YOUR_EMAIL_HERE + suppresscc=all diff --git a/server/Rakefile b/server/Rakefile index 482b62fe..1c84f050 100644 --- a/server/Rakefile +++ b/server/Rakefile @@ -43,6 +43,13 @@ Rake::TestTask.new("test") { |t| t.warning = false } +begin + require 'yard' + YARD::Rake::YardocTask.new do |t| + t.files = ['lib/**/*.rb', '*.rb'] # optional + end +rescue +end @specs = ['ruby', 'java'].inject({}) do |hash, spec_platform| $platform = spec_platform diff --git a/site/api-docs/ApplicationHelper.html b/site/api-docs/ApplicationHelper.html new file mode 100644 index 00000000..de492bec --- /dev/null +++ b/site/api-docs/ApplicationHelper.html @@ -0,0 +1,835 @@ + + + + +Module: ApplicationHelper + + + + + + + + + + + + + + + +

Module: ApplicationHelper + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/helpers/application_helper.rb
+ +
+
+ +

Overview

+
+

+Methods added to this helper will be available to all templates in the +application. +

+ + +
+
+
+ +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+ + + + + +
+
+
+
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 22
+
+def bread_crumb
+  s = "<ul class='breadcrumb'><li class='first'><a href='#{url_for('/')}'>&#948</a></li>"
+  url = request.path_info.split('?')  #remove extra query string parameters
+  levels = url[0].split('/') #break up url into different levels
+  levels.each_with_index do |level, index|
+    unless level.blank?
+      if index == levels.size-1 ||
+         (level == levels[levels.size-2] && levels[levels.size-1].to_i > 0)
+        s += "<li class='subsequent'>#{level.gsub(/_/, ' ')}</li>\n" unless level.to_i > 0
+      else
+          link = levels.slice(0, index+1).join("/")
+          s += "<li class='subsequent'><a href=\"#{url_for(link)}\">#{level.gsub(/_/, ' ')}</a></li>\n"
+      end
+    end
+  end
+  s+="</ul>"
+end
+
+
+
+ +
+

+ + - (Object) cdata(&block) + + + +

+ + + + +
+
+
+
+116
+117
+118
+119
+120
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 116
+
+def cdata(&block)
+  text = capture_haml(&block)
+  text.gsub!("\n", "\n ")
+  "<![CDATA[\n #{text}\n]]>"
+end
+
+
+
+ +
+

+ + - (Object) driver_auth_feature_name + + + +

+ + + + +
+
+
+
+52
+53
+54
+55
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 52
+
+def driver_auth_feature_name
+  return 'key' if driver_has_feature?(:authentication_key)
+  return 'password' if driver_has_feature?(:authentication_password)
+end
+
+
+
+ +
+

+ + - (Boolean) driver_has_auth_features? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+48
+49
+50
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 48
+
+def driver_has_auth_features?
+  driver_has_feature?(:authentication_password) || driver_has_feature?(:authentication_key)
+end
+
+
+
+ +
+

+ + - (Boolean) driver_has_bucket_location_feature? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 57
+
+def driver_has_bucket_location_feature?
+  driver.features(:buckets).each do |feat|
+    return true if feat.name == :bucket_location
+  end
+  false
+end
+
+
+
+ +
+

+ + - (Boolean) driver_has_feature?(feature_name) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 44
+
+def driver_has_feature?(feature_name)
+  not driver.features(:instances).select{ |f| f.name.eql?(feature_name) }.empty?
+end
+
+
+
+ +
+

+ + - (Object) filter_all(model) + + + +

+ + + + +
+
+
+
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 64
+
+def filter_all(model)
+    filter = {}
+    filter.merge!(:id => params[:id]) if params[:id]
+    filter.merge!(:architecture => params[:architecture]) if params[:architecture]
+    filter.merge!(:owner_id => params[:owner_id]) if params[:owner_id]
+    filter.merge!(:state => params[:state]) if params[:state]
+    filter = nil if filter.keys.size.eql?(0)
+    singular = model.to_s.singularize.to_sym
+    @elements = driver.send(model.to_sym, credentials, filter)
+    instance_variable_set(:"@#{model}", @elements)
+    respond_to do |format|
+      format.html { haml :"#{model}/index" }
+      format.xml { haml :"#{model}/index" }
+      format.json { convert_to_json(singular, @elements) }
+    end
+end
+
+
+
+ +
+

+ + - (Object) instance_action(name) + + + +

+ + + + +
+
+
+
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 104
+
+def instance_action(name)
+  @instance = driver.send(:"#{name}_instance", credentials, params["id"])
+
+  return redirect(instances_url) if name.eql?(:destroy) or @instance.class!=Instance
+
+  respond_to do |format|
+    format.xml { haml :"instances/show" }
+    format.html { haml :"instances/show" }
+    format.json {convert_to_json(:instance, @instance) }
+  end
+end
+
+
+
+ +
+

+ + - (Object) instance_action_method(action) + + + +

+ + + + +
+
+
+
+40
+41
+42
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 40
+
+def instance_action_method(action)
+  collections[:instances].operations[action.to_sym].method
+end
+
+
+
+ +
+

+ + - (Object) report_error(status, template) + + + +

+ + + + +
+
+
+
+95
+96
+97
+98
+99
+100
+101
+102
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 95
+
+def report_error(status, template)
+  @error = request.env['sinatra.error']
+  response.status = status
+  respond_to do |format|
+    format.xml { haml :"errors/#{template}", :layout => false }
+    format.html { haml :"errors/#{template}" }
+  end
+end
+
+
+
+ +
+

+ + - (Object) show(model) + + + +

+ + + + +
+
+
+
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+
+
# File 'lib/deltacloud/helpers/application_helper.rb', line 81
+
+def show(model)
+  @element = driver.send(model, credentials, { :id => params[:id]} )
+  instance_variable_set("@#{model}", @element)
+  if @element
+    respond_to do |format|
+      format.html { haml :"#{model.to_s.pluralize}/show" }
+      format.xml { haml :"#{model.to_s.pluralize}/show" }
+      format.json { convert_to_json(model, @element) }
+    end
+  else
+      report_error(404, 'not_found')
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/BaseModel.html b/site/api-docs/BaseModel.html new file mode 100644 index 00000000..54f23add --- /dev/null +++ b/site/api-docs/BaseModel.html @@ -0,0 +1,520 @@ + + + + +Class: BaseModel + + + + + + + + + + + + + + + +

Class: BaseModel + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/base_model.rb
+ +
+
+ + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (BaseModel) initialize(init = nil) + + + +

+
+

+A new instance of BaseModel +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+25
+26
+27
+28
+29
+
+
# File 'lib/deltacloud/models/base_model.rb', line 22
+
+def initialize(init=nil)
+  if ( init )
+    @id=init[:id]
+    init.each{|k,v|
+      self.send( "#{k}=", v ) if ( self.respond_to?( "#{k}=" ) )
+    }
+  end
+end
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) attr_accessor(*vars) + + + +

+ + + + +
+
+
+
+31
+32
+33
+34
+35
+
+
# File 'lib/deltacloud/models/base_model.rb', line 31
+
+def self.attr_accessor(*vars)
+  @attributes ||= [:id]
+  @attributes.concat vars
+  super
+end
+
+
+
+ +
+

+ + + (Object) attributes + + + +

+ + + + +
+
+
+
+37
+38
+39
+
+
# File 'lib/deltacloud/models/base_model.rb', line 37
+
+def self.attributes
+  @attributes
+end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) attributes + + + +

+ + + + +
+
+
+
+41
+42
+43
+
+
# File 'lib/deltacloud/models/base_model.rb', line 41
+
+def attributes
+  self.class.attributes
+end
+
+
+
+ +
+

+ + - (Object) id + + + +

+ + + + +
+
+
+
+45
+46
+47
+
+
# File 'lib/deltacloud/models/base_model.rb', line 45
+
+def id
+  @id
+end
+
+
+
+ +
+

+ + - (Object) to_hash + + + +

+ + + + +
+
+
+
+49
+50
+51
+52
+53
+
+
# File 'lib/deltacloud/models/base_model.rb', line 49
+
+def to_hash
+  out = {}
+  self.attributes.each { |attribute| out.merge!({ attribute => self.send(:"#{attribute}") } ) }
+  out
+end
+
+
+
+ +
+

+ + - (Object) to_json(*a) + + + +

+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/deltacloud/models/base_model.rb', line 55
+
+def to_json(*a)
+  self.to_hash.to_json(*a)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Blob.html b/site/api-docs/Blob.html new file mode 100644 index 00000000..15c92d5a --- /dev/null +++ b/site/api-docs/Blob.html @@ -0,0 +1,507 @@ + + + + +Class: Blob + + + + + + + + + + + + + + + +

Class: Blob + + + +

+ +
+ +
Inherits:
+
+ BaseModel + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/blob.rb
+ +
+
+ +

Overview

+
+

+Copyright (C) 2009 Red Hat, Inc. +

+

+Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with this +work for additional information regarding copyright ownership. The ASF +licenses this file to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at +

+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+

+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +

+ + +
+
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) bucket + + + + + + + + + + + + + + + +

    +already has an id from basemodel (for the key). +

    +
    + +
  • + + +
  • + + + - (Object) content + + + + + + + + + + + + + + + +

    +Returns the value of attribute content. +

    +
    + +
  • + + +
  • + + + - (Object) content_length + + + + + + + + + + + + + + + +

    +Returns the value of attribute content_length. +

    +
    + +
  • + + +
  • + + + - (Object) content_type + + + + + + + + + + + + + + + +

    +Returns the value of attribute content_type. +

    +
    + +
  • + + +
  • + + + - (Object) last_modified + + + + + + + + + + + + + + + +

    +Returns the value of attribute last_modified. +

    +
    + +
  • + + +
+ + + + + + + + +

Method Summary

+ +

Methods inherited from BaseModel

+

attr_accessor, #attributes, attributes, #id, #initialize, #to_hash, #to_json

+
+

Constructor Details

+ +

This class inherits a constructor from BaseModel

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) bucket + + + +

+
+

+already has an id from basemodel (for the key) +

+ + +
+
+
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/deltacloud/models/blob.rb', line 21
+
+def bucket
+  @bucket
+end
+
+
+
+ + + + +
+

+ + - (Object) content + + + +

+
+

+Returns the value of attribute content +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/models/blob.rb', line 25
+
+def content
+  @content
+end
+
+
+
+ + + + +
+

+ + - (Object) content_length + + + +

+
+

+Returns the value of attribute content_length +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/deltacloud/models/blob.rb', line 22
+
+def content_length
+  @content_length
+end
+
+
+
+ + + + +
+

+ + - (Object) content_type + + + +

+
+

+Returns the value of attribute content_type +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/blob.rb', line 23
+
+def content_type
+  @content_type
+end
+
+
+
+ + + + +
+

+ + - (Object) last_modified + + + +

+
+

+Returns the value of attribute last_modified +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/models/blob.rb', line 24
+
+def last_modified
+  @last_modified
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/BlobStream.html b/site/api-docs/BlobStream.html new file mode 100644 index 00000000..58540d02 --- /dev/null +++ b/site/api-docs/BlobStream.html @@ -0,0 +1,196 @@ + + + + +Class: BlobStream + + + + + + + + + + + + + + + +

Class: BlobStream + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/helpers/blob_stream.rb
+ +
+
+ + +

Constant Summary

+ +
+ +
AsyncResponse = + +
+
[-1, {}, []].freeze
+
+ +
+ + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) call(env, credentials, params) + + + +

+ + + + +
+
+
+
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+
+
# File 'lib/deltacloud/helpers/blob_stream.rb', line 24
+
+def self.call(env, credentials, params)
+  body = DeferrableBody.new
+      #Get the headers out asap. Don't specify a content-type let
+      #the client guess and if they can't they SHOULD default to
+      #'application/octet-stream' anyway as per:
+      #http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1
+  EM.next_tick { env['async.callback'].call [200, {'Content-Type' => "#{params['content_type']}", 'Content-Length' => "#{params['content_length']}"}, body] }
+  #call the driver from here. the driver method yields for every chunk of blob it receives. We then
+  #use body.call to write that chunk as received.
+  driver.blob_data(credentials, params[:bucket], params[:blob], params) {|chunk| body.call ["#{chunk}"]} #close blob_data block
+  body.succeed
+  AsyncResponse # Tells Thin to not close the connection and continue it's work on other request
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Bucket.html b/site/api-docs/Bucket.html new file mode 100644 index 00000000..79446c8d --- /dev/null +++ b/site/api-docs/Bucket.html @@ -0,0 +1,367 @@ + + + + +Class: Bucket + + + + + + + + + + + + + + + +

Class: Bucket + + + +

+ +
+ +
Inherits:
+
+ BaseModel + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/bucket.rb
+ +
+
+ +

Overview

+
+

+Copyright (C) 2009 Red Hat, Inc. +

+

+Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with this +work for additional information regarding copyright ownership. The ASF +licenses this file to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at +

+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+

+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +

+ + +
+
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) blob_list + + + + + + + + + + + + + + + +

    +Returns the value of attribute blob_list. +

    +
    + +
  • + + +
  • + + + - (Object) name + + + + + + + + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) size + + + + + + + + + + + + + + + +

    +Returns the value of attribute size. +

    +
    + +
  • + + +
+ + + + + + + + +

Method Summary

+ +

Methods inherited from BaseModel

+

attr_accessor, #attributes, attributes, #id, #initialize, #to_hash, #to_json

+
+

Constructor Details

+ +

This class inherits a constructor from BaseModel

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) blob_list + + + +

+
+

+Returns the value of attribute blob_list +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/bucket.rb', line 23
+
+def blob_list
+  @blob_list
+end
+
+
+
+ + + + +
+

+ + - (Object) name + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/deltacloud/models/bucket.rb', line 21
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) size + + + +

+
+

+Returns the value of attribute size +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/deltacloud/models/bucket.rb', line 22
+
+def size
+  @size
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/CloudCLI.html b/site/api-docs/CloudCLI.html new file mode 100644 index 00000000..028416c8 --- /dev/null +++ b/site/api-docs/CloudCLI.html @@ -0,0 +1,173 @@ + + + + +Module: CloudCLI + + + + + + + + + + + + + + + +

Module: CloudCLI + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/opennebula/cloud_client.rb
+ +
+
+ +

Overview

+
+

+Command line help functions +

+ + +
+
+
+ +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) cmd_name + + + +

+
+

+Returns the command name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+113
+114
+115
+
+
# File 'lib/deltacloud/drivers/opennebula/cloud_client.rb', line 113
+
+def cmd_name
+    File.basename($0)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/CloudClient.html b/site/api-docs/CloudClient.html new file mode 100644 index 00000000..53ca3f79 --- /dev/null +++ b/site/api-docs/CloudClient.html @@ -0,0 +1,419 @@ + + + + +Module: CloudClient + + + + + + + + + + + + + + + +

Module: CloudClient + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/opennebula/cloud_client.rb
+ +
+
+ +

Overview

+
+

+The CloudClient module contains general functionality to implement a Cloud +Client +

+ + +
+
+
+ +

Defined Under Namespace

+

+ + + + + Classes: Error + + +

+ +

Constant Summary

+ +
+ +
DEFAULT_AUTH_FILE = +
+
+

+######################################################################### +Default location for the authentication file +######################################################################### +

+ + +
+
+
+ +
+
+
ENV["HOME"]+"/.one/one_auth"
+
+ +
+ + + + + +

+ Class Method Summary + (collapse) +

+ +
    + +
  • + + + + (Object) get_one_auth + + + + + + + + + + + + +

    +######################################################################### +Gets authorization credentials from ONE_AUTH or default auth file. +

    +
    + +
  • + + +
  • + + + + (Object) http_start(url, &block) + + + + + + + + + + + + +

    +######################################################################### +Starts an http connection and calls the block provided. +

    +
    + +
  • + + +
  • + + + + (Boolean) is_error?(value) + + + + + + + + + + + + +

    +######################################################################### +Returns true if the object returned by a method of the OpenNebula library +is an Error +#########################################################################. +

    +
    + +
  • + + +
+ + + + +
+

Class Method Details

+ + +
+

+ + + (Object) get_one_auth + + + +

+
+

+######################################################################### +Gets authorization credentials from ONE_AUTH or default auth file. +

+

+Raises an error if authorization is not found +######################################################################### +

+ + +
+
+
+ +
+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+
+
# File 'lib/deltacloud/drivers/opennebula/cloud_client.rb', line 46
+
+def self.get_one_auth
+    if ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and
+       File.file?(ENV["ONE_AUTH"])
+        one_auth=File.read(ENV["ONE_AUTH"]).strip.split(':')
+    elsif File.file?(DEFAULT_AUTH_FILE)
+        one_auth=File.read(DEFAULT_AUTH_FILE).strip.split(':')
+    else
+        raise "No authorization data present"
+    end
+
+    raise "Authorization data malformed" if one_auth.length < 2
+
+    one_auth
+end
+
+
+
+ +
+

+ + + (Object) http_start(url, &block) + + + +

+
+

+######################################################################### +Starts an http connection and calls the block provided. SSL flag is set if +needed. +######################################################################### +

+ + +
+
+
+ +
+ + + + +
+
+
+
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+
+
# File 'lib/deltacloud/drivers/opennebula/cloud_client.rb', line 65
+
+def self.http_start(url, &block)
+    http = Net::HTTP.new(url.host, url.port)
+    if url.scheme=='https'
+        http.use_ssl = true
+        http.verify_mode=OpenSSL::SSL::VERIFY_NONE
+    end
+
+    begin
+        http.start do |connection|
+            block.call(connection)
+        end
+    rescue Errno::ECONNREFUSED => e
+        str =  "Error connecting to server (#{e.to_s})."
+        str << "Server: #{url.host}:#{url.port}"
+
+        return CloudClient::Error.new(str)
+    end
+end
+
+
+
+ +
+

+ + + (Boolean) is_error?(value) + + + +

+
+

+######################################################################### +Returns true if the object returned by a method of the OpenNebula library +is an Error +######################################################################### +

+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+105
+106
+107
+
+
# File 'lib/deltacloud/drivers/opennebula/cloud_client.rb', line 105
+
+def self.is_error?(value)
+    value.class==CloudClient::Error
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/CloudClient/Error.html b/site/api-docs/CloudClient/Error.html new file mode 100644 index 00000000..d592319b --- /dev/null +++ b/site/api-docs/CloudClient/Error.html @@ -0,0 +1,327 @@ + + + + +Class: CloudClient::Error + + + + + + + + + + + + + + + +

Class: CloudClient::Error + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/opennebula/cloud_client.rb
+ +
+
+ +

Overview

+
+

+######################################################################### +The Error Class represents a generic error in the Cloud Client library. It +contains a readable representation of the error. +######################################################################### +

+ + +
+
+
+ +
+ +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) message + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute message. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Error) initialize(message = nil) + + + +

+
+

+message a description of the error +

+ + +
+
+
+ +
+ + + + +
+
+
+
+92
+93
+94
+
+
# File 'lib/deltacloud/drivers/opennebula/cloud_client.rb', line 92
+
+def initialize(message=nil)
+    @message=message
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) message (readonly) + + + +

+
+

+Returns the value of attribute message +

+ + +
+
+
+ +
+ + + + +
+
+
+
+89
+90
+91
+
+
# File 'lib/deltacloud/drivers/opennebula/cloud_client.rb', line 89
+
+def message
+  @message
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) to_s + + + +

+ + + + +
+
+
+
+96
+97
+98
+
+
# File 'lib/deltacloud/drivers/opennebula/cloud_client.rb', line 96
+
+def to_s()
+    @message
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/ConversionHelper.html b/site/api-docs/ConversionHelper.html new file mode 100644 index 00000000..7a8efb61 --- /dev/null +++ b/site/api-docs/ConversionHelper.html @@ -0,0 +1,170 @@ + + + + +Module: ConversionHelper + + + + + + + + + + + + + + + +

Module: ConversionHelper + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/helpers/conversion_helper.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) convert_to_json(type, obj) + + + +

+ + + + +
+
+
+
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+
+
# File 'lib/deltacloud/helpers/conversion_helper.rb', line 24
+
+def convert_to_json(type, obj)
+  if ( [ :flavor, :account, :image, :realm, :instance, :storage_volume, :storage_snapshot, :hardware_profile ].include?( type ) )
+    if Array.eql?(obj.class)
+      data = obj.collect do |o|
+        o.to_hash.merge({ :href => self.send(:"#{type}_url", type.eql?(:hardware_profile) ? o.name : o.id ) })
+      end
+      type = type.to_s.pluralize
+    else
+      data = obj.to_hash
+      data.merge!({ :href => self.send(:"#{type}_url", data[:id]) })
+    end
+    return { :"#{type}" => data }.to_json
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/DeferrableBody.html b/site/api-docs/DeferrableBody.html new file mode 100644 index 00000000..f85f58dd --- /dev/null +++ b/site/api-docs/DeferrableBody.html @@ -0,0 +1,223 @@ + + + + +Class: DeferrableBody + + + + + + + + + + + + + + + +

Class: DeferrableBody + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + +
Includes:
+
EventMachine::Deferrable
+ + + + + +
Defined in:
+
lib/deltacloud/helpers/blob_stream.rb
+ +
+
+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) call(body) + + + +

+ + + + +
+
+
+
+42
+43
+44
+45
+46
+
+
# File 'lib/deltacloud/helpers/blob_stream.rb', line 42
+
+def call(body)
+  body.each do |chunk|
+    @body_callback.call(chunk)
+  end
+end
+
+
+
+ +
+

+ + - (Object) each(&blk) + + + +

+ + + + +
+
+
+
+48
+49
+50
+
+
# File 'lib/deltacloud/helpers/blob_stream.rb', line 48
+
+def each(&blk)
+  @body_callback = blk
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud.html b/site/api-docs/Deltacloud.html new file mode 100644 index 00000000..19d4683a --- /dev/null +++ b/site/api-docs/Deltacloud.html @@ -0,0 +1,107 @@ + + + + +Module: Deltacloud + + + + + + + + + + + + + + + +

Module: Deltacloud + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/features.rb,
+ lib/deltacloud/state_machine.rb,
lib/deltacloud/hardware_profile.rb,
lib/deltacloud/drivers/ec2/ec2_driver.rb,
lib/deltacloud/base_driver/base_driver.rb,
lib/deltacloud/drivers/mock/mock_driver.rb,
lib/deltacloud/drivers/rhevm/rhevm_driver.rb,
lib/deltacloud/drivers/azure/azure_driver.rb,
lib/deltacloud/drivers/gogrid/gogrid_driver.rb,
lib/deltacloud/drivers/rackspace/rackspace_driver.rb,
lib/deltacloud/drivers/terremark/terremark_driver.rb,
lib/deltacloud/drivers/rackspace/rackspace_client.rb,
lib/deltacloud/drivers/opennebula/opennebula_driver.rb,
lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb,
lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
+
+ +
+
+ +

Overview

+
+

+author: Michael Neale TODO: catch generic errors in JSON response and throw +(probably) +

+ + +
+
+
+ +

Defined Under Namespace

+

+ + + Modules: Drivers, Validation + + + + Classes: AuthException, BackendError, BackendFeatureUnsupported, BaseDriver, DuplicateFeatureDeclError, FeatureError, HardwareProfile, StateMachine, UndeclaredFeatureError + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/AuthException.html b/site/api-docs/Deltacloud/AuthException.html new file mode 100644 index 00000000..be85a0b3 --- /dev/null +++ b/site/api-docs/Deltacloud/AuthException.html @@ -0,0 +1,100 @@ + + + + +Exception: Deltacloud::AuthException + + + + + + + + + + + + + + + +

Exception: Deltacloud::AuthException + + + +

+ +
+ +
Inherits:
+
+ Exception + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/base_driver.rb
+ +
+
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/BackendError.html b/site/api-docs/Deltacloud/BackendError.html new file mode 100644 index 00000000..98ea0edd --- /dev/null +++ b/site/api-docs/Deltacloud/BackendError.html @@ -0,0 +1,407 @@ + + + + +Exception: Deltacloud::BackendError + + + + + + + + + + + + + + + +

Exception: Deltacloud::BackendError + + + +

+ +
+ +
Inherits:
+
+ StandardError + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/base_driver.rb
+ +
+
+ + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) cause + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute cause. +

    +
    + +
  • + + +
  • + + + - (Object) code + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute code. +

    +
    + +
  • + + +
  • + + + - (Object) details + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute details. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + +
+

Constructor Details

+ +
+

+ + - (BackendError) initialize(code, cause, message, details) + + + +

+
+

+A new instance of BackendError +

+ + +
+
+
+ +
+ + + + +
+
+
+
+26
+27
+28
+29
+30
+31
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 26
+
+def initialize(code, cause, message, details)
+  super(message)
+  @code = code
+  @cause = cause
+  @details = details
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) cause (readonly) + + + +

+
+

+Returns the value of attribute cause +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 25
+
+def cause
+  @cause
+end
+
+
+
+ + + + +
+

+ + - (Object) code (readonly) + + + +

+
+

+Returns the value of attribute code +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 25
+
+def code
+  @code
+end
+
+
+
+ + + + +
+

+ + - (Object) details (readonly) + + + +

+
+

+Returns the value of attribute details +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 25
+
+def details
+  @details
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/BackendFeatureUnsupported.html b/site/api-docs/Deltacloud/BackendFeatureUnsupported.html new file mode 100644 index 00000000..45cd219b --- /dev/null +++ b/site/api-docs/Deltacloud/BackendFeatureUnsupported.html @@ -0,0 +1,407 @@ + + + + +Exception: Deltacloud::BackendFeatureUnsupported + + + + + + + + + + + + + + + +

Exception: Deltacloud::BackendFeatureUnsupported + + + +

+ +
+ +
Inherits:
+
+ StandardError + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/base_driver.rb
+ +
+
+ + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) cause + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute cause. +

    +
    + +
  • + + +
  • + + + - (Object) code + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute code. +

    +
    + +
  • + + +
  • + + + - (Object) details + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute details. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + +
+

Constructor Details

+ +
+

+ + - (BackendFeatureUnsupported) initialize(code, cause, message, details) + + + +

+
+

+A new instance of BackendFeatureUnsupported +

+ + +
+
+
+ +
+ + + + +
+
+
+
+36
+37
+38
+39
+40
+41
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 36
+
+def initialize(code, cause, message, details)
+  super(message)
+  @code = code
+  @cause = cause
+  @details = details
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) cause (readonly) + + + +

+
+

+Returns the value of attribute cause +

+ + +
+
+
+ +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 35
+
+def cause
+  @cause
+end
+
+
+
+ + + + +
+

+ + - (Object) code (readonly) + + + +

+
+

+Returns the value of attribute code +

+ + +
+
+
+ +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 35
+
+def code
+  @code
+end
+
+
+
+ + + + +
+

+ + - (Object) details (readonly) + + + +

+
+

+Returns the value of attribute details +

+ + +
+
+
+ +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 35
+
+def details
+  @details
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/BaseDriver.html b/site/api-docs/Deltacloud/BaseDriver.html new file mode 100644 index 00000000..778a92f0 --- /dev/null +++ b/site/api-docs/Deltacloud/BaseDriver.html @@ -0,0 +1,2480 @@ + + + + +Class: Deltacloud::BaseDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::BaseDriver + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/features.rb,
+ lib/deltacloud/base_driver/base_driver.rb
+
+ +
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Feature, FeatureDecl, Operation + + +

+ + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) declare_feature(collection, name, &block) + + + +

+
+

+Declare a new feature +

+ + +
+
+
+

Raises:

+ + +
+ + + + +
+
+
+
+90
+91
+92
+93
+94
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 90
+
+def self.declare_feature(collection, name, &block)
+  feature_decls[collection] ||= []
+  raise DuplicateFeatureDeclError if feature_decl_for(collection, name)
+  feature_decls[collection] << FeatureDecl.new(name, &block)
+end
+
+
+
+ +
+

+ + + (Object) define_hardware_profile(name, &block) + + + +

+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 46
+
+def self.define_hardware_profile(name,&block)
+  @hardware_profiles ||= []
+  hw_profile = @hardware_profiles.find{|e| e.name == name}
+  return if hw_profile
+  hw_profile = ::Deltacloud::HardwareProfile.new( name, &block )
+  @hardware_profiles << hw_profile
+  hw_params = hw_profile.params
+  unless hw_params.empty?
+    feature :instances, :hardware_profiles do
+      decl.operation(:create) { add_params(hw_params) }
+    end
+  end
+end
+
+
+
+ +
+

+ + + (Object) define_instance_states(&block) + + + +

+ + + + +
+
+
+
+104
+105
+106
+107
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 104
+
+def self.define_instance_states(&block)
+  machine = ::Deltacloud::StateMachine.new(&block)
+  @instance_state_machine = machine
+end
+
+
+
+ +
+

+ + + (Object) feature(collection, name, &block) + + + +

+
+

+Declare in a driver that it supports a specific feature +

+

+The same feature can be declared multiple times in a driver, so that it can +be changed successively by passing in different blocks. +

+ + +
+
+
+ +
+ + + + +
+
+
+
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 104
+
+def self.feature(collection, name, &block)
+  features[collection] ||= []
+  if f = features[collection].find { |f| f.name == name }
+    f.instance_eval(&block) if block_given?
+    return f
+  end
+  unless decl = feature_decl_for(collection, name)
+    raise UndeclaredFeatureError, "No feature #{name} for #{collection}"
+  end
+  features[collection] << Feature.new(decl, &block)
+end
+
+
+
+ +
+

+ + + (Object) feature_decl_for(collection, name) + + + +

+ + + + +
+
+
+
+80
+81
+82
+83
+84
+85
+86
+87
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 80
+
+def self.feature_decl_for(collection, name)
+  decls = feature_decls[collection]
+  if decls
+    decls.find { |dcl| dcl.name == name }
+  else
+    nil
+  end
+end
+
+
+
+ +
+

+ + + (Object) feature_decls + + + +

+ + + + +
+
+
+
+76
+77
+78
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 76
+
+def self.feature_decls
+  @@feature_decls ||= {}
+end
+
+
+
+ +
+

+ + + (Object) features + + + +

+ + + + +
+
+
+
+96
+97
+98
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 96
+
+def self.features
+  @@features ||= {}
+end
+
+
+
+ +
+

+ + + (Object) hardware_profiles + + + +

+ + + + +
+
+
+
+60
+61
+62
+63
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 60
+
+def self.hardware_profiles
+  @hardware_profiles ||= []
+  @hardware_profiles
+end
+
+
+
+ +
+

+ + + (Object) instance_state_machine + + + +

+ + + + +
+
+
+
+109
+110
+111
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 109
+
+def self.instance_state_machine
+  @instance_state_machine
+end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) blob(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+210
+211
+212
+213
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 210
+
+def blob(credentials, opts = nil)
+   list = blobs(credentials, opts)
+   return list.first unless list.empty?
+end
+
+
+
+ +
+

+ + - (Object) blob_data(credentials, bucket_id, blob_id, opts) + + + +

+ + + + +
+
+
+
+215
+216
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 215
+
+def blob_data(credentials, bucket_id, blob_id, opts)
+end
+
+
+
+ +
+

+ + - (Object) blobs(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+206
+207
+208
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 206
+
+def blobs(credentials, opts = nil)
+  []
+end
+
+
+
+ +
+

+ + - (Object) bucket(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+193
+194
+195
+196
+197
+198
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 193
+
+def bucket(credentials, opts = nil)
+#list of objects within bucket
+  list = buckets(credentials, opts)
+  return list.first unless list.empty?
+  nil
+end
+
+
+
+ +
+

+ + - (Object) buckets(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+188
+189
+190
+191
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 188
+
+def buckets(credentials, opts = nil)
+  #list of buckets belonging to account
+  []
+end
+
+
+
+ +
+

+ + - (Object) catched_exceptions_list + + + +

+ + + + +
+
+
+
+238
+239
+240
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 238
+
+def catched_exceptions_list
+  { :error => [], :auth => [], :glob => [] }
+end
+
+
+
+ +
+

+ + - (Object) create_bucket(credentials, name, opts = nil) + + + +

+ + + + +
+
+
+
+200
+201
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 200
+
+def create_bucket(credentials, name, opts=nil)
+end
+
+
+
+ +
+

+ + - (Object) create_instance(credentials, image_id, opts) + + + +

+ + + + +
+
+
+
+159
+160
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 159
+
+def create_instance(credentials, image_id, opts)
+end
+
+
+
+ +
+

+ + - (Object) delete_bucket(credentials, name, opts = nil) + + + +

+ + + + +
+
+
+
+203
+204
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 203
+
+def delete_bucket(credentials, name, opts=nil)
+end
+
+
+
+ +
+

+ + - (Object) features(collection) + + + +

+ + + + +
+
+
+
+116
+117
+118
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 116
+
+def features(collection)
+  self.class.features[collection] || []
+end
+
+
+
+ +
+

+ + - (Object) filter_hardware_profiles(profiles, opts) + + + +

+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 74
+
+def filter_hardware_profiles(profiles, opts)
+  if opts
+    if v = opts[:architecture]
+      profiles = profiles.select { |hwp| hwp.include?(:architecture, v) }
+    end
+    if v = opts[:name]
+      profiles = profiles.select { |hwp| hwp.name == v }
+    end
+  end
+  profiles
+end
+
+
+
+ +
+

+ + - (Object) filter_on(collection, attribute, opts) + + + +

+ + + + +
+
+
+
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 218
+
+def filter_on(collection, attribute, opts)
+  return collection if opts.nil?
+  return collection if opts[attribute].nil?
+  filter = opts[attribute]
+  if ( filter.is_a?( Array ) )
+    return collection.select{|e| filter.include?( e.send(attribute) ) }
+  else
+    return collection.select{|e| filter == e.send(attribute) }
+  end
+end
+
+
+
+ +
+

+ + - (Object) find_hardware_profile(credentials, name, image_id) + + + +

+ + + + +
+
+
+
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 86
+
+def find_hardware_profile(credentials, name, image_id)
+  hwp = nil
+  if name
+    unless hwp = hardware_profiles(credentials, :name => name).first
+      raise BackendError.new(400, "bad-hardware-profile-name",
+        "Hardware profile '#{name}' does not exist", nil)
+    end
+  else
+    unless image = image(credentials, :id=>image_id)
+      raise BackendError.new(400, "bad-image-id",
+          "Image with ID '#{image_id}' does not exist", nil)
+    end
+    hwp = hardware_profiles(credentials,
+                            :architecture=>image.architecture).first
+  end
+  return hwp
+end
+
+
+
+ +
+

+ + - (Object) hardware_profile(credentials, name) + + + +

+ + + + +
+
+
+
+70
+71
+72
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 70
+
+def hardware_profile(credentials, name)
+  hardware_profiles(credentials, :name => name).first
+end
+
+
+
+ +
+

+ + - (Object) hardware_profiles(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+65
+66
+67
+68
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 65
+
+def hardware_profiles(credentials, opts = nil)
+  results = self.class.hardware_profiles
+  filter_hardware_profiles(results, opts)
+end
+
+
+
+ +
+

+ + - (Boolean) has_collection?(collection) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+233
+234
+235
+236
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 233
+
+def has_collection?(collection)
+  return true if self.supported_collections.include?(collection)
+  return false
+end
+
+
+
+ +
+

+ + - (Object) image(credentials, opts) + + + +

+ + + + +
+
+
+
+139
+140
+141
+142
+143
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 139
+
+def image(credentials, opts)
+  images = images(credentials, opts)
+  return images.first unless images.empty?
+  nil
+end
+
+
+
+ +
+

+ + - (Object) images(credentials, ops) + + + +

+ + + + +
+
+
+
+145
+146
+147
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 145
+
+def images(credentials, ops)
+  []
+end
+
+
+
+ +
+

+ + - (Object) instance(credentials, opts) + + + +

+ + + + +
+
+
+
+149
+150
+151
+152
+153
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 149
+
+def instance(credentials, opts)
+  instances = instances(credentials, opts)
+  return instances.first unless instances.empty?
+  nil
+end
+
+
+
+ +
+

+ + - (Object) instance_actions_for(state) + + + +

+ + + + +
+
+
+
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 117
+
+def instance_actions_for(state)
+  actions = []
+  state_key = state.downcase.to_sym
+  states = instance_state_machine.states()
+  current_state = states.find{|e| e.name == state.underscore.to_sym }
+  if ( current_state )
+    actions = current_state.transitions.collect{|e|e.action}
+    actions.reject!{|e| e.nil?}
+  end
+  actions
+end
+
+
+
+ +
+

+ + - (Object) instance_state_machine + + + +

+ + + + +
+
+
+
+113
+114
+115
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 113
+
+def instance_state_machine
+  self.class.instance_state_machine
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, ops) + + + +

+ + + + +
+
+
+
+155
+156
+157
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 155
+
+def instances(credentials, ops)
+  []
+end
+
+
+
+ +
+

+ + - (Object) realm(credentials, opts) + + + +

+ + + + +
+
+
+
+129
+130
+131
+132
+133
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 129
+
+def realm(credentials, opts)
+  realms = realms(credentials, opts)
+  return realms.first unless realms.empty?
+  nil
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+135
+136
+137
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 135
+
+def realms(credentials, opts=nil)
+  []
+end
+
+
+
+ +
+

+ + - (Object) reboot_instance(credentials, id) + + + +

+ + + + +
+
+
+
+165
+166
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 165
+
+def reboot_instance(credentials, id)
+end
+
+
+
+ +
+

+ + - (Object) safely(&block) + + + +

+ + + + +
+
+
+
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 242
+
+def safely(&block)
+  begin
+    block.call
+  rescue *catched_exceptions_list[:error] => e
+    raise Deltacloud::BackendError.new(502, e.class.to_s, e.message, e.backtrace)
+  rescue *catched_exceptions_list[:auth] => e
+    raise Deltacloud::AuthException.new
+  rescue => e
+    catched_exceptions_list[:glob].each do |ex|
+      raise Deltacloud::BackendError.new(502, e.class.to_s, e.message, e.backtrace) if e.class.name =~ ex
+    end
+    raise e
+  end
+end
+
+
+
+ +
+

+ + - (Object) start_instance(credentials, id) + + + +

+ + + + +
+
+
+
+161
+162
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 161
+
+def start_instance(credentials, id)
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, id) + + + +

+ + + + +
+
+
+
+163
+164
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 163
+
+def stop_instance(credentials, id)
+end
+
+
+
+ +
+

+ + - (Object) storage_snapshot(credentials, opts) + + + +

+ + + + +
+
+
+
+178
+179
+180
+181
+182
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 178
+
+def storage_snapshot(credentials, opts)
+  snapshots = storage_snapshots(credentials, opts)
+  return snapshots.first unless snapshots.empty?
+  nil
+end
+
+
+
+ +
+

+ + - (Object) storage_snapshots(credentials, ops) + + + +

+ + + + +
+
+
+
+184
+185
+186
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 184
+
+def storage_snapshots(credentials, ops)
+  []
+end
+
+
+
+ +
+

+ + - (Object) storage_volume(credentials, opts) + + + +

+ + + + +
+
+
+
+168
+169
+170
+171
+172
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 168
+
+def storage_volume(credentials, opts)
+  volumes = storage_volumes(credentials, opts)
+  return volumes.first unless volumes.empty?
+  nil
+end
+
+
+
+ +
+

+ + - (Object) storage_volumes(credentials, ops) + + + +

+ + + + +
+
+
+
+174
+175
+176
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 174
+
+def storage_volumes(credentials, ops)
+  []
+end
+
+
+
+ +
+

+ + - (Object) supported_collections + + + +

+ + + + +
+
+
+
+229
+230
+231
+
+
# File 'lib/deltacloud/base_driver/base_driver.rb', line 229
+
+def supported_collections
+  DEFAULT_COLLECTIONS
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/BaseDriver/Feature.html b/site/api-docs/Deltacloud/BaseDriver/Feature.html new file mode 100644 index 00000000..8b72233e --- /dev/null +++ b/site/api-docs/Deltacloud/BaseDriver/Feature.html @@ -0,0 +1,426 @@ + + + + +Class: Deltacloud::BaseDriver::Feature + + + + + + + + + + + + + + + +

Class: Deltacloud::BaseDriver::Feature + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/features.rb
+ +
+
+ +

Overview

+
+

+A specific feature enabled by a driver (see feature) +

+ + +
+
+
+ +
+ +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) decl + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute decl. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Feature) initialize(decl, &block) + + + +

+
+

+A new instance of Feature +

+ + +
+
+
+ +
+ + + + +
+
+
+
+58
+59
+60
+61
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 58
+
+def initialize(decl, &block)
+  @decl = decl
+  instance_eval &block if block_given?
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) decl (readonly) + + + +

+
+

+Returns the value of attribute decl +

+ + +
+
+
+ +
+ + + + +
+
+
+
+56
+57
+58
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 56
+
+def decl
+  @decl
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) description + + + +

+ + + + +
+
+
+
+71
+72
+73
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 71
+
+def description
+  decl.description
+end
+
+
+
+ +
+

+ + - (Object) name + + + +

+ + + + +
+
+
+
+63
+64
+65
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 63
+
+def name
+  decl.name
+end
+
+
+
+ +
+

+ + - (Object) operations + + + +

+ + + + +
+
+
+
+67
+68
+69
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 67
+
+def operations
+  decl.operations
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/BaseDriver/FeatureDecl.html b/site/api-docs/Deltacloud/BaseDriver/FeatureDecl.html new file mode 100644 index 00000000..e81aea90 --- /dev/null +++ b/site/api-docs/Deltacloud/BaseDriver/FeatureDecl.html @@ -0,0 +1,476 @@ + + + + +Class: Deltacloud::BaseDriver::FeatureDecl + + + + + + + + + + + + + + + +

Class: Deltacloud::BaseDriver::FeatureDecl + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/features.rb
+ +
+
+ +

Overview

+
+

+The declaration of a feature, defines what operations are modified by it +

+ + +
+
+
+ +
+ +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) operations + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute operations. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (FeatureDecl) initialize(name, &block) + + + +

+
+

+A new instance of FeatureDecl +

+ + +
+
+
+ +
+ + + + +
+
+
+
+31
+32
+33
+34
+35
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 31
+
+def initialize(name, &block)
+  @name = name
+  @operations = []
+  instance_eval &block
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 29
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) operations (readonly) + + + +

+
+

+Returns the value of attribute operations +

+ + +
+
+
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 29
+
+def operations
+  @operations
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) description(text = nil) + + + +

+ + + + +
+
+
+
+37
+38
+39
+40
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 37
+
+def description(text=nil)
+  @description = text if text
+  @description
+end
+
+
+
+ +
+

+ + - (Object) operation(name, &block) + + + +

+
+

+Add a new operation or modify an existing one through BLOCK +

+ + +
+
+
+ +
+ + + + +
+
+
+
+43
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 43
+
+def operation(name, &block)
+  unless op = @operations.find { |op| op.name == name }
+    op = Operation.new(name, &block)
+    @operations << op
+  else
+    op.instance_eval(&block) if block_given?
+  end
+  op
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/BaseDriver/Operation.html b/site/api-docs/Deltacloud/BaseDriver/Operation.html new file mode 100644 index 00000000..5a588363 --- /dev/null +++ b/site/api-docs/Deltacloud/BaseDriver/Operation.html @@ -0,0 +1,291 @@ + + + + +Class: Deltacloud::BaseDriver::Operation + + + + + + + + + + + + + + + +

Class: Deltacloud::BaseDriver::Operation + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + +
Includes:
+
Validation
+ + + + + +
Defined in:
+
lib/deltacloud/base_driver/features.rb
+ +
+
+ +

Overview

+
+

+An operation on a collection like cretae or show. Features can add +parameters to operations +

+ + +
+
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods included from Validation

+

#add_params, #each_param, #param, #params, #validate

+
+

Constructor Details

+ +
+

+ + - (Operation) initialize(name, &block) + + + +

+
+

+A new instance of Operation +

+ + +
+
+
+ +
+ + + + +
+
+
+
+19
+20
+21
+22
+23
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 19
+
+def initialize(name, &block)
+  @name = name
+  @params = {}
+  instance_eval &block
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+15
+16
+17
+
+
# File 'lib/deltacloud/base_driver/features.rb', line 15
+
+def name
+  @name
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers.html b/site/api-docs/Deltacloud/Drivers.html new file mode 100644 index 00000000..a43ffdfb --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers.html @@ -0,0 +1,93 @@ + + + + +Module: Deltacloud::Drivers + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/ec2/ec2_driver.rb,
+ lib/deltacloud/drivers/mock/mock_driver.rb,
lib/deltacloud/drivers/rhevm/rhevm_driver.rb,
lib/deltacloud/drivers/azure/azure_driver.rb,
lib/deltacloud/drivers/gogrid/gogrid_driver.rb,
lib/deltacloud/drivers/rackspace/rackspace_driver.rb,
lib/deltacloud/drivers/terremark/terremark_driver.rb,
lib/deltacloud/drivers/rackspace/rackspace_client.rb,
lib/deltacloud/drivers/opennebula/opennebula_driver.rb,
lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb,
lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
+
+ +
+
+ +

Defined Under Namespace

+

+ + + Modules: Azure, EC2, Gogrid, Mock, Opennebula, RHEVM, Rackspace, RimuHosting, Terremark + + + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Azure.html b/site/api-docs/Deltacloud/Drivers/Azure.html new file mode 100644 index 00000000..bdb9cf8b --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Azure.html @@ -0,0 +1,91 @@ + + + + +Module: Deltacloud::Drivers::Azure + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::Azure + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/azure/azure_driver.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: AzureDriver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Azure/AzureDriver.html b/site/api-docs/Deltacloud/Drivers/Azure/AzureDriver.html new file mode 100644 index 00000000..e206816c --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Azure/AzureDriver.html @@ -0,0 +1,558 @@ + + + + +Class: Deltacloud::Drivers::Azure::AzureDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::Azure::AzureDriver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/azure/azure_driver.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #bucket, #catched_exceptions_list, #create_instance, declare_feature, define_hardware_profile, define_instance_states, feature, feature_decl_for, feature_decls, features, #features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #hardware_profiles, #has_collection?, #image, #images, #instance, #instance_actions_for, instance_state_machine, #instance_state_machine, #instances, #realm, #realms, #reboot_instance, #safely, #start_instance, #stop_instance, #storage_snapshot, #storage_snapshots, #storage_volume, #storage_volumes

+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) blob_data(credentials, bucket_id, blob_id, opts) {|WAZ::Blobs::Container.find(bucket_id)[blob_id]| ... } + + + +

+
+ + +
+
+
+

Yields:

+
    + +
  • + + (WAZ::Blobs::Container.find(bucket_id)[blob_id]) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+84
+85
+86
+87
+88
+
+
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 84
+
+def blob_data(credentials, bucket_id, blob_id, opts)
+  azure_connect(credentials)
+  # WAZ get blob data methods cant accept blocks for 'streaming'... FIXME
+    yield WAZ::Blobs::Container.find(bucket_id)[blob_id].value
+end
+
+
+
+ +
+

+ + - (Object) blobs(credentials, opts) + + + +

+
+

+— Blobs — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+
+
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 71
+
+def blobs(credentials, opts)
+  blob_list = []
+  azure_connect(credentials)
+  safely do
+    the_bucket = WAZ::Blobs::Container.find(opts['bucket'])
+    the_bucket.blobs.each do |waz_blob|
+      blob_list << convert_blob(waz_blob)
+    end
+  end
+  blob_list = filter_on(blob_list, :id, opts)
+  blob_list
+end
+
+
+
+ +
+

+ + - (Object) buckets(credentials, opts) + + + +

+
+

+— Buckets — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+
+
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 34
+
+def buckets(credentials, opts)
+  buckets = []
+  azure_connect(credentials)
+  safely do
+    WAZ::Blobs::Container.list.each do |waz_container|
+      buckets << convert_container(waz_container)
+    end
+  end
+  buckets = filter_on(buckets, :id, opts)
+end
+
+
+
+ +
+

+ + - (Object) create_bucket(credentials, name, opts) + + + +

+
+

+— Create bucket — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+48
+49
+50
+51
+52
+53
+54
+55
+56
+
+
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 48
+
+def create_bucket(credentials, name, opts)
+  bucket = nil
+  azure_connect(credentials)
+  safely do
+    waz_container = WAZ::Blobs::Container.create(name)
+    bucket = convert_container(waz_container)
+  end
+  bucket
+end
+
+
+
+ +
+

+ + - (Object) delete_bucket(credentials, name, opts) + + + +

+
+

+— Delete bucket — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+61
+62
+63
+64
+65
+66
+
+
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 61
+
+def delete_bucket(credentials, name, opts)
+  azure_connect(credentials)
+  safely do
+    WAZ::Blobs::Container.find(name).destroy!
+  end
+end
+
+
+
+ +
+

+ + - (Object) supported_collections + + + +

+ + + + +
+
+
+
+28
+29
+
+
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 28
+
+def supported_collections; [:buckets]
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/EC2.html b/site/api-docs/Deltacloud/Drivers/EC2.html new file mode 100644 index 00000000..9b2b0c64 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/EC2.html @@ -0,0 +1,91 @@ + + + + +Module: Deltacloud::Drivers::EC2 + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::EC2 + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/ec2/ec2_driver.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: EC2Driver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/EC2/EC2Driver.html b/site/api-docs/Deltacloud/Drivers/EC2/EC2Driver.html new file mode 100644 index 00000000..3ba7d3a6 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/EC2/EC2Driver.html @@ -0,0 +1,1682 @@ + + + + +Class: Deltacloud::Drivers::EC2::EC2Driver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::EC2::EC2Driver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/ec2/ec2_driver.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #bucket, declare_feature, define_hardware_profile, define_instance_states, feature, feature_decl_for, feature_decls, #features, features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #hardware_profiles, #has_collection?, #image, #instance, #instance_actions_for, #instance_state_machine, instance_state_machine, #realm, #safely, #start_instance, #storage_snapshot, #storage_volume

+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) blob_data(credentials, bucket_id, blob_id, opts) + + + +

+
+

+— Blob data — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+395
+396
+397
+398
+399
+400
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 395
+
+def blob_data(credentials, bucket_id, blob_id, opts)
+  s3_client = s3_client(credentials)
+  s3_client.interface.get(bucket_id, blob_id) do |chunk|
+    yield chunk
+  end
+end
+
+
+
+ +
+

+ + - (Object) blobs(credentials, opts = nil) + + + +

+
+

+— Blobs — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 379
+
+def blobs(credentials, opts = nil)
+  s3_client = s3_client(credentials)
+  blobs = []
+  safely do
+    s3_bucket = s3_client.bucket(opts['bucket'])
+    s3_bucket.keys({}, true).each do |s3_object|
+      blobs << convert_object(s3_object)
+    end
+  end
+  blobs = filter_on(blobs, :id, opts)
+  blobs
+end
+
+
+
+ +
+

+ + - (Object) buckets(credentials, opts) + + + +

+
+

+— Buckets — get a list of your buckets from the s3 service +

+ + +
+
+
+ +
+ + + + +
+
+
+
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 328
+
+def buckets(credentials, opts)
+  buckets = []
+  safely do
+    s3_client = s3_client(credentials)
+    bucket_list = s3_client.buckets
+    bucket_list.each do |current|
+      buckets << convert_bucket(current)
+    end
+  end
+  buckets = filter_on(buckets, :id, opts)
+  buckets
+end
+
+
+
+ +
+

+ + - (Object) create_bucket(credentials, name, opts = {}) + + + +

+
+

+— Create bucket — valid values for bucket location: +‘EU’|’us-west1’|’ap-southeast-1’ - if +you don’t specify a location then by default buckets are created in +‘us-east’ [but if you do specify ‘us-east’ +things blow up] +

+ + +
+
+
+ +
+ + + + +
+
+
+
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 347
+
+def create_bucket(credentials, name, opts={})
+  bucket = nil
+  safely do
+    begin
+      s3_client = s3_client(credentials)
+      bucket_location = opts['location']
+      if bucket_location
+        bucket = RightAws::S3::Bucket.create(s3_client, name, true, nil, :location => bucket_location)
+      else
+        bucket = RightAws::S3::Bucket.create(s3_client, name, true)
+      end #if
+      rescue RightAws::AwsError => e
+        raise e unless e.message =~ /BucketAlreadyExists/
+        raise Deltacloud::BackendError.new(409, e.class.to_s, e.message, e.backtrace)
+    end #begin
+  end #do
+  convert_bucket(bucket)
+end
+
+
+
+ +
+

+ + - (Object) create_instance(credentials, image_id, opts) + + + +

+ + + + +
+
+
+
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 178
+
+def create_instance(credentials, image_id, opts)
+  ec2 = new_client( credentials )
+  realm_id = opts[:realm_id]
+  safely do
+    image = image(credentials, :id => image_id )
+    hwp = find_hardware_profile(credentials, opts[:hwp_id], image.id)
+    ec2_instances = ec2.run_instances(
+      :image_id => image.id,
+      :user_data => opts[:user_data],
+      :key_name => opts[:keyname],
+      :availability_zone => realm_id,
+      :monitoring_enabled => true,
+      :instance_type => hwp.name,
+      :disable_api_termination => false,
+      :instance_initiated_shutdown_behavior => 'terminate'
+    )
+    return convert_instance( ec2_instances.instancesSet.item.first, 'pending' )
+  end
+end
+
+
+
+ +
+

+ + - (Object) create_key(credentials, opts = {}) + + + +

+ + + + +
+
+
+
+300
+301
+302
+303
+304
+305
+306
+307
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 300
+
+def create_key(credentials, opts={})
+  key = Key.new
+  ec2 = new_client( credentials )
+  safely do
+    key = convert_key(ec2.create_keypair(opts))
+  end
+  return key
+end
+
+
+
+ +
+

+ + - (Object) delete_bucket(credentials, name, opts = {}) + + + +

+
+

+— Delete_bucket — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+369
+370
+371
+372
+373
+374
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 369
+
+def delete_bucket(credentials, name, opts={})
+  s3_client = s3_client(credentials)
+  safely do
+    s3_client.interface.delete_bucket(name)
+  end
+end
+
+
+
+ +
+

+ + - (Object) destroy_instance(credentials, id) + + + +

+ + + + +
+
+
+
+230
+231
+232
+233
+234
+235
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 230
+
+def destroy_instance(credentials, id)
+  ec2 = new_client(credentials)
+  backup = ec2.terminate_instances( :instance_id => id )
+
+  generate_instance(ec2, id, backup)
+end
+
+
+
+ +
+

+ + - (Object) destroy_key(credentials, opts = {}) + + + +

+ + + + +
+
+
+
+309
+310
+311
+312
+313
+314
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 309
+
+def destroy_key(credentials, opts={})
+  safely do
+    ec2 = new_client( credentials )
+    ec2.delete_keypair(opts)
+  end
+end
+
+
+
+ +
+

+ + - (Object) generate_instance(ec2, id, backup) + + + +

+ + + + +
+
+
+
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 198
+
+def generate_instance(ec2, id, backup)
+  begin
+    this_instance = ec2.describe_instances( :instance_id => id ).reservationSet.item.first.instancesSet.item.first
+    convert_instance(this_instance, this_instance.ownerId)
+  rescue Exception => e
+    puts "WARNING: ignored error during instance refresh: #{e.message}"
+    # at this point, the action has succeeded but our follow-up
+    # "describe_instances" failed for some reason.  Create a simple Instance
+    # object with only the ID and new state in place
+    state = convert_state(backup.instancesSet.item.first.currentState.name)
+    Instance.new( {
+      :id => id,
+      :state => state,
+      :actions => instance_actions_for( state ),
+    } )
+  end
+end
+
+
+
+ +
+

+ + - (Object) images(credentials, opts = {}) + + + +

+
+

+Images +

+ + +
+
+
+ +
+ + + + +
+
+
+
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 121
+
+def images(credentials, opts={} )
+  ec2 = new_client(credentials)
+  img_arr = []
+  # if we know the image_id, we don't want to limit by owner_id, since this
+  # will exclude public images
+  if (opts and opts[:id])
+    config = { :image_id => opts[:id] }
+  else
+    config = { :owner_id => "amazon" }
+    config.merge!({ :owner_id => opts[:owner_id] }) if opts and opts[:owner_id]
+  end
+  safely do
+    ec2.describe_images(config).imagesSet.item.each do |image|
+      img_arr << convert_image(image)
+    end
+  end
+  img_arr = filter_on( img_arr, :architecture, opts )
+  img_arr.sort_by{|e| [e.owner_id, e.name]}
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, opts = nil) + + + +

+
+

+Instances +

+ + +
+
+
+ +
+ + + + +
+
+
+
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 159
+
+def instances(credentials, opts=nil)
+  ec2 = new_client(credentials)
+  instances = []
+  safely do
+    param = opts.nil? ? nil : opts[:id]
+    ec2_instances = ec2.describe_instances.reservationSet
+    return [] unless ec2_instances
+    ec2_instances.item.each do |item|
+      item.instancesSet.item.each do |ec2_instance|
+        instances << convert_instance( ec2_instance, item.ownerId )
+      end
+    end
+  end
+  instances = filter_on( instances, :id, opts )
+  instances = filter_on( instances, :state, opts )
+  instances
+end
+
+
+
+ +
+

+ + - (Object) key(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+283
+284
+285
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 283
+
+def key(credentials, opts=nil)
+  keys(credentials, opts).first
+end
+
+
+
+ +
+

+ + - (Object) keys(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 287
+
+def keys(credentials, opts=nil)
+  ec2 = new_client( credentials )
+  opts[:key_name] = opts[:id] if opts and opts[:id]
+  keypairs = ec2.describe_keypairs(opts || {})
+  result = []
+  safely do
+    keypairs.keySet.item.each do |keypair|
+      result << convert_key(keypair)
+    end
+  end
+  result
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+
+

+Realms +

+ + +
+
+
+ +
+ + + + +
+
+
+
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 145
+
+def realms(credentials, opts=nil)
+  ec2 = new_client(credentials)
+  realms = []
+  safely do
+    ec2.describe_availability_zones.availabilityZoneInfo.item.each do |ec2_realm|
+      realms << convert_realm( ec2_realm )
+    end
+  end
+  realms
+end
+
+
+
+ +
+

+ + - (Object) reboot_instance(credentials, id) + + + +

+ + + + +
+
+
+
+216
+217
+218
+219
+220
+221
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 216
+
+def reboot_instance(credentials, id)
+  ec2 = new_client(credentials)
+  backup = ec2.reboot_instances( :instance_id => id )
+
+  generate_instance(ec2, id, backup)
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, id) + + + +

+ + + + +
+
+
+
+223
+224
+225
+226
+227
+228
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 223
+
+def stop_instance(credentials, id)
+  ec2 = new_client(credentials)
+  backup = ec2.terminate_instances( :instance_id => id )
+
+  generate_instance(ec2, id, backup)
+end
+
+
+
+ +
+

+ + - (Object) storage_snapshots(credentials, opts = nil) + + + +

+
+

+Storage Snapshots +

+ + +
+
+
+ +
+ + + + +
+
+
+
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 264
+
+def storage_snapshots(credentials, opts=nil)
+  ec2 = new_client( credentials )
+  snapshots = []
+  safely do
+    if (opts)
+      ec2.describe_snapshots(:owner => 'self', :snapshot_id => opts[:id]).snapshotSet.item.each do |ec2_snapshot|
+        snapshots << convert_snapshot( ec2_snapshot )
+      end
+    else
+      ec2_snapshots = ec2.describe_snapshots(:owner => 'self').snapshotSet
+      return [] unless ec2_snapshots
+      ec2_snapshots.item.each do |ec2_snapshot|
+        snapshots << convert_snapshot( ec2_snapshot )
+      end
+    end
+  end
+  snapshots
+end
+
+
+
+ +
+

+ + - (Object) storage_volumes(credentials, opts = nil) + + + +

+
+

+Storage Volumes +

+ + +
+
+
+ +
+ + + + +
+
+
+
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 241
+
+def storage_volumes(credentials, opts=nil)
+  ec2 = new_client( credentials )
+  volumes = []
+  safely do
+    if (opts)
+      ec2.describe_volumes(:volume_id => opts[:id]).volumeSet.item.each do |ec2_volume|
+        volumes << convert_volume( ec2_volume )
+      end
+    else
+      ec2_volumes = ec2.describe_volumes.volumeSet
+      return [] unless ec2_volumes
+      ec2_volumes.item.each do |ec2_volume|
+        volumes << convert_volume( ec2_volume )
+      end
+    end
+  end
+  volumes
+end
+
+
+
+ +
+

+ + - (Object) supported_collections + + + +

+ + + + +
+
+
+
+40
+41
+42
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 40
+
+def supported_collections
+  DEFAULT_COLLECTIONS + [ :keys, :buckets ]
+end
+
+
+
+ +
+

+ + - (Boolean) valid_credentials?(credentials) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+316
+317
+318
+319
+320
+321
+322
+323
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 316
+
+def valid_credentials?(credentials)
+  client = new_client(credentials)
+  # FIXME: We need to do this call to determine if
+  #        EC2 is working with given credentials. There is no
+  #        other way to check, if given credentials are valid or not.
+  realms = client.describe_availability_zones rescue false
+  return realms ? true : false
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Gogrid.html b/site/api-docs/Deltacloud/Drivers/Gogrid.html new file mode 100644 index 00000000..2154a8ba --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Gogrid.html @@ -0,0 +1,91 @@ + + + + +Module: Deltacloud::Drivers::Gogrid + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::Gogrid + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/gogrid/gogrid_driver.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: GogridDriver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Gogrid/GogridDriver.html b/site/api-docs/Deltacloud/Drivers/Gogrid/GogridDriver.html new file mode 100644 index 00000000..5f4ae048 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Gogrid/GogridDriver.html @@ -0,0 +1,1012 @@ + + + + +Class: Deltacloud::Drivers::Gogrid::GogridDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::Gogrid::GogridDriver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/gogrid/gogrid_driver.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #blob_data, #blobs, #bucket, #buckets, #catched_exceptions_list, #create_bucket, declare_feature, define_hardware_profile, define_instance_states, #delete_bucket, feature, feature_decl_for, feature_decls, features, #features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, #hardware_profiles, hardware_profiles, #has_collection?, #image, #instance, #instance_actions_for, #instance_state_machine, instance_state_machine, #realm, #storage_snapshot, #storage_snapshots, #storage_volume, #storage_volumes

+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) create_instance(credentials, image_id, opts = nil) + + + +

+ + + + +
+
+
+
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 76
+
+def create_instance(credentials, image_id, opts=nil)
+  server_ram = nil
+  if opts[:hwp_memory]
+    mem = opts[:hwp_memory].to_i
+    server_ram = (mem == 512) ? "512MB" : "#{mem / 1024}GB"
+  else
+    server_ram = "512MB"
+  end
+  client = new_client(credentials)
+  name = (opts[:name] && opts[:name]!='') ? opts[:name] : get_random_instance_name
+  safely do
+    instance = client.request('grid/server/add', {
+      'name' => name,
+      'image' => image_id,
+      'server.ram' => server_ram,
+      'ip' => get_free_ip_from_realm(credentials, opts[:realm_id] || '1')
+    })['list'].first
+    if instance
+       = (client, instance[:id])
+      if ['username'] and ['password']
+        instance['username'] = ['username']
+        instance['password'] = ['password']
+        inst = convert_instance(instance, credentials.user)
+      else
+        inst = convert_instance(instance, credentials.user)
+        inst.authn_error = "Unable to fetch password"
+      end
+      return inst
+    else
+      return nil
+    end
+  end
+end
+
+
+
+ +
+

+ + - (Object) destroy_instance(credentials, id) + + + +

+ + + + +
+
+
+
+162
+163
+164
+165
+166
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 162
+
+def destroy_instance(credentials, id)
+  safely do
+    new_client(credentials).request('grid/server/delete', { 'name' => id})
+  end
+end
+
+
+
+ +
+

+ + - (Object) images(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 51
+
+def images(credentials, opts=nil)
+  imgs = []
+  if opts and opts[:id]
+    safely do
+      imgs = [convert_image(new_client(credentials).request('grid/image/get', { 'id' => opts[:id] })['list'].first)]
+    end
+  else
+    safely do
+      imgs = new_client(credentials).request('grid/image/list', { 'state' => 'Available'})['list'].collect do |image|
+        convert_image(image, credentials.user)
+      end
+    end
+  end
+  imgs = filter_on( imgs, :architecture, opts )
+  imgs.sort_by{|e| [e.owner_id, e.description]}
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 122
+
+def instances(credentials, opts=nil)
+  require 'ap'
+  instances = []
+  if opts and opts[:id]
+    begin
+      client = new_client(credentials)
+      instance = client.request('grid/server/get', { 'name' => opts[:id] })['list'].first
+       = (client, instance['id'])
+      if ['username'] and ['password']
+        instance['username'] = ['username']
+        instance['password'] = ['password']
+        inst = convert_instance(instance, credentials.user)
+      else
+        inst = convert_instance(instance, credentials.user)
+        inst.authn_error = "Unable to fetch password"
+      end
+      instances = [inst]
+    rescue Exception => e
+      if e.message == "400 Bad Request"
+        # in the case of a VM that we just made, the grid/server/get method
+        # throws a "400 Bad Request error".  In this case we try again by
+        # getting a full listing a filtering on the id.  This could
+        # potentially take a long time, but I don't see another way to get
+        # information about a newly created instance
+        instances = list_instances(credentials, opts[:id])
+      end
+    end
+  else
+    instances = list_instances(credentials, nil)
+  end
+  instances = filter_on( instances, :state, opts )
+  instances
+end
+
+
+
+ +
+

+ + - (Object) key(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+180
+181
+182
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 180
+
+def key(credentials, opts=nil)
+  keys(credentials, opts).first
+end
+
+
+
+ +
+

+ + - (Object) keys(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 184
+
+def keys(credentials, opts=nil)
+  gogrid = new_client( credentials )
+  creds = []
+  safely do
+    gogrid.request('support/password/list')['list'].each do |password|
+      creds << convert_key(password)
+    end
+  end
+  return creds
+end
+
+
+
+ +
+

+ + - (Object) list_instances(credentials, id) + + + +

+ + + + +
+
+
+
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 110
+
+def list_instances(credentials, id)
+  instances = []
+  safely do
+    new_client(credentials).request('grid/server/list')['list'].collect do |instance|
+      if id.nil? or instance['name'] == id
+        instances << convert_instance(instance, credentials.user)
+      end
+    end
+  end
+  instances
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+68
+69
+70
+71
+72
+73
+74
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 68
+
+def realms(credentials, opts=nil)
+  safely do
+    new_client(credentials).request('common/lookup/list', { 'lookup' => 'ip.datacenter' })['list'].collect do |realm|
+      convert_realm(realm)
+    end
+  end
+end
+
+
+
+ +
+

+ + - (Object) reboot_instance(credentials, id) + + + +

+ + + + +
+
+
+
+156
+157
+158
+159
+160
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 156
+
+def reboot_instance(credentials, id)
+  safely do
+    new_client(credentials).request('grid/server/power', { 'name' => id, 'power' => 'reboot'})
+  end
+end
+
+
+
+ +
+

+ + - (Object) start_instance(credentials, id) + + + +

+ + + + +
+
+
+
+174
+175
+176
+177
+178
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 174
+
+def start_instance(credentials, id)
+  safely do
+    new_client(credentials).request('grid/server/power', { 'name' => id, 'power' => 'on'})
+  end
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, id) + + + +

+ + + + +
+
+
+
+168
+169
+170
+171
+172
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 168
+
+def stop_instance(credentials, id)
+  safely do
+    new_client(credentials).request('grid/server/power', { 'name' => id, 'power' => 'off'})
+  end
+end
+
+
+
+ +
+

+ + - (Object) supported_collections + + + +

+ + + + +
+
+
+
+46
+47
+48
+49
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 46
+
+def supported_collections
+  DEFAULT_COLLECTIONS.reject! { |c| [ :storage_volumes, :storage_snapshots ].include?(c) }
+  DEFAULT_COLLECTIONS + [ :keys ]
+end
+
+
+
+ +
+

+ + - (Boolean) valid_credentials?(credentials) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+195
+196
+197
+198
+199
+200
+201
+202
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 195
+
+def valid_credentials?(credentials)
+  client = new_client(credentials)
+  # FIXME: We need to do this call to determine if
+  #        GoGrid is working with given credentials. There is no
+  #        other way to check, if given credentials are valid or not.
+  return false unless new_client(credentials).request('common/lookup/list', { 'lookup' => 'ip.datacenter' })
+  true
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Mock.html b/site/api-docs/Deltacloud/Drivers/Mock.html new file mode 100644 index 00000000..ca93757f --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Mock.html @@ -0,0 +1,91 @@ + + + + +Module: Deltacloud::Drivers::Mock + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::Mock + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/mock/mock_driver.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: MockDriver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Mock/MockDriver.html b/site/api-docs/Deltacloud/Drivers/Mock/MockDriver.html new file mode 100644 index 00000000..188f9b53 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Mock/MockDriver.html @@ -0,0 +1,1102 @@ + + + + +Class: Deltacloud::Drivers::Mock::MockDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::Mock::MockDriver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/mock/mock_driver.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #blob_data, #blobs, #bucket, #buckets, #catched_exceptions_list, #create_bucket, declare_feature, define_hardware_profile, define_instance_states, #delete_bucket, feature, feature_decl_for, feature_decls, #features, features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #hardware_profiles, #has_collection?, #image, #instance, #instance_actions_for, instance_state_machine, #instance_state_machine, #realm, #safely, #storage_snapshot, #storage_volume, #supported_collections

+
+

Constructor Details

+ +
+

+ + - (MockDriver) initialize + + + +

+
+

+A new instance of MockDriver +

+ + +
+
+
+ +
+ + + + +
+
+
+
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 81
+
+def initialize
+  if ENV["DELTACLOUD_MOCK_STORAGE"]
+    @storage_root = ENV["DELTACLOUD_MOCK_STORAGE"]
+  elsif ENV["USER"]
+    @storage_root = File::join("/var/tmp", "deltacloud-mock-#{ENV["USER"]}")
+  else
+    raise "Please set either the DELTACLOUD_MOCK_STORAGE or USER environment variable"
+  end
+  if ! File::directory?(@storage_root)
+    FileUtils::rm_rf(@storage_root)
+    FileUtils::mkdir_p(@storage_root)
+    data = Dir::glob(File::join(File::dirname(__FILE__), "data", "*"))
+    FileUtils::cp_r(data, @storage_root)
+  end
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) create_instance(credentials, image_id, opts) + + + +

+ + + + +
+
+
+
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 147
+
+def create_instance(credentials, image_id, opts)
+  check_credentials( credentials )
+  ids = Dir[ "#{@storage_root}/instances/*.yml" ].collect{|e| File.basename( e, ".yml" )}
+
+  count = 0
+  while true
+    next_id = "inst" + count.to_s
+    if not ids.include?(next_id)
+      break
+    end
+    count = count + 1
+  end
+
+  realm_id = opts[:realm_id]
+  if ( realm_id.nil? )
+    realm = realms(credentials).first
+    ( realm_id = realm.id ) if realm
+  end
+
+  hwp = find_hardware_profile(credentials, opts[:hwp_id], image_id)
+
+  name = opts[:name] || "i-#{Time.now.to_i}"
+
+  instance = {
+    :name=>name,
+    :state=>'RUNNING',
+    :image_id=>image_id,
+    :owner_id=>credentials.user,
+    :public_addresses=>["#{image_id}.#{next_id}.public.com"],
+    :private_addresses=>["#{image_id}.#{next_id}.private.com"],
+    :instance_profile => InstanceProfile.new(hwp.name, opts),
+    :realm_id=>realm_id,
+    :actions=>instance_actions_for( 'RUNNING' )
+  }
+  File.open( "#{@storage_root}/instances/#{next_id}.yml", 'w' ) {|f|
+    YAML.dump( instance, f )
+  }
+  instance[:id] = next_id
+  Instance.new( instance )
+end
+
+
+
+ +
+

+ + - (Object) destroy_instance(credentials, id) + + + +

+ + + + +
+
+
+
+213
+214
+215
+216
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 213
+
+def destroy_instance(credentials, id)
+  check_credentials( credentials )
+  FileUtils.rm( "#{@storage_root}/instances/#{id}.yml" )
+end
+
+
+
+ +
+

+ + - (Object) images(credentials, opts = nil) + + + +

+
+

+Images +

+ + +
+
+
+ +
+ + + + +
+
+
+
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 108
+
+def images(credentials, opts=nil )
+  check_credentials( credentials )
+  images = []
+  Dir[ "#{@storage_root}/images/*.yml" ].each do |image_file|
+    image = YAML.load( File.read( image_file ) )
+    image[:id] = File.basename( image_file, ".yml" )
+    image[:name] = image[:description]
+    images << Image.new( image )
+  end
+  images = filter_on( images, :id, opts )
+  images = filter_on( images, :architecture, opts )
+  if ( opts && opts[:owner_id] == 'self' )
+    images = images.select{|e| e.owner_id == credentials.user }
+  else
+    images = filter_on( images, :owner_id, opts )
+  end
+  images.sort_by{|e| [e.owner_id,e.description]}
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, opts = nil) + + + +

+
+

+Instances +

+ + +
+
+
+ +
+ + + + +
+
+
+
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 131
+
+def instances(credentials, opts=nil)
+  check_credentials( credentials )
+  instances = []
+  Dir[ "#{@storage_root}/instances/*.yml" ].each do |instance_file|
+    instance = YAML.load( File.read( instance_file ) )
+    if ( instance[:owner_id] == credentials.user )
+      instance[:id] = File.basename( instance_file, ".yml" )
+      instance[:actions] = instance_actions_for( instance[:state] )
+      instances << Instance.new( instance )
+    end
+  end
+  instances = filter_on( instances, :id, opts )
+  instances = filter_on( instances, :state, opts )
+  instances
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+97
+98
+99
+100
+101
+102
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 97
+
+def realms(credentials, opts=nil)
+  return REALMS if ( opts.nil? )
+  results = REALMS
+  results = filter_on( results, :id, opts )
+  results
+end
+
+
+
+ +
+

+ + - (Object) reboot_instance(credentials, id) + + + +

+ + + + +
+
+
+
+204
+205
+206
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 204
+
+def reboot_instance(credentials, id)
+  update_instance_state(credentials, id, 'RUNNING')
+end
+
+
+
+ +
+

+ + - (Object) start_instance(credentials, id) + + + +

+ + + + +
+
+
+
+200
+201
+202
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 200
+
+def start_instance(credentials, id)
+  update_instance_state(credentials, id, 'RUNNING')
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, id) + + + +

+ + + + +
+
+
+
+208
+209
+210
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 208
+
+def stop_instance(credentials, id)
+  update_instance_state(credentials, id, 'STOPPED')
+end
+
+
+
+ +
+

+ + - (Object) storage_snapshots(credentials, opts = nil) + + + +

+
+

+Storage Snapshots +

+ + +
+
+
+ +
+ + + + +
+
+
+
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 240
+
+def storage_snapshots(credentials, opts=nil)
+  check_credentials( credentials )
+  snapshots = []
+  Dir[ "#{@storage_root}/storage_snapshots/*.yml" ].each do |storage_snapshot_file|
+    storage_snapshot = YAML.load( File.read( storage_snapshot_file ) )
+    if ( storage_snapshot[:owner_id] == credentials.user )
+      storage_snapshot[:id] = File.basename( storage_snapshot_file, ".yml" )
+      snapshots << StorageSnapshot.new( storage_snapshot )
+    end
+  end
+  snapshots = filter_on( snapshots, :id, opts )
+  snapshots
+end
+
+
+
+ +
+

+ + - (Object) storage_volumes(credentials, opts = nil) + + + +

+
+

+Storage Volumes +

+ + +
+
+
+ +
+ + + + +
+
+
+
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 222
+
+def storage_volumes(credentials, opts=nil)
+  check_credentials( credentials )
+  volumes = []
+  Dir[ "#{@storage_root}/storage_volumes/*.yml" ].each do |storage_volume_file|
+    storage_volume = YAML.load( File.read( storage_volume_file ) )
+    if ( storage_volume[:owner_id] == credentials.user )
+      storage_volume[:id] = File.basename( storage_volume_file, ".yml" )
+      volumes << StorageVolume.new( storage_volume )
+    end
+  end
+  volumes = filter_on( volumes, :id, opts )
+  volumes
+end
+
+
+
+ +
+

+ + - (Object) update_instance_state(credentials, id, state) + + + +

+ + + + +
+
+
+
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 188
+
+def update_instance_state(credentials, id, state)
+  instance_file = "#{@storage_root}/instances/#{id}.yml"
+  instance_yml  = YAML.load( File.read( instance_file ) )
+  instance_yml[:id] = id
+  instance_yml[:state] = state
+  instance_yml[:actions] = instance_actions_for( instance_yml[:state] )
+  File.open( instance_file, 'w' ) do |f|
+    f << YAML.dump( instance_yml )
+  end
+  Instance.new( instance_yml )
+end
+
+
+
+ +
+

+ + - (Boolean) valid_credentials?(credentials) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+254
+255
+256
+257
+258
+259
+260
+261
+
+
# File 'lib/deltacloud/drivers/mock/mock_driver.rb', line 254
+
+def valid_credentials?(credentials)
+  begin
+    check_credentials(credentials)
+    return true
+  rescue Deltacloud::AuthException
+  end
+  return false
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Opennebula.html b/site/api-docs/Deltacloud/Drivers/Opennebula.html new file mode 100644 index 00000000..d3fd5095 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Opennebula.html @@ -0,0 +1,91 @@ + + + + +Module: Deltacloud::Drivers::Opennebula + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::Opennebula + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/opennebula/opennebula_driver.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: OpennebulaDriver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Opennebula/OpennebulaDriver.html b/site/api-docs/Deltacloud/Drivers/Opennebula/OpennebulaDriver.html new file mode 100644 index 00000000..644b2366 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Opennebula/OpennebulaDriver.html @@ -0,0 +1,573 @@ + + + + +Class: Deltacloud::Drivers::Opennebula::OpennebulaDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::Opennebula::OpennebulaDriver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/opennebula/opennebula_driver.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #blob_data, #blobs, #bucket, #buckets, #catched_exceptions_list, #create_bucket, declare_feature, define_hardware_profile, define_instance_states, #delete_bucket, feature, feature_decl_for, feature_decls, features, #features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #hardware_profiles, #has_collection?, #image, #instance, #instance_actions_for, instance_state_machine, #instance_state_machine, #realm, #reboot_instance, #safely, #storage_snapshot, #storage_snapshots, #storage_volume, #storage_volumes, #supported_collections

+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) create_instance(credentials, image_id, opts = nil) + + + +

+ + + + +
+
+
+
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+
+
# File 'lib/deltacloud/drivers/opennebula/opennebula_driver.rb', line 126
+
+def create_instance(credentials, image_id, opts=nil)
+occi_client = new_client(credentials)
+
+hwp_id = opts[:hwp_id] || 'small'
+
+instancexml = ERB.new(OCCI_VM).result(binding)
+instancefile = "|echo '#{instancexml}'"
+
+xmlvm = occi_client.post_vms(instancefile)
+
+convert_instance(xmlvm.to_s(), credentials)
+end
+
+
+
+ +
+

+ + - (Object) destroy_instance(credentials, id) + + + +

+ + + + +
+
+
+
+150
+151
+152
+
+
# File 'lib/deltacloud/drivers/opennebula/opennebula_driver.rb', line 150
+
+def destroy_instance(credentials, id)
+occi_action(credentials, id, 'DONE')
+end
+
+
+
+ +
+

+ + - (Object) images(credentials, opts = nil) + + + +

+
+

+Images +

+ + +
+
+
+ +
+ + + + +
+
+
+
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+
+
# File 'lib/deltacloud/drivers/opennebula/opennebula_driver.rb', line 72
+
+def images(credentials, opts=nil)
+occi_client = new_client(credentials)
+
+images = []
+imagesxml = occi_client.get_images
+
+storage = REXML::Document.new(imagesxml)
+storage.root.elements.each do |d|
+  id = d.attributes['href'].split("/").last
+
+  diskxml = occi_client.get_image(id)
+
+  images << convert_image(diskxml.to_s(), credentials)
+end
+images
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+
+
# File 'lib/deltacloud/drivers/opennebula/opennebula_driver.rb', line 106
+
+def instances(credentials, opts=nil)
+occi_client = new_client(credentials)
+
+instances = []
+instancesxml = occi_client.get_vms
+
+computes = REXML::Document.new(instancesxml)
+computes.root.elements.each do |d|
+  vm_id = d.attributes['href'].split("/").last
+
+  computexml = occi_client.get_vm(vm_id)
+
+  instances << convert_instance(computexml.to_s(), credentials)
+end
+      instances = filter_on( instances, :id, opts )
+      instances = filter_on( instances, :state, opts )
+instances
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+60
+61
+62
+63
+64
+65
+
+
# File 'lib/deltacloud/drivers/opennebula/opennebula_driver.rb', line 60
+
+def realms(credentials, opts=nil)
+return REALMS if ( opts.nil? )
+results = REALMS
+results = filter_on( results, :id, opts )
+results
+end
+
+
+
+ +
+

+ + - (Object) start_instance(credentials, id) + + + +

+ + + + +
+
+
+
+140
+141
+142
+
+
# File 'lib/deltacloud/drivers/opennebula/opennebula_driver.rb', line 140
+
+def start_instance(credentials, id)
+occi_action(credentials, id, 'RESUME')
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, id) + + + +

+ + + + +
+
+
+
+145
+146
+147
+
+
# File 'lib/deltacloud/drivers/opennebula/opennebula_driver.rb', line 145
+
+def stop_instance(credentials, id)
+occi_action(credentials, id, 'STOPPED')
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/RHEVM.html b/site/api-docs/Deltacloud/Drivers/RHEVM.html new file mode 100644 index 00000000..6fdaa226 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/RHEVM.html @@ -0,0 +1,91 @@ + + + + +Module: Deltacloud::Drivers::RHEVM + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::RHEVM + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: RHEVMDriver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/RHEVM/RHEVMDriver.html b/site/api-docs/Deltacloud/Drivers/RHEVM/RHEVMDriver.html new file mode 100644 index 00000000..5a757794 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/RHEVM/RHEVMDriver.html @@ -0,0 +1,1644 @@ + + + + +Class: Deltacloud::Drivers::RHEVM::RHEVMDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::RHEVM::RHEVMDriver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+ +
+
+ + +

Constant Summary

+ +
+ +
SCRIPT_DIR = + +
+
File.dirname(__FILE__) + '/scripts'
+
+ +
CONFIG = + +
+
YAML.load_file(File.dirname(__FILE__) + '/../../../../config/rhevm_config.yml')
+
+ +
SCRIPT_DIR_ARG = + +
+
'"' + SCRIPT_DIR + '"'
+
+ +
DELIM_BEGIN = + +
+
"<_OUTPUT>"
+
+ +
DELIM_END = + +
+
"</_OUTPUT>"
+
+ +
POWERSHELL = + +
+
"c:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"
+
+ +
NO_OWNER = + +
+
""
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #blob_data, #blobs, #bucket, #buckets, #catched_exceptions_list, #create_bucket, declare_feature, define_hardware_profile, define_instance_states, #delete_bucket, feature, feature_decl_for, feature_decls, #features, features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #hardware_profiles, #has_collection?, #image, #instance, #instance_actions_for, instance_state_machine, #instance_state_machine, #realm, #safely, #storage_snapshot, #storage_volume, #supported_collections

+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) create_instance(credentials, image_id, opts) + + + +

+ + + + +
+
+
+
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 213
+
+def create_instance(credentials, image_id, opts)
+  name = opts[:name]
+  name = "Inst-#{rand(10000)}" if (name.nil? or name.empty?)
+  realm_id = opts[:realm_id]
+  if (realm_id.nil?)
+      realms = filter_on(realms(credentials, opts), :name, :name => "data")
+      puts realms[0]
+      realm_id = realms[0].id
+  end
+  vm = execute(credentials, "addVm.ps1", image_id, name, realm_id)
+  vm_to_instance(vm[0])
+end
+
+
+
+ +
+

+ + - (Object) destroy_instance(credentials, image_id) + + + +

+ + + + +
+
+
+
+231
+232
+233
+234
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 231
+
+def destroy_instance(credentials, image_id)
+  vm = execute(credentials, "deleteVm.ps1", image_id)
+  vm_to_instance(vm[0])
+end
+
+
+
+ +
+

+ + - (Object) domain_to_realm(dom) + + + +

+ + + + +
+
+
+
+109
+110
+111
+112
+113
+114
+115
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 109
+
+def domain_to_realm(dom)
+  Realm.new({
+    :id => dom["StorageId"],
+    :name => dom["Name"],
+    :limit => dom["AvailableDiskSize"]
+  })
+end
+
+
+
+ +
+

+ + - (Object) execute(credentials, command, *args) + + + +

+
+

+Execute a Powershell command, and convert the output to YAML in order to +get back an array of maps. +

+ + +
+
+
+ +
+ + + + +
+
+
+
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 42
+
+def execute(credentials, command, *args)
+  args = args.to_a
+  argString = genArgString(credentials, args)
+  puts argString
+  outputMaps = {}
+  output = `#{POWERSHELL} -command "&{#{File.join(SCRIPT_DIR, command)} #{argString}; exit $LASTEXITCODE}`
+  exitStatus = $?.exitstatus
+  puts(output)
+  puts("EXITSTATUS #{exitStatus}")
+  st = output.index(DELIM_BEGIN)
+  if (st)
+    st += DELIM_BEGIN.length
+    ed = output.index(DELIM_END)
+    output = output.slice(st, (ed-st))
+    # Lets make it yaml
+    output.strip!
+    if (output.length > 0)
+      outputMaps = YAML.load(self.toYAML(output))
+    end
+  end
+  outputMaps
+end
+
+
+
+ +
+

+ + - (Object) genArgString(credentials, args) + + + +

+ + + + +
+
+
+
+65
+66
+67
+68
+69
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 65
+
+def genArgString(credentials, args)
+  commonArgs = [SCRIPT_DIR_ARG, credentials.user, credentials.password, CONFIG["domain"]]
+  commonArgs.concat(args)
+  commonArgs.join(" ")
+end
+
+
+
+ +
+

+ + - (Object) images(credentials, opts = nil) + + + +

+
+

+Images +

+ + +
+
+
+ +
+ + + + +
+
+
+
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 123
+
+def images(credentials, opts=nil )
+  templates = []
+  if (opts.nil?)
+    templates = execute(credentials, "templates.ps1")
+  else
+    if (opts[:id])
+      templates = execute(credentials, "templateById.ps1", opts[:id])
+    end
+  end
+  images = []
+  templates.each do |templ|
+    images << template_to_image(templ)
+  end
+  images
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 171
+
+def instances(credentials, opts=nil)
+  vms = []
+  if (opts.nil?)
+    vms = execute(credentials, "vms.ps1")
+  else
+    if (opts[:id])
+      vms = execute(credentials, "vmById.ps1", opts[:id])
+    end
+  end
+  instances = []
+  vms.each do |vm|
+    instances << vm_to_instance(vm)
+  end
+  instances = filter_on( instances, :id, opts )
+  instances = filter_on( instances, :state, opts )
+  instances
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+
+

+Realms +

+ + +
+
+
+ +
+ + + + +
+
+
+
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 96
+
+def realms(credentials, opts=nil)
+  domains = execute(credentials, "storageDomains.ps1")
+  if (!opts.nil? && opts[:id])
+      domains = domains.select{|d| opts[:id] == d["StorageId"]}
+  end
+
+  realms = []
+  domains.each do |dom|
+    realms << domain_to_realm(dom)
+  end
+  realms
+end
+
+
+
+ +
+

+ + - (Object) reboot_instance(credentials, image_id) + + + +

+ + + + +
+
+
+
+226
+227
+228
+229
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 226
+
+def reboot_instance(credentials, image_id)
+  vm = execute(credentials, "rebootVm.ps1", image_id)
+  vm_to_instance(vm[0])
+end
+
+
+
+ +
+

+ + - (Object) start_instance(credentials, image_id) + + + +

+ + + + +
+
+
+
+203
+204
+205
+206
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 203
+
+def start_instance(credentials, image_id)
+  vm = execute(credentials, "startVm.ps1", image_id)
+  vm_to_instance(vm[0])
+end
+
+
+
+ +
+

+ + - (Object) statify(state) + + + +

+ + + + +
+
+
+
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 79
+
+def statify(state)
+    st = state.nil? ? "" : state.upcase()
+    case st
+    when "UP"
+      "RUNNING"
+    when "DOWN"
+      "STOPPED"
+    when "POWERING UP"
+      "PENDING"
+  end
+
+  define_hardware_profile 'rhevm'
+
+  #
+  # Realms
+  #
+
+  def realms(credentials, opts=nil)
+    domains = execute(credentials, "storageDomains.ps1")
+    if (!opts.nil? && opts[:id])
+        domains = domains.select{|d| opts[:id] == d["StorageId"]}
+    end
+
+    realms = []
+    domains.each do |dom|
+      realms << domain_to_realm(dom)
+    end
+    realms
+  end
+
+  def domain_to_realm(dom)
+    Realm.new({
+      :id => dom["StorageId"],
+      :name => dom["Name"],
+      :limit => dom["AvailableDiskSize"]
+    })
+  end
+
+
+
+  #
+  # Images
+  #
+
+  def images(credentials, opts=nil )
+    templates = []
+    if (opts.nil?)
+      templates = execute(credentials, "templates.ps1")
+    else
+      if (opts[:id])
+        templates = execute(credentials, "templateById.ps1", opts[:id])
+      end
+    end
+    images = []
+    templates.each do |templ|
+      images << template_to_image(templ)
+    end
+    images
+  end
+
+  def template_to_image(templ)
+    Image.new({
+      :id => templ["TemplateId"],
+      :name => templ["Name"],
+      :description => templ["Description"],
+      :architecture => templ["OperatingSystem"],
+      :owner_id => NO_OWNER,
+      :mem_size_md => templ["MemSizeMb"],
+      :instance_count => templ["ChildCount"],
+      :state => templ["Status"],
+      :capacity => templ["SizeGB"]
+    })
+  end
+
+  #
+  # Instances
+  #
+
+  define_instance_states do
+    start.to(:stopped)            .on( :create )
+
+    pending.to(:shutting_down)    .on( :stop )
+    pending.to(:running)          .automatically
+
+    running.to(:pending)          .on( :reboot )
+    running.to(:shutting_down)    .on( :stop )
+
+    shutting_down.to(:stopped)    .automatically
+    stopped.to(:pending)          .on( :start )
+    stopped.to(:finish)           .on( :destroy )
+  end
+
+  def instances(credentials, opts=nil)
+    vms = []
+    if (opts.nil?)
+      vms = execute(credentials, "vms.ps1")
+    else
+      if (opts[:id])
+        vms = execute(credentials, "vmById.ps1", opts[:id])
+      end
+    end
+    instances = []
+    vms.each do |vm|
+      instances << vm_to_instance(vm)
+    end
+    instances = filter_on( instances, :id, opts )
+    instances = filter_on( instances, :state, opts )
+    instances
+  end
+
+  def vm_to_instance(vm)
+    Instance.new({
+      :id => vm["VmId"],
+      :description => vm["Description"],
+      :name => vm["Name"],
+      :architecture => vm["OperatingSystem"],
+      :owner_id => NO_OWNER,
+      :image_id => vm["TemplateId"],
+      :state => statify(vm["Status"]),
+      :instance_profile => InstanceProfile.new("rhevm"),
+      :actions => instance_actions_for(statify(vm["Status"])),
+    })
+  end
+
+  def start_instance(credentials, image_id)
+    vm = execute(credentials, "startVm.ps1", image_id)
+    vm_to_instance(vm[0])
+  end
+
+  def stop_instance(credentials, image_id)
+    vm = execute(credentials, "stopVm.ps1", image_id)
+    vm_to_instance(vm[0])
+  end
+
+  def create_instance(credentials, image_id, opts)
+    name = opts[:name]
+    name = "Inst-#{rand(10000)}" if (name.nil? or name.empty?)
+    realm_id = opts[:realm_id]
+    if (realm_id.nil?)
+        realms = filter_on(realms(credentials, opts), :name, :name => "data")
+        puts realms[0]
+        realm_id = realms[0].id
+    end
+    vm = execute(credentials, "addVm.ps1", image_id, name, realm_id)
+    vm_to_instance(vm[0])
+  end
+
+  def reboot_instance(credentials, image_id)
+    vm = execute(credentials, "rebootVm.ps1", image_id)
+    vm_to_instance(vm[0])
+  end
+
+  def destroy_instance(credentials, image_id)
+    vm = execute(credentials, "deleteVm.ps1", image_id)
+    vm_to_instance(vm[0])
+  end
+
+  #
+  # Storage Volumes
+  #
+
+  def storage_volumes(credentials, ids=nil)
+    volumes = []
+    volumes
+  end
+
+  #
+  # Storage Snapshots
+  #
+
+  def storage_snapshots(credentials, ids=nil)
+    snapshots = []
+    snapshots
+  end
+
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, image_id) + + + +

+ + + + +
+
+
+
+208
+209
+210
+211
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 208
+
+def stop_instance(credentials, image_id)
+  vm = execute(credentials, "stopVm.ps1", image_id)
+  vm_to_instance(vm[0])
+end
+
+
+
+ +
+

+ + - (Object) storage_snapshots(credentials, ids = nil) + + + +

+
+

+Storage Snapshots +

+ + +
+
+
+ +
+ + + + +
+
+
+
+249
+250
+251
+252
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 249
+
+def storage_snapshots(credentials, ids=nil)
+  snapshots = []
+  snapshots
+end
+
+
+
+ +
+

+ + - (Object) storage_volumes(credentials, ids = nil) + + + +

+
+

+Storage Volumes +

+ + +
+
+
+ +
+ + + + +
+
+
+
+240
+241
+242
+243
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 240
+
+def storage_volumes(credentials, ids=nil)
+  volumes = []
+  volumes
+end
+
+
+
+ +
+

+ + - (Object) template_to_image(templ) + + + +

+ + + + +
+
+
+
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 139
+
+def template_to_image(templ)
+  Image.new({
+    :id => templ["TemplateId"],
+    :name => templ["Name"],
+    :description => templ["Description"],
+    :architecture => templ["OperatingSystem"],
+    :owner_id => NO_OWNER,
+    :mem_size_md => templ["MemSizeMb"],
+    :instance_count => templ["ChildCount"],
+    :state => templ["Status"],
+    :capacity => templ["SizeGB"]
+  })
+end
+
+
+
+ +
+

+ + - (Object) toYAML(output) + + + +

+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 71
+
+def toYAML(output)
+  yOutput = "- \n" + output
+  yOutput.gsub!(/^(\w*)[ ]*:[ ]*([A-Z0-9a-z._ -:{}]*)/,' \1: "\2"')
+  yOutput.gsub!(/^[ ]*$/,"- ")
+  puts(yOutput)
+  yOutput
+end
+
+
+
+ +
+

+ + - (Object) vm_to_instance(vm) + + + +

+ + + + +
+
+
+
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+
+
# File 'lib/deltacloud/drivers/rhevm/rhevm_driver.rb', line 189
+
+def vm_to_instance(vm)
+  Instance.new({
+    :id => vm["VmId"],
+    :description => vm["Description"],
+    :name => vm["Name"],
+    :architecture => vm["OperatingSystem"],
+    :owner_id => NO_OWNER,
+    :image_id => vm["TemplateId"],
+    :state => statify(vm["Status"]),
+    :instance_profile => InstanceProfile.new("rhevm"),
+    :actions => instance_actions_for(statify(vm["Status"])),
+  })
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Rackspace.html b/site/api-docs/Deltacloud/Drivers/Rackspace.html new file mode 100644 index 00000000..b7bb8f42 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Rackspace.html @@ -0,0 +1,93 @@ + + + + +Module: Deltacloud::Drivers::Rackspace + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::Rackspace + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/rackspace/rackspace_driver.rb,
+ lib/deltacloud/drivers/rackspace/rackspace_client.rb
+
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: RackspaceClient, RackspaceDriver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Rackspace/RackspaceClient.html b/site/api-docs/Deltacloud/Drivers/Rackspace/RackspaceClient.html new file mode 100644 index 00000000..81e5f47e --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Rackspace/RackspaceClient.html @@ -0,0 +1,632 @@ + + + + +Class: Deltacloud::Drivers::Rackspace::RackspaceClient + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::Rackspace::RackspaceClient + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/rackspace/rackspace_client.rb
+ +
+
+ + +

Constant Summary

+ +
+ +
@@AUTH_API = + +
+
URI.parse('https://auth.api.rackspacecloud.com/v1.0')
+
+ +
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (RackspaceClient) initialize(username, auth_key) + + + +

+
+

+A new instance of RackspaceClient +

+ + +
+
+
+ +
+ + + + +
+
+
+
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 36
+
+def initialize(username, auth_key)
+  http = Net::HTTP.new(@@AUTH_API.host,@@AUTH_API.port)
+  http.use_ssl = true
+  authed = http.get(@@AUTH_API.path, {'X-Auth-User' => username, 'X-Auth-Key' => auth_key})
+  if authed.is_a?(Net::HTTPUnauthorized)
+    raise Deltacloud::AuthException, "Failed to authenticate to Rackspace"
+  elsif !authed.is_a?(Net::HTTPSuccess)
+    backend_error!(resp)
+  end
+  @auth_token  = authed.header['X-Auth-Token']
+  @service_uri = URI.parse(authed.header['X-Server-Management-Url'])
+  @service = Net::HTTP.new(@service_uri.host, @service_uri.port)
+  @service.use_ssl = true
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) delete_server(server_id) + + + +

+ + + + +
+
+
+
+79
+80
+81
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 79
+
+def delete_server(server_id)
+  delete("/servers/#{server_id}", headers)
+end
+
+
+
+ +
+

+ + - (Object) headers + + + +

+ + + + +
+
+
+
+89
+90
+91
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 89
+
+def headers
+  {"Accept" => "application/json", "X-Auth-Token" => @auth_token, "Content-Type" => "application/json"}
+end
+
+
+
+ +
+

+ + - (Object) list_flavors + + + +

+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 51
+
+def list_flavors
+  JSON.parse(get('/flavors/detail'))['flavors']
+end
+
+
+
+ +
+

+ + - (Object) list_images + + + +

+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 55
+
+def list_images
+  JSON.parse(get('/images/detail'))['images']
+end
+
+
+
+ +
+

+ + - (Object) list_servers + + + +

+ + + + +
+
+
+
+59
+60
+61
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 59
+
+def list_servers
+    JSON.parse(get('/servers/detail'))['servers']
+end
+
+
+
+ +
+

+ + - (Object) load_server_details(server_id) + + + +

+ + + + +
+
+
+
+64
+65
+66
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 64
+
+def load_server_details( server_id )
+  JSON.parse(get("/servers/#{server_id}"))['server']
+end
+
+
+
+ +
+

+ + - (Object) reboot_server(server_id) + + + +

+ + + + +
+
+
+
+83
+84
+85
+86
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 83
+
+def reboot_server(server_id)
+  json = { :reboot => { :type => :SOFT }}.to_json
+  post("/servers/#{server_id}/action", json, headers)
+end
+
+
+
+ +
+

+ + - (Object) start_server(image_id, flavor_id, name) + + + +

+ + + + +
+
+
+
+69
+70
+71
+72
+73
+74
+75
+76
+77
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_client.rb', line 69
+
+def start_server(image_id, flavor_id, name)
+  json = { :server => { :name => name,
+                        :imageId => image_id.to_i,
+                        :flavorId => flavor_id.to_i }}.to_json
+  # FIXME: The response has the root password in 'adminPass'; we somehow
+  # need to communicate this back since it's the only place where we can
+  # get it from
+  JSON.parse(post("/servers", json, headers).body)["server"]
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Rackspace/RackspaceDriver.html b/site/api-docs/Deltacloud/Drivers/Rackspace/RackspaceDriver.html new file mode 100644 index 00000000..008c7901 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Rackspace/RackspaceDriver.html @@ -0,0 +1,1214 @@ + + + + +Class: Deltacloud::Drivers::Rackspace::RackspaceDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::Rackspace::RackspaceDriver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/rackspace/rackspace_driver.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #bucket, #catched_exceptions_list, declare_feature, define_hardware_profile, define_instance_states, feature, feature_decl_for, feature_decls, #features, features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #has_collection?, #image, #instance, #instance_actions_for, #instance_state_machine, instance_state_machine, #realm, #start_instance, #storage_snapshot, #storage_snapshots, #storage_volume, #storage_volumes

+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) blob_data(credentials, bucket_id, blob_id, opts) + + + +

+
+

+- Blob data - +

+ + +
+
+
+ +
+ + + + +
+
+
+
+224
+225
+226
+227
+228
+229
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 224
+
+def blob_data(credentials, bucket_id, blob_id, opts)
+  cf = cloudfiles_client(credentials)
+  cf.container(bucket_id).object(blob_id).data_stream do |chunk|
+    yield chunk
+  end
+end
+
+
+
+ +
+

+ + - (Object) blobs(credentials, opts) + + + +

+
+

+— Blobs — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 208
+
+def blobs(credentials, opts)
+  cf = cloudfiles_client(credentials)
+  blobs = []
+  safely do
+    cf_container = cf.container(opts['bucket'])
+    cf_container.objects.each do |object_name|
+      blobs << convert_object(cf_container.object(object_name))
+    end
+  end
+  blobs = filter_on(blobs, :id, opts)
+  blobs
+end
+
+
+
+ +
+

+ + - (Object) buckets(credentials, opts) + + + +

+
+

+— Buckets — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 169
+
+def buckets(credentials, opts)
+  bucket_list = []
+  cf = cloudfiles_client(credentials)
+  safely do
+    cf.containers.each do |container_name|
+      current = cf.container(container_name)
+      bucket_list << convert_container(current)
+    end #containers.each
+  end #safely
+  bucket_list = filter_on(bucket_list, :id, opts)
+  bucket_list
+end
+
+
+
+ +
+

+ + - (Object) create_bucket(credentials, name, opts) + + + +

+
+

+— Create Bucket — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+185
+186
+187
+188
+189
+190
+191
+192
+193
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 185
+
+def create_bucket(credentials, name, opts)
+  bucket = nil
+  cf = cloudfiles_client(credentials)
+  safely do
+    new_bucket = cf.create_container(name)
+    bucket = convert_container(new_bucket)
+  end
+  bucket
+end
+
+
+
+ +
+

+ + - (Object) create_instance(credentials, image_id, opts) + + + +

+
+

+create instance. Default to flavor 1 - really need a name though… In +rackspace, all flavors work with all images. +

+ + +
+
+
+ +
+ + + + +
+
+
+
+111
+112
+113
+114
+115
+116
+117
+118
+119
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 111
+
+def create_instance(credentials, image_id, opts)
+  racks = new_client( credentials )
+  hwp_id = opts[:hwp_id] || 1
+  name = Time.now.to_s
+  if (opts[:name]) then name = opts[:name] end
+  safely do
+    return convert_srv_to_instance(racks.start_server(image_id, hwp_id, name))
+  end
+end
+
+
+
+ +
+

+ + - (Object) delete_bucket(credentials, name, opts) + + + +

+
+

+— Delete Bucket — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+198
+199
+200
+201
+202
+203
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 198
+
+def delete_bucket(credentials, name, opts)
+  cf = cloudfiles_client(credentials)
+  safely do
+    cf.delete_container(name)
+  end
+end
+
+
+
+ +
+

+ + - (Object) destroy_instance(credentials, id) + + + +

+ + + + +
+
+
+
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 94
+
+def destroy_instance(credentials, id)
+  racks = new_client(credentials)
+  safely do
+    racks.delete_server(id)
+  end
+  Instance.new( {
+    :id => id,
+    :state => "STOPPED",
+    :actions => instance_actions_for( "STOPPED" ),
+  } )
+end
+
+
+
+ +
+

+ + - (Object) hardware_profiles(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 35
+
+def hardware_profiles(credentials, opts = nil)
+  racks = new_client( credentials )
+  results=""
+  safely do
+    results = racks.list_flavors.map do |flav|
+      HardwareProfile.new(flav["id"].to_s) do
+        architecture 'x86_64'
+        memory flav["ram"].to_i
+        storage flav["disk"].to_i
+      end
+    end
+  end
+  filter_hardware_profiles(results, opts)
+end
+
+
+
+ +
+

+ + - (Object) images(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 50
+
+def images(credentials, opts=nil)
+  racks = new_client( credentials )
+  results=""
+  safely do
+    results = racks.list_images.map do |img|
+      Image.new( {
+                   :id=>img["id"].to_s,
+                   :name=>img["name"],
+                   :description => img["name"] + " " + img["status"] + "",
+                   :owner_id=>"root",
+                   :architecture=>'x86_64'
+                 } )
+    end
+  end
+  results.sort_by{|e| [e.description]}
+  results = filter_on( results, :id, opts )
+  results
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, opts = nil) + + + +

+
+

+Instances +

+ + +
+
+
+ +
+ + + + +
+
+
+
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 124
+
+def instances(credentials, opts=nil)
+  racks = new_client(credentials)
+  instances = []
+  safely do
+    if (opts.nil?)
+      instances = racks.list_servers.map do |srv|
+        convert_srv_to_instance(srv)
+      end
+    else
+      instances << convert_srv_to_instance(racks.load_server_details(opts[:id]))
+    end
+  end
+  instances = filter_on( instances, :id, opts )
+  instances = filter_on( instances, :state, opts )
+  instances
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+
+

+rackspace does not at this stage have realms… its all US/TX, all the +time (at least at time of writing) +

+ + +
+
+
+ +
+ + + + +
+
+
+
+70
+71
+72
+73
+74
+75
+76
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 70
+
+def realms(credentials, opts=nil)
+  [Realm.new( {
+    :id=>"us",
+    :name=>"United States",
+    :state=> "AVAILABLE"
+  } )]
+end
+
+
+
+ +
+

+ + - (Object) reboot_instance(credentials, id) + + + +

+ + + + +
+
+
+
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 78
+
+def reboot_instance(credentials, id)
+  racks = new_client(credentials)
+  safely do
+    racks.reboot_server(id)
+  end
+  Instance.new( {
+    :id => id,
+    :state => "RUNNING",
+    :actions => instance_actions_for( "RUNNING" ),
+  } )
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, id) + + + +

+ + + + +
+
+
+
+90
+91
+92
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 90
+
+def stop_instance(credentials, id)
+  destroy_instance(credentials, id)
+end
+
+
+
+ +
+

+ + - (Object) supported_collections + + + +

+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 31
+
+def supported_collections
+  DEFAULT_COLLECTIONS + [ :buckets ]
+end
+
+
+
+ +
+

+ + - (Boolean) valid_credentials?(credentials) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+141
+142
+143
+144
+145
+146
+147
+148
+
+
# File 'lib/deltacloud/drivers/rackspace/rackspace_driver.rb', line 141
+
+def valid_credentials?(credentials)
+  begin
+    new_client(credentials)
+  rescue
+    return false
+  end
+  true
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/RimuHosting.html b/site/api-docs/Deltacloud/Drivers/RimuHosting.html new file mode 100644 index 00000000..3922eb16 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/RimuHosting.html @@ -0,0 +1,93 @@ + + + + +Module: Deltacloud::Drivers::RimuHosting + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::RimuHosting + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb,
+ lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
+
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: RimuHostingClient, RimuHostingDriver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/RimuHosting/RimuHostingClient.html b/site/api-docs/Deltacloud/Drivers/RimuHosting/RimuHostingClient.html new file mode 100644 index 00000000..991a67f2 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/RimuHosting/RimuHostingClient.html @@ -0,0 +1,571 @@ + + + + +Class: Deltacloud::Drivers::RimuHosting::RimuHostingClient + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::RimuHosting::RimuHostingClient + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (RimuHostingClient) initialize(credentials, baseuri = 'https://rimuhosting.com/r') + + + +

+
+

+A new instance of RimuHostingClient +

+ + +
+
+
+ +
+ + + + +
+
+
+
+31
+32
+33
+34
+35
+36
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb', line 31
+
+def initialize(credentials ,baseuri = 'https://rimuhosting.com/r')
+  @uri = URI.parse(baseuri)
+  @service = Net::HTTP.new(@uri.host, @uri.port)
+  @service.use_ssl = true
+  @auth = "rimuhosting apikey=#{credentials.password}"
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) create_server(image_id, plan_code, name) + + + +

+ + + + +
+
+
+
+76
+77
+78
+79
+80
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb', line 76
+
+def create_server(image_id, plan_code, name)
+  json = {:new_vps => {:instantiation_options => {:domain_name => name, :distro => image_id},
+                      :pricing_plan_code => plan_code}}.to_json
+  request('/orders/new-vps',json, 'POST')[:about_order]
+end
+
+
+
+ +
+

+ + - (Object) delete_server(id) + + + +

+ + + + +
+
+
+
+72
+73
+74
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb', line 72
+
+def delete_server(id)
+  request("/orders/order-#{id}-a/vps",'', 'DELETE')
+end
+
+
+
+ +
+

+ + - (Object) list_images + + + +

+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb', line 55
+
+def list_images
+  request('/distributions')["distro_infos"]
+end
+
+
+
+ +
+

+ + - (Object) list_nodes + + + +

+ + + + +
+
+
+
+63
+64
+65
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb', line 63
+
+def list_nodes
+  request('/orders;include_inactive=N')["about_orders"]
+end
+
+
+
+ +
+

+ + - (Object) list_plans + + + +

+ + + + +
+
+
+
+59
+60
+61
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb', line 59
+
+def list_plans
+  request('/pricing-plans;server-type=VPS')["pricing_plan_infos"]
+end
+
+
+
+ +
+

+ + - (Object) request(resource, data = '', method = 'GET') + + + +

+ + + + +
+
+
+
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb', line 38
+
+def request(resource, data='', method='GET')
+  headers = {"Accept" => "application/json", "Content-Type" => "application/json"}
+  if(!@auth.nil?)
+    headers["Authorization"] = @auth
+  end
+  r = @service.send_request(method, @uri.path + resource, data, headers)
+       puts r.body
+  res = JSON.parse(r.body)
+  res = res[res.keys[0]]
+
+  if(res['response_type'] == "ERROR" and ( (res['error_info']['error_class'] == "PermissionException") or
+             (res['error_info']['error_class'] == "LoginRequired") )) 
+    raise Deltacloud::AuthException.new
+  end
+  res
+end
+
+
+
+ +
+

+ + - (Object) set_server_state(id, state) + + + +

+ + + + +
+
+
+
+67
+68
+69
+70
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb', line 67
+
+def set_server_state(id, state)
+  json = {"reboot_request" => {"running_state" => state}}.to_json
+  request("/orders/order-#{id}-a/vps/running-state", json, 'PUT')
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/RimuHosting/RimuHostingDriver.html b/site/api-docs/Deltacloud/Drivers/RimuHosting/RimuHostingDriver.html new file mode 100644 index 00000000..e5da3c7f --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/RimuHosting/RimuHostingDriver.html @@ -0,0 +1,825 @@ + + + + +Class: Deltacloud::Drivers::RimuHosting::RimuHostingDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::RimuHosting::RimuHostingDriver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #blob_data, #blobs, #bucket, #buckets, #catched_exceptions_list, #create_bucket, declare_feature, define_hardware_profile, define_instance_states, #delete_bucket, feature, feature_decl_for, feature_decls, #features, features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #has_collection?, #image, #instance, #instance_actions_for, instance_state_machine, #instance_state_machine, #realm, #storage_snapshot, #storage_snapshots, #storage_volume, #storage_volumes, #supported_collections

+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) convert_srv_to_instance(inst) + + + +

+ + + + +
+
+
+
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 124
+
+def convert_srv_to_instance( inst )
+  Instance.new({
+          :id => inst["order_oid"].to_s,
+          :name => inst["domain_name"],
+          :image_id => "lenny",
+          :state => "RUNNING",
+          :name => inst["domain_name"],
+          :realm_id => "RH",
+          :owner_id => "root",
+          :instance_profile => InstanceProfile.new("none"),
+          :actions => instance_actions_for("RUNNING"),
+          :public_addresses => inst["allocated_ips"]["primary_ip"],
+          :launch_time => inst["billing_info"]["order_date"]["iso_format"]
+  })
+end
+
+
+
+ +
+

+ + - (Object) create_instance(credentials, image_id, opts) + + + +

+ + + + +
+
+
+
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 111
+
+def create_instance(credentials, image_id, opts)
+   rh = RimuHostingClient.new(credentials)
+  # really need to raise an exception here.
+  hwp_id = opts[:hwp_id] || 1
+  # really bad, but at least its a fqdn
+  name = Time.now.to_s + '.com'
+  if (opts[:name]) then
+    name = opts[:name]
+  end
+  convert_srv_to_instance(rh.create_server(image_id, hwp_id, name))
+
+end
+
+
+
+ +
+

+ + - (Object) destroy_instance(credentials, id) + + + +

+ + + + +
+
+
+
+104
+105
+106
+107
+108
+109
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 104
+
+def destroy_instance(credentials, id)
+  safely do
+    rh = RimuHostingClient.new(credentials)
+    return rh.delete_server(id)
+  end
+end
+
+
+
+ +
+

+ + - (Object) hardware_profiles(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 49
+
+def hardware_profiles(credentials, opts = nil)
+  safely do
+    rh = RimuHostingClient.new(credentials)
+    results = rh.list_plans.map do |plan|
+      # FIXME: x86 is not a valid architecture; what is Rimu offering ?
+      # FIXME: VPS plans offer a range of memory/storage, but that's
+      #        not contained in hte pricing_plan_infos
+      HardwareProfile.new(plan["pricing_plan_code"]) do
+        memory plan["minimum_memory_mb"].to_f
+        storage plan["minimum_disk_gb"].to_i
+        architecture "x86"
+      end
+    end
+  end
+  filter_hardware_profiles(results, opts)
+end
+
+
+
+ +
+

+ + - (Object) images(credentails, opts = nil) + + + +

+ + + + +
+
+
+
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 31
+
+def images(credentails, opts=nil)
+  safely do
+    rh = RimuHostingClient.new(credentails)
+    images = rh.list_images.map do | image |
+      Image.new({
+              :id => image["distro_code"].gsub(/\./,"-"),
+              :name => image["distro_code"],
+              :description => image["distro_description"],
+              :owner_id => "root",
+              :architecture => "x86"
+      })
+    end
+  end
+  images.sort_by{|e| [e.description]}
+  images = filter_on( images, :id, opts)
+  images
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 74
+
+def instances(credentials, opts=nil)
+  safely do
+    rh = RimuHostingClient.new(credentials)
+    instances = rh.list_nodes.map do | inst |
+      convert_srv_to_instance(inst)
+    end
+  end
+  instances = filter_on( instances, :id, opts)
+  instances = filter_on( instances, :state, opts )
+  instances
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+ + + + +
+
+
+
+66
+67
+68
+69
+70
+71
+72
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 66
+
+def realms(credentials, opts=nil)
+  [Realm.new( {
+          :id=>"rimu",
+          :name=>"RimuHosting",
+          :state=> "AVAILABLE"
+  } )]
+end
+
+
+
+ +
+

+ + - (Object) reboot_instance(credentials, id) + + + +

+ + + + +
+
+
+
+86
+87
+88
+89
+90
+91
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 86
+
+def reboot_instance(credentials, id)
+  safely do
+    rh = RimuHostingClient.new(credentials)
+    rh.set_server_state(id, :RESTARTING)
+  end
+end
+
+
+
+ +
+

+ + - (Object) safely(&block) + + + +

+ + + + +
+
+
+
+153
+154
+155
+156
+157
+158
+159
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 153
+
+def safely(&block)
+  begin
+    block.call
+  rescue Exception => e
+    raise Deltacloud::BackendError.new(500, e.class.to_s, e.message, e.backtrace)
+  end
+end
+
+
+
+ +
+

+ + - (Object) start_instance(credentials, id) + + + +

+ + + + +
+
+
+
+93
+94
+95
+96
+97
+98
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 93
+
+def start_instance(credentials, id)
+  safely do
+    rh = RimuHostingClient.new(credentials)
+    rh.set_server_state(id, :STARTED)
+  end
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, id) + + + +

+ + + + +
+
+
+
+100
+101
+102
+
+
# File 'lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb', line 100
+
+def stop_instance(credentials, id)
+  destroy_instance(credentials, id)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Terremark.html b/site/api-docs/Deltacloud/Drivers/Terremark.html new file mode 100644 index 00000000..66fdf0b9 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Terremark.html @@ -0,0 +1,91 @@ + + + + +Module: Deltacloud::Drivers::Terremark + + + + + + + + + + + + + + + +

Module: Deltacloud::Drivers::Terremark + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/terremark/terremark_driver.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: TerremarkDriver + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Drivers/Terremark/TerremarkDriver.html b/site/api-docs/Deltacloud/Drivers/Terremark/TerremarkDriver.html new file mode 100644 index 00000000..d98d0255 --- /dev/null +++ b/site/api-docs/Deltacloud/Drivers/Terremark/TerremarkDriver.html @@ -0,0 +1,879 @@ + + + + +Class: Deltacloud::Drivers::Terremark::TerremarkDriver + + + + + + + + + + + + + + + +

Class: Deltacloud::Drivers::Terremark::TerremarkDriver + + + +

+ +
+ +
Inherits:
+
+ BaseDriver + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/terremark/terremark_driver.rb
+ +
+
+ + +

Constant Summary

+ +
+ +
VAPP_STATE_MAP = +
+
+

+— Vapp State Map… for use with convert_instance (get an integer +back from terremark) — +

+ + +
+
+
+ +
+
+
{ "0" =>  "PENDING", "1" =>  "PENDING", "2" =>  "STOPPED", "4" =>  "RUNNING" }
+
+ +
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseDriver

+

#blob, #blob_data, #blobs, #bucket, #buckets, #catched_exceptions_list, #create_bucket, declare_feature, define_hardware_profile, define_instance_states, #delete_bucket, feature, feature_decl_for, feature_decls, #features, features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #hardware_profiles, #has_collection?, #image, #instance, #instance_actions_for, #instance_state_machine, instance_state_machine, #realm, #storage_snapshot, #storage_snapshots, #storage_volume, #storage_volumes, #supported_collections

+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) create_instance(credentials, image_id, opts) + + + +

+
+

+— CREATE INSTANCE — launch a vapp template. Needs a name, ram, +no. cpus, id of vapp_template +

+ + +
+
+
+ +
+ + + + +
+
+
+
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 129
+
+def create_instance(credentials, image_id, opts)
+  new_vapp = nil
+  vapp_opts = {} #assemble options to pass to Fog::Terremark::Real.instantiate_vapp_template
+  terremark_hwp = hardware_profiles(credentials, {:name => 'default'}).first #sanity check values against default
+  name = opts['name'] #name could be nil or length 0 or too long
+  name = "inst#{Time.now.to_i}" if (name.nil? || (name.length == 0))
+  name = name.slice(0..13) #name < 15 chars (says terremark)
+  unless ( (terremark_hwp.include?(:cpu, opts[:hwp_cpu].to_i)) &&
+            (terremark_hwp.include?(:memory, opts[:hwp_memory].to_i)) ) then
+     raise Deltacloud::Validation::Failure.new(Deltacloud::Validation::Param.new(["cpu"]), "Error with cpu and/or memory values. you said cpu->#{opts[:hwp_cpu]} and mem->#{opts[:hwp_memory]}")
+  end
+  vapp_opts['cpus'] = opts[:hwp_cpu]
+  vapp_opts['memory'] =  opts[:hwp_memory]
+  safely do
+    terremark_client = new_client(credentials)
+#######
+#FIXME#  what happens if there is an issue getting the new vapp id? (eg even though created succesfully)
+#######
+    vapp_id = terremark_client.instantiate_vapp_template(name, image_id, vapp_opts).body['href'].split('/').last
+    new_vapp = terremark_client.get_vapp(vapp_id)
+    return convert_instance(new_vapp, terremark_client, credentials.user) #return an Instance object
+  end
+end
+
+
+
+ +
+

+ + - (Object) destroy_instance(credentials, id) + + + +

+
+

+— DESTROY INSTANCE — shuts down… in terremark need to do +a futher delete to get rid of a vapp entirely +

+ + +
+
+
+ +
+ + + + +
+
+
+
+187
+188
+189
+190
+191
+192
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 187
+
+def destroy_instance(credentials, id)
+  safely do
+    terremark_client = new_client(credentials)
+    return terremark_client.delete_vapp(id)
+  end
+end
+
+
+
+ +
+

+ + - (Object) images(credentials, opts = nil) + + + +

+
+

+— IMAGES — aka "vapp_templates" +

+ + +
+
+
+ +
+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 57
+
+def images(credentials, opts=nil)
+    image_list = []
+    terremark_client = new_client(credentials)
+    safely do
+      vdc_id = terremark_client.default_vdc_id
+      catalogItems = terremark_client.get_catalog(vdc_id).body['CatalogItems']
+      catalogItems.each{ |catalog_item|
+        current_item_id = catalog_item['href'].split('/').last
+        current_item = terremark_client.get_catalog_item(current_item_id).body['Entity']
+          if(current_item['type'] == 'application/vnd.vmware.vcloud.vAppTemplate+xml')
+            image_list << convert_image(current_item, credentials.user)
+          end
+      } #end of catalogItems.each
+    end
+    image_list = filter_on( image_list, :id, opts )
+    image_list = filter_on( image_list, :architecture, opts )
+    image_list = filter_on( image_list, :owner_id, opts )
+    image_list
+end
+
+
+
+ +
+

+ + - (Object) instances(credentials, opts = nil) + + + +

+
+

+— INSTANCES — aka vApps +

+ + +
+
+
+ +
+ + + + +
+
+
+
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 93
+
+def instances(credentials, opts=nil)
+    instances = []
+    terremark_client = new_client(credentials)
+    safely do
+      vdc_items = terremark_client.get_vdc(terremark_client.default_vdc_id()).body['ResourceEntities']
+      vdc_items.each{|current_item|
+        if(current_item['type'] == 'application/vnd.vmware.vcloud.vApp+xml')
+           vapp_id =  current_item['href'].split('/').last
+           vapp = terremark_client.get_vapp(vapp_id)
+           instances  << convert_instance(vapp, terremark_client, credentials.user)
+        end
+      }#end vdc_items.each
+    end
+    instances = filter_on( instances, :id, opts )
+    instances
+end
+
+
+
+ +
+

+ + - (Object) realms(credentials, opts = nil) + + + +

+
+

+— REALMS — only one realm… everything in US? +

+ + +
+
+
+ +
+ + + + +
+
+
+
+81
+82
+83
+84
+85
+86
+87
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 81
+
+def realms(credentials, opts=nil)
+   [Realm.new( {
+    :id=>"US-Miami",
+    :name=>"United States - Miami",
+    :state=> "AVAILABLE"
+  } )]
+end
+
+
+
+ +
+

+ + - (Object) reboot_instance(credentials, id) + + + +

+
+

+— REBOOT INSTANCE — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+156
+157
+158
+159
+160
+161
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 156
+
+def reboot_instance(credentials, id)
+  safely do
+    terremark_client =  new_client(credentials)
+    return terremark_client.power_reset(id)
+  end
+end
+
+
+
+ +
+

+ + - (Object) start_instance(credentials, id) + + + +

+
+

+— START INSTANCE — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+166
+167
+168
+169
+170
+171
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 166
+
+def start_instance(credentials, id)
+  safely do
+    terremark_client =  new_client(credentials)
+    return terremark_client.power_on(id)
+  end
+end
+
+
+
+ +
+

+ + - (Object) stop_instance(credentials, id) + + + +

+
+

+— STOP INSTANCE — +

+ + +
+
+
+ +
+ + + + +
+
+
+
+176
+177
+178
+179
+180
+181
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 176
+
+def stop_instance(credentials, id)
+  safely do
+    terremark_client = new_client(credentials)
+    return terremark_client.power_shutdown(id)
+  end
+end
+
+
+
+ +
+

+ + - (Boolean) valid_credentials?(credentials) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+194
+195
+196
+197
+198
+199
+200
+201
+
+
# File 'lib/deltacloud/drivers/terremark/terremark_driver.rb', line 194
+
+def valid_credentials?(credentials)
+  begin
+    new_client(credentials)
+  rescue Deltacloud::AuthException
+    return false
+  end
+  true
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/DuplicateFeatureDeclError.html b/site/api-docs/Deltacloud/DuplicateFeatureDeclError.html new file mode 100644 index 00000000..7f4a5825 --- /dev/null +++ b/site/api-docs/Deltacloud/DuplicateFeatureDeclError.html @@ -0,0 +1,111 @@ + + + + +Exception: Deltacloud::DuplicateFeatureDeclError + + + + + + + + + + + + + + + +

Exception: Deltacloud::DuplicateFeatureDeclError + + + +

+ +
+ +
Inherits:
+
+ FeatureError + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/features.rb
+ +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/FeatureError.html b/site/api-docs/Deltacloud/FeatureError.html new file mode 100644 index 00000000..b26421c2 --- /dev/null +++ b/site/api-docs/Deltacloud/FeatureError.html @@ -0,0 +1,104 @@ + + + + +Exception: Deltacloud::FeatureError + + + + + + + + + + + + + + + +

Exception: Deltacloud::FeatureError + + + +

+ +
+ +
Inherits:
+
+ StandardError + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/features.rb
+ +
+
+ +
+

Direct Known Subclasses

+

DuplicateFeatureDeclError, UndeclaredFeatureError

+
+ + + + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/HardwareProfile.html b/site/api-docs/Deltacloud/HardwareProfile.html new file mode 100644 index 00000000..b35a6d08 --- /dev/null +++ b/site/api-docs/Deltacloud/HardwareProfile.html @@ -0,0 +1,860 @@ + + + + +Class: Deltacloud::HardwareProfile + + + + + + + + + + + + + + + +

Class: Deltacloud::HardwareProfile + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/hardware_profile.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: Property + + +

+ +

Constant Summary

+ +
+ +
UNITS = + +
+
{
+  :memory => "MB",
+  :storage => "GB",
+  :architecture => "label",
+  :cpu => "count"
+}
+
+ +
+ + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
+ + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (HardwareProfile) initialize(name, &block) + + + +

+
+

+A new instance of HardwareProfile +

+ + +
+
+
+ +
+ + + + +
+
+
+
+97
+98
+99
+100
+101
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 97
+
+def initialize(name,&block)
+  @properties   = {}
+  @name         = name
+  instance_eval &block if block_given?
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+91
+92
+93
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 91
+
+def name
+  @name
+end
+
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) property(prop) + + + +

+ + + + +
+
+
+
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 79
+
+def property(prop)
+  define_method(prop) do |*args|
+    values, opts, *ignored = *args
+    instvar = :"@#{prop}"
+    unless values.nil?
+      @properties[prop] = Property.new(prop, values, opts || {})
+    end
+    @properties[prop]
+  end
+end
+
+
+
+ +
+

+ + + (Object) unit(name) + + + +

+ + + + +
+
+
+
+12
+13
+14
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 12
+
+def self.unit(name)
+  UNITS[name]
+end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Boolean) default?(prop, v) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+115
+116
+117
+118
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 115
+
+def default?(prop, v)
+  p = @properties[prop.to_sym]
+  p && p.default.to_s == v
+end
+
+
+
+ +
+

+ + - (Object) each_property(&block) + + + +

+ + + + +
+
+
+
+103
+104
+105
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 103
+
+def each_property(&block)
+  @properties.each_value { |prop| yield prop }
+end
+
+
+
+ +
+

+ + - (Boolean) include?(prop, v) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+142
+143
+144
+145
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 142
+
+def include?(prop, v)
+  p = @properties[prop]
+  p.nil? || p.include?(v)
+end
+
+
+
+ +
+

+ + - (Object) params + + + +

+ + + + +
+
+
+
+147
+148
+149
+150
+151
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 147
+
+def params
+  @properties.values.inject([]) { |m, prop|
+    m << prop.to_param
+  }.compact
+end
+
+
+
+ +
+

+ + - (Object) properties + + + +

+ + + + +
+
+
+
+107
+108
+109
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 107
+
+def properties
+  @properties.values
+end
+
+
+
+ +
+

+ + - (Object) property(name) + + + +

+ + + + +
+
+
+
+111
+112
+113
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 111
+
+def property(name)
+  @properties[name.to_sym]
+end
+
+
+
+ +
+

+ + - (Object) to_hash + + + +

+ + + + +
+
+
+
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 120
+
+def to_hash
+  props = []
+  self.each_property do |p|
+    if p.kind.eql? :fixed
+      props << { :kind => p.kind, :value => p.value, :name => p.name, :unit => p.unit } 
+    else
+      param = { :operation => "create", :method => "post", :name => p.name }
+      if p.kind.eql? :range
+        param[:range] = { :first => p.first, :last => p.last }
+      elsif p.kind.eql? :enum
+        param[:enum] = p.values.collect { |v| { :entry => v } }
+      end
+      param
+      props << { :kind => p.kind, :value => p.default, :name => p.name, :unit => p.unit, :param => param }
+    end
+  end
+  {
+    :id => self.name,
+    :properties => props
+  }
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/HardwareProfile/Property.html b/site/api-docs/Deltacloud/HardwareProfile/Property.html new file mode 100644 index 00000000..e8c2c566 --- /dev/null +++ b/site/api-docs/Deltacloud/HardwareProfile/Property.html @@ -0,0 +1,1031 @@ + + + + +Class: Deltacloud::HardwareProfile::Property + + + + + + + + + + + + + + + +

Class: Deltacloud::HardwareProfile::Property + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/hardware_profile.rb
+ +
+
+ + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) default + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute default. +

    +
    + +
  • + + +
  • + + + - (Object) first + + + + + + + readonly + + + + + + + + +

    +kind == :range. +

    +
    + +
  • + + +
  • + + + - (Object) kind + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute kind. +

    +
    + +
  • + + +
  • + + + - (Object) last + + + + + + + readonly + + + + + + + + +

    +kind == :range. +

    +
    + +
  • + + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) value + + + + + + + readonly + + + + + + + + +

    +kind == :fixed. +

    +
    + +
  • + + +
  • + + + - (Object) values + + + + + + + readonly + + + + + + + + +

    +kind == :enum. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Property) initialize(name, values, opts = {}) + + + +

+
+

+A new instance of Property +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 25
+
+def initialize(name, values, opts = {})
+  @name = name
+  if values.is_a?(Range)
+    @kind = :range
+    @first = values.first
+    @last = values.last
+    @default = values.first
+  elsif values.is_a?(Array)
+    @kind = :enum
+    @values = values
+    @default = values.first
+  else
+    @kind = :fixed
+    @value = values
+    @default = @value
+  end
+  @default = opts[:default] if opts[:default]
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) default (readonly) + + + +

+
+

+Returns the value of attribute default +

+ + +
+
+
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 17
+
+def default
+  @default
+end
+
+
+
+ + + + +
+

+ + - (Object) first (readonly) + + + +

+
+

+kind == :range +

+ + +
+
+
+ +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 19
+
+def first
+  @first
+end
+
+
+
+ + + + +
+

+ + - (Object) kind (readonly) + + + +

+
+

+Returns the value of attribute kind +

+ + +
+
+
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 17
+
+def kind
+  @kind
+end
+
+
+
+ + + + +
+

+ + - (Object) last (readonly) + + + +

+
+

+kind == :range +

+ + +
+
+
+ +
+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 19
+
+def last
+  @last
+end
+
+
+
+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+17
+18
+19
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 17
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) value (readonly) + + + +

+
+

+kind == :fixed +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 23
+
+def value
+  @value
+end
+
+
+
+ + + + +
+

+ + - (Object) values (readonly) + + + +

+
+

+kind == :enum +

+ + +
+
+
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 21
+
+def values
+  @values
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Boolean) fixed? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+52
+53
+54
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 52
+
+def fixed?
+  kind == :fixed
+end
+
+
+
+ +
+

+ + - (Boolean) include?(v) + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+67
+68
+69
+70
+71
+72
+73
+74
+75
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 67
+
+def include?(v)
+  if kind == :fixed
+    return v == value
+  elsif kind == :range
+    return v >= first && v <= last
+  else
+    return values.include?(v)
+  end
+end
+
+
+
+ +
+

+ + - (Object) param + + + +

+ + + + +
+
+
+
+48
+49
+50
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 48
+
+def param
+  "hwp_#{name}"
+end
+
+
+
+ +
+

+ + - (Object) to_param + + + +

+ + + + +
+
+
+
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 56
+
+def to_param
+  return nil if kind == :fixed
+  if kind == :range
+    # FIXME: We can't validate ranges currently
+    args = [param, :string, :optional]
+  else
+    args = [param, :string, :optional, values.collect { |v| v.to_s} ]
+  end
+  Validation::Param.new(args)
+end
+
+
+
+ +
+

+ + - (Object) unit + + + +

+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/deltacloud/hardware_profile.rb', line 44
+
+def unit
+  HardwareProfile.unit(name)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/StateMachine.html b/site/api-docs/Deltacloud/StateMachine.html new file mode 100644 index 00000000..3ea512d8 --- /dev/null +++ b/site/api-docs/Deltacloud/StateMachine.html @@ -0,0 +1,495 @@ + + + + +Class: Deltacloud::StateMachine + + + + + + + + + + + + + + + +

Class: Deltacloud::StateMachine + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/state_machine.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: State, Transition + + +

+ + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) states + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute states. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (StateMachine) initialize(&block) + + + +

+
+

+A new instance of StateMachine +

+ + +
+
+
+ +
+ + + + +
+
+
+
+6
+7
+8
+9
+
+
# File 'lib/deltacloud/state_machine.rb', line 6
+
+def initialize(&block)
+  @states  = []
+  instance_eval &block if block
+end
+
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + - (Object) method_missing(sym, *args) + + + +

+ + + + +
+
+
+
+28
+29
+30
+31
+
+
# File 'lib/deltacloud/state_machine.rb', line 28
+
+def method_missing(sym,*args)
+  return state( sym ) if ( args.empty? )
+  super( sym, *args )
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) states (readonly) + + + +

+
+

+Returns the value of attribute states +

+ + +
+
+
+ +
+ + + + +
+
+
+
+5
+6
+7
+
+
# File 'lib/deltacloud/state_machine.rb', line 5
+
+def states
+  @states
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) finish + + + +

+ + + + +
+
+
+
+15
+16
+17
+
+
# File 'lib/deltacloud/state_machine.rb', line 15
+
+def finish()
+  state(:finish)
+end
+
+
+
+ +
+

+ + - (Object) start + + + +

+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/deltacloud/state_machine.rb', line 11
+
+def start()
+  state(:start)
+end
+
+
+
+ +
+

+ + - (Object) state(name) + + + +

+ + + + +
+
+
+
+19
+20
+21
+22
+23
+24
+25
+26
+
+
# File 'lib/deltacloud/state_machine.rb', line 19
+
+def state(name)
+  state = @states.find{|e| e.name == name.to_sym}
+  if ( state.nil? )
+    state = State.new( self, name.to_sym )
+    @states << state
+  end
+  state
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/StateMachine/State.html b/site/api-docs/Deltacloud/StateMachine/State.html new file mode 100644 index 00000000..08cfd627 --- /dev/null +++ b/site/api-docs/Deltacloud/StateMachine/State.html @@ -0,0 +1,443 @@ + + + + +Class: Deltacloud::StateMachine::State + + + + + + + + + + + + + + + +

Class: Deltacloud::StateMachine::State + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/state_machine.rb
+ +
+
+ + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) transitions + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute transitions. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (State) initialize(machine, name) + + + +

+
+

+A new instance of State +

+ + +
+
+
+ +
+ + + + +
+
+
+
+38
+39
+40
+41
+42
+
+
# File 'lib/deltacloud/state_machine.rb', line 38
+
+def initialize(machine, name)
+  @machine = machine
+  @name    = name
+  @transitions = []
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/deltacloud/state_machine.rb', line 35
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) transitions (readonly) + + + +

+
+

+Returns the value of attribute transitions +

+ + +
+
+
+ +
+ + + + +
+
+
+
+36
+37
+38
+
+
# File 'lib/deltacloud/state_machine.rb', line 36
+
+def transitions
+  @transitions
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) to(destination_name) + + + +

+ + + + +
+
+
+
+48
+49
+50
+51
+52
+53
+
+
# File 'lib/deltacloud/state_machine.rb', line 48
+
+def to(destination_name)
+  destination = @machine.state(destination_name)
+  transition = Transition.new( @machine, destination )
+  @transitions << transition
+  transition
+end
+
+
+
+ +
+

+ + - (Object) to_s + + + +

+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/deltacloud/state_machine.rb', line 44
+
+def to_s
+  self.name.to_s
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/StateMachine/Transition.html b/site/api-docs/Deltacloud/StateMachine/Transition.html new file mode 100644 index 00000000..342a891f --- /dev/null +++ b/site/api-docs/Deltacloud/StateMachine/Transition.html @@ -0,0 +1,510 @@ + + + + +Class: Deltacloud::StateMachine::Transition + + + + + + + + + + + + + + + +

Class: Deltacloud::StateMachine::Transition + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/state_machine.rb
+ +
+
+ + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) action + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute action. +

    +
    + +
  • + + +
  • + + + - (Object) destination + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute destination. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Transition) initialize(machine, destination) + + + +

+
+

+A new instance of Transition +

+ + +
+
+
+ +
+ + + + +
+
+
+
+62
+63
+64
+65
+66
+67
+
+
# File 'lib/deltacloud/state_machine.rb', line 62
+
+def initialize(machine, destination)
+  @machine = machine
+  @destination = destination
+  @auto   = false
+  @action = nil
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) action (readonly) + + + +

+
+

+Returns the value of attribute action +

+ + +
+
+
+ +
+ + + + +
+
+
+
+60
+61
+62
+
+
# File 'lib/deltacloud/state_machine.rb', line 60
+
+def action
+  @action
+end
+
+
+
+ + + + +
+

+ + - (Object) destination (readonly) + + + +

+
+

+Returns the value of attribute destination +

+ + +
+
+
+ +
+ + + + +
+
+
+
+59
+60
+61
+
+
# File 'lib/deltacloud/state_machine.rb', line 59
+
+def destination
+  @destination
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) automatically + + + +

+ + + + +
+
+
+
+69
+70
+71
+
+
# File 'lib/deltacloud/state_machine.rb', line 69
+
+def automatically
+  @auto = true
+end
+
+
+
+ +
+

+ + - (Boolean) automatically? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+73
+74
+75
+
+
# File 'lib/deltacloud/state_machine.rb', line 73
+
+def automatically?
+  @auto
+end
+
+
+
+ +
+

+ + - (Object) on(action) + + + +

+ + + + +
+
+
+
+77
+78
+79
+
+
# File 'lib/deltacloud/state_machine.rb', line 77
+
+def on(action)
+  @action = action
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/UndeclaredFeatureError.html b/site/api-docs/Deltacloud/UndeclaredFeatureError.html new file mode 100644 index 00000000..c6f69f90 --- /dev/null +++ b/site/api-docs/Deltacloud/UndeclaredFeatureError.html @@ -0,0 +1,111 @@ + + + + +Exception: Deltacloud::UndeclaredFeatureError + + + + + + + + + + + + + + + +

Exception: Deltacloud::UndeclaredFeatureError + + + +

+ +
+ +
Inherits:
+
+ FeatureError + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/features.rb
+ +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Validation.html b/site/api-docs/Deltacloud/Validation.html new file mode 100644 index 00000000..5370ff5a --- /dev/null +++ b/site/api-docs/Deltacloud/Validation.html @@ -0,0 +1,425 @@ + + + + +Module: Deltacloud::Validation + + + + + + + + + + + + + + + +

Module: Deltacloud::Validation + + + +

+ +
+ + + + + + + +
Included in:
+
BaseDriver::Operation, Sinatra::Rabbit::Operation
+ + + +
Defined in:
+
lib/deltacloud/validation.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: Failure, Param + + +

+ + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) add_params(new) + + + +

+
+

+Add the parameters in hash new to already existing parameters. If +new contains a parameter with an already existing name, the old +definition is clobbered. +

+ + +
+
+
+ +
+ + + + +
+
+
+
+49
+50
+51
+52
+53
+
+
# File 'lib/deltacloud/validation.rb', line 49
+
+def add_params(new)
+  # We do not check for duplication on purpose: multiple calls
+  # to add_params should be cumulative
+  new.each { |p|  @params[p.name] = p }
+end
+
+
+
+ +
+

+ + - (Object) each_param(&block) + + + +

+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/deltacloud/validation.rb', line 55
+
+def each_param(&block)
+  params.each_value { |p| yield p }
+end
+
+
+
+ +
+

+ + - (Object) param(*args) + + + +

+
+ + +
+
+
+

Raises:

+
    + +
  • + + (DuplicateParamException) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+35
+36
+37
+38
+39
+
+
# File 'lib/deltacloud/validation.rb', line 35
+
+def param(*args)
+  raise DuplicateParamException if params[args[0]]
+  p = Param.new(args)
+  params[p.name] = p
+end
+
+
+
+ +
+

+ + - (Object) params + + + +

+ + + + +
+
+
+
+41
+42
+43
+44
+
+
# File 'lib/deltacloud/validation.rb', line 41
+
+def params
+  @params ||= {}
+  @params
+end
+
+
+
+ +
+

+ + - (Object) validate(values) + + + +

+ + + + +
+
+
+
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+
+
# File 'lib/deltacloud/validation.rb', line 59
+
+def validate(values)
+  each_param do |p|
+    if p.required? and not values[p.name]
+      raise Failure.new(p, "Required parameter #{p.name} not found")
+    end
+    if values[p.name] and not p.options.empty? and
+        not p.options.include?(values[p.name])
+      raise Failure.new(p, "Parameter #{p.name} has value #{values[p.name]} which is not in #{p.options.join(", ")}")
+    end
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Validation/Failure.html b/site/api-docs/Deltacloud/Validation/Failure.html new file mode 100644 index 00000000..44ccbe4c --- /dev/null +++ b/site/api-docs/Deltacloud/Validation/Failure.html @@ -0,0 +1,319 @@ + + + + +Exception: Deltacloud::Validation::Failure + + + + + + + + + + + + + + + +

Exception: Deltacloud::Validation::Failure + + + +

+ +
+ +
Inherits:
+
+ StandardError + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/validation.rb
+ +
+
+ + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) param + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute param. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + +
+

Constructor Details

+ +
+

+ + - (Failure) initialize(param, msg = '') + + + +

+
+

+A new instance of Failure +

+ + +
+
+
+ +
+ + + + +
+
+
+
+5
+6
+7
+8
+
+
# File 'lib/deltacloud/validation.rb', line 5
+
+def initialize(param, msg='')
+  super(msg)
+  @param = param
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) param (readonly) + + + +

+
+

+Returns the value of attribute param +

+ + +
+
+
+ +
+ + + + +
+
+
+
+4
+5
+6
+
+
# File 'lib/deltacloud/validation.rb', line 4
+
+def param
+  @param
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) name + + + +

+ + + + +
+
+
+
+10
+11
+12
+
+
# File 'lib/deltacloud/validation.rb', line 10
+
+def name
+  param.name
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Deltacloud/Validation/Param.html b/site/api-docs/Deltacloud/Validation/Param.html new file mode 100644 index 00000000..8332d0a0 --- /dev/null +++ b/site/api-docs/Deltacloud/Validation/Param.html @@ -0,0 +1,693 @@ + + + + +Class: Deltacloud::Validation::Param + + + + + + + + + + + + + + + +

Class: Deltacloud::Validation::Param + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/validation.rb
+ +
+
+ + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) description + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute description. +

    +
    + +
  • + + +
  • + + + - (Object) klass + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute klass. +

    +
    + +
  • + + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) options + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute options. +

    +
    + +
  • + + +
  • + + + - (Object) type + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute type. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Param) initialize(args) + + + +

+
+

+A new instance of Param +

+ + +
+
+
+ +
+ + + + +
+
+
+
+18
+19
+20
+21
+22
+23
+24
+
+
# File 'lib/deltacloud/validation.rb', line 18
+
+def initialize(args)
+  @name = args[0]
+  @klass = args[1] || :string
+  @type = args[2] || :optional
+  @options = args[3] || []
+  @description = args[4] || ''
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) description (readonly) + + + +

+
+

+Returns the value of attribute description +

+ + +
+
+
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/deltacloud/validation.rb', line 16
+
+def description
+  @description
+end
+
+
+
+ + + + +
+

+ + - (Object) klass (readonly) + + + +

+
+

+Returns the value of attribute klass +

+ + +
+
+
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/deltacloud/validation.rb', line 16
+
+def klass
+  @klass
+end
+
+
+
+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/deltacloud/validation.rb', line 16
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) options (readonly) + + + +

+
+

+Returns the value of attribute options +

+ + +
+
+
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/deltacloud/validation.rb', line 16
+
+def options
+  @options
+end
+
+
+
+ + + + +
+

+ + - (Object) type (readonly) + + + +

+
+

+Returns the value of attribute type +

+ + +
+
+
+ +
+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/deltacloud/validation.rb', line 16
+
+def type
+  @type
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Boolean) optional? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/deltacloud/validation.rb', line 30
+
+def optional?
+  type.eql?(:optional)
+end
+
+
+
+ +
+

+ + - (Boolean) required? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/deltacloud/validation.rb', line 26
+
+def required?
+  type.eql?(:required)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/GoGridClient.html b/site/api-docs/GoGridClient.html new file mode 100644 index 00000000..cdfd094c --- /dev/null +++ b/site/api-docs/GoGridClient.html @@ -0,0 +1,469 @@ + + + + +Class: GoGridClient + + + + + + + + + + + + + + + +

Class: GoGridClient + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/gogrid/gogrid_client.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (GoGridClient) initialize(server = 'https://api.gogrid.com/api', apikey = 'YOUR API KEY', secret = 'YOUR SHARED SECRET', format = 'json', version = '1.5') + + + +

+
+

+A new instance of GoGridClient +

+ + +
+
+
+ +
+ + + + +
+
+
+
+8
+9
+10
+11
+12
+13
+14
+15
+16
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_client.rb', line 8
+
+def initialize(server='https://api.gogrid.com/api',
+               apikey='YOUR API KEY',
+               secret='YOUR SHARED SECRET', 
+               format='json',
+               version='1.5')
+  @server = server
+  @secret = secret
+  @default_params = {'format'=>format, 'v'=>version,'api_key' => apikey}
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) encode_params(params) + + + +

+ + + + +
+
+
+
+46
+47
+48
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_client.rb', line 46
+
+def encode_params(params)
+  params.map {|k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&")
+end
+
+
+
+ +
+

+ + - (Object) getRequestURL(method, params) + + + +

+ + + + +
+
+
+
+18
+19
+20
+21
+22
+23
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_client.rb', line 18
+
+def getRequestURL(method,params)
+  requestURL = @server+'/'+method+'?'
+  call_params = @default_params.merge(params)
+  call_params['sig']=getSignature(@default_params['api_key'],@secret)
+  requestURL = requestURL+encode_params(call_params)
+end
+
+
+
+ +
+

+ + - (Object) getSignature(key, secret) + + + +

+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_client.rb', line 25
+
+def getSignature(key,secret)
+  Digest::MD5.hexdigest(key+secret+"%.0f"%Time.new.to_f)
+end
+
+
+
+ +
+

+ + - (Object) request(method, params = {}, version = nil) + + + +

+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_client.rb', line 33
+
+def request(method, params={}, version=nil)
+  if version
+    @default_params['v'] = version
+  else
+    @default_params['v'] = '1.5'
+  end
+  begin
+    JSON::parse(sendAPIRequest(method, params))
+  rescue Exception => e
+    STDERR.puts("ERROR: #{e.message}")
+  end
+end
+
+
+
+ +
+

+ + - (Object) sendAPIRequest(method, params = {}) + + + +

+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_client.rb', line 29
+
+def sendAPIRequest(method,params={})
+  open(getRequestURL(method,params)).read
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/HardwareProfilesHelper.html b/site/api-docs/HardwareProfilesHelper.html new file mode 100644 index 00000000..9493b1ef --- /dev/null +++ b/site/api-docs/HardwareProfilesHelper.html @@ -0,0 +1,232 @@ + + + + +Module: HardwareProfilesHelper + + + + + + + + + + + + + + + +

Module: HardwareProfilesHelper + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/helpers/hardware_profiles_helper.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) format_hardware_property(prop) + + + +

+ + + + +
+
+
+
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+
+
# File 'lib/deltacloud/helpers/hardware_profiles_helper.rb', line 3
+
+def format_hardware_property(prop)
+  return "&empty;" unless prop
+  u = hardware_property_unit(prop)
+  case prop.kind
+    when :range
+    "#{prop.first} #{u} - #{prop.last} #{u} (default: #{prop.default} #{u})"
+    when :enum
+    prop.values.collect{ |v| "#{v} #{u}"}.join(', ') + " (default: #{prop.default} #{u})"
+    else
+    "#{prop.value} #{u}"
+  end
+end
+
+
+
+ +
+

+ + - (Object) format_instance_profile(ip) + + + +

+ + + + +
+
+
+
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+
+
# File 'lib/deltacloud/helpers/hardware_profiles_helper.rb', line 16
+
+def format_instance_profile(ip)
+  o = ip.overrides.collect do |p, v|
+    u = hardware_property_unit(p)
+    "#{p} = #{v} #{u}"
+  end
+  if o.empty?
+    ""
+  else
+    "with #{o.join(", ")}"
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Image.html b/site/api-docs/Image.html new file mode 100644 index 00000000..b1378501 --- /dev/null +++ b/site/api-docs/Image.html @@ -0,0 +1,408 @@ + + + + +Class: Image + + + + + + + + + + + + + + + +

Class: Image + + + +

+ +
+ +
Inherits:
+
+ BaseModel + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/image.rb
+ +
+
+ + + + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) architecture + + + + + + + + + + + + + + + +

    +Returns the value of attribute architecture. +

    +
    + +
  • + + +
  • + + + - (Object) description + + + + + + + + + + + + + + + +

    +Returns the value of attribute description. +

    +
    + +
  • + + +
  • + + + - (Object) name + + + + + + + + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) owner_id + + + + + + + + + + + + + + + +

    +Returns the value of attribute owner_id. +

    +
    + +
  • + + +
+ + + + + + + + +

Method Summary

+ +

Methods inherited from BaseModel

+

attr_accessor, #attributes, attributes, #id, #initialize, #to_hash, #to_json

+
+

Constructor Details

+ +

This class inherits a constructor from BaseModel

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) architecture + + + +

+
+

+Returns the value of attribute architecture +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/models/image.rb', line 25
+
+def architecture
+  @architecture
+end
+
+
+
+ + + + +
+

+ + - (Object) description + + + +

+
+

+Returns the value of attribute description +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/models/image.rb', line 24
+
+def description
+  @description
+end
+
+
+
+ + + + +
+

+ + - (Object) name + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/deltacloud/models/image.rb', line 22
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) owner_id + + + +

+
+

+Returns the value of attribute owner_id +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/image.rb', line 23
+
+def owner_id
+  @owner_id
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Instance.html b/site/api-docs/Instance.html new file mode 100644 index 00000000..42fc231a --- /dev/null +++ b/site/api-docs/Instance.html @@ -0,0 +1,1268 @@ + + + + +Class: Instance + + + + + + + + + + + + + + + +

Class: Instance + + + +

+ +
+ +
Inherits:
+
+ BaseModel + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/instance.rb,
+ lib/deltacloud/drivers/ec2/ec2_driver.rb,
lib/deltacloud/drivers/gogrid/gogrid_driver.rb
+
+ +
+
+ + + + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) actions + + + + + + + + + + + + + + + +

    +Returns the value of attribute actions. +

    +
    + +
  • + + +
  • + + + - (Object) authn_error + + + + + + + + + + + + + + + +

    +Returns the value of attribute authn_error. +

    +
    + +
  • + + +
  • + + + - (Object) image_id + + + + + + + + + + + + + + + +

    +Returns the value of attribute image_id. +

    +
    + +
  • + + +
  • + + + - (Object) instance_profile + + + + + + + + + + + + + + + +

    +Returns the value of attribute instance_profile. +

    +
    + +
  • + + +
  • + + + - (Object) keyname + + + + + + + + + + + + + + + +

    +Returns the value of attribute keyname. +

    +
    + +
  • + + +
  • + + + - (Object) launch_time + + + + + + + + + + + + + + + +

    +Returns the value of attribute launch_time. +

    +
    + +
  • + + +
  • + + + - (Object) name + + + + + + + + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) owner_id + + + + + + + + + + + + + + + +

    +Returns the value of attribute owner_id. +

    +
    + +
  • + + +
  • + + + - (Object) password + + + + + + + + + + + + + + + +

    +Returns the value of attribute password. +

    +
    + +
  • + + +
  • + + + - (Object) private_addresses + + + + + + + + + + + + + + + +

    +Returns the value of attribute private_addresses. +

    +
    + +
  • + + +
  • + + + - (Object) public_addresses + + + + + + + + + + + + + + + +

    +Returns the value of attribute public_addresses. +

    +
    + +
  • + + +
  • + + + - (Object) realm_id + + + + + + + + + + + + + + + +

    +Returns the value of attribute realm_id. +

    +
    + +
  • + + +
  • + + + - (Object) state + + + + + + + + + + + + + + + +

    +Returns the value of attribute state. +

    +
    + +
  • + + +
  • + + + - (Object) username + + + + + + + + + + + + + + + +

    +Returns the value of attribute username. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseModel

+

attr_accessor, attributes, #attributes, #id, #to_hash, #to_json

+
+

Constructor Details

+ +
+

+ + - (Instance) initialize(init = nil) + + + +

+
+

+A new instance of Instance +

+ + +
+
+
+ +
+ + + + +
+
+
+
+32
+33
+34
+35
+36
+37
+
+
# File 'lib/deltacloud/models/instance.rb', line 32
+
+def initialize(init=nil)
+ super(init)
+ self.actions = [] if self.actions.nil?
+ self.public_addresses = [] if self.public_addresses.nil?
+ self.private_addresses = [] if self.private_addresses.nil?
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) actions + + + +

+
+

+Returns the value of attribute actions +

+ + +
+
+
+ +
+ + + + +
+
+
+
+27
+28
+29
+
+
# File 'lib/deltacloud/models/instance.rb', line 27
+
+def actions
+  @actions
+end
+
+
+
+ + + + +
+

+ + - (Object) authn_error + + + +

+
+

+Returns the value of attribute authn_error +

+ + +
+
+
+ +
+ + + + +
+
+
+
+27
+28
+29
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 27
+
+def authn_error
+  @authn_error
+end
+
+
+
+ + + + +
+

+ + - (Object) image_id + + + +

+
+

+Returns the value of attribute image_id +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/instance.rb', line 23
+
+def image_id
+  @image_id
+end
+
+
+
+ + + + +
+

+ + - (Object) instance_profile + + + +

+
+

+Returns the value of attribute instance_profile +

+ + +
+
+
+ +
+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/deltacloud/models/instance.rb', line 30
+
+def instance_profile
+  @instance_profile
+end
+
+
+
+ + + + +
+

+ + - (Object) keyname + + + +

+
+

+Returns the value of attribute keyname +

+ + +
+
+
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 26
+
+def keyname
+  @keyname
+end
+
+
+
+ + + + +
+

+ + - (Object) launch_time + + + +

+
+

+Returns the value of attribute launch_time +

+ + +
+
+
+ +
+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/deltacloud/models/instance.rb', line 31
+
+def launch_time
+  @launch_time
+end
+
+
+
+ + + + +
+

+ + - (Object) name + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/models/instance.rb', line 24
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) owner_id + + + +

+
+

+Returns the value of attribute owner_id +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/deltacloud/models/instance.rb', line 22
+
+def owner_id
+  @owner_id
+end
+
+
+
+ + + + +
+

+ + - (Object) password + + + +

+
+

+Returns the value of attribute password +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 24
+
+def password
+  @password
+end
+
+
+
+ + + + +
+

+ + - (Object) private_addresses + + + +

+
+

+Returns the value of attribute private_addresses +

+ + +
+
+
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/deltacloud/models/instance.rb', line 29
+
+def private_addresses
+  @private_addresses
+end
+
+
+
+ + + + +
+

+ + - (Object) public_addresses + + + +

+
+

+Returns the value of attribute public_addresses +

+ + +
+
+
+ +
+ + + + +
+
+
+
+28
+29
+30
+
+
# File 'lib/deltacloud/models/instance.rb', line 28
+
+def public_addresses
+  @public_addresses
+end
+
+
+
+ + + + +
+

+ + - (Object) realm_id + + + +

+
+

+Returns the value of attribute realm_id +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/models/instance.rb', line 25
+
+def realm_id
+  @realm_id
+end
+
+
+
+ + + + +
+

+ + - (Object) state + + + +

+
+

+Returns the value of attribute state +

+ + +
+
+
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/deltacloud/models/instance.rb', line 26
+
+def state
+  @state
+end
+
+
+
+ + + + +
+

+ + - (Object) username + + + +

+
+

+Returns the value of attribute username +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 23
+
+def username
+  @username
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Boolean) authn_feature_failed? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_driver.rb', line 29
+
+def authn_feature_failed?
+  return true unless authn_error.nil?
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/InstanceProfile.html b/site/api-docs/InstanceProfile.html new file mode 100644 index 00000000..a99ed1d6 --- /dev/null +++ b/site/api-docs/InstanceProfile.html @@ -0,0 +1,621 @@ + + + + +Class: InstanceProfile + + + + + + + + + + + + + + + +

Class: InstanceProfile + + + +

+ +
+ +
Inherits:
+
+ BaseModel + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/instance_profile.rb
+ +
+
+ +

Overview

+
+

+Model to store the hardware profile applied to an instance together with +any instance-specific overrides +

+ + +
+
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) architecture + + + + + + + + + + + + + + + +

    +Returns the value of attribute architecture. +

    +
    + +
  • + + +
  • + + + - (Object) cpu + + + + + + + + + + + + + + + +

    +Returns the value of attribute cpu. +

    +
    + +
  • + + +
  • + + + - (Object) memory + + + + + + + + + + + + + + + +

    +Returns the value of attribute memory. +

    +
    + +
  • + + +
  • + + + - (Object) storage + + + + + + + + + + + + + + + +

    +Returns the value of attribute storage. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseModel

+

attr_accessor, attributes, #attributes, #id, #to_hash, #to_json

+
+

Constructor Details

+ +
+

+ + - (InstanceProfile) initialize(hwp_name, args = {}) + + + +

+
+

+A new instance of InstanceProfile +

+ + +
+
+
+ +
+ + + + +
+
+
+
+27
+28
+29
+30
+31
+32
+33
+34
+
+
# File 'lib/deltacloud/models/instance_profile.rb', line 27
+
+def initialize(hwp_name, args = {})
+  opts = args.inject({ :id => hwp_name.to_s }) do |m, e|
+    k, v = e
+    m[$1] = v if k.to_s =~ /^hwp_(.*)$/
+    m
+  end
+  super(opts)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) architecture + + + +

+
+

+Returns the value of attribute architecture +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/models/instance_profile.rb', line 24
+
+def architecture
+  @architecture
+end
+
+
+
+ + + + +
+

+ + - (Object) cpu + + + +

+
+

+Returns the value of attribute cpu +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/models/instance_profile.rb', line 25
+
+def cpu
+  @cpu
+end
+
+
+
+ + + + +
+

+ + - (Object) memory + + + +

+
+

+Returns the value of attribute memory +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/deltacloud/models/instance_profile.rb', line 22
+
+def memory
+  @memory
+end
+
+
+
+ + + + +
+

+ + - (Object) storage + + + +

+
+

+Returns the value of attribute storage +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/instance_profile.rb', line 23
+
+def storage
+  @storage
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) name + + + +

+ + + + +
+
+
+
+36
+37
+38
+
+
# File 'lib/deltacloud/models/instance_profile.rb', line 36
+
+def name
+  id
+end
+
+
+
+ +
+

+ + - (Object) overrides + + + +

+ + + + +
+
+
+
+40
+41
+42
+43
+44
+45
+46
+47
+
+
# File 'lib/deltacloud/models/instance_profile.rb', line 40
+
+def overrides
+  [:memory, :storage, :architecture, :cpu].inject({}) do |h, p|
+    if v = instance_variable_get("@#{p}")
+      h[p] = v
+    end
+    h
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Key.html b/site/api-docs/Key.html new file mode 100644 index 00000000..44e5863f --- /dev/null +++ b/site/api-docs/Key.html @@ -0,0 +1,666 @@ + + + + +Class: Key + + + + + + + + + + + + + + + +

Class: Key + + + +

+ +
+ +
Inherits:
+
+ BaseModel + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/key.rb
+ +
+
+ +

Overview

+
+

+Copyright (C) 2009 Red Hat, Inc. +

+

+Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with this +work for additional information regarding copyright ownership. The ASF +licenses this file to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at +

+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+

+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +

+ + +
+
+
+ +
+ + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) credential_type + + + + + + + + + + + + + + + +

    +Returns the value of attribute credential_type. +

    +
    + +
  • + + +
  • + + + - (Object) fingerprint + + + + + + + + + + + + + + + +

    +Returns the value of attribute fingerprint. +

    +
    + +
  • + + +
  • + + + - (Object) password + + + + + + + + + + + + + + + +

    +Returns the value of attribute password. +

    +
    + +
  • + + +
  • + + + - (Object) pem_rsa_key + + + + + + + + + + + + + + + +

    +Returns the value of attribute pem_rsa_key. +

    +
    + +
  • + + +
  • + + + - (Object) username + + + + + + + + + + + + + + + +

    +Returns the value of attribute username. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods inherited from BaseModel

+

attr_accessor, #attributes, attributes, #id, #initialize, #to_hash, #to_json

+
+

Constructor Details

+ +

This class inherits a constructor from BaseModel

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) credential_type + + + +

+
+

+Returns the value of attribute credential_type +

+ + +
+
+
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/deltacloud/models/key.rb', line 21
+
+def credential_type
+  @credential_type
+end
+
+
+
+ + + + +
+

+ + - (Object) fingerprint + + + +

+
+

+Returns the value of attribute fingerprint +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/deltacloud/models/key.rb', line 22
+
+def fingerprint
+  @fingerprint
+end
+
+
+
+ + + + +
+

+ + - (Object) password + + + +

+
+

+Returns the value of attribute password +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/models/key.rb', line 24
+
+def password
+  @password
+end
+
+
+
+ + + + +
+

+ + - (Object) pem_rsa_key + + + +

+
+

+Returns the value of attribute pem_rsa_key +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/models/key.rb', line 25
+
+def pem_rsa_key
+  @pem_rsa_key
+end
+
+
+
+ + + + +
+

+ + - (Object) username + + + +

+
+

+Returns the value of attribute username +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/key.rb', line 23
+
+def username
+  @username
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Boolean) is_key? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+31
+32
+33
+
+
# File 'lib/deltacloud/models/key.rb', line 31
+
+def is_key?
+  true if @credential_type.eql?(:key)
+end
+
+
+
+ +
+

+ + - (Boolean) is_password? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+27
+28
+29
+
+
# File 'lib/deltacloud/models/key.rb', line 27
+
+def is_password?
+  true if @credential_type.eql?(:password)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/MethodSerializer.html b/site/api-docs/MethodSerializer.html new file mode 100644 index 00000000..fa552d85 --- /dev/null +++ b/site/api-docs/MethodSerializer.html @@ -0,0 +1,91 @@ + + + + +Module: MethodSerializer + + + + + + + + + + + + + + + +

Module: MethodSerializer + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/method_serializer.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + Modules: Cache + + + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/MethodSerializer/Cache.html b/site/api-docs/MethodSerializer/Cache.html new file mode 100644 index 00000000..2084ab78 --- /dev/null +++ b/site/api-docs/MethodSerializer/Cache.html @@ -0,0 +1,483 @@ + + + + +Module: MethodSerializer::Cache + + + + + + + + + + + + + + + +

Module: MethodSerializer::Cache + + + +

+ +
+ + + + + + + +
Included in:
+
Mock::EC2, Mock::S3
+ + + +
Defined in:
+
lib/deltacloud/method_serializer.rb
+ +
+
+ + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) wrap_methods(c, opts = {}) + + + +

+ + + + +
+
+
+
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+
+
# File 'lib/deltacloud/method_serializer.rb', line 62
+
+def self.wrap_methods(c, opts={})
+  $methods_cache_dir = opts[:cache_dir]
+  $scenario_prefix = nil
+  c.class_eval do
+    cached_methods.each do |m|
+      next if c.instance_methods(false).include?("original_#{m}")
+      alias_method "original_#{m}".to_sym, m.to_sym
+      define_method m.to_sym do |*args|
+        args = args.first if args.size.eql?(1) and not args.first.class.eql?(Array)
+        output = deserialize_data(m, args)
+        unless output
+          output = method("original_#{m}".to_sym).to_proc[args]
+          return serialize_data(m, args, output)
+        else
+          return output
+        end
+      end
+    end
+  end
+end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) args_hash(args) + + + +

+ + + + +
+
+
+
+49
+50
+51
+52
+53
+54
+
+
# File 'lib/deltacloud/method_serializer.rb', line 49
+
+def args_hash(args)
+  if args.class == Hash
+    args = args.to_a.collect {|i| [i[0].to_s, i[1]]}.sort
+  end
+  Digest::SHA1.hexdigest(args.to_s)
+end
+
+
+
+ +
+

+ + - (Object) cache_dir + + + +

+ + + + +
+
+
+
+26
+27
+28
+29
+30
+31
+
+
# File 'lib/deltacloud/method_serializer.rb', line 26
+
+def cache_dir
+  storage_dir = $methods_cache_dir || File.join(File.dirname(__FILE__), 'cache')
+  class_dir = self.class.name.split('::').last
+  class_dir ||= self.class.name
+  File.join(storage_dir, class_dir.downcase)
+end
+
+
+
+ +
+

+ + - (Object) cache_file_name(method_name, args) + + + +

+ + + + +
+
+
+
+56
+57
+58
+59
+60
+
+
# File 'lib/deltacloud/method_serializer.rb', line 56
+
+def cache_file_name(method_name, args)
+  FileUtils.mkdir_p(cache_dir) unless File.directory?(cache_dir)
+  method_name = $scenario_prefix ? "#{$scenario_prefix}_#{method_name}" : method_name
+  File.join(cache_dir, "#{method_name}.#{args_hash(args)}")
+end
+
+
+
+ +
+

+ + - (Object) deserialize_data(method_name, args) + + + +

+ + + + +
+
+
+
+40
+41
+42
+43
+44
+45
+46
+47
+
+
# File 'lib/deltacloud/method_serializer.rb', line 40
+
+def deserialize_data(method_name, args)
+  begin
+    data = File.readlines(cache_file_name(method_name, args)).join
+    Marshal.load(Base64.decode64(data))
+  rescue Errno::ENOENT
+    return false
+  end
+end
+
+
+
+ +
+

+ + - (Object) serialize_data(method_name, args, data) + + + +

+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+
+
# File 'lib/deltacloud/method_serializer.rb', line 33
+
+def serialize_data(method_name, args, data)
+  File.open(cache_file_name(method_name, args), 'w') do |f|
+    f.puts(Base64.encode64(Marshal.dump(data)))
+  end
+  return data
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Mock.html b/site/api-docs/Mock.html new file mode 100644 index 00000000..7230ff39 --- /dev/null +++ b/site/api-docs/Mock.html @@ -0,0 +1,102 @@ + + + + +Module: Mock + + + + + + + + + + + + + + + +

Module: Mock + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/base_driver/mock_driver.rb
+ +
+
+ +

Overview

+
+

+Create ‘mock’ version of original driver client/gem: +

+ + +
+
+
+ +

Defined Under Namespace

+

+ + + + + Classes: EC2, S3 + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Mock/EC2.html b/site/api-docs/Mock/EC2.html new file mode 100644 index 00000000..a8453943 --- /dev/null +++ b/site/api-docs/Mock/EC2.html @@ -0,0 +1,205 @@ + + + + +Class: Mock::EC2 + + + + + + + + + + + + + + + +

Class: Mock::EC2 + + + +

+ +
+ +
Inherits:
+
+ AWS::EC2::Base + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + +
Includes:
+
MethodSerializer::Cache
+ + + + + +
Defined in:
+
lib/deltacloud/base_driver/mock_driver.rb
+ +
+
+ + + + + + + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods included from MethodSerializer::Cache

+

#args_hash, #cache_dir, #cache_file_name, #deserialize_data, #serialize_data, wrap_methods

+ + + +
+

Class Method Details

+ + +
+

+ + + (Object) cached_methods + + + +

+ + + + +
+
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+
+
# File 'lib/deltacloud/base_driver/mock_driver.rb', line 23
+
+def self.cached_methods
+  [
+    :describe_images,
+    :describe_availability_zones,
+    :describe_keypairs,
+    :create_keypair,
+    :run_instances,
+    :describe_instances,
+    :reboot_instances,
+    :terminate_instances,
+    :delete_keypair
+  ]
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Mock/S3.html b/site/api-docs/Mock/S3.html new file mode 100644 index 00000000..187eb5d2 --- /dev/null +++ b/site/api-docs/Mock/S3.html @@ -0,0 +1,189 @@ + + + + +Class: Mock::S3 + + + + + + + + + + + + + + + +

Class: Mock::S3 + + + +

+ +
+ +
Inherits:
+
+ RightAws::S3 + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + +
Includes:
+
MethodSerializer::Cache
+ + + + + +
Defined in:
+
lib/deltacloud/base_driver/mock_driver.rb
+ +
+
+ + + + + + + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods included from MethodSerializer::Cache

+

#args_hash, #cache_dir, #cache_file_name, #deserialize_data, #serialize_data, wrap_methods

+ + + +
+

Class Method Details

+ + +
+

+ + + (Object) cached_methods + + + +

+ + + + +
+
+
+
+10
+11
+12
+13
+14
+
+
# File 'lib/deltacloud/base_driver/mock_driver.rb', line 10
+
+def self.cached_methods
+  [
+    :buckets
+  ]
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/OCCIClient.html b/site/api-docs/OCCIClient.html new file mode 100644 index 00000000..b157a826 --- /dev/null +++ b/site/api-docs/OCCIClient.html @@ -0,0 +1,91 @@ + + + + +Module: OCCIClient + + + + + + + + + + + + + + + +

Module: OCCIClient + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/opennebula/occi_client.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: Client + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/OCCIClient/Client.html b/site/api-docs/OCCIClient/Client.html new file mode 100644 index 00000000..76a5f9fa --- /dev/null +++ b/site/api-docs/OCCIClient/Client.html @@ -0,0 +1,798 @@ + + + + +Class: OCCIClient::Client + + + + + + + + + + + + + + + +

Class: OCCIClient::Client + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/opennebula/occi_client.rb
+ +
+
+ +

Overview

+
+

+Client Library to interface with the OpenNebula OCCI Service +

+ + +
+
+
+ +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Client) initialize(endpoint_str = nil, user = nil, pass = nil, debug_flag = true) + + + +

+
+

+Initialize client library +

+ + +
+
+
+ +
+ + + + +
+
+
+
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+
+
# File 'lib/deltacloud/drivers/opennebula/occi_client.rb', line 37
+
+def initialize(endpoint_str=nil, user=nil, pass=nil, debug_flag=true)
+    @debug = debug_flag
+
+    # Server location
+    if endpoint_str
+        @endpoint =  endpoint_str
+    elsif ENV["OCCI_URL"]
+        @endpoint = ENV["OCCI_URL"]
+    else
+        @endpoint = "http://localhost:4567"
+    end
+
+    # Autentication
+    if user && pass
+        @occiauth = [user, pass]
+    else
+        @occiauth = CloudClient::get_one_auth
+    end
+
+    if !@occiauth
+        raise "No authorization data present"
+    end
+
+    @occiauth[1] = Digest::SHA1.hexdigest(@occiauth[1])
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) get_image(image_uuid) + + + +

+
+

+Retieves an Image :image_uuid Image identifier +

+ + +
+
+
+ +
+ + + + +
+
+
+
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+
+
# File 'lib/deltacloud/drivers/opennebula/occi_client.rb', line 187
+
+def get_image(image_uuid)
+    url = URI.parse(@endpoint+"/storage/"+image_uuid)
+    req = Net::HTTP::Get.new(url.path)
+
+    req.basic_auth @occiauth[0], @occiauth[1]
+
+    res = CloudClient::http_start(url) {|http|
+        http.request(req)
+    }
+
+    if CloudClient::is_error?(res)
+        return res
+    else
+        return res.body
+    end
+end
+
+
+
+ +
+

+ + - (Object) get_images + + + +

+
+

+Retieves the pool of Images owned by the user +

+ + +
+
+
+ +
+ + + + +
+
+
+
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+
+
# File 'lib/deltacloud/drivers/opennebula/occi_client.rb', line 116
+
+def get_images
+    url = URI.parse(@endpoint+"/storage")
+    req = Net::HTTP::Get.new(url.path)
+
+    req.basic_auth @occiauth[0], @occiauth[1]
+
+    res = CloudClient::http_start(url) {|http|
+        http.request(req)
+    }
+
+    if CloudClient::is_error?(res)
+        return res
+    else
+        return res.body
+    end
+end
+
+
+
+ +
+

+ + - (Object) get_vm(id) + + + +

+
+

+:id VM identifier +

+ + +
+
+
+ +
+ + + + +
+
+
+
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+
+
# File 'lib/deltacloud/drivers/opennebula/occi_client.rb', line 140
+
+def get_vm(id)
+    url = URI.parse(@endpoint+"/compute/" + id.to_s)
+    req = Net::HTTP::Get.new(url.path)
+
+    req.basic_auth @occiauth[0], @occiauth[1]
+
+    res = CloudClient::http_start(url) {|http|
+        http.request(req)
+    }
+
+    if CloudClient::is_error?(res)
+        return res
+    else
+        return res.body
+    end
+end
+
+
+
+ +
+

+ + - (Object) get_vms + + + +

+
+

+Retieves the pool of Virtual Machines +

+ + +
+
+
+ +
+ + + + +
+
+
+
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+
+
# File 'lib/deltacloud/drivers/opennebula/occi_client.rb', line 96
+
+def get_vms
+    url = URI.parse(@endpoint+"/compute")
+    req = Net::HTTP::Get.new(url.path)
+
+    req.basic_auth @occiauth[0], @occiauth[1]
+
+    res = CloudClient::http_start(url) {|http|
+        http.request(req)
+    }
+
+    if CloudClient::is_error?(res)
+        return res
+    else
+        return res.body
+    end
+end
+
+
+
+ +
+

+ + - (Object) post_vms(xmlfile) + + + +

+
+

+Post a new VM to the VM Pool :instance_type :xmlfile +

+ + +
+
+
+ +
+ + + + +
+
+
+
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+
+
# File 'lib/deltacloud/drivers/opennebula/occi_client.rb', line 72
+
+def post_vms(xmlfile)
+    xml=File.read(xmlfile)
+
+    url = URI.parse(@endpoint+"/compute")
+
+    req = Net::HTTP::Post.new(url.path)
+    req.body=xml
+
+    req.basic_auth @occiauth[0], @occiauth[1]
+
+    res = CloudClient::http_start(url) do |http|
+        http.request(req)
+    end
+
+    if CloudClient::is_error?(res)
+        return res
+    else
+        return res.body
+    end
+end
+
+
+
+ +
+

+ + - (Object) put_vm(xmlfile) + + + +

+
+

+Puts a new Compute representation in order to change its state :xmlfile +Compute OCCI xml representation +

+ + +
+
+
+ +
+ + + + +
+
+
+
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+
+
# File 'lib/deltacloud/drivers/opennebula/occi_client.rb', line 161
+
+def put_vm(xmlfile)
+    xml=File.read(xmlfile)
+    vm_info=REXML::Document.new(xml).root.elements
+
+    url = URI.parse(@endpoint+'/compute/' + vm_info['ID'].text)
+
+    req = Net::HTTP::Put.new(url.path)
+    req.body = xml
+
+    req.basic_auth @occiauth[0], @occiauth[1]
+
+    res = CloudClient::http_start(url) do |http|
+        http.request(req)
+    end
+
+    if CloudClient::is_error?(res)
+        return res
+    else
+        return res.body
+    end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Rack.html b/site/api-docs/Rack.html new file mode 100644 index 00000000..d33ac0ea --- /dev/null +++ b/site/api-docs/Rack.html @@ -0,0 +1,91 @@ + + + + +Module: Rack + + + + + + + + + + + + + + + +

Module: Rack + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/accept_media_types.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: AcceptMediaTypes, Request + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Rack/AcceptMediaTypes.html b/site/api-docs/Rack/AcceptMediaTypes.html new file mode 100644 index 00000000..f730f0b1 --- /dev/null +++ b/site/api-docs/Rack/AcceptMediaTypes.html @@ -0,0 +1,318 @@ + + + + +Class: Rack::AcceptMediaTypes + + + + + + + + + + + + + + + +

Class: Rack::AcceptMediaTypes + + + +

+ +
+ +
Inherits:
+
+ Array + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/accept_media_types.rb
+ +
+
+ +

Overview

+
+

+AcceptMediaTypes is intended for wrapping env[‘HTTP_ACCEPT’]. +

+

+It allows ordering of its values (accepted media types) according to their +"quality" (preference level). +

+

+This wrapper is typically used to determine the request’s prefered +media type (see example below). +

+
Examples
+
+  env['HTTP_ACCEPT']  #=> 'application/xml;q=0.8,text/html,text/plain;q=0.9'
+
+  types = Rack::AcceptMediaTypes.new(env['HTTP_ACCEPT'])
+  types               #=> ['text/html', 'text/plain', 'application/xml']
+  types.prefered      #=>  'text/html'
+
+
Notes
+

+For simplicity, media type parameters are striped, as they are seldom used +in practice. Users who need them are excepted to parse the Accept header +manually. +

+
References
+

+HTTP 1.1 Specs: +

+
    +
  • http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 + +
  • +
  • http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.9 + +
  • +
+ + +
+
+
+ +

Defined Under Namespace

+

+ + + + + Classes: AcceptMediaType + + +

+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + +
+

Constructor Details

+ +
+

+ + - (AcceptMediaTypes) initialize(header) + + + +

+
+

+— NOTE Reason for special handling of nil accept header: +

+

+"If no Accept header field is present, then it is assumed that the +client accepts all media types." +

+ + +
+
+
+ +
+ + + + +
+
+
+
+63
+64
+65
+66
+67
+68
+69
+
+
# File 'lib/sinatra/accept_media_types.rb', line 63
+
+def initialize(header)
+  if header.nil?
+    replace(['*/*'])
+  else
+    replace(order(header.gsub(/ /, '').split(/,/)))
+  end
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) prefered + + + +

+
+

+The client’s prefered media type. +

+ + +
+
+
+ +
+ + + + +
+
+
+
+72
+73
+74
+
+
# File 'lib/sinatra/accept_media_types.rb', line 72
+
+def prefered
+  first
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Rack/AcceptMediaTypes/AcceptMediaType.html b/site/api-docs/Rack/AcceptMediaTypes/AcceptMediaType.html new file mode 100644 index 00000000..f4497a52 --- /dev/null +++ b/site/api-docs/Rack/AcceptMediaTypes/AcceptMediaType.html @@ -0,0 +1,496 @@ + + + + +Class: Rack::AcceptMediaTypes::AcceptMediaType + + + + + + + + + + + + + + + +

Class: Rack::AcceptMediaTypes::AcceptMediaType + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + +
Includes:
+
Comparable
+ + + + + +
Defined in:
+
lib/sinatra/accept_media_types.rb
+ +
+
+ +

Overview

+
+

+http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 +

+ + +
+
+
+ +
+ + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) quality + + + + + + + + + + + + + + + +

    +qvalue = ( "0" [ "." 0*3DIGIT ] ). +

    +
    + +
  • + + +
  • + + + - (Object) range + + + + + + + + + + + + + + + +

    +media-range = ( "*/*" +

    +
    +              | ( type "/" "*" )
    +              | ( type "/" subtype )
    +              ) *( ";" parameter ).
    +
    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ +
    + +
  • + + + - (Object) <=>(type) + + + + + + + + + + + + +
    + +
  • + + +
  • + + + - (AcceptMediaType) initialize(type) + + + + + + constructor + + + + + + + + +

    +A new instance of AcceptMediaType. +

    +
    + +
  • + + +
  • + + + - (Boolean) valid? + + + + + + + + + + + + +

    +"A weight is normalized to a real number in the range 0 through 1, +where 0 is the minimum and 1 the maximum value. +

    +
    + +
  • + + +
+ + + +
+

Constructor Details

+ +
+

+ + - (AcceptMediaType) initialize(type) + + + +

+
+

+A new instance of AcceptMediaType +

+ + +
+
+
+ +
+ + + + +
+
+
+
+99
+100
+101
+102
+
+
# File 'lib/sinatra/accept_media_types.rb', line 99
+
+def initialize(type)
+  self.range, *params = type.split(';')
+  self.quality = extract_quality(params)
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) quality + + + +

+
+

+qvalue = ( "0" [ "." 0*3DIGIT ] ) +

+
+       | ( "1" [ "." 0*3("0") ] )
+
+ + +
+
+
+ +
+ + + + +
+
+
+
+97
+98
+99
+
+
# File 'lib/sinatra/accept_media_types.rb', line 97
+
+def quality
+  @quality
+end
+
+
+
+ + + + +
+

+ + - (Object) range + + + +

+
+

+media-range = ( "*/*" +

+
+              | ( type "/" "*" )
+              | ( type "/" subtype )
+              ) *( ";" parameter )
+
+ + +
+
+
+ +
+ + + + +
+
+
+
+93
+94
+95
+
+
# File 'lib/sinatra/accept_media_types.rb', line 93
+
+def range
+  @range
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) <=>(type) + + + +

+ + + + +
+
+
+
+104
+105
+106
+
+
# File 'lib/sinatra/accept_media_types.rb', line 104
+
+def <=>(type)
+  self.quality <=> type.quality
+end
+
+
+
+ +
+

+ + - (Boolean) valid? + + + +

+
+

+"A weight is normalized to a real number in the range 0 through 1, +where 0 is the minimum and 1 the maximum value. If a parameter has a +quality value of 0, then content with this parameter is `not +acceptable’ for the client." +

+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+113
+114
+115
+
+
# File 'lib/sinatra/accept_media_types.rb', line 113
+
+def valid?
+  self.quality.between?(0.1, 1)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Rack/Request.html b/site/api-docs/Rack/Request.html new file mode 100644 index 00000000..64bb7938 --- /dev/null +++ b/site/api-docs/Rack/Request.html @@ -0,0 +1,206 @@ + + + + +Class: Rack::Request + + + + + + + + + + + + + + + +

Class: Rack::Request + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/accept_media_types.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ +
    + +
  • + + + - (Object) accept_media_types + + + + + + + + + + + + +

    +The media types of the HTTP_ACCEPT header ordered according to their +"quality" (preference level), without any media type parameters. +

    +
    + +
  • + + +
+ + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) accept_media_types + + + +

+
+

+The media types of the HTTP_ACCEPT header ordered according to their +"quality" (preference level), without any media type parameters. +

+
Examples
+
+  env['HTTP_ACCEPT']  #=> 'application/xml;q=0.8,text/html,text/plain;q=0.9'
+
+  req = Rack::Request.new(env)
+  req.accept_media_types          #=> ['text/html', 'text/plain', 'application/xml']
+  req.accept_media_types.prefered #=>  'text/html'
+
+

+For more information, see: +

+
    +
  • Acept header: +http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 + +
  • +
  • Quality values: +http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.9 + +
  • +
+
Returns
+ + +
AcceptMediaTypes:ordered list of accept header’s media types + +
+ + +
+
+
+ +
+ + + + +
+
+
+
+21
+22
+23
+
+
# File 'lib/sinatra/accept_media_types.rb', line 21
+
+def accept_media_types
+   @accept_media_types ||= Rack::AcceptMediaTypes.new(@env['HTTP_ACCEPT'])
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Realm.html b/site/api-docs/Realm.html new file mode 100644 index 00000000..90624d3d --- /dev/null +++ b/site/api-docs/Realm.html @@ -0,0 +1,338 @@ + + + + +Class: Realm + + + + + + + + + + + + + + + +

Class: Realm + + + +

+ +
+ +
Inherits:
+
+ BaseModel + + + show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/realm.rb
+ +
+
+ + + + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) limit + + + + + + + + + + + + + + + +

    +Returns the value of attribute limit. +

    +
    + +
  • + + +
  • + + + - (Object) name + + + + + + + + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) state + + + + + + + + + + + + + + + +

    +Returns the value of attribute state. +

    +
    + +
  • + + +
+ + + + + + + + +

Method Summary

+ +

Methods inherited from BaseModel

+

attr_accessor, #attributes, attributes, #id, #initialize, #to_hash, #to_json

+
+

Constructor Details

+ +

This class inherits a constructor from BaseModel

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) limit + + + +

+
+

+Returns the value of attribute limit +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/realm.rb', line 23
+
+def limit
+  @limit
+end
+
+
+
+ + + + +
+

+ + - (Object) name + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/deltacloud/models/realm.rb', line 22
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) state + + + +

+
+

+Returns the value of attribute state +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/models/realm.rb', line 24
+
+def state
+  @state
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/RightAws.html b/site/api-docs/RightAws.html new file mode 100644 index 00000000..3307cb34 --- /dev/null +++ b/site/api-docs/RightAws.html @@ -0,0 +1,91 @@ + + + + +Module: RightAws + + + + + + + + + + + + + + + +

Module: RightAws + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: MockEc2 + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/RightAws/MockEc2.html b/site/api-docs/RightAws/MockEc2.html new file mode 100644 index 00000000..30c38fea --- /dev/null +++ b/site/api-docs/RightAws/MockEc2.html @@ -0,0 +1,740 @@ + + + + +Class: RightAws::MockEc2 + + + + + + + + + + + + + + + +

Class: RightAws::MockEc2 + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (MockEc2) initialize(opts = {}) + + + +

+
+

+A new instance of MockEc2 +

+ + +
+
+
+ +
+ + + + +
+
+
+
+4
+5
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 4
+
+def initialize(opts={})
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) describe_availability_zones(opts = {}) + + + +

+ + + + +
+
+
+
+19
+20
+21
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 19
+
+def describe_availability_zones(opts={})
+  load_fixtures_for(:realms)
+end
+
+
+
+ +
+

+ + - (Object) describe_images(opts = {}) + + + +

+ + + + +
+
+
+
+7
+8
+9
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 7
+
+def describe_images(opts={})
+  load_fixtures_for(:images)
+end
+
+
+
+ +
+

+ + - (Object) describe_images_by_owner(id) + + + +

+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 11
+
+def describe_images_by_owner(id)
+  load_fixtures_for(:images).select { |i| i[:aws_owner].eql?(id) }
+end
+
+
+
+ +
+

+ + - (Object) describe_instances(opts = {}) + + + +

+ + + + +
+
+
+
+23
+24
+25
+26
+27
+28
+29
+30
+31
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 23
+
+def describe_instances(opts={})
+  instances = load_fixtures_for(:instances)
+  instances.each_with_index do |instance, i|
+    instances[i] = update_delayed_state(instance)
+    return [instance] if opts and opts[:id] and instance[:aws_instance_id].eql?(opts[:id])
+  end
+  update_fixtures_for(:instances, instances)
+  instances
+end
+
+
+
+ +
+

+ + - (Object) describe_snapshots(opts = {}) + + + +

+ + + + +
+
+
+
+83
+84
+85
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 83
+
+def describe_snapshots(opts={})
+  load_fixtures_for(:storage_snapshot)
+end
+
+
+
+ +
+

+ + - (Object) describe_volumes(opts = {}) + + + +

+ + + + +
+
+
+
+87
+88
+89
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 87
+
+def describe_volumes(opts={})
+  load_fixtures_for(:storage_volume)
+end
+
+
+
+ +
+

+ + - (Object) reboot_instances(id) + + + +

+ + + + +
+
+
+
+77
+78
+79
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 77
+
+def reboot_instances(id)
+  update_instance_state(id, 'pending', '0')
+end
+
+
+
+ +
+

+ + - (Object) run_instances(image_id, min_count, max_count, group_ids, key_name, user_data = '', addressing_type = nil, instance_type = nil, kernel_id = nil, ramdisk_id = nil, availability_zone = nil, block_device_mappings = nil) + + + +

+
+ + +
+
+
+

Raises:

+
    + +
  • + + (Exception) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 33
+
+def run_instances(image_id, min_count, max_count, group_ids, key_name, user_data='', addressing_type = nil, instance_type = nil, kernel_id = nil, ramdisk_id = nil, availability_zone = nil, block_device_mappings = nil)
+
+  instances = load_fixtures_for(:instances)
+  image = load_fixtures_for(:images).select { |img| img[:aws_id].eql?(image_id) }.first
+
+  if availability_zone
+    realm = load_fixtures_for(:realms).select { |realm| realm[:zone_name].eql?(availability_zone) }.first
+  else
+    realm = load_fixtures_for(:realms).first
+  end
+
+  raise Exception unless image
+  raise Exception unless realm
+
+  instance = { }
+  instance[:aws_image_id] = image[:aws_id]
+  instance[:aws_availability_zone] = realm[:zone_name]
+  instance[:aws_instance_type] = instance_type
+  instance[:aws_owner] = user_data
+  instance[:aws_state] = 'pending'
+  instance[:aws_reason] = ''
+  instance[:dns_name] = "#{random_dns}-01-C9.usma2.compute.amazonaws.com"
+  instance[:private_dns_name] = "#{random_dns}-02-P9.usma2.compute.amazonaws.com"
+  instance[:aws_state_code] = "0"
+  instance[:aws_key_name] = "staging"
+  instance[:aws_kernel_id] = "aki-be3adfd7"
+  instance[:aws_ramdisk_id] = "ari-ce34gad7"
+  instance[:aws_groups] = ["default"]
+  instance[:aws_instance_id] = random_instance_id
+  instance[:aws_reservation_id] = "r-aabbccdd"
+  instance[:aws_launch_time] = instance_time_format
+
+  instances << instance
+
+  update_fixtures_for(:instances, instances)
+
+  return [instance]
+end
+
+
+
+ +
+

+ + - (Object) terminate_instances(id) + + + + Also known as: + destroy_instance + + +

+ + + + +
+
+
+
+73
+74
+75
+
+
# File 'lib/deltacloud/drivers/ec2/ec2_mock_driver.rb', line 73
+
+def terminate_instances(id)
+  update_instance_state(id, 'stopping', '80')
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra.html b/site/api-docs/Sinatra.html new file mode 100644 index 00000000..f82c2d55 --- /dev/null +++ b/site/api-docs/Sinatra.html @@ -0,0 +1,110 @@ + + + + +Module: Sinatra + + + + + + + + + + + + + + + +

Module: Sinatra + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/lazy_auth.rb,
+ lib/sinatra/rabbit.rb,
lib/sinatra/url_for.rb,
lib/sinatra/respond_to.rb,
lib/sinatra/static_assets.rb,
lib/sinatra/respond_to_old.rb
+
+ +
+
+ +

Overview

+
+

+Accept header parsing was looked at but deemed too much of an irregularity +to deal with. Problems with the header differences from IE, Firefox, +Safari, and every other UA causes problems with the expected output. The +general expected behavior would be serve html when no extension provided, +but most UAs say they will accept application/xml with out a quality +indicator, meaning you’d get the xml block served insead. Just plain +retarded, use the extension and you’ll never be suprised. +

+ + +
+
+
+ +

Defined Under Namespace

+

+ + + Modules: LazyAuth, Rabbit, RabbitHelper, RespondTo, StaticAssets, UrlForHelper + + + + +

+ + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/LazyAuth.html b/site/api-docs/Sinatra/LazyAuth.html new file mode 100644 index 00000000..76398c44 --- /dev/null +++ b/site/api-docs/Sinatra/LazyAuth.html @@ -0,0 +1,227 @@ + + + + +Module: Sinatra::LazyAuth + + + + + + + + + + + + + + + +

Module: Sinatra::LazyAuth + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/lazy_auth.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: LazyCredentials + + +

+ + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) authorize! + + + +

+ + + + +
+
+
+
+42
+43
+44
+45
+46
+
+
# File 'lib/sinatra/lazy_auth.rb', line 42
+
+def authorize!
+  r = "#{DRIVER}-deltacloud@#{HOSTNAME}"
+  response['WWW-Authenticate'] = %(Basic realm="#{r}")
+  throw(:halt, [401, "Not authorized\n"])
+end
+
+
+
+ +
+

+ + - (Object) credentials + + + +

+
+

+Request the current user’s credentials. Actual credentials are only +requested when an attempt is made to get the user name or password +

+ + +
+
+
+ +
+ + + + +
+
+
+
+50
+51
+52
+
+
# File 'lib/sinatra/lazy_auth.rb', line 50
+
+def credentials
+  LazyCredentials.new(self)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/LazyAuth/LazyCredentials.html b/site/api-docs/Sinatra/LazyAuth/LazyCredentials.html new file mode 100644 index 00000000..230d7c41 --- /dev/null +++ b/site/api-docs/Sinatra/LazyAuth/LazyCredentials.html @@ -0,0 +1,360 @@ + + + + +Class: Sinatra::LazyAuth::LazyCredentials + + + + + + + + + + + + + + + +

Class: Sinatra::LazyAuth::LazyCredentials + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/lazy_auth.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (LazyCredentials) initialize(app) + + + +

+
+

+A new instance of LazyCredentials +

+ + +
+
+
+ +
+ + + + +
+
+
+
+8
+9
+10
+11
+
+
# File 'lib/sinatra/lazy_auth.rb', line 8
+
+def initialize(app)
+  @app = app
+  @provided = false
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) password + + + +

+ + + + +
+
+
+
+18
+19
+20
+21
+
+
# File 'lib/sinatra/lazy_auth.rb', line 18
+
+def password
+  credentials!
+  @password
+end
+
+
+
+ +
+

+ + - (Boolean) provided? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/sinatra/lazy_auth.rb', line 23
+
+def provided?
+  @provided
+end
+
+
+
+ +
+

+ + - (Object) user + + + +

+ + + + +
+
+
+
+13
+14
+15
+16
+
+
# File 'lib/sinatra/lazy_auth.rb', line 13
+
+def user
+  credentials!
+  @user
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/Rabbit.html b/site/api-docs/Sinatra/Rabbit.html new file mode 100644 index 00000000..e2787688 --- /dev/null +++ b/site/api-docs/Sinatra/Rabbit.html @@ -0,0 +1,248 @@ + + + + +Module: Sinatra::Rabbit + + + + + + + + + + + + + + + +

Module: Sinatra::Rabbit + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/rabbit.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: Collection, DuplicateCollectionException, DuplicateOperationException, DuplicateParamException, Operation + + +

+ + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) collection(name, &block) + + + +

+
+

+Create a new collection. NAME should be the pluralized name of the +collection. +

+

+Adds a helper method #{name}_url which returns the URL to the :index +operation on this collection. +

+ + +
+
+
+

Raises:

+ + +
+ + + + +
+
+
+
+204
+205
+206
+207
+208
+209
+210
+
+
# File 'lib/sinatra/rabbit.rb', line 204
+
+def collection(name, &block)
+  raise DuplicateCollectionException if collections[name]
+  return unless driver.has_collection?(name.to_sym)
+  collections[name] = Collection.new(name, &block)
+  collections[name].add_feature_params(driver.features(name))
+  collections[name].generate
+end
+
+
+
+ +
+

+ + - (Object) collections + + + +

+ + + + +
+
+
+
+195
+196
+197
+
+
# File 'lib/sinatra/rabbit.rb', line 195
+
+def collections
+  @collections ||= {}
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/Rabbit/Collection.html b/site/api-docs/Sinatra/Rabbit/Collection.html new file mode 100644 index 00000000..d95b1aac --- /dev/null +++ b/site/api-docs/Sinatra/Rabbit/Collection.html @@ -0,0 +1,716 @@ + + + + +Class: Sinatra::Rabbit::Collection + + + + + + + + + + + + + + + +

Class: Sinatra::Rabbit::Collection + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/rabbit.rb
+ +
+
+ + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
  • + + + - (Object) operations + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute operations. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Collection) initialize(name, &block) + + + +

+
+

+A new instance of Collection +

+ + +
+
+
+ +
+ + + + +
+
+
+
+116
+117
+118
+119
+120
+121
+122
+
+
# File 'lib/sinatra/rabbit.rb', line 116
+
+def initialize(name, &block)
+  @name = name
+  @description = ""
+  @operations = {}
+  instance_eval(&block) if block_given?
+  generate_documentation
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+114
+115
+116
+
+
# File 'lib/sinatra/rabbit.rb', line 114
+
+def name
+  @name
+end
+
+
+
+ + + + +
+

+ + - (Object) operations (readonly) + + + +

+
+

+Returns the value of attribute operations +

+ + +
+
+
+ +
+ + + + +
+
+
+
+114
+115
+116
+
+
# File 'lib/sinatra/rabbit.rb', line 114
+
+def operations
+  @operations
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) add_feature_params(features) + + + +

+ + + + +
+
+
+
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+
+
# File 'lib/sinatra/rabbit.rb', line 178
+
+def add_feature_params(features)
+  features.each do |f|
+    f.operations.each do |fop|
+      if cop = operations[fop.name]
+        fop.params.each_key do |k|
+          if cop.params.has_key?(k)
+            raise DuplicateParamException, "Parameter '#{k}' for operation #{fop.name} defined by collection #{@name} and by feature #{f.name}"
+          else
+            cop.params[k] = fop.params[k]
+          end
+        end
+      end
+    end
+  end
+end
+
+
+
+ +
+

+ + - (Object) description(text = '') + + + +

+
+

+Set/Return description for collection If first parameter is not present, +full description will be returned. +

+ + +
+
+
+ +
+ + + + +
+
+
+
+127
+128
+129
+130
+
+
# File 'lib/sinatra/rabbit.rb', line 127
+
+def description(text='')
+  return @description if text.blank?
+  @description = text
+end
+
+
+
+ +
+

+ + - (Object) generate + + + +

+ + + + +
+
+
+
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+
+
# File 'lib/sinatra/rabbit.rb', line 163
+
+def generate
+  operations.values.each { |op| op.generate }
+  app = ::Sinatra::Application
+  collname = name # Work around Ruby's weird scoping/capture
+  app.send(:define_method, "#{name.to_s.singularize}_url") do |id|
+      url_for "/api/#{collname}/#{id}", :full
+  end
+
+  if index_op = operations[:index]
+    app.send(:define_method, "#{name}_url") do
+      url_for index_op.path.gsub(/\/\?$/,''), :full
+    end
+  end
+end
+
+
+
+ +
+

+ + - (Object) generate_documentation + + + +

+ + + + +
+
+
+
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+
+
# File 'lib/sinatra/rabbit.rb', line 132
+
+def generate_documentation
+  coll, oper, features = self, @operations, driver.features(name)
+  ::Sinatra::Application.get("/api/docs/#{@name}") do
+    @collection, @operations, @features = coll, oper, features
+    respond_to do |format|
+      format.html { haml :'docs/collection' }
+      format.xml { haml :'docs/collection' }
+    end
+  end
+end
+
+
+
+ +
+

+ + - (Object) operation(name, opts = {}, &block) + + + +

+
+

+Add a new operation for this collection. For the standard REST operations +:index, :show, :update, and :destroy, we already know what method to use +and whether this is an operation on the URL for individual elements or for +the whole collection. +

+

+For non-standard operations, options must be passed: +

+
+ :method : one of the HTTP methods
+ :member : whether this is an operation on the collection or an
+           individual element (FIXME: custom operations on the
+           collection will use a nonsensical URL) The URL for the
+           operation is the element URL with the name of the operation
+           appended
+
+

+This also defines a helper method like show_instance_url that returns the +URL to this operation (in request context) +

+ + +
+
+
+

Raises:

+ + +
+ + + + +
+
+
+
+158
+159
+160
+161
+
+
# File 'lib/sinatra/rabbit.rb', line 158
+
+def operation(name, opts = {}, &block)
+  raise DuplicateOperationException if @operations[name]
+  @operations[name] = Operation.new(self, name, opts, &block)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/Rabbit/DuplicateCollectionException.html b/site/api-docs/Sinatra/Rabbit/DuplicateCollectionException.html new file mode 100644 index 00000000..7217c80a --- /dev/null +++ b/site/api-docs/Sinatra/Rabbit/DuplicateCollectionException.html @@ -0,0 +1,100 @@ + + + + +Exception: Sinatra::Rabbit::DuplicateCollectionException + + + + + + + + + + + + + + + +

Exception: Sinatra::Rabbit::DuplicateCollectionException + + + +

+ +
+ +
Inherits:
+
+ Exception + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/rabbit.rb
+ +
+
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/Rabbit/DuplicateOperationException.html b/site/api-docs/Sinatra/Rabbit/DuplicateOperationException.html new file mode 100644 index 00000000..a57a25f4 --- /dev/null +++ b/site/api-docs/Sinatra/Rabbit/DuplicateOperationException.html @@ -0,0 +1,100 @@ + + + + +Exception: Sinatra::Rabbit::DuplicateOperationException + + + + + + + + + + + + + + + +

Exception: Sinatra::Rabbit::DuplicateOperationException + + + +

+ +
+ +
Inherits:
+
+ Exception + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/rabbit.rb
+ +
+
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/Rabbit/DuplicateParamException.html b/site/api-docs/Sinatra/Rabbit/DuplicateParamException.html new file mode 100644 index 00000000..dd02a19b --- /dev/null +++ b/site/api-docs/Sinatra/Rabbit/DuplicateParamException.html @@ -0,0 +1,100 @@ + + + + +Exception: Sinatra::Rabbit::DuplicateParamException + + + + + + + + + + + + + + + +

Exception: Sinatra::Rabbit::DuplicateParamException + + + +

+ +
+ +
Inherits:
+
+ Exception + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/rabbit.rb
+ +
+
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/Rabbit/Operation.html b/site/api-docs/Sinatra/Rabbit/Operation.html new file mode 100644 index 00000000..895b995a --- /dev/null +++ b/site/api-docs/Sinatra/Rabbit/Operation.html @@ -0,0 +1,817 @@ + + + + +Class: Sinatra::Rabbit::Operation + + + + + + + + + + + + + + + +

Class: Sinatra::Rabbit::Operation + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + +
Includes:
+
Deltacloud::Validation
+ + + + + +
Defined in:
+
lib/sinatra/rabbit.rb
+ +
+
+ + +

Constant Summary

+ +
+ +
STANDARD = + +
+
{
+  :index => { :method => :get, :member => false },
+  :show =>  { :method => :get, :member => true },
+  :create => { :method => :post, :member => false },
+  :update => { :method => :put, :member => true },
+  :destroy => { :method => :delete, :member => true }
+}
+
+ +
+ + + + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) method + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute method. +

    +
    + +
  • + + +
  • + + + - (Object) name + + + + + + + readonly + + + + + + + + +

    +Returns the value of attribute name. +

    +
    + +
  • + + +
+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + +

Methods included from Deltacloud::Validation

+

#add_params, #each_param, #param, #params, #validate

+
+

Constructor Details

+ +
+

+ + - (Operation) initialize(coll, name, opts, &block) + + + +

+
+

+A new instance of Operation +

+ + +
+
+
+ +
+ + + + +
+
+
+
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+
+
# File 'lib/sinatra/rabbit.rb', line 26
+
+def initialize(coll, name, opts, &block)
+  @name = name.to_sym
+  opts = STANDARD[@name].merge(opts) if standard?
+  @collection = coll
+  raise "No method for operation #{name}" unless opts[:method]
+  @method = opts[:method].to_sym
+  @member = opts[:member]
+  @description = ""
+  instance_eval(&block) if block_given?
+  generate_documentation
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) method (readonly) + + + +

+
+

+Returns the value of attribute method +

+ + +
+
+
+ +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/sinatra/rabbit.rb', line 14
+
+def method
+  @method
+end
+
+
+
+ + + + +
+

+ + - (Object) name (readonly) + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ +
+ + + + +
+
+
+
+14
+15
+16
+
+
# File 'lib/sinatra/rabbit.rb', line 14
+
+def name
+  @name
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) control(&block) + + + +

+ + + + +
+
+
+
+58
+59
+60
+61
+62
+63
+64
+
+
# File 'lib/sinatra/rabbit.rb', line 58
+
+def control(&block)
+  op = self
+  @control = Proc.new do
+    op.validate(params)
+    instance_eval(&block)
+  end
+end
+
+
+
+ +
+

+ + - (Object) description(text = "") + + + +

+ + + + +
+
+
+
+42
+43
+44
+45
+
+
# File 'lib/sinatra/rabbit.rb', line 42
+
+def description(text="")
+  return @description if text.blank?
+  @description = text
+end
+
+
+
+ +
+

+ + - (Object) generate + + + +

+ + + + +
+
+
+
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+
+
# File 'lib/sinatra/rabbit.rb', line 84
+
+def generate
+  ::Sinatra::Application.send(@method, path, {}, &@control)
+  # Set up some Rails-like URL helpers
+  if name == :index
+    gen_route "#{@collection.name}_url"
+  elsif name == :show
+    gen_route "#{@collection.name.to_s.singularize}_url"
+  else
+    gen_route "#{name}_#{@collection.name.to_s.singularize}_url"
+  end
+end
+
+
+
+ +
+

+ + - (Object) generate_documentation + + + +

+ + + + +
+
+
+
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+
+
# File 'lib/sinatra/rabbit.rb', line 47
+
+def generate_documentation
+  coll, oper = @collection, self
+  ::Sinatra::Application.get("/api/docs/#{@collection.name}/#{@name}") do
+    @collection, @operation = coll, oper
+    respond_to do |format|
+      format.html { haml :'docs/operation' }
+      format.xml { haml :'docs/operation' }
+    end
+  end
+end
+
+
+
+ +
+

+ + - (Object) path(args = {}) + + + +

+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+
+
# File 'lib/sinatra/rabbit.rb', line 71
+
+def path(args = {})
+  l_prefix = args[:prefix] ? args[:prefix] : prefix
+  if @member
+    if standard?
+      "#{l_prefix}/#{@collection.name}/:id"
+    else
+      "#{l_prefix}/#{@collection.name}/:id/#{name}"
+    end
+  else
+    "#{l_prefix}/#{@collection.name}"
+  end
+end
+
+
+
+ +
+

+ + - (Object) prefix + + + +

+ + + + +
+
+
+
+66
+67
+68
+69
+
+
# File 'lib/sinatra/rabbit.rb', line 66
+
+def prefix
+  # FIXME: Make the /api prefix configurable
+  "/api"
+end
+
+
+
+ +
+

+ + - (Boolean) standard? + + + +

+
+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/sinatra/rabbit.rb', line 38
+
+def standard?
+  STANDARD.keys.include?(name)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/RabbitHelper.html b/site/api-docs/Sinatra/RabbitHelper.html new file mode 100644 index 00000000..a8500dbb --- /dev/null +++ b/site/api-docs/Sinatra/RabbitHelper.html @@ -0,0 +1,206 @@ + + + + +Module: Sinatra::RabbitHelper + + + + + + + + + + + + + + + +

Module: Sinatra::RabbitHelper + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/rabbit.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) entry_points + + + +

+ + + + +
+
+
+
+228
+229
+230
+231
+232
+233
+
+
# File 'lib/sinatra/rabbit.rb', line 228
+
+def entry_points
+  collections.values.inject([]) do |m, coll|
+    url = url_for coll.operations[:index].path, :full
+    m << [ coll.name, url ]
+  end
+end
+
+
+
+ +
+

+ + - (Object) query_url(url, params) + + + +

+ + + + +
+
+
+
+223
+224
+225
+226
+
+
# File 'lib/sinatra/rabbit.rb', line 223
+
+def query_url(url, params)
+  return url if params.nil? || params.empty?
+  url + "?#{URI.escape(params.collect{|k,v| "#{k}=#{v}"}.join('&'))}"
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/RespondTo.html b/site/api-docs/Sinatra/RespondTo.html new file mode 100644 index 00000000..9d38324a --- /dev/null +++ b/site/api-docs/Sinatra/RespondTo.html @@ -0,0 +1,524 @@ + + + + +Module: Sinatra::RespondTo + + + + + + + + + + + + + + + +

Module: Sinatra::RespondTo + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/respond_to.rb,
+ lib/sinatra/respond_to_old.rb
+
+ +
+
+ +

Defined Under Namespace

+

+ + + Modules: Helpers + + + + Classes: MissingTemplate, UnhandledFormat + + +

+ +

Constant Summary

+ +
+ +
SUPPORTED_ACCEPT_HEADERS = +
+
+

+Define all MIME types you want to support here. This conversion table will +be used for auto-negotiation with browser in sinatra when no +‘format’ parameter is specified. +

+ + +
+
+
+ +
+
+
{
+  :xml => [
+    'text/xml',
+    'application/xml'
+  ],
+  :html => [
+    'text/html',
+    'application/xhtml+xml'
+  ],
+  :json => [
+    'application/json'
+  ]
+}
+
+ +
TEXT_MIME_TYPES = + +
+
[:txt, :html, :js, :json, :xml, :rss, :atom, :css, :asm, :c, :cc, :conf,
+:csv, :cxx, :diff, :dtd, :f, :f77, :f90, :for, :gemspec, :h, :hh, :htm,
+:log, :mathml, :mml, :p, :pas, :pl, :pm, :py, :rake, :rb, :rdf, :rtf, :ru,
+:s, :sgm, :sgml, :sh, :svg, :svgz, :text, :wsdl, :xhtml, :xsl, :xslt, :yaml,
+:yml, :ics, :png]
+
+ +
+ + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) registered(app) + + + +

+ + + + +
+
+
+
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+
+
# File 'lib/sinatra/respond_to.rb', line 59
+
+def self.registered(app)
+  app.helpers RespondTo::Helpers
+
+  app.set :default_charset, 'utf-8'
+  app.set :default_content, :html
+  app.set :assume_xhr_is_js, true
+
+#deltacloud: removed the code that tried to 'guess' content based on extension
+#as this broke blobstore api (stripping blob names). Use ?format if present, otherwise 
+#use http accept, otherwise set to default
+  app.before do
+    if (params[:format])
+      @mime_types = [Helpers::mime_type(params[:format])]
+      format params[:format]
+    elsif env['HTTP_ACCEPT'].nil? || env['HTTP_ACCEPT'].empty?
+      ext = options.default_content
+    end
+  end
+
+ app.configure :development do |dev|
+    dev.error UnhandledFormat do
+      content_type :html, :charset => 'utf-8'
+
+      ("<!DOCTYPE html>\n<html>\n<head>\n<style type=\"text/css\">\nbody { text-align:center;font-family:helvetica,arial;font-size:22px;\ncolor:#888;margin:20px}\n#c {margin:0 auto;width:500px;text-align:left}\n</style>\n</head>\n<body>\n<h2>Sinatra doesn't know this ditty.</h2>\n<img src='/__sinatra__/404.png'>\n<div id=\"c\">\nTry this:\n<pre>\#{request.request_method.downcase} '\#{request.path_info}' do\\n  respond_to do |wants|\\n    wants.\#{format} { \"Hello World\" }\\n  end\\nend</pre>\n</div>\n</body>\n</html>\n").gsub(/^ {10}/, '')
+    end
+
+    dev.error MissingTemplate do
+      content_type :html, :charset => 'utf-8'
+      response.status = request.env['sinatra.error'].code
+
+      engine = request.env['sinatra.error'].message.split('.').last
+      engine = 'haml' unless ['haml', 'builder', 'erb'].include? engine
+
+      path = File.basename(request.path_info)
+      path = "root" if path.nil? || path.empty?
+
+      format = engine == 'builder' ? 'xml' : 'html'
+
+      layout = case engine
+               when 'haml' then "!!!\n%html\n  %body= yield"
+               when 'erb' then "<html>\n  <body>\n    <%= yield %>\n  </body>\n</html>"
+               when 'builder' then ::Sinatra::VERSION =~ /^1.0/ ? "xml << yield" : "builder do |xml|\n  xml << yield\nend"
+               end
+
+      layout = "<small>app.#{format}.#{engine}</small>\n<pre>#{escape_html(layout)}</pre>"
+
+      ("<!DOCTYPE html>\n<html>\n<head>\n<style type=\"text/css\">\nbody { text-align:center;font-family:helvetica,arial;font-size:22px;\ncolor:#888;margin:20px}\n#c {margin:0 auto;width:500px;text-align:left;}\nsmall {float:right;clear:both;}\npre {clear:both;}\n</style>\n</head>\n<body>\n<h2>Sinatra can't find \#{request.env['sinatra.error'].message}</h2>\n<img src='/__sinatra__/500.png'>\n<div id=\"c\">\nTry this:<br />\n\#{layout}\n<small>\#{path}.\#{format}.\#{engine}</small>\n<pre>Hello World!</pre>\n<small>application.rb</small>\n<pre>\#{request.request_method.downcase} '\#{request.path_info}' do\\n  respond_to do |wants|\\n    wants.\#{engine == 'builder' ? 'xml' : 'html'} { \#{engine} :\#{path}\#{\",\\n\#{' '*32}layout => :app\" if layout} }\\n  end\\nend</pre>\n</div>\n</body>\n</html>\n").gsub(/^ {10}/, '')
+    end
+
+  end
+
+  app.class_eval do
+    private
+      def accept_list
+        @mime_types || Rack::AcceptMediaTypes.new(env['HTTP_ACCEPT'] || '')
+      end
+
+      # Changes in 1.0 Sinatra reuse render for layout so we store
+      # the original value to tell us if this is an automatic attempt
+      # to do a layout call.  If it is, it might fail with Errno::ENOENT
+      # and we want to pass that back to sinatra since it isn't a MissingTemplate
+      # error
+      def render_with_format(*args, &block)
+        assumed_layout = args[1] == :layout
+        args[1] = "#{args[1]}.#{format}".to_sym if args[1].is_a?(::Symbol)
+        render_without_format *args, &block
+      rescue Errno::ENOENT => e
+        raise MissingTemplate, "#{args[1]}.#{args[0]}" unless assumed_layout
+        raise e
+      end
+      alias_method :render_without_format, :render
+      alias_method :render, :render_with_format
+
+      if ::Sinatra::VERSION =~ /^0\.9/
+        def lookup_layout_with_format(*args)
+          args[1] = "#{args[1]}.#{format}".to_sym if args[1].is_a?(::Symbol)
+          lookup_layout_without_format *args
+        end
+        alias_method :lookup_layout_without_format, :lookup_layout
+        alias_method :lookup_layout, :lookup_layout_with_format
+      end
+  end
+end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) accept_to_array + + + +

+
+

+We need to pass array of available response types to best_media_type method +

+ + +
+
+
+ +
+ + + + +
+
+
+
+45
+46
+47
+48
+49
+
+
# File 'lib/sinatra/respond_to.rb', line 45
+
+def accept_to_array
+  SUPPORTED_ACCEPT_HEADERS.keys.collect do |key|
+    SUPPORTED_ACCEPT_HEADERS[key]
+  end.flatten
+end
+
+
+
+ +
+

+ + - (Object) lookup_format_from_mime(mime) + + + +

+
+

+Then, when we get best media type for response, we need to know which +format to choose +

+ + +
+
+
+ +
+ + + + +
+
+
+
+53
+54
+55
+56
+57
+
+
# File 'lib/sinatra/respond_to.rb', line 53
+
+def lookup_format_from_mime(mime)
+  SUPPORTED_ACCEPT_HEADERS.keys.each do |format|
+    return format if SUPPORTED_ACCEPT_HEADERS[format].include?(mime)
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/RespondTo/Helpers.html b/site/api-docs/Sinatra/RespondTo/Helpers.html new file mode 100644 index 00000000..22d7d0f7 --- /dev/null +++ b/site/api-docs/Sinatra/RespondTo/Helpers.html @@ -0,0 +1,737 @@ + + + + +Module: Sinatra::RespondTo::Helpers + + + + + + + + + + + + + + + +

Module: Sinatra::RespondTo::Helpers + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/respond_to.rb,
+ lib/sinatra/respond_to_old.rb
+
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: Format + + +

+ + + + +

+ Class Method Summary + (collapse) +

+ +
    + +
  • + + + + (Object) included(klass) + + + + + + + + + + + + +

    +Patch the content_type function to remember the set type This helps cut +down on time in the format helper so it doesn’t have to do a reverse +lookup on the header. +

    +
    + +
  • + + +
  • + + + + (Object) mime_type(sym) + + + + + + + + + + + + +
    + +
  • + + +
+ +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) included(klass) + + + +

+
+

+Patch the content_type function to remember the set type This helps cut +down on time in the format helper so it doesn’t have to do a reverse +lookup on the header +

+ + +
+
+
+ +
+ + + + +
+
+
+
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+
+
# File 'lib/sinatra/respond_to.rb', line 182
+
+def self.included(klass)
+  klass.class_eval do
+    def content_type_with_save(*args)
+      content_type_without_save *args
+      @_format = args.first.to_sym
+      response['Content-Type']
+    end
+    alias_method :content_type_without_save, :content_type
+    alias_method :content_type, :content_type_with_save
+  end if ::Sinatra::VERSION =~ /^1.0/
+end
+
+
+
+ +
+

+ + + (Object) mime_type(sym) + + + +

+ + + + +
+
+
+
+172
+173
+174
+
+
# File 'lib/sinatra/respond_to_old.rb', line 172
+
+def self.mime_type(sym)
+  ::Sinatra::Base.respond_to?(:mime_type) && ::Sinatra::Base.mime_type(sym) || ::Sinatra::Base.media_type(sym)
+end
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) charset(val = nil) + + + +

+ + + + +
+
+
+
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+
+
# File 'lib/sinatra/respond_to_old.rb', line 198
+
+def charset(val=nil)
+  fail "Content-Type must be set in order to specify a charset" if response['Content-Type'].nil?
+
+  if response['Content-Type'] =~ /charset=[^;]+/
+    response['Content-Type'].sub!(/charset=[^;]+/, (val == '' && '') || "charset=#{val}")
+  else
+    response['Content-Type'] += ";charset=#{val}"
+  end unless val.nil?
+
+  response['Content-Type'][/charset=([^;]+)/, 1]
+end
+
+
+
+ +
+

+ + - (Object) extension(val = nil) + + + +

+
+

+Extension holds trimmed extension. This is extra usefull when you want to +build original URI (with extension) You can simply call +"#requestrequest.env[&request.env[&#8216;REQUEST_URI&request.env[&#8216;REQUEST_URI&#8217;].#extension" +

+ + +
+
+
+ +
+ + + + +
+
+
+
+204
+205
+206
+207
+
+
# File 'lib/sinatra/respond_to.rb', line 204
+
+def extension(val=nil)
+  @_extension ||= val
+  @_extension
+end
+
+
+
+ +
+

+ + - (Object) format(val = nil) + + + +

+
+

+This helper will holds current format. Helper should be accesible from all +places in Sinatra +

+ + +
+
+
+ +
+ + + + +
+
+
+
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+
+
# File 'lib/sinatra/respond_to.rb', line 211
+
+def format(val=nil)
+  unless val.nil?
+    mime_type = ::Sinatra::RespondTo::Helpers.mime_type(val)
+    fail "Unknown media type #{val}\nTry registering the extension with a mime type" if mime_type.nil?
+
+    @_format = val.to_sym
+    response['Content-Type'].sub!(/^[^;]+/, mime_type)
+    charset options.default_charset if Sinatra::RespondTo::TEXT_MIME_TYPES.include?(format) and format!=:png
+  end
+
+  @_format
+end
+
+
+
+ +
+

+ + - (Object) match_accept_type(mime_types, format) + + + +

+ + + + +
+
+
+
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+
+
# File 'lib/sinatra/respond_to_old.rb', line 219
+
+def match_accept_type(mime_types, format)
+  selected = []
+
+  accepted_types = mime_types.map {|type| Regexp.escape(type).gsub(/\\\*/,'.*') }
+  # Fix for Chrome based browsers which returns XML when 'xhtml' is requested.
+  if env['HTTP_USER_AGENT'] =~ /Chrome/ and accepted_types.size>1
+    accepted_types[0], accepted_types[1] = accepted_types[1], accepted_types[0]
+    if accepted_types[0].eql?('application/xhtml\\+xml')
+      accepted_types[0] = 'text/html'
+    end
+  end
+  accepted_types.each do |at|
+    format.each do |fmt, ht, handler|
+      (selected = [fmt, ht, handler]) and break if ht.match(at)
+    end
+    break unless selected.empty?
+  end
+  selected
+end
+
+
+
+ +
+

+ + - (Object) respond_to {|wants| ... } + + + +

+
+ + +
+
+
+

Yields:

+
    + +
  • + + (wants) + + + + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+216
+217
+218
+219
+220
+221
+222
+223
+
+
# File 'lib/sinatra/respond_to.rb', line 216
+
+def respond_to(&block)
+  wants = Format.new
+  yield wants
+  fmt, type, handler = match_accept_type(accept_list, wants)
+  raise UnhandledFormat if fmt.nil?
+  format fmt
+  handler.nil? ? nil : handler.call
+end
+
+
+
+ +
+

+ + - (Boolean) static_file?(path) + + + +

+
+

+This is mostly just a helper so request.path_info isn’t changed when +serving files from the public directory +

+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+191
+192
+193
+194
+195
+196
+
+
# File 'lib/sinatra/respond_to_old.rb', line 191
+
+def static_file?(path)
+  public_dir = File.expand_path(options.public)
+  path = File.expand_path(File.join(public_dir, unescape(path)))
+
+  path[0, public_dir.length] == public_dir && File.file?(path)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/RespondTo/Helpers/Format.html b/site/api-docs/Sinatra/RespondTo/Helpers/Format.html new file mode 100644 index 00000000..09fe005b --- /dev/null +++ b/site/api-docs/Sinatra/RespondTo/Helpers/Format.html @@ -0,0 +1,189 @@ + + + + +Class: Sinatra::RespondTo::Helpers::Format + + + + + + + + + + + + + + + +

Class: Sinatra::RespondTo::Helpers::Format + + + +

+ +
+ +
Inherits:
+
+ Array + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/respond_to_old.rb
+ +
+
+ +

Overview

+
+

+NOTE Array instead of hash because order matters (wildcard type matches +first handler) +

+ + +
+
+
+ +
+ + + + +

+ Instance Method Summary + (collapse) +

+ + + + + +
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + - (Object) method_missing(format, *args, &handler) + + + +

+ + + + +
+
+
+
+242
+243
+244
+245
+246
+247
+248
+
+
# File 'lib/sinatra/respond_to_old.rb', line 242
+
+def method_missing(format, *args, &handler)
+  mt = Sinatra::RespondTo::Helpers.mime_type(format)
+  if mt.nil?
+    Sinatra::Base.send(:fail, "Unknown media type for respond_to: #{format}\nTry registering the extension with a mime type")
+  end
+  self << [format.to_s, mt, handler]
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/RespondTo/MissingTemplate.html b/site/api-docs/Sinatra/RespondTo/MissingTemplate.html new file mode 100644 index 00000000..b4c5a11f --- /dev/null +++ b/site/api-docs/Sinatra/RespondTo/MissingTemplate.html @@ -0,0 +1,165 @@ + + + + +Class: Sinatra::RespondTo::MissingTemplate + + + + + + + + + + + + + + + +

Class: Sinatra::RespondTo::MissingTemplate + + + +

+ +
+ +
Inherits:
+
+ NotFound + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/respond_to.rb,
+ lib/sinatra/respond_to_old.rb
+
+ +
+
+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) code + + + +

+ + + + +
+
+
+
+17
+
+
# File 'lib/sinatra/respond_to_old.rb', line 17
+
+def code; 500 end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/RespondTo/UnhandledFormat.html b/site/api-docs/Sinatra/RespondTo/UnhandledFormat.html new file mode 100644 index 00000000..2a71ce17 --- /dev/null +++ b/site/api-docs/Sinatra/RespondTo/UnhandledFormat.html @@ -0,0 +1,100 @@ + + + + +Class: Sinatra::RespondTo::UnhandledFormat + + + + + + + + + + + + + + + +

Class: Sinatra::RespondTo::UnhandledFormat + + + +

+ +
+ +
Inherits:
+
+ NotFound + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/respond_to_old.rb
+ +
+
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/StaticAssets.html b/site/api-docs/Sinatra/StaticAssets.html new file mode 100644 index 00000000..21513012 --- /dev/null +++ b/site/api-docs/Sinatra/StaticAssets.html @@ -0,0 +1,160 @@ + + + + +Module: Sinatra::StaticAssets + + + + + + + + + + + + + + + +

Module: Sinatra::StaticAssets + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/static_assets.rb
+ +
+
+ +

Defined Under Namespace

+

+ + + Modules: Helpers + + + + +

+ + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) registered(app) + + + +

+ + + + +
+
+
+
+76
+77
+78
+79
+
+
# File 'lib/sinatra/static_assets.rb', line 76
+
+def self.registered(app)
+  app.helpers StaticAssets::Helpers
+  app.disable :xhtml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/StaticAssets/Helpers.html b/site/api-docs/Sinatra/StaticAssets/Helpers.html new file mode 100644 index 00000000..224ea422 --- /dev/null +++ b/site/api-docs/Sinatra/StaticAssets/Helpers.html @@ -0,0 +1,332 @@ + + + + +Module: Sinatra::StaticAssets::Helpers + + + + + + + + + + + + + + + +

Module: Sinatra::StaticAssets::Helpers + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/static_assets.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) image_tag(source, options = {}) + + + +

+
+

+In HTML <link> and <img> tags have no end tag. In XHTML, on the +contrary, these tags must be properly closed. +

+

+We can choose the appropriate behaviour with closed option: +

+
+  image_tag "/images/foo.png", :alt => "Foo itself", :closed => true
+
+

+The default value of closed option is false. +

+ + +
+
+
+ +
+ + + + +
+
+
+
+16
+17
+18
+19
+
+
# File 'lib/sinatra/static_assets.rb', line 16
+
+def image_tag(source, options = {})
+  options[:src] = url_for(source)
+  tag("img", options)
+end
+
+
+
+ +
+

+ + - (Object) javascript_script_tag(*sources) + + + +

+ + + + +
+
+
+
+26
+27
+28
+29
+
+
# File 'lib/sinatra/static_assets.rb', line 26
+
+def javascript_script_tag(*sources)
+  list, options = extract_options(sources)
+  list.collect { |source| javascript_tag(source, options) }.join("\n")
+end
+
+
+
+ +
+ + + + + +
+
+
+
+31
+32
+33
+34
+35
+
+
# File 'lib/sinatra/static_assets.rb', line 31
+
+def link_to(desc, url, options = {})
+  tag("a", options.merge(:href => url_for(url))) do
+    desc
+  end
+end
+
+
+
+ +
+ + + + + +
+
+
+
+21
+22
+23
+24
+
+
# File 'lib/sinatra/static_assets.rb', line 21
+
+def stylesheet_link_tag(*sources)
+  list, options = extract_options(sources)
+  list.collect { |source| stylesheet_tag(source, options) }.join("\n")
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/Sinatra/UrlForHelper.html b/site/api-docs/Sinatra/UrlForHelper.html new file mode 100644 index 00000000..1979ddb5 --- /dev/null +++ b/site/api-docs/Sinatra/UrlForHelper.html @@ -0,0 +1,273 @@ + + + + +Module: Sinatra::UrlForHelper + + + + + + + + + + + + + + + +

Module: Sinatra::UrlForHelper + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/sinatra/url_for.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) root_url + + + +

+ + + + +
+
+
+
+45
+46
+47
+
+
# File 'lib/sinatra/url_for.rb', line 45
+
+def root_url
+  url_for '/'
+end
+
+
+
+ +
+

+ + - (Object) url_for(url_fragment, mode = :path_only) + + + +

+
+

+Construct a link to url_fragment, which should be given relative +to the base of this Sinatra app. The mode should be either +:path_only, which will generate an absolute path within the +current domain (the default), or :full, which will include the +site name and port number. (The latter is typically necessary for links in +RSS feeds.) Example usage: +

+
+  url_for "/"            # Returns "/myapp/"
+  url_for "/foo"         # Returns "/myapp/foo"
+  url_for "/foo", :full  # Returns "http://example.com/myapp/foo"
+
+

+— See README.rdoc for a list of some of the people who helped me +clean up earlier versions of this code. +

+ + +
+
+
+ +
+ + + + +
+
+
+
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+
+
# File 'lib/sinatra/url_for.rb', line 18
+
+def url_for url_fragment, mode=:path_only
+  case mode
+  when :path_only
+    base = request.script_name
+  when :full
+    scheme = request.scheme
+    if (scheme == 'http' && request.port == 80 ||
+        scheme == 'https' && request.port == 443)
+      port = ""
+    else
+      port = ":#{request.port}"
+    end
+    request_host = HOSTNAME ? HOSTNAME : request.host
+    base = "#{scheme}://#{request_host}#{port}#{request.script_name}"
+  else
+    raise TypeError, "Unknown url_for mode #{mode}"
+  end
+  url_escape = URI.escape(url_fragment)
+  # Don't add the base fragment if url_for gets called more than once
+  # per url or the url_fragment passed in is an absolute url
+  if url_escape.match(/^#{base}/) or url_escape.match(/^http/)
+    url_escape
+  else
+    "#{base}#{url_escape}"
+  end
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/StorageSnapshot.html b/site/api-docs/StorageSnapshot.html new file mode 100644 index 00000000..9261b54a --- /dev/null +++ b/site/api-docs/StorageSnapshot.html @@ -0,0 +1,338 @@ + + + + +Class: StorageSnapshot + + + + + + + + + + + + + + + +

Class: StorageSnapshot + + + +

+ +
+ +
Inherits:
+
+ BaseModel + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/storage_snapshot.rb
+ +
+
+ + + + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) created + + + + + + + + + + + + + + + +

    +Returns the value of attribute created. +

    +
    + +
  • + + +
  • + + + - (Object) state + + + + + + + + + + + + + + + +

    +Returns the value of attribute state. +

    +
    + +
  • + + +
  • + + + - (Object) storage_volume_id + + + + + + + + + + + + + + + +

    +Returns the value of attribute storage_volume_id. +

    +
    + +
  • + + +
+ + + + + + + + +

Method Summary

+ +

Methods inherited from BaseModel

+

attr_accessor, #attributes, attributes, #id, #initialize, #to_hash, #to_json

+
+

Constructor Details

+ +

This class inherits a constructor from BaseModel

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) created + + + +

+
+

+Returns the value of attribute created +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/models/storage_snapshot.rb', line 25
+
+def created
+  @created
+end
+
+
+
+ + + + +
+

+ + - (Object) state + + + +

+
+

+Returns the value of attribute state +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/storage_snapshot.rb', line 23
+
+def state
+  @state
+end
+
+
+
+ + + + +
+

+ + - (Object) storage_volume_id + + + +

+
+

+Returns the value of attribute storage_volume_id +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/models/storage_snapshot.rb', line 24
+
+def storage_volume_id
+  @storage_volume_id
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/StorageVolume.html b/site/api-docs/StorageVolume.html new file mode 100644 index 00000000..203ad635 --- /dev/null +++ b/site/api-docs/StorageVolume.html @@ -0,0 +1,478 @@ + + + + +Class: StorageVolume + + + + + + + + + + + + + + + +

Class: StorageVolume + + + +

+ +
+ +
Inherits:
+
+ BaseModel + +
    +
  • Object
  • + + + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/deltacloud/models/storage_volume.rb
+ +
+
+ + + + + + + +

Instance Attribute Summary (collapse)

+
    + +
  • + + + - (Object) capacity + + + + + + + + + + + + + + + +

    +Returns the value of attribute capacity. +

    +
    + +
  • + + +
  • + + + - (Object) created + + + + + + + + + + + + + + + +

    +Returns the value of attribute created. +

    +
    + +
  • + + +
  • + + + - (Object) device + + + + + + + + + + + + + + + +

    +Returns the value of attribute device. +

    +
    + +
  • + + +
  • + + + - (Object) instance_id + + + + + + + + + + + + + + + +

    +Returns the value of attribute instance_id. +

    +
    + +
  • + + +
  • + + + - (Object) state + + + + + + + + + + + + + + + +

    +Returns the value of attribute state. +

    +
    + +
  • + + +
+ + + + + + + + +

Method Summary

+ +

Methods inherited from BaseModel

+

attr_accessor, #attributes, attributes, #id, #initialize, #to_hash, #to_json

+
+

Constructor Details

+ +

This class inherits a constructor from BaseModel

+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (Object) capacity + + + +

+
+

+Returns the value of attribute capacity +

+ + +
+
+
+ +
+ + + + +
+
+
+
+24
+25
+26
+
+
# File 'lib/deltacloud/models/storage_volume.rb', line 24
+
+def capacity
+  @capacity
+end
+
+
+
+ + + + +
+

+ + - (Object) created + + + +

+
+

+Returns the value of attribute created +

+ + +
+
+
+ +
+ + + + +
+
+
+
+22
+23
+24
+
+
# File 'lib/deltacloud/models/storage_volume.rb', line 22
+
+def created
+  @created
+end
+
+
+
+ + + + +
+

+ + - (Object) device + + + +

+
+

+Returns the value of attribute device +

+ + +
+
+
+ +
+ + + + +
+
+
+
+26
+27
+28
+
+
# File 'lib/deltacloud/models/storage_volume.rb', line 26
+
+def device
+  @device
+end
+
+
+
+ + + + +
+

+ + - (Object) instance_id + + + +

+
+

+Returns the value of attribute instance_id +

+ + +
+
+
+ +
+ + + + +
+
+
+
+25
+26
+27
+
+
# File 'lib/deltacloud/models/storage_volume.rb', line 25
+
+def instance_id
+  @instance_id
+end
+
+
+
+ + + + +
+

+ + - (Object) state + + + +

+
+

+Returns the value of attribute state +

+ + +
+
+
+ +
+ + + + +
+
+
+
+23
+24
+25
+
+
# File 'lib/deltacloud/models/storage_volume.rb', line 23
+
+def state
+  @state
+end
+
+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/String.html b/site/api-docs/String.html new file mode 100644 index 00000000..3fa2000b --- /dev/null +++ b/site/api-docs/String.html @@ -0,0 +1,421 @@ + + + + +Class: String + + + + + + + + + + + + + + + +

Class: String + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/sinatra/rabbit.rb
+ +
+
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Boolean) blank? + + + +

+
+

+Rails defines this for a number of other classes, including Object see +activesupport/lib/active_support/core_ext/object/blank.rb +

+ + +
+
+
+

Returns:

+
    + +
  • + + (Boolean) + + + + +
  • + +
+ +
+ + + + +
+
+
+
+243
+244
+245
+
+
# File 'lib/sinatra/rabbit.rb', line 243
+
+def blank?
+    self !~ /\S/
+end
+
+
+
+ +
+

+ + - (Object) pluralize + + + +

+ + + + +
+
+
+
+258
+259
+260
+
+
# File 'lib/sinatra/rabbit.rb', line 258
+
+def pluralize
+  self + "s"
+end
+
+
+
+ +
+

+ + - (Object) singularize + + + +

+ + + + +
+
+
+
+262
+263
+264
+
+
# File 'lib/sinatra/rabbit.rb', line 262
+
+def singularize
+  self.gsub(/s$/, '')
+end
+
+
+
+ +
+

+ + - (Object) titlecase + + + +

+
+

+Title case. +

+
+  "this is a string".titlecase
+  => "This Is A String"
+
+

+CREDIT: Eliazar Parra Copied from facets +

+ + +
+
+
+ +
+ + + + +
+
+
+
+254
+255
+256
+
+
# File 'lib/sinatra/rabbit.rb', line 254
+
+def titlecase
+  gsub(/\b\w/){ $`[-1,1] == "'" ? $& : $&.upcase }
+end
+
+
+
+ +
+

+ + - (Object) underscore + + + +

+ + + + +
+
+
+
+266
+267
+268
+269
+270
+271
+272
+
+
# File 'lib/sinatra/rabbit.rb', line 266
+
+def underscore
+    gsub(/::/, '/').
+        gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
+        gsub(/([a-z\d])([A-Z])/,'\1_\2').
+        tr("-", "_").
+        downcase
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/site/api-docs/_index.html b/site/api-docs/_index.html new file mode 100644 index 00000000..2924723c --- /dev/null +++ b/site/api-docs/_index.html @@ -0,0 +1,826 @@ + + + + +Documentation by YARD 0.6.1 + + + + + + + + + + + + + + + +
+

Documentation by YARD 0.6.1

+

Alphabetic Index

+ + +

File Listing

+ + +
+ +

Namespace Listing A-Z

+ + + + + + + + + + +
+ + + + + + + + + + + + + + +
    +
  • E
  • +
      + +
    • + EC2 + + (Mock) + +
    • + +
    • + EC2 + + (Deltacloud::Drivers) + +
    • + +
    • + EC2Driver + + (Deltacloud::Drivers::EC2) + +
    • + +
    • + Error + + (CloudClient) + +
    • + +
    +
+ + +
    +
  • F
  • +
      + +
    • + Failure + + (Deltacloud::Validation) + +
    • + +
    • + Feature + + (Deltacloud::BaseDriver) + +
    • + +
    • + FeatureDecl + + (Deltacloud::BaseDriver) + +
    • + +
    • + FeatureError + + (Deltacloud) + +
    • + +
    • + Format + + (Sinatra::RespondTo::Helpers) + +
    • + +
    +
+ + + + + +
+ + + + + + + + +
    +
  • K
  • +
      + +
    • + Key + +
    • + +
    +
+ + + + + + + + + + + +
    +
  • P
  • +
      + +
    • + Param + + (Deltacloud::Validation) + +
    • + +
    • + Property + + (Deltacloud::HardwareProfile) + +
    • + +
    +
+ + + + + +
+ + + + + +
    +
  • T
  • + +
+ + + + + +
    +
  • V
  • + +
+ +
+
+ + + + + \ No newline at end of file diff --git a/site/api-docs/class_list.html b/site/api-docs/class_list.html new file mode 100644 index 00000000..7c907577 --- /dev/null +++ b/site/api-docs/class_list.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + +
+

Class List

+ + + + +
+ + + diff --git a/site/api-docs/css/common.css b/site/api-docs/css/common.css new file mode 100644 index 00000000..cf25c452 --- /dev/null +++ b/site/api-docs/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/site/api-docs/css/full_list.css b/site/api-docs/css/full_list.css new file mode 100644 index 00000000..f95e4e68 --- /dev/null +++ b/site/api-docs/css/full_list.css @@ -0,0 +1,53 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; } +#full_list ul { padding: 0; } +#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } +#noresults { padding: 7px 12px; } +#content.insearch #noresults { margin-left: 7px; } +ul.collapsed ul, ul.collapsed li { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } +li:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a:link, a:visited { text-decoration: none; color: #05a; } +li.clicked { background: #05a; color: #ccc; } +li.clicked a:link, li.clicked a:visited { color: #eee; } +li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; } +#nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; } +#nav a:link, #nav a:visited { color: #358; } +#nav a:hover { background: transparent; color: #5af; } + +.frames #content h1 { margin-top: 0; } +.frames li { white-space: nowrap; cursor: normal; } +.frames li small { display: block; font-size: 0.8em; } +.frames li small:before { content: ""; } +.frames li small:after { content: ""; } +.frames li small.search_info { display: none; } +.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +.frames #content.insearch #search { background-position: center right; } +.frames #search input { width: 110px; } +.frames #nav { display: block; } + +#full_list.insearch li { display: none; } +#full_list.insearch li.found { display: list-item; padding-left: 10px; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/site/api-docs/css/style.css b/site/api-docs/css/style.css new file mode 100644 index 00000000..c752b110 --- /dev/null +++ b/site/api-docs/css/style.css @@ -0,0 +1,307 @@ +body { + padding: 0 20px; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; +} +body.frames { padding: 0 5px; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; +} +h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; } +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.docstring .object_link { font-family: monospace; } + +.note { + color: #222; + -moz-border-radius: 3px; -webkit-border-radius: 3px; + background: #e3e4e3; border: 1px solid #d5d5d5; padding: 7px 10px; + display: block; +} +.note.todo { background: #ffffc5; border-color: #ececaa; } +.note.returns_void { background: #efefef; } +.note.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.private { background: #ffffc5; border-color: #ececaa; } +.note.title { text-transform: lowercase; padding: 1px 5px; margin-left: 5px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; } +h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; } +.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; } +.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.private { background: #d5d5d5; border-color: #c5c5c5; } + +h3.inherited { + font-style: italic; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-weight: normal; + padding: 0; + margin: 0; + margin-top: 12px; + margin-bottom: 3px; + font-size: 13px; +} +p.inherited { + padding: 0; + margin: 0; + margin-left: 25px; +} + +dl.box { + width: 520px; + font-size: 1em; +} +dl.box dt { + float: left; + display: block; + width: 100px; + margin: 0; + text-align: right; + font-weight: bold; + border: 1px solid #aaa; + border-width: 1px 0px 0px 1px; + padding: 6px 0; + padding-right: 10px; +} +dl.box dd { + float: left; + display: block; + width: 380px; + margin: 0; + padding: 6px 0; + padding-right: 20px; + border: 1px solid #aaa; + border-width: 1px 1px 0 0; +} +dl.box .last { + border-bottom: 1px solid #aaa; +} +dl.box .r1 { background: #eee; } + +ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; } +#files { padding-left: 15px; font-size: 1.1em; } + +#files { padding: 0; } +#files li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; } + +dl.constants { margin-left: 40px; } +dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; } +dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; } + +.summary_desc { margin-left: 32px; display: block; font-family: sans-serif; } +.summary_desc tt { font-size: 0.9em; } +dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; } +dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; } +dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; } +dl.constants .discussion *:first-child { margin-top: 0; } +dl.constants .discussion *:last-child { margin-bottom: 0; } + +.method_details { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; } +.method_details.first { border: 0; } +p.signature { + font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace; + padding: 6px 10px; margin-top: 18px; + background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +p.signature tt { font-family: Monaco, Consolas, Courier, monospace; } +p.signature .overload { display: block; } +p.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; } +p.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; } +p.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; } + +.tags h3 { font-size: 1em; margin-bottom: 0; } +.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; } +.tags ul li { margin-bottom: 3px; } +.tags ul .name { font-family: monospace; font-weight: bold; } +.tags ul .note { padding: 3px 6px; } +.tags { margin-bottom: 12px; } + +.tags .examples h3 { margin-bottom: 10px; } +.tags .examples h4 { padding: 0; margin: 0; margin-left: 15px; font-weight: bold; font-size: 0.9em; } + +.tags .overload .overload_item { list-style: none; margin-bottom: 25px; } +.tags .overload .overload_item .signature { + padding: 2px 8px; + background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; } +.tags .overload .docstring { margin-top: 15px; } + +.defines { display: none; } + +#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; } + +.showSource { font-size: 0.9em; } +.showSource a:link, .showSource a:visited { text-decoration: none; color: #666; } + +#content a:link, #content a:visited { text-decoration: none; color: #05a; } +#content a:hover { background: #ffffa5; } +.docstring { margin-right: 6em; } + +ul.summary { + list-style: none; + font-family: monospace; + font-size: 1em; + line-height: 1.5em; +} +ul.summary a:link, ul.summary a:visited { + text-decoration: none; font-size: 1.1em; +} +ul.summary li { margin-bottom: 5px; } +.summary .summary_signature { + padding: 1px 10px; + background: #eaeaff; border: 1px solid #dfdfe5; + -moz-border-radius: 3px; -webkit-border-radius: 3px; +} +.summary_signature:hover { background: #eeeeff; cursor: pointer; } +ul.summary.compact li { display: inline; margin-right: 5px; line-height: 2.6em;} +ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; } +#content .summary_signature:hover a:link, +#content .summary_signature:hover a:visited { + background: transparent; + color: #48f; +} + +p.inherited a { font-family: monospace; font-size: 0.9em; } +p.inherited { word-spacing: 5px; font-size: 1.2em; } + +p.children { font-size: 1.2em; } +p.children a { font-size: 0.9em; } +p.children strong { font-size: 0.8em; } +p.children strong.modules { padding-left: 5px; } + +ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; } +ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; } +ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHtJREFUeNqMzrEJAkEURdGzuhgZbSoYWcAWoBVsB4JgZAGmphsZCZYzTQgWNCYrDN9RvMmHx+X916SUBFbo8CzD1idXrLErw1mQttgXtyrOcQ/Ny5p4Qh+2XqLYYazsPWNTiuMkRxa4vcV+evuNAUOLIx5+c2hyzv7hNQC67Q+/HHmlEwAAAABJRU5ErkJggg==) no-repeat top center; } +ul.fullTree li:first-child { padding-top: 0; background: transparent; } +ul.fullTree li:last-child { padding-bottom: 0; } +.showAll ul.fullTree { display: block; } +.showAll .inheritName { display: none; } + +#search { position: absolute; right: 14px; top: 0px; } +#search a:link, #search a:visited { + display: block; float: left; margin-right: 4px; + padding: 8px 10px; text-decoration: none; color: #05a; + border: 1px solid #d8d8e5; + -moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px; + -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px; + background: #eaf0ff; + -webkit-box-shadow: -1px 1px 3px #ddd; +} +#search a:hover { background: #f5faff; color: #06b; } +#search a.active { + background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457; + -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; + -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; +} +#search a.inactive { color: #999; } +.frames #search { display: none; } +.inheritanceTree, .toggleDefines { float: right; } + +#menu { font-size: 1.3em; color: #bbb; top: -5px; position: relative; } +#menu .title, #menu a { font-size: 0.7em; } +#menu .title a { font-size: 1em; } +#menu .title { color: #555; } +#menu a:link, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; } +#menu a:hover { color: #05a; } +#menu .noframes { display: none; } +.frames #menu .noframes { display: inline; float: right; } + +#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; } +#footer a:link, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; } +#footer a:hover { color: #05a; } + +#listing ul.alpha { font-size: 1.1em; } +#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; } +#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; } +#listing ul.alpha ul { margin: 0; padding-left: 15px; } +#listing ul small { color: #666; font-size: 0.7em; } + +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } + +#search_frame { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 36px; + right: 18px; + width: 500px; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + -webkit-box-shadow: -7px 5px 25px #aaa; + -moz-box-shadow: -7px 5px 25px #aaa; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +#content ul.summary li.deprecated a:link, +#content ul.summary li.deprecated a:visited { text-decoration: line-through; font-style: italic; } + +#toc { + padding: 20px; padding-right: 30px; border: 1px solid #ddd; float: right; background: #fff; margin-left: 20px; margin-bottom: 20px; + max-width: 300px; + -webkit-box-shadow: -2px 2px 6px #bbb; + -moz-box-shadow: -2px 2px 6px #bbb; + z-index: 5000; + position: relative; +} +#toc.nofloat { float: none; max-width: none; border: none; padding: 0; margin: 20px 0; -webkit-box-shadow: none; -moz-box-shadow: none; } +#toc.nofloat.hidden { padding: 0; background: 0; margin-bottom: 5px; } +#toc .title { margin: 0; } +#toc ol { padding-left: 1.8em; } +#toc li { font-size: 1.1em; line-height: 1.7em; } +#toc > ol > li { font-size: 1.1em; font-weight: bold; } +#toc ol > ol { font-size: 0.9em; } +#toc ol ol > ol { padding-left: 2.3em; } +#toc ol + li { margin-top: 0.3em; } +#toc.hidden { padding: 10px; background: #f6f6f6; -webkit-box-shadow: none; -moz-box-shadow: none; } +#filecontents h1 + #toc.nofloat { margin-top: 0; } + +/* syntax highlighting */ +.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; } +#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; } +#filecontents pre.code, .docstring pre.code { display: block; } +.source_code .lines { padding-right: 12px; color: #555; text-align: right; } +#filecontents pre.code, .docstring pre.code, +.tags .example { padding: 5px 12px; margin-top: 4px; border: 1px solid #eef; background: #f5f5ff; } +pre.code { color: #000; } +pre.code .info.file { color: #555; } +pre.code .val { color: #036A07; } +pre.code .tstring_content, +pre.code .heredoc_beg, pre.code .heredoc_end, +pre.code .qwords_beg, pre.code .qwords_end, +pre.code .tstring, pre.code .dstring { color: #036A07; } +pre.code .fid, pre.code .id.new, pre.code .id.to_s, +pre.code .id.to_sym, pre.code .id.to_f, +pre.code .dot + pre.code .id, +pre.code .id.to_i pre.code .id.each { color: #0085FF; } +pre.code .comment { color: #0066FF; } +pre.code .const, pre.code .constant { color: #585CF6; } +pre.code .symbol { color: #C5060B; } +pre.code .kw, +pre.code .label, +pre.code .id.require, +pre.code .id.extend, +pre.code .id.include { color: #0000FF; } +pre.code .ivar { color: #318495; } +pre.code .gvar, +pre.code .id.backref, +pre.code .id.nth_ref { color: #6D79DE; } +pre.code .regexp, .dregexp { color: #036A07; } +pre.code a { border-bottom: 1px dotted #bbf; } + diff --git a/site/api-docs/file.README.html b/site/api-docs/file.README.html new file mode 100644 index 00000000..ecaa000b --- /dev/null +++ b/site/api-docs/file.README.html @@ -0,0 +1,114 @@ + + + + +Documentation by YARD 0.6.1 + + + + + + + + + + + + + + + +

Deltacloud API

+ +

Hooray, you have successfully checked out Deltacloud Core. +Deltacloud protects yourapps from cloud API changes and incompatibilities, +so you can concentrate on managing cloud instances the way you want.

+ +

You can find more documentation at the Deltacloud web site at: +incubator.apache.org/deltacloud

+ +

Prerequisites

+ +

Deltacloud Core depends on a number of other Ruby libraries. The easiest +way to install them is to either install the deltacloud-core package from +your distribution is repository, e.g. yum install deltacloud-core on +Fedora, or install the gem with gem install deltacloud-core.

+ +

If you do not want to do that, have a look at the dependencies in the gem +spec for deltacloud-core and install them manually from git repository:

+ +
$ mkdir deltacloud
+$ cd deltacloud
+$ git svn init -s https://svn.apache.org/repos/asf/incubator/deltacloud
+$ git svn fetch --log-window-size 10000
+$ git clone git://git.apache.org/deltacloud.git core
+
+ +

Running

+ +

To get started, run ./bin/deltacloudd -i mock; this will run Deltacloud +Core with the mock driver, a driver that does not talk to a cloud, but +simulates being one. It will store data about its instances etc. in +/var/tmp/deltacloud-mock-$USER; that directory will automatically populated +with sample data if it does not exist. Subsequent runs will continue using +the data found there. If you need to start over from scratch, just delete +that directory and restart deltacloudd.

+ +

Once you have the server running, point your browser at +localhost:3001/api to get a HTML version of Deltacloud Core. +If you want to look at the XML that REST clients will see, simply add +?format=xml to URLs. Deltacloud Core does content negotiation; REST clients should not +set format to URLs, they should simply set the Accept header appropriately.

+ +

Some operations require authentication. For the mock driver, the username +and password are mockuser and mockpassword. A current list of drivers +and what kind of credentials they need can be found at +Deltacloud Incubator site (http://incubator.apache.org/deltacloud/drivers.html)

+ +

Happy hacking - and do not forget to send patches to the mailing list (see +deltacloud-devel or +incubator-deltacloud-dev +You could send patches using git format-patch master and then git send-email +--thread. Example git/.config file:

+ +
[sendemail]
+    to = deltacloud-dev@incubator.apache.org
+    signedoffbycc=no
+    chainreplyto=no
+    smtpserver=YOUR_SMTP_SERVER_HERE
+    thread=yes
+    from=YOUR_EMAIL_HERE
+    suppresscc=all
+
+ + + + + \ No newline at end of file diff --git a/site/api-docs/file_list.html b/site/api-docs/file_list.html new file mode 100644 index 00000000..df1cdcb1 --- /dev/null +++ b/site/api-docs/file_list.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + +
+

File List

+ + + + +
+ + + diff --git a/site/api-docs/frames.html b/site/api-docs/frames.html new file mode 100644 index 00000000..cdb06df6 --- /dev/null +++ b/site/api-docs/frames.html @@ -0,0 +1,13 @@ + + + + + + Documentation by YARD 0.6.1 + + + + + + diff --git a/site/api-docs/index.html b/site/api-docs/index.html new file mode 100644 index 00000000..ecaa000b --- /dev/null +++ b/site/api-docs/index.html @@ -0,0 +1,114 @@ + + + + +Documentation by YARD 0.6.1 + + + + + + + + + + + + + + + +

Deltacloud API

+ +

Hooray, you have successfully checked out Deltacloud Core. +Deltacloud protects yourapps from cloud API changes and incompatibilities, +so you can concentrate on managing cloud instances the way you want.

+ +

You can find more documentation at the Deltacloud web site at: +incubator.apache.org/deltacloud

+ +

Prerequisites

+ +

Deltacloud Core depends on a number of other Ruby libraries. The easiest +way to install them is to either install the deltacloud-core package from +your distribution is repository, e.g. yum install deltacloud-core on +Fedora, or install the gem with gem install deltacloud-core.

+ +

If you do not want to do that, have a look at the dependencies in the gem +spec for deltacloud-core and install them manually from git repository:

+ +
$ mkdir deltacloud
+$ cd deltacloud
+$ git svn init -s https://svn.apache.org/repos/asf/incubator/deltacloud
+$ git svn fetch --log-window-size 10000
+$ git clone git://git.apache.org/deltacloud.git core
+
+ +

Running

+ +

To get started, run ./bin/deltacloudd -i mock; this will run Deltacloud +Core with the mock driver, a driver that does not talk to a cloud, but +simulates being one. It will store data about its instances etc. in +/var/tmp/deltacloud-mock-$USER; that directory will automatically populated +with sample data if it does not exist. Subsequent runs will continue using +the data found there. If you need to start over from scratch, just delete +that directory and restart deltacloudd.

+ +

Once you have the server running, point your browser at +localhost:3001/api to get a HTML version of Deltacloud Core. +If you want to look at the XML that REST clients will see, simply add +?format=xml to URLs. Deltacloud Core does content negotiation; REST clients should not +set format to URLs, they should simply set the Accept header appropriately.

+ +

Some operations require authentication. For the mock driver, the username +and password are mockuser and mockpassword. A current list of drivers +and what kind of credentials they need can be found at +Deltacloud Incubator site (http://incubator.apache.org/deltacloud/drivers.html)

+ +

Happy hacking - and do not forget to send patches to the mailing list (see +deltacloud-devel or +incubator-deltacloud-dev +You could send patches using git format-patch master and then git send-email +--thread. Example git/.config file:

+ +
[sendemail]
+    to = deltacloud-dev@incubator.apache.org
+    signedoffbycc=no
+    chainreplyto=no
+    smtpserver=YOUR_SMTP_SERVER_HERE
+    thread=yes
+    from=YOUR_EMAIL_HERE
+    suppresscc=all
+
+ + + + + \ No newline at end of file diff --git a/site/api-docs/js/app.js b/site/api-docs/js/app.js new file mode 100644 index 00000000..262ba960 --- /dev/null +++ b/site/api-docs/js/app.js @@ -0,0 +1,202 @@ +function createSourceLinks() { + $('.method_details_list .source_code'). + before("[View source]"); + $('.toggleSource').toggle(function() { + $(this).parent().next().slideDown(100); + $(this).text("Hide source"); + }, + function() { + $(this).parent().next().slideUp(100); + $(this).text("View source"); + }); +} + +function createDefineLinks() { + var tHeight = 0; + $('.defines').after(" more..."); + $('.toggleDefines').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).prev().show(); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function() { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more...") + }); +} + +function createFullTreeLinks() { + var tHeight = 0; + $('.inheritanceTree').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass('showAll'); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function() { + $(this).parent().toggleClass('showAll'); + $(this).parent().prev().height(tHeight); + $(this).text("show all") + }); +} + +function fixBoxInfoHeights() { + $('dl.box dd.r1, dl.box dd.r2').each(function() { + $(this).prev().height($(this).height()); + }); +} + +function searchFrameLinks() { + $('#method_list_link').click(function() { + toggleSearchFrame(this, relpath + 'method_list.html'); + }); + + $('#class_list_link').click(function() { + toggleSearchFrame(this, relpath + 'class_list.html'); + }); + + $('#file_list_link').click(function() { + toggleSearchFrame(this, relpath + 'file_list.html'); + }); +} + +function toggleSearchFrame(id, link) { + var frame = $('#search_frame'); + $('#search a').removeClass('active').addClass('inactive'); + if (frame.attr('src') == link && frame.css('display') != "none") { + frame.slideUp(100); + $('#search a').removeClass('active inactive'); + } + else { + $(id).addClass('active').removeClass('inactive'); + frame.attr('src', link).slideDown(100); + } +} + +function linkSummaries() { + $('.summary_signature').click(function() { + document.location = $(this).find('a').attr('href'); + }); +} + +function framesInit() { + if (window.top.frames.main) { + document.body.className = 'frames'; + $('#menu .noframes a').attr('href', document.location); + $('html head title', window.parent.document).text($('html head title').text()); + } +} + +function keyboardShortcuts() { + if (window.top.frames.main) return; + $(document).keypress(function(evt) { + if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return; + if (evt.originalTarget.nodeName == "INPUT" || + evt.originalTarget.nodeName == "TEXTAREA") return; + switch (evt.charCode) { + case 67: case 99: $('#class_list_link').click(); break; // 'c' + case 77: case 109: $('#method_list_link').click(); break; // 'm' + case 70: case 102: $('#file_list_link').click(); break; // 'f' + } + }); +} + +function summaryToggle() { + $('.summary_toggle').click(function() { + localStorage.summaryCollapsed = $(this).text(); + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().next(); + if (next.hasClass('compact')) { + next.toggle(); + next.next().toggle(); + } + else if (next.hasClass('summary')) { + var list = $('