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 2012/03/19 17:28:29 UTC

[PATCH 4/4] CIMI: Adds VSPTemplate entity and views to CIMI Client

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


Signed-off-by: marios <ma...@redhat.com>
---
 clients/cimi/app.rb                         |    1 +
 clients/cimi/lib/entities.rb                |    1 +
 clients/cimi/lib/entities/vsp_template.rb   |   30 +++++++++++++++++++++++++++
 clients/cimi/views/vsp_templates/index.haml |   30 +++++++++++++++++++++++++++
 clients/cimi/views/vsp_templates/show.haml  |   29 ++++++++++++++++++++++++++
 5 files changed, 91 insertions(+), 0 deletions(-)
 create mode 100644 clients/cimi/lib/entities/vsp_template.rb
 create mode 100644 clients/cimi/views/vsp_templates/index.haml
 create mode 100644 clients/cimi/views/vsp_templates/show.haml

diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index 6a124e5..d9423f9 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -35,6 +35,7 @@ module CIMI::Frontend
     use CIMI::Frontend::RoutingGroupTemplate
     use CIMI::Frontend::VSP
     use CIMI::Frontend::VSPConfiguration
+    use CIMI::Frontend::VSPTemplate
     use Rack::Session::Cookie
 
     helpers CIMI::Frontend::Helper
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 7071bf2..3442360 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -35,3 +35,4 @@ require 'entities/routing_group'
 require 'entities/routing_group_template'
 require 'entities/vsp'
 require 'entities/vsp_configuration'
+require 'entities/vsp_template'
diff --git a/clients/cimi/lib/entities/vsp_template.rb b/clients/cimi/lib/entities/vsp_template.rb
new file mode 100644
index 0000000..93f238f
--- /dev/null
+++ b/clients/cimi/lib/entities/vsp_template.rb
@@ -0,0 +1,30 @@
+# 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::Frontend::VSPTemplate < CIMI::Frontend::Entity
+
+  get '/cimi/vsp_templates/:id' do
+    vsp_template_xml = get_entity('vsp_templates', params[:id], credentials)
+    @vsp_template = CIMI::Model::VSPTemplate.from_xml(vsp_template_xml)
+    haml :'vsp_templates/show'
+  end
+
+  get '/cimi/vsp_templates' do
+    vsp_templates_xml = get_entity_collection('vsp_templates', credentials)
+    @vsp_templates = CIMI::Model::VSPTemplateCollection.from_xml(vsp_templates_xml)
+    haml :'vsp_templates/index'
+  end
+
+end
diff --git a/clients/cimi/views/vsp_templates/index.haml b/clients/cimi/views/vsp_templates/index.haml
new file mode 100644
index 0000000..025f438
--- /dev/null
+++ b/clients/cimi/views/vsp_templates/index.haml
@@ -0,0 +1,30 @@
+- @title=@vsp_templates.description
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li.active
+      VSPTemplateCollection
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@vsp_templates.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@vsp_templates.id}?format=json", :class => 'label warning' } JSON
+
+%blockquote
+  %p
+    A VSP Template Collection entity represents the collection of VSP Templates within a Provider.
+    This entity can be used to locate and create VSP Templates.
+
+%h3 VSPTemplateCollection
+%ul
+  - @vsp_templates.vsp_templates.each do |vsp_templ|
+    %li
+      %a{ :href => "/cimi/vsp_templates/#{vsp_templ.href.split('/').last}"}=vsp_templ.href.split('/').last
+
+-details 'VSPTemplateCollection details' do
+  -row 'ID', @vsp_templates.id
+  -row 'Description', @vsp_templates.description
+  -row 'Created', @vsp_templates.created
diff --git a/clients/cimi/views/vsp_templates/show.haml b/clients/cimi/views/vsp_templates/show.haml
new file mode 100644
index 0000000..157a8fd
--- /dev/null
+++ b/clients/cimi/views/vsp_templates/show.haml
@@ -0,0 +1,29 @@
+- @title="#{@vsp_template.name}"
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li
+      %a{ :href => "/cimi/vsp_templates"} VSPTemplateCollection
+      %span.divider="/"
+    %li.active
+      = @vsp_template.name
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@vsp_template.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@vsp_template.id}?format=json", :class => 'label warning' } JSON
+
+%blockquote
+  %p
+    The VSP Template is a set of Configuration values for realizing a VSP.
+    A VSP Template may be used to create multiple VSPs
+
+-details 'VSPTemplate details' do
+  -row 'ID', @vsp_template.id
+  -row 'Description', @vsp_template.description
+  -row 'Created', @vsp_template.created
+  -row 'Network', @vsp_template.network.href
+  -row 'VSP Config', @vsp_template.vsp_config.href
-- 
1.7.6.5