deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH 1/5] CIMI: Added machine support for new cimi client
Date Mon, 05 Dec 2011 10:52:03 GMT
Hi,

ACK to all patches in this series. I pushed them to SVN.

 -- Michal

On Dec 2, 2011, at 7:32 PM, email4tong@gmail.com wrote:

> From: Tong Li <litong01@us.ibm.com>
> 
> ---
> clients/cimi/app.rb                    |    1 +
> clients/cimi/lib/entities.rb           |    1 +
> clients/cimi/lib/entities/machine.rb   |   30 ++++++++++++++++++++++++++++++
> clients/cimi/views/machines/index.haml |   21 +++++++++++++++++++++
> clients/cimi/views/machines/show.haml  |   32 ++++++++++++++++++++++++++++++++
> 5 files changed, 85 insertions(+), 0 deletions(-)
> create mode 100644 clients/cimi/lib/entities/machine.rb
> create mode 100644 clients/cimi/views/machines/index.haml
> create mode 100644 clients/cimi/views/machines/show.haml
> 
> diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
> index 3be0af9..33d187f 100644
> --- a/clients/cimi/app.rb
> +++ b/clients/cimi/app.rb
> @@ -19,6 +19,7 @@ module CIMI::Frontend
>     use CIMI::Frontend::CloudEntryPoint
>     use CIMI::Frontend::MachineConfiguration
>     use CIMI::Frontend::MachineImage
> +    use CIMI::Frontend::Machine
> 
>     configure do
>       enable :logging
> diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
> index 0fd1535..7b77be0 100644
> --- a/clients/cimi/lib/entities.rb
> +++ b/clients/cimi/lib/entities.rb
> @@ -22,3 +22,4 @@ require 'entities/base_entity'
> require 'entities/cloud_entry_point'
> require 'entities/machine_configuration'
> require 'entities/machine_image'
> +require 'entities/machine'
> \ No newline at end of file
> diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb
> new file mode 100644
> index 0000000..6d0d961
> --- /dev/null
> +++ b/clients/cimi/lib/entities/machine.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::Machine < CIMI::Frontend::Entity
> +
> +  get '/cimi/machines/:id' do
> +    machine_xml = CIMI::Frontend.get_entity('machines', params[:id], credentials)
> +    @machine= CIMI::Model::Machine.from_xml(machine_xml)
> +    haml :'machines/show'
> +  end
> +
> +  get '/cimi/machines' do
> +    machine_xml = CIMI::Frontend.get_entity_collection('machines', credentials)
> +    @machines = CIMI::Model::MachineCollection.from_xml(machine_xml)
> +    haml :'machines/index'
> +  end
> +
> +end
> \ No newline at end of file
> diff --git a/clients/cimi/views/machines/index.haml b/clients/cimi/views/machines/index.haml
> new file mode 100644
> index 0000000..6359d3a
> --- /dev/null
> +++ b/clients/cimi/views/machines/index.haml
> @@ -0,0 +1,21 @@
> +- @title=@machines.description
> +
> +- content_for :breadcrumb do
> +  %ul.breadcrumb
> +    %li
> +      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
> +      %span.divider="/"
> +    %li.active
> +      MachineCollection
> +
> +
> +%blockquote
> +  %p
> +    A Machine Collection entity represents the collection of Machine
> +    entities within a Provider. This entity can be used to locate and create
> +    Machines.
> +
> +%ul
> +  - @machines.machines.each do |machine|
> +    %li
> +      %a{ :href => "/cimi/machines/#{machine.href.split('/').last}"}=machine.href.split('/').last
> diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/views/machines/show.haml
> new file mode 100644
> index 0000000..088aa80
> --- /dev/null
> +++ b/clients/cimi/views/machines/show.haml
> @@ -0,0 +1,32 @@
> +- @title="#{@machine.name}"
> +
> +- content_for :breadcrumb do
> +  %ul.breadcrumb
> +    %li
> +      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
> +      %span.divider="/"
> +    %li
> +      %a{ :href => "/cimi/machines"} MachineCollection
> +      %span.divider="/"
> +    %li.active
> +      = @machine.name
> +
> +%blockquote
> +  %p
> +    This entity represents a
> +    Machine Instance
> +
> +%dl
> +  %dt URI
> +  %dd
> +    %a{ :href => @machine.uri }=@machine.uri
> +  %dt Description
> +  %dd=@machine.description
> +  %dt Created
> +  %dd #{@machine.created}&nbsp;
> +  %dt State
> +  %dd=@machine.state
> +  %dt Network Interfaces
> +  %dd=@machine.network_interfaces
> +  %dt Details
> +  %dd=@machine.inspect
> \ No newline at end of file
> -- 
> 1.7.4.1
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


Mime
View raw message