deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [1/9] git commit: CIMI: Adds VSPTemplate + VSPTemplateCollection to CIMI server
Date Tue, 20 Mar 2012 10:10:19 GMT
Updated Branches:
  refs/heads/master 925d0ed65 -> 9ddd4b5eb


CIMI: Adds VSPTemplate + VSPTemplateCollection 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/7ba2815c
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/7ba2815c
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/7ba2815c

Branch: refs/heads/master
Commit: 7ba2815c7f3ebe2d88ad079583bcadcd56d9353c
Parents: 07ea4af
Author: marios <marios@redhat.com>
Authored: Fri Mar 16 19:30:01 2012 +0200
Committer: marios <marios@redhat.com>
Committed: Tue Mar 20 12:09:08 2012 +0200

----------------------------------------------------------------------
 server/lib/cimi/model.rb                         |    2 +
 server/lib/cimi/model/vsp_template.rb            |   34 +++++++++++++++++
 server/lib/cimi/model/vsp_template_collection.rb |   34 +++++++++++++++++
 server/lib/cimi/server.rb                        |   31 +++++++++++++++
 4 files changed, 101 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7ba2815c/server/lib/cimi/model.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model.rb b/server/lib/cimi/model.rb
index 1136593..0befe31 100644
--- a/server/lib/cimi/model.rb
+++ b/server/lib/cimi/model.rb
@@ -59,3 +59,5 @@ require 'cimi/model/vsp'
 require 'cimi/model/vsp_collection'
 require 'cimi/model/vsp_configuration'
 require 'cimi/model/vsp_configuration_collection'
+require 'cimi/model/vsp_template'
+require 'cimi/model/vsp_template_collection'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7ba2815c/server/lib/cimi/model/vsp_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/vsp_template.rb b/server/lib/cimi/model/vsp_template.rb
new file mode 100644
index 0000000..f1b8078
--- /dev/null
+++ b/server/lib/cimi/model/vsp_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::VSPTemplate < CIMI::Model::Base
+
+  href :network
+
+  href :vsp_config
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.vsp_templates(context.credentials, {:env=>context})
+    else
+      context.driver.vsp_templates(context.credentials, {:env=>context, :id=>id})
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7ba2815c/server/lib/cimi/model/vsp_template_collection.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/vsp_template_collection.rb b/server/lib/cimi/model/vsp_template_collection.rb
new file mode 100644
index 0000000..4acb74e
--- /dev/null
+++ b/server/lib/cimi/model/vsp_template_collection.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::VSPTemplateCollection < CIMI::Model::Base
+
+  CIMI::Model.register_as_root_entity! "VSPTemplates"
+
+  array :vsp_templates do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.vsp_templates_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VSPTemplateCollection",
+      :vsp_templates => VSPTemplate.all_uri(context)
+    )
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7ba2815c/server/lib/cimi/server.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
index 4dc0606..0f62951 100644
--- a/server/lib/cimi/server.rb
+++ b/server/lib/cimi/server.rb
@@ -727,3 +727,34 @@ global_collection :vsp_configurations do
   end
 
 end
+
+
+global_collection :vsp_templates do
+
+  description 'The VSP Template is a set of Configuration values for realizing a VSP. A VSP
Template may be used to create multiple VSPs'
+
+  operation :index do
+    description 'List all VSPTemplates in the VSPTemplateCollection'
+    param :CIMISelect, :string, :optional
+    control do
+      vsp_templates = VSPTemplateCollection.default(self).filter_by(params[:CIMISelect])
+      respond_to do |format|
+        format.xml {vsp_templates.to_xml}
+        format.json {vsp_templates.to_json}
+      end
+    end
+  end
+
+  operation :show do
+    description 'Show a specific VSPTemplate'
+    param :id, :string, :required
+    control do
+      vsp_template = VSPTemplate.find(params[:id], self)
+      respond_to do |format|
+        format.xml {vsp_template.to_xml}
+        format.json {vsp_template.to_json}
+      end
+    end
+  end
+
+end


Mime
View raw message