You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2011/11/25 18:27:17 UTC

[PATCH 3/5] Adds CIMI::Volume create and CIMI::VolumeConfiguration list/show to server.rb

From: marios <ma...@redhat.com>


Signed-off-by: marios <ma...@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