The routing pattern we use in CB2 needs to be finalized.  Currently there are a 
couple of different routing patterns in use which is going to lead to problems 
down the road.

Fact:  We need to have two controllers per barclamp/managed object.  One for UI 
and another for API calls.  There was an earlier discussion around using a 
single controller for both UI and API, the output of this design discussion is 
we need two. 

Please let's assume there will be two moving forward and limit the scope of 
this thread to the routing pattern.

As a starting place we could use namespaces.   The UI would use the root 
namespace and api calls would fall under a :api namespace that includes a 
version scope.

Example routes for Network Barclamp

resources :networks  #UI routes for networks, URL http:[host]:[port]/networks

namespace :api
     scope ':barclamp' do
          scope ':version' do
               resources :networks #Versioned API routes for networks , URL 
http:[host]:[port]/api/network/v2/networks
               resources :conduits  #Versioned API routes for conduits,  URL 
http:[host]:[port]/api/network/v2/conduits
             ...
        end
   end 
end 

The controllers would then be located in file system as follows:
[barclamp_root]/app/controllers/networks_controller.rb - UI Controller
[barclamp_root]/app/controllers/api/networks_controller.rb - API controller.

There are other ways of doing, this is one idea.    We need to settle on a 
common scheme ASAP.

Feedback please.





_______________________________________________
Crowbar mailing list
Crowbar@dell.com
https://lists.us.dell.com/mailman/listinfo/crowbar
For more information: http://crowbar.github.com/

Reply via email to