Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C29C6D347 for ; Fri, 18 Jan 2013 09:52:55 +0000 (UTC) Received: (qmail 9632 invoked by uid 500); 18 Jan 2013 09:52:55 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 9614 invoked by uid 500); 18 Jan 2013 09:52:55 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 9606 invoked by uid 99); 18 Jan 2013 09:52:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jan 2013 09:52:55 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of martha.c.chumo@gmail.com designates 209.85.212.178 as permitted sender) Received: from [209.85.212.178] (HELO mail-wi0-f178.google.com) (209.85.212.178) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jan 2013 09:52:49 +0000 Received: by mail-wi0-f178.google.com with SMTP id hn3so2910955wib.5 for ; Fri, 18 Jan 2013 01:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=Dj1/yMaeeogIwabP168jvPcgHPLibqQkjFToVHfek+c=; b=hh/kuHwgr6G4ou1SDAD+5T4rJnT6gNd7oMxlDBWKHhUNlr4fZiZiCmcaRd/QgjAcT3 sNxWgzRsL4t50n3DLF/ZoQYsjT8DIS4CgJXtq7fHAVodZZLf6V7bEmUVmAten5AavjDe OYLmidmx3qDMmCrBkoDAO7J4mbi7IpKluHPR4BFLM7Mv6W0VIV0zZQQan0xglcOKTGl6 TjREXE/mwkWxEawb+Fa5RcHjGLelO7gOzPdfher9SRFLLw2qRKAvkh3QJauFCN+r5AKv TtPrr4HlU/epZYCFgg3SlXnH3rZCpMWKSKJZwPbbr8WtSSs88MgfnPD7iQxiUdYi7jKv LJ3Q== X-Received: by 10.194.240.129 with SMTP id wa1mr13166009wjc.21.1358502748028; Fri, 18 Jan 2013 01:52:28 -0800 (PST) Received: from localhost.localdomain ([212.49.88.101]) by mx.google.com with ESMTPS id dm3sm2659866wib.9.2013.01.18.01.52.26 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jan 2013 01:52:27 -0800 (PST) From: martha.c.chumo@gmail.com To: dev@deltacloud.apache.org Subject: [PATCH 4/4] DTACLOUD-409:added address templates view files and address_template to entities Date: Fri, 18 Jan 2013 12:52:10 +0300 Message-Id: <1358502730-12713-4-git-send-email-martha.c.chumo@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358502730-12713-1-git-send-email-martha.c.chumo@gmail.com> References: <1358502730-12713-1-git-send-email-martha.c.chumo@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org From: NjeriChelimo --- clients/cimi/app.rb | 1 + clients/cimi/lib/entities.rb | 1 + clients/cimi/lib/entities/address_template.rb | 30 +++++++++++++++++++++++ clients/cimi/views/address_templates/index.haml | 23 +++++++++++++++++ clients/cimi/views/address_templates/show.haml | 30 +++++++++++++++++++++++ 5 files changed, 85 insertions(+) create mode 100644 clients/cimi/lib/entities/address_template.rb create mode 100644 clients/cimi/views/address_templates/index.haml create mode 100644 clients/cimi/views/address_templates/show.haml diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb index be358b8..3809425 100644 --- a/clients/cimi/app.rb +++ b/clients/cimi/app.rb @@ -20,6 +20,7 @@ module CIMI::Frontend class Application < Sinatra::Base use CIMI::Frontend::Address + use CIMI::Frontend::AddressTemplate use CIMI::Frontend::CloudEntryPoint use CIMI::Frontend::MachineConfiguration use CIMI::Frontend::MachineImage diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb index 87a02f4..c5c40df 100644 --- a/clients/cimi/lib/entities.rb +++ b/clients/cimi/lib/entities.rb @@ -21,6 +21,7 @@ end require 'entities/base_entity' require 'entities/cloud_entry_point' require 'entities/address' +require 'entities/address_template' require 'entities/machine_configuration' require 'entities/machine_admin' require 'entities/machine_image' diff --git a/clients/cimi/lib/entities/address_template.rb b/clients/cimi/lib/entities/address_template.rb new file mode 100644 index 0000000..667e647 --- /dev/null +++ b/clients/cimi/lib/entities/address_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::AddressTemplate < CIMI::Frontend::Entity + + get '/cimi/address_templates/:id' do + address_templates_xml = get_entity('address_templates', params[:id], credentials) + @address_template = CIMI::Model::AddressTemplate.from_xml(address_templates_xml) + haml :'address_templates/show' + end + + get '/cimi/address_templates' do + address_template_xml = get_entity_collection('address_templates', credentials) + @address_templates = CIMI::Model::AddressTemplateCollection.from_xml(address_template_xml) + haml :'address_templates/index' + end + +end diff --git a/clients/cimi/views/address_templates/index.haml b/clients/cimi/views/address_templates/index.haml new file mode 100644 index 0000000..93d1e48 --- /dev/null +++ b/clients/cimi/views/address_templates/index.haml @@ -0,0 +1,23 @@ +- @title=collection_name @address_templates + +- content_for :breadcrumb do + %ul.breadcrumb + %li + %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint + %span.divider="/" + %li.active + AddressTemplateCollection + +- content_for :actions do + %p + %a{ :href => "#{@address_templates.id}?format=xml", :class => 'label warning' } XML + %a{ :href => "#{@address_templates.id}?format=json", :class => 'label warning' } JSON + +%ul + - @address_templates.address_templates.each do |template| + %li + %a{ :href => "/cimi/address_templates/#{href_to_id(template.id)}"}=href_to_id(template.id) + +-details do + -row 'ID', @address_templates.id + -row 'Count', @address_templates.count diff --git a/clients/cimi/views/address_templates/show.haml b/clients/cimi/views/address_templates/show.haml new file mode 100644 index 0000000..aac2ff5 --- /dev/null +++ b/clients/cimi/views/address_templates/show.haml @@ -0,0 +1,30 @@ +- @title="#{@address_template.name}" + +- content_for :breadcrumb do + %ul.breadcrumb + %li + %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint + %span.divider="/" + %li + %a{ :href => "/cimi/network_port_templates"} AddressTemplateCollection + %span.divider="/" + %li.active + = @address_template.name + +- content_for :actions do + %p + %a{ :href => "#{@address_template.id}?format=xml", :class => 'label warning' } XML + %a{ :href => "#{@address_template.id}?format=json", :class => 'label warning' } JSON + +-details do + -row 'ID', @address_template.id + -row 'Name',@address_template.name + -row 'Description',@address_template.description + -row 'Created',@address_template.created + -row 'IP',@address_template.ip + -row 'Host name',@address_template.hostname + -row 'Allocation',@address_template.allocation + -row 'Default gateway',@address_template.default_gateway + -row 'DNS',@address_template.dns + -row 'Protocol',@address_template.protocol + -row 'mask',@address_template.mask -- 1.7.9.5