deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1232041 - in /deltacloud/trunk/server/lib/cimi: model.rb server.rb
Date Mon, 16 Jan 2012 15:46:42 GMT
Author: marios
Date: Mon Jan 16 15:46:42 2012
New Revision: 1232041

URL: http://svn.apache.org/viewvc?rev=1232041&view=rev
Log:
Adds new CIMI::Network models and routes for Sinatra

Modified:
    deltacloud/trunk/server/lib/cimi/model.rb
    deltacloud/trunk/server/lib/cimi/server.rb

Modified: deltacloud/trunk/server/lib/cimi/model.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model.rb?rev=1232041&r1=1232040&r2=1232041&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model.rb Mon Jan 16 15:46:42 2012
@@ -45,3 +45,8 @@ require 'cimi/model/volume_image_collect
 require 'cimi/model/volume_template_collection'
 require 'cimi/model/entity_metadata'
 require 'cimi/model/entity_metadata_collection'
+require 'cimi/model/network'
+require 'cimi/model/network_collection'
+require 'cimi/model/network_configuration'
+require 'cimi/model/network_configuration_collection'
+require 'cimi/model/network_template'

Modified: deltacloud/trunk/server/lib/cimi/server.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/server.rb?rev=1232041&r1=1232040&r2=1232041&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/server.rb (original)
+++ deltacloud/trunk/server/lib/cimi/server.rb Mon Jan 16 15:46:42 2012
@@ -492,4 +492,84 @@ global_collection :entity_metadata do
 
 end
 
+global_collection :networks do
+  description 'A Network represents an abstraction of a layer 2 broadcast domain'
+
+  operation :index do
+    description "List all Networks"
+    param :CIMISelect,  :string,  :optional
+    control do
+      networks = NetworkCollection.default(self).filter_by(params[:CIMISelect])
+      respond_to do |format|
+        format.xml { networks.to_xml }
+        format.json { networks.to_json }
+      end
+    end
+  end
+
+  operation :show do
+    description "Show a specific Network"
+    param :id, :string, :required
+    control do
+      network = Network.find(params[:id], self)
+      respond_to do |format|
+        format.xml { network.to_xml }
+        format.json { network.to_json }
+      end
+    end
+  end
+
+  operation :create do
+    description "Create a new Network"
+    control do
+      if request.content_type.end_with("+json")
+        network = Network.create_from_json(request.body.read, self)
+      else
+        network = Network.create_from_xml(request.body.read, self)
+      end
+      respond_to do |format|
+        format.xml { network.to_xml}
+        format.json { network.to_json }
+      end
+    end
+  end
+
+  operation :destroy do
+    description "Delete a specified Network"
+    param :id, :string, :required
+    control do
+      Network.delete!(params[:id], self)
+      no_content_with_status(200)
+    end
+  end
+
+end
+
+global_collection :network_configurations do
+  description 'Network Configurations contain the set of configuration values representing
the information needed to create a Network with certain characteristics'
+
+  operation :index do
+    description 'List all NetworkConfigurations'
+    param :CIMISelect, :string, :optional
+    control do
+      network_configurations = NetworkConfigurationCollection.default(self).filter_by(params[:CIMISelect])
+      respond_to do |format|
+        format.xml { network_configurations.to_xml  }
+        format.json { network_configurations.to_json }
+      end
+    end
+  end
+
+  operation :show do
+    description 'Show a specific NetworkConfiguration'
+    param :id, :string, :required
+    control do
+      network_config = NetworkConfiguration.find(params[:id], self)
+      respond_to do
+        format.xml { network_config.to_xml }
+        format.json { network_config.to_json }
+      end
+    end
+  end
+end
 end



Mime
View raw message