deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martha.c.ch...@gmail.com
Subject [PATCH 2/2] CIMI Client - view files for credentials
Date Mon, 18 Mar 2013 07:26:42 GMT
From: NjeriChelimo <martha.c.chumo@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


Mime
View raw message