You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:43:05 UTC
svn commit: r962280 - in /incubator/deltacloud/trunk/server: server.rb
views/hardware_profiles/index.xml.haml views/hardware_profiles/show.xml.haml
Author: lutter
Date: Thu Jul 8 23:43:05 2010
New Revision: 962280
URL: http://svn.apache.org/viewvc?rev=962280&view=rev
Log:
Hardware profiles: generate XML output
Added:
incubator/deltacloud/trunk/server/views/hardware_profiles/index.xml.haml
incubator/deltacloud/trunk/server/views/hardware_profiles/show.xml.haml
Modified:
incubator/deltacloud/trunk/server/server.rb
Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=962280&r1=962279&r2=962280&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Thu Jul 8 23:43:05 2010
@@ -290,15 +290,21 @@ collection :instances do
end
collection :hardware_profiles do
- description "Hardware profiles"
+ description <<END
+ A hardware profile represents a configuration of resources upon which a
+ machine may be deployed. It defines aspects such as local disk storage,
+ available RAM, and architecture. Each provider is free to define as many
+ (or as few) hardware profiles as desired.
+END
operation :index do
description "List of available hardware profiles"
param :id, :string
+ param :architecture, :string, :optional, [ 'i386', 'x86_64' ]
control do
- @profiles = driver.hardware_profiles
+ @profiles = driver.hardware_profiles(credentials, params)
respond_to do |format|
- format.xml { convert_to_xml(:hardware_profiles, @profiles) }
+ format.xml { haml :'hardware_profiles/index' }
format.html { haml :'hardware_profiles/index' }
end
end
Added: incubator/deltacloud/trunk/server/views/hardware_profiles/index.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/hardware_profiles/index.xml.haml?rev=962280&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/views/hardware_profiles/index.xml.haml (added)
+++ incubator/deltacloud/trunk/server/views/hardware_profiles/index.xml.haml Thu Jul 8 23:43:05 2010
@@ -0,0 +1,4 @@
+!!! XML
+%hardware-profiles
+ - @profiles.each do |prof|
+ = haml :'hardware_profiles/show', :locals => { :@profile => prof, :partial => true }
Added: incubator/deltacloud/trunk/server/views/hardware_profiles/show.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/hardware_profiles/show.xml.haml?rev=962280&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/views/hardware_profiles/show.xml.haml (added)
+++ incubator/deltacloud/trunk/server/views/hardware_profiles/show.xml.haml Thu Jul 8 23:43:05 2010
@@ -0,0 +1,17 @@
+- unless defined?(partial)
+ !!! XML
+%hardware-profile{ :href => hardware_profile_url(@profile.name) }
+ %id= @profile.name
+ - @profile.each_property do |prop|
+ - attr = { :name => prop.name, :kind => prop.kind, :unit => prop.unit }
+ - if prop.kind == :fixed
+ %property{ attr, :value => prop.value }/
+ - else
+ %property{ attr, :value => prop.default }
+ %param{ :operation => "create", :href => instances_url, :method => "post", :name => prop.param }
+ - if prop.kind == :range
+ %range{ :first => prop.first, :last => prop.last }/
+ - elsif prop.kind == :enum
+ %enum
+ - prop.values.each do |v|
+ %entry{ :value => v }/