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...@gmail.com on 2013/03/18 08:26:41 UTC
[PATCH 1/2] CIMI Client - added view files for system and system_template
From: NjeriChelimo <ma...@gmail.com>
---
clients/cimi/app.rb | 2 ++
clients/cimi/lib/entities.rb | 2 ++
clients/cimi/lib/entities/system.rb | 30 ++++++++++++++++++++++++
clients/cimi/lib/entities/system_template.rb | 30 ++++++++++++++++++++++++
clients/cimi/views/system_templates/index.haml | 24 +++++++++++++++++++
clients/cimi/views/system_templates/show.haml | 22 +++++++++++++++++
clients/cimi/views/systems/index.haml | 24 +++++++++++++++++++
clients/cimi/views/systems/show.haml | 23 ++++++++++++++++++
8 files changed, 157 insertions(+)
create mode 100644 clients/cimi/lib/entities/system.rb
create mode 100644 clients/cimi/lib/entities/system_template.rb
create mode 100644 clients/cimi/views/system_templates/index.haml
create mode 100644 clients/cimi/views/system_templates/show.haml
create mode 100644 clients/cimi/views/systems/index.haml
create mode 100644 clients/cimi/views/systems/show.haml
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index 465ad90..c5a2e87 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -40,6 +40,8 @@ module CIMI::Frontend
use CIMI::Frontend::NetworkPort
use CIMI::Frontend::RoutingGroup
use CIMI::Frontend::RoutingGroupTemplate
+ use CIMI::Frontend::System
+ use CIMI::Frontend::SystemTemplate
use CIMI::Frontend::VSP
use CIMI::Frontend::VSPConfiguration
use CIMI::Frontend::VSPTemplate
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 49f74f5..c0a5bc3 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -40,6 +40,8 @@ require 'entities/network_port_template'
require 'entities/network_template'
require 'entities/routing_group'
require 'entities/routing_group_template'
+require 'entities/system'
+require 'entities/system_template'
require 'entities/vsp'
require 'entities/vsp_configuration'
require 'entities/vsp_template'
diff --git a/clients/cimi/lib/entities/system.rb b/clients/cimi/lib/entities/system.rb
new file mode 100644
index 0000000..7fd1ea4
--- /dev/null
+++ b/clients/cimi/lib/entities/system.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::System < CIMI::Frontend::Entity
+
+ get '/cimi/systems/:id' do
+ system_xml = get_entity('systems', params[:id], credentials)
+ @system = CIMI::Model::System.from_xml(system_xml)
+ haml :'systems/show'
+ end
+
+ get '/cimi/systems' do
+ systems_xml = get_entity_collection('systems', credentials)
+ @systems = CIMI::Model::SystemCollection.from_xml(systems_xml)
+ haml :'systems/index'
+ end
+
+end
diff --git a/clients/cimi/lib/entities/system_template.rb b/clients/cimi/lib/entities/system_template.rb
new file mode 100644
index 0000000..8f98794
--- /dev/null
+++ b/clients/cimi/lib/entities/system_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::SystemTemplate < CIMI::Frontend::Entity
+
+ get '/cimi/system_templates/:id' do
+ system_template_xml = get_entity('system_templates', params[:id], credentials)
+ @system_template = CIMI::Model::SystemTemplate.from_xml(system_template_xml)
+ haml :'system_templates/show'
+ end
+
+ get '/cimi/system_templates' do
+ system_templates_xml = get_entity_collection('system_templates', credentials)
+ @system_templates = CIMI::Model::SystemTemplateCollection.from_xml(system_templates_xml)
+ haml :'system_templates/index'
+ end
+
+end
diff --git a/clients/cimi/views/system_templates/index.haml b/clients/cimi/views/system_templates/index.haml
new file mode 100644
index 0000000..3806087
--- /dev/null
+++ b/clients/cimi/views/system_templates/index.haml
@@ -0,0 +1,24 @@
+- @title=collection_name @system_templates
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li.active
+ SystemTemplateCollection
+- content_for :actions do
+ %p
+ %a{ :href => "#{@system_templates.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@system_templates.id}?format=json", :class => 'label warning' } JSON
+
+
+%h3 SystemTemplateCollection
+%ul
+ - @system_templates.system_templates.each do |system_template|
+ %li
+ %a{ :href => "/cimi/system_templates/#{href_to_id system_template.id}"}=href_to_id(system_template.id)
+
+-details 'SystemTemplateCollection details' do
+ -row 'ID', @system_templates.id
+ -row 'Count', @system_templates.count
diff --git a/clients/cimi/views/system_templates/show.haml b/clients/cimi/views/system_templates/show.haml
new file mode 100644
index 0000000..9ad1741
--- /dev/null
+++ b/clients/cimi/views/system_templates/show.haml
@@ -0,0 +1,22 @@
+- @title="#{@system_template.name}"
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/system_templates"} SystemTemplateCollection
+ %span.divider="/"
+ %li.active
+ = @system_template.name
+
+- content_for :actions do
+ %p
+ %a{ :href => "#{@system_template.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@system_template.id}?format=json", :class => 'label warning' } JSON
+
+-details 'SystemTemplate details' do
+ -row 'ID', @system_template.id
+ -row 'Name', @system_template.name
+ -row 'Created', @system_template.created
diff --git a/clients/cimi/views/systems/index.haml b/clients/cimi/views/systems/index.haml
new file mode 100644
index 0000000..4e40d23
--- /dev/null
+++ b/clients/cimi/views/systems/index.haml
@@ -0,0 +1,24 @@
+- @title=collection_name @systems
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li.active
+ SystemCollection
+- content_for :actions do
+ %p
+ %a{ :href => "#{@systems.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@systems.id}?format=json", :class => 'label warning' } JSON
+
+
+%h3 SystemCollection
+%ul
+ - @systems.systems.each do |system|
+ %li
+ %a{ :href => "/cimi/systems/#{href_to_id system.id}"}=href_to_id(system.id)
+
+-details 'SystemCollection details' do
+ -row 'ID', @systems.id
+ -row 'Count', @systems.count
diff --git a/clients/cimi/views/systems/show.haml b/clients/cimi/views/systems/show.haml
new file mode 100644
index 0000000..cc6557a
--- /dev/null
+++ b/clients/cimi/views/systems/show.haml
@@ -0,0 +1,23 @@
+- @title="#{@system.name}"
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/systems"} SystemCollection
+ %span.divider="/"
+ %li.active
+ = @system.name
+
+- content_for :actions do
+ %p
+ %a{ :href => "#{@system.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@system.id}?format=json", :class => 'label warning' } JSON
+
+-details 'System details' do
+ -row 'ID', @system.id
+ -row 'Name', @system.name
+ -row 'Created', @system.created
+ -row 'State', @system.state
--
1.7.9.5
[PATCH 2/2] CIMI Client - view files for credentials
Posted by ma...@gmail.com.
From: NjeriChelimo <ma...@gmail.com>
---
clients/cimi/app.rb | 1 +
clients/cimi/lib/entities.rb | 1 +
clients/cimi/lib/entities/credential.rb | 30 +++++++++++++++++++++++++++++
clients/cimi/views/credentials/index.haml | 24 +++++++++++++++++++++++
clients/cimi/views/credentials/show.haml | 24 +++++++++++++++++++++++
5 files changed, 80 insertions(+)
create mode 100644 clients/cimi/lib/entities/credential.rb
create mode 100644 clients/cimi/views/credentials/index.haml
create mode 100644 clients/cimi/views/credentials/show.haml
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index c5a2e87..06a0ac7 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -22,6 +22,7 @@ module CIMI::Frontend
use CIMI::Frontend::Address
use CIMI::Frontend::AddressTemplate
use CIMI::Frontend::CloudEntryPoint
+ use CIMI::Frontend::Credential
use CIMI::Frontend::ForwardingGroup
use CIMI::Frontend::ForwardingGroupTemplate
use CIMI::Frontend::MachineConfiguration
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index c0a5bc3..1742aa7 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -22,6 +22,7 @@ require 'entities/base_entity'
require 'entities/cloud_entry_point'
require 'entities/address'
require 'entities/address_template'
+require 'entities/credential'
require 'entities/forwarding_group'
require 'entities/forwarding_group_template'
require 'entities/machine_configuration'
diff --git a/clients/cimi/lib/entities/credential.rb b/clients/cimi/lib/entities/credential.rb
new file mode 100644
index 0000000..9eb0bb6
--- /dev/null
+++ b/clients/cimi/lib/entities/credential.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::Credential < CIMI::Frontend::Entity
+
+ get '/cimi/credentials/:id' do
+ credential_xml = get_entity('credentials', params[:id], credentials)
+ @credential = CIMI::Model::Credential.from_xml(credential_xml)
+ haml :'credentials/show'
+ end
+
+ get '/cimi/credentials' do
+ credentials_xml = get_entity_collection('credentials', credentials)
+ @credentials = CIMI::Model::CredentialCollection.from_xml(credentials_xml)
+ haml :'credentials/index'
+ end
+
+end
diff --git a/clients/cimi/views/credentials/index.haml b/clients/cimi/views/credentials/index.haml
new file mode 100644
index 0000000..74ecd29
--- /dev/null
+++ b/clients/cimi/views/credentials/index.haml
@@ -0,0 +1,24 @@
+- @title=collection_name @credentials
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li.active
+ CredentialCollection
+- content_for :actions do
+ %p
+ %a{ :href => "#{@credentials.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@credentials.id}?format=json", :class => 'label warning' } JSON
+
+
+%h3 CredentialCollection
+%ul
+ - @credentials.credentials.each do |credential|
+ %li
+ %a{ :href => "/cimi/credentials/#{href_to_id credential.id}"}=href_to_id(credential.id)
+
+-details 'CredentialCollection details' do
+ -row 'ID', @credentials.id
+ -row 'Count', @credentials.count
diff --git a/clients/cimi/views/credentials/show.haml b/clients/cimi/views/credentials/show.haml
new file mode 100644
index 0000000..6b58ec9
--- /dev/null
+++ b/clients/cimi/views/credentials/show.haml
@@ -0,0 +1,24 @@
+- @title="#{@credential.name}"
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/credentials"} CredentialCollection
+ %span.divider="/"
+ %li.active
+ = @credential.name
+
+- content_for :actions do
+ %p
+ %a{ :href => "#{@credential.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@credential.id}?format=json", :class => 'label warning' } JSON
+
+-details 'Credential details' do
+ -row 'ID', @credential.id
+ -row 'Name', @credential.name
+ -row 'Description', @credential.description
+ -row 'Created', @credential.created
+ -row 'Username', @credential.username
--
1.7.9.5