deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [9/9] git commit: CIMI: adds RoutingGroupTemplate and Collection to CIMI server
Date Tue, 20 Mar 2012 10:10:20 GMT
CIMI: adds RoutingGroupTemplate and Collection to CIMI server


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/b96375f6
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/b96375f6
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/b96375f6

Branch: refs/heads/master
Commit: b96375f62f3d47f148c616a1609c9f745c32bdfd
Parents: 925d0ed
Author: marios <marios@redhat.com>
Authored: Fri Mar 16 16:49:30 2012 +0200
Committer: marios <marios@redhat.com>
Committed: Tue Mar 20 12:09:07 2012 +0200

----------------------------------------------------------------------
 server/lib/cimi/model.rb                           |    2 +
 server/lib/cimi/model/routing_group_template.rb    |   34 ++++++++++++++
 .../model/routing_group_template_collection.rb     |   35 +++++++++++++++
 server/lib/cimi/server.rb                          |   33 ++++++++++++++
 4 files changed, 104 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b96375f6/server/lib/cimi/model.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model.rb b/server/lib/cimi/model.rb
index 60f2d99..132ae6a 100644
--- a/server/lib/cimi/model.rb
+++ b/server/lib/cimi/model.rb
@@ -53,3 +53,5 @@ require 'cimi/model/network_template'
 require 'cimi/model/network_template_collection'
 require 'cimi/model/routing_group'
 require 'cimi/model/routing_group_collection'
+require 'cimi/model/routing_group_template'
+require 'cimi/model/routing_group_template_collection'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b96375f6/server/lib/cimi/model/routing_group_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/routing_group_template.rb b/server/lib/cimi/model/routing_group_template.rb
new file mode 100644
index 0000000..204a353
--- /dev/null
+++ b/server/lib/cimi/model/routing_group_template.rb
@@ -0,0 +1,34 @@
+# 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.
+
+class CIMI::Model::RoutingGroupTemplate < CIMI::Model::Base
+
+  array :networks do
+    scalar :href
+  end
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.routing_group_templates(context.credentials, {:env=>context})
+    else
+      context.driver.routing_group_templates(context.credentials, {:env=>context, :id=>id})
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b96375f6/server/lib/cimi/model/routing_group_template_collection.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/routing_group_template_collection.rb b/server/lib/cimi/model/routing_group_template_collection.rb
new file mode 100644
index 0000000..5e7a9ba
--- /dev/null
+++ b/server/lib/cimi/model/routing_group_template_collection.rb
@@ -0,0 +1,35 @@
+# 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.
+
+
+class CIMI::Model::RoutingGroupTemplateCollection < CIMI::Model::Base
+
+  act_as_root_entity :routing_group_template
+
+  array :routing_group_templates do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.routing_group_templates_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} RoutingGroupTemplateCollection",
+      :routing_group_templates => RoutingGroupTemplate.all_uri(context)
+    )
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b96375f6/server/lib/cimi/server.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
index 06ad758..9f541d0 100644
--- a/server/lib/cimi/server.rb
+++ b/server/lib/cimi/server.rb
@@ -635,3 +635,36 @@ global_collection :routing_groups do
   end
 
 end
+
+
+global_collection :routing_group_templates do
+
+  description 'Routing Groups Templates capture the configuration values for realizing a
RoutingGroup. A Routing Group Template may be used to create multiple RoutingGroups'
+
+  operation :index do
+    description 'List all RoutingGroupTemplates in the RoutingGroupTemplateCollection'
+    param :CIMISelect, :string, :optional
+    control do
+      routing_group_templates = RoutingGroupTemplateCollection.default(self).filter_by(params[:CIMISelect])
+      respond_to do |format|
+        format.xml {routing_group_templates.to_xml}
+        format.json {routing_group_templates.to_json}
+      end
+    end
+  end
+
+  operation :show do
+    description 'Show a specific RoutingGroupTemplate'
+    param :id, :string, :required
+    control do
+      routing_group_template = RoutingGroupTemplate.find(params[:id], self)
+      respond_to do |format|
+        format.xml {routing_group_template.to_xml}
+        format.json {routing_group_template.to_json}
+      end
+    end
+  end
+
+end
+
+


Mime
View raw message