deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 3/5] Adds CIMI::Volume create and CIMI::VolumeConfiguration list/show to server.rb
Date Fri, 25 Nov 2011 17:27:17 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/cimi/server.rb |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
index 85fa2f6..64f3b8c 100644
--- a/server/lib/cimi/server.rb
+++ b/server/lib/cimi/server.rb
@@ -238,4 +238,45 @@ global_collection :volumes do
     end
   end
 
+  operation :create do
+    description "Create a new Volume."
+    control do
+      params.merge!({:content_type => (request.content_type.end_with?("+json") ? :json
 : :xml) })
+      #((request.content_type.end_with?("+xml")) ? :xml : report_error(415) ) FIXME
+      new_volume = Volume.create(params, self)
+      respond_to do |format|
+        format.json { new_volume.to_json }
+        format.xml { new_volume.to_xml }
+      end
+    end
+  end
+
+end
+
+global_collection :volume_configurations do
+  description "The Volume Configuration entity represents the set of configuration values
needed to create a Volume with certain characteristics. Volume Configurations are created
by Providers and MAY, at the Providers discretion, be created by Consumers"
+
+  operation :index do
+    description "Get list all VolumeConfigurations"
+    control do
+      volume_configs = VolumeConfiguration.all(self)
+      respond_to do |format|
+        format.xml { volume_configs.to_xml_cimi_collection(self) }
+        format.json { volume_configs.to_json_cimi_collection(self) }
+      end
+    end
+  end
+
+  operation :show do
+    description "Get a specific VolumeConfiguration"
+    param :id, :required, :string
+    control do
+      volume_config = VolumeConfiguration.find(params[:id], self)
+      respond_to do |format|
+        format.xml { volume_config.to_xml }
+        format.json { volume_config.json }
+      end
+    end
+  end
+
 end
-- 
1.7.6.4


Mime
View raw message