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:16:05 UTC
svn commit: r962001 - in /incubator/deltacloud/trunk/framework:
app/controllers/ app/views/api/ app/views/root/ config/
Author: lutter
Date: Thu Jul 8 23:16:05 2010
New Revision: 962001
URL: http://svn.apache.org/viewvc?rev=962001&view=rev
Log:
Create API entry-point for discovery of inner entry points.
Added:
incubator/deltacloud/trunk/framework/app/controllers/api_controller.rb
incubator/deltacloud/trunk/framework/app/views/api/
incubator/deltacloud/trunk/framework/app/views/api/show.html.erb
incubator/deltacloud/trunk/framework/app/views/api/show.xml.erb
Modified:
incubator/deltacloud/trunk/framework/app/controllers/application_controller.rb
incubator/deltacloud/trunk/framework/app/views/root/index.html.erb
incubator/deltacloud/trunk/framework/config/routes.rb
Added: incubator/deltacloud/trunk/framework/app/controllers/api_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/api_controller.rb?rev=962001&view=auto
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/api_controller.rb (added)
+++ incubator/deltacloud/trunk/framework/app/controllers/api_controller.rb Thu Jul 8 23:16:05 2010
@@ -0,0 +1,20 @@
+
+class ApiController < ApplicationController
+
+ def show
+ @version = 1.0
+ @entry_points = [
+ [ :flavors, flavors_url ],
+ [ :images, images_url ],
+ [ :instances, instances_url ],
+ [ :storage_volumes, storage_volumes_url ],
+ [ :storage_snapshots, storage_snapshots_url ],
+ ]
+ respond_to do |format|
+ format.html
+ format.json
+ format.xml
+ end
+ end
+
+end
Modified: incubator/deltacloud/trunk/framework/app/controllers/application_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/application_controller.rb?rev=962001&r1=962000&r2=962001&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/application_controller.rb (original)
+++ incubator/deltacloud/trunk/framework/app/controllers/application_controller.rb Thu Jul 8 23:16:05 2010
@@ -9,6 +9,8 @@ class ApplicationController < ActionCont
# filter_parameter_logging :password
+ protected
+
def credentials
creds = {}
authenticate_with_http_basic do |name,password|
Added: incubator/deltacloud/trunk/framework/app/views/api/show.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/api/show.html.erb?rev=962001&view=auto
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/api/show.html.erb (added)
+++ incubator/deltacloud/trunk/framework/app/views/api/show.html.erb Thu Jul 8 23:16:05 2010
@@ -0,0 +1,7 @@
+<h1>API v<%= @version %></h1>
+
+<ul>
+ <% for entry_point in @entry_points %>
+ <li><%= link_to entry_point[0], entry_point[1] %></li>
+ <% end %>
+</ul>
Added: incubator/deltacloud/trunk/framework/app/views/api/show.xml.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/api/show.xml.erb?rev=962001&view=auto
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/api/show.xml.erb (added)
+++ incubator/deltacloud/trunk/framework/app/views/api/show.xml.erb Thu Jul 8 23:16:05 2010
@@ -0,0 +1,5 @@
+<api version="<%= @version %>">
+ <% for entry_point in @entry_points %>
+ <link rel="<%= entry_point[0] %>"><%= entry_point[1] %></link>
+ <% end %>
+</api>
Modified: incubator/deltacloud/trunk/framework/app/views/root/index.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/root/index.html.erb?rev=962001&r1=962000&r2=962001&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/root/index.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/root/index.html.erb Thu Jul 8 23:16:05 2010
@@ -2,14 +2,4 @@
<!-- <h1>δ-cloud-framework</h1> -->
<h1>DeltaCloud: <%= DRIVER.to_s.titlecase %></h1>
-<ul>
- <li><%= link_to 'Flavors', flavors_url %></li>
- <li><%= link_to 'Images', images_url %></li>
- <li><%= link_to 'Instances', instances_url %></li>
- <li>Storage
- <ul>
- <li><%= link_to 'Volumes', storage_volumes_url %></li>
- <li><%= link_to 'Snapshots', storage_snapshots_url %></li>
- </ul>
- </li>
-</ul>
+<%= link_to 'API', api_url %>
Modified: incubator/deltacloud/trunk/framework/config/routes.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/config/routes.rb?rev=962001&r1=962000&r2=962001&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/config/routes.rb (original)
+++ incubator/deltacloud/trunk/framework/config/routes.rb Thu Jul 8 23:16:05 2010
@@ -4,6 +4,8 @@ ActionController::Routing::Routes.draw d
map.root :controller=>'root'
+ map.resource :api, :controller=>'Api'
+
map.resources :images
map.resources :instances,