---
server/deltacloud.rb | 3 ++
server/lib/sinatra/respond_to.rb | 3 ++
server/server.rb | 44 ++++++++++++++++++++++++-------------
3 files changed, 34 insertions(+), 16 deletions(-)
diff --git a/server/deltacloud.rb b/server/deltacloud.rb
index 1c19a5d..039b95f 100644
--- a/server/deltacloud.rb
+++ b/server/deltacloud.rb
@@ -12,3 +12,6 @@ require 'deltacloud/models/instance'
require 'deltacloud/models/instance_profile'
require 'deltacloud/models/storage_snapshot'
require 'deltacloud/models/storage_volume'
+
+require 'deltacloud/validation'
+require 'deltacloud/helpers'
diff --git a/server/lib/sinatra/respond_to.rb b/server/lib/sinatra/respond_to.rb
index 64b3cd7..07d6489 100644
--- a/server/lib/sinatra/respond_to.rb
+++ b/server/lib/sinatra/respond_to.rb
@@ -263,3 +263,6 @@ module Sinatra
end
end
end
+
+Rack::Mime::MIME_TYPES.merge!({ ".gv" => "text/plain" })
+Sinatra::Application.register Sinatra::RespondTo
diff --git a/server/server.rb b/server/server.rb
index f4613e5..e52fd2a 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -1,17 +1,14 @@
-require 'rubygems'
require 'deltacloud'
require 'drivers'
require 'json'
require 'sinatra'
require 'sinatra/respond_to'
-require 'erb'
-require 'haml'
-require 'open3'
require 'sinatra/static_assets'
require 'sinatra/rabbit'
require 'sinatra/lazy_auth'
-require 'deltacloud/validation'
-require 'deltacloud/helpers'
+require 'erb'
+require 'haml'
+require 'open3'
configure do
set :raise_errors => false
@@ -23,15 +20,10 @@ configure :development do
$stderr.sync = true
end
-
# You could use $API_HOST environment variable to change your hostname to
# whatever you want (eg. if you running API behind NAT)
HOSTNAME=ENV['API_HOST'] ? ENV['API_HOST'] : nil
-Rack::Mime::MIME_TYPES.merge!({ ".gv" => "text/plain" })
-
-Sinatra::Application.register Sinatra::RespondTo
-
error Deltacloud::Validation::Failure do
report_error(400, "validation_failure")
end
@@ -66,10 +58,20 @@ end
# Rabbit DSL
collection :realms do
- description "Within a cloud provider a realm represents a boundary
containing resources. The exact definition of a realm is left to the cloud
provider. In some cases, a realm may represent different datacenters, different
continents, or different pools of resources within a single datacenter. A cloud
provider may insist that resources must all exist within a single realm in
order to cooperate. For instance, storage volumes may only be allowed to be
mounted to instances within the same realm."
+ description <<END
+ Within a cloud provider a realm represents a boundary containing resources.
+ The exact definition of a realm is left to the cloud provider.
+ In some cases, a realm may represent different datacenters, different
continents,
+ or different pools of resources within a single datacenter.
+ A cloud provider may insist that resources must all exist within a single
realm in
+ order to cooperate. For instance, storage volumes may only be allowed to be
mounted to
+ instances within the same realm.
+END
operation :index do
- description 'Operation will list all available realms. For specific
architecture use "architecture" parameter.'
+ description <<END
+ Operation will list all available realms. For specific architecture use
"architecture" parameter.
+END
param :id, :string
param :architecture, :string, :optional, [ 'i386', 'x86_64' ]
control { filter_all(:realms) }
@@ -85,10 +87,17 @@ collection :realms do
end
collection :images do
- description "An image is a platonic form of a machine. Images are not
directly executable, but are a template for creating actual instances of
machines."
+ description <<END
+ An image is a platonic form of a machine. Images are not directly executable,
+ but are a template for creating actual instances of machines."
+END
operation :index do
- description 'The instances collection will return a set of all images
available to the current use. You can filter images using "owner_id" and
"architecture" parameter'
+ description <<END
+ The instances collection will return a set of all images
+ available to the current use. You can filter images using
+ "owner_id" and "architecture" parameter
+END
param :id, :string
param :owner_id, :string
param :architecture, :string, :optional
@@ -152,7 +161,10 @@ get "/api/instances/new" do
end
collection :instances do
- description "An instance is a concrete machine realized from an image. The
images collection may be obtained by following the link from the primary
entry-point."
+ description <<END
+ An instance is a concrete machine realized from an image.
+ The images collection may be obtained by following the link from the primary
entry-point."
+END
operation :index do
description "List all instances"
--
1.7.1
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel