deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [2/54] git commit: CIMI: Replaced 'check_capability' with Sinatra::Base
Date Mon, 20 Aug 2012 08:53:44 GMT
CIMI: Replaced 'check_capability' with Sinatra::Base

* The 'check_capability' is obsoleted in Rabbit and the Sinatra
  method 'set' is used instead.

* Added missing driver methods to :with_capability options


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/c3833af2
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/c3833af2
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/c3833af2

Branch: refs/heads/master
Commit: c3833af2b30da320ce162468f9f4a0c582bd54a2
Parents: eb55781
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Aug 16 11:59:06 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Mon Aug 20 10:53:54 2012 +0200

----------------------------------------------------------------------
 server/lib/cimi/collections/address_templates.rb   |    6 ++--
 server/lib/cimi/collections/addresses.rb           |   11 ++++---
 server/lib/cimi/collections/entity_metadata.rb     |    2 -
 server/lib/cimi/collections/machine_admins.rb      |   10 +++---
 .../lib/cimi/collections/machine_configurations.rb |    4 +-
 server/lib/cimi/collections/machine_images.rb      |    6 ++--
 server/lib/cimi/collections/machines.rb            |   20 +++++++-------
 .../lib/cimi/collections/network_configurations.rb |    7 +++--
 server/lib/cimi/collections/network_templates.rb   |    7 +++--
 server/lib/cimi/collections/networks.rb            |   16 ++++++------
 .../cimi/collections/routing_group_templates.rb    |    7 +++--
 server/lib/cimi/collections/routing_groups.rb      |    7 +++--
 .../lib/cimi/collections/volume_configurations.rb  |    6 ++--
 server/lib/cimi/collections/volume_images.rb       |    6 ++--
 server/lib/cimi/collections/volumes.rb             |    7 +++--
 server/lib/cimi/collections/vsp_configurations.rb  |    7 +++--
 server/lib/cimi/collections/vsp_templates.rb       |    7 +++--
 server/lib/cimi/collections/vsps.rb                |   15 ++++++-----
 18 files changed, 79 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/address_templates.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/address_templates.rb b/server/lib/cimi/collections/address_templates.rb
index db59507..809fc82 100644
--- a/server/lib/cimi/collections/address_templates.rb
+++ b/server/lib/cimi/collections/address_templates.rb
@@ -16,11 +16,11 @@
 module CIMI::Collections
   class AddressTemplates < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
 
     collection :address_templates do
 
-      operation :index do
+      operation :index, :with_capability => :address_templates do
         description 'List all AddressTemplates in the AddressTemplateCollection'
         param :CIMISelect, :string, :optional
         control do
@@ -32,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :address_template do
         description 'Show a specific AddressTemplate'
         control do
           address_template = CIMI::Model::AddressTemplate.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/addresses.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/addresses.rb b/server/lib/cimi/collections/addresses.rb
index 96871c1..ca2959e 100644
--- a/server/lib/cimi/collections/addresses.rb
+++ b/server/lib/cimi/collections/addresses.rb
@@ -16,12 +16,13 @@
 module CIMI::Collections
   class Addresses < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :addresses do
 
       description 'An Address represents an IP address, and its associated metdata, for a
particular Network.'
 
-      operation :index do
+      operation :index, :with_capability => :addresses do
         description 'List all Addresses in the AddressCollection'
         param :CIMISelect, :string, :optional
         control do
@@ -33,7 +34,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :address do
         description 'Show a specific Address'
         control do
           address = CIMI::Model::Address.find(params[:id], self)
@@ -44,7 +45,7 @@ module CIMI::Collections
         end
       end
 
-      operation :create do
+      operation :create, :with_capability => :create_address do
         description "Create a new Address"
         control do
           if request.content_type.end_with?("json")
@@ -59,7 +60,7 @@ module CIMI::Collections
         end
       end
 
-      operation :destroy do
+      operation :destroy, :with_capability => :delete_address do
         description "Delete a specified Address"
         param :id, :string, :required
         control do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/entity_metadata.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/entity_metadata.rb b/server/lib/cimi/collections/entity_metadata.rb
index 84e1fec..0bca4e3 100644
--- a/server/lib/cimi/collections/entity_metadata.rb
+++ b/server/lib/cimi/collections/entity_metadata.rb
@@ -16,8 +16,6 @@
 module CIMI::Collections
   class EntityMetadata < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
-
     collection :entity_metadata do
 
       operation :index do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/machine_admins.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/machine_admins.rb b/server/lib/cimi/collections/machine_admins.rb
index c413cc9..d2cf3b4 100644
--- a/server/lib/cimi/collections/machine_admins.rb
+++ b/server/lib/cimi/collections/machine_admins.rb
@@ -16,12 +16,12 @@
 module CIMI::Collections
   class MachineAdmins < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
 
     collection :machine_admins do
       description 'Machine Admin entity'
 
-      operation :index do
+      operation :index, :with_capability => :keys do
         description "List all machine admins"
         param :CIMISelect,  :string,  :optional
         control do
@@ -33,7 +33,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :key do
         description "Show specific machine admin"
         control do
           machine_admin = MachineAdmin.find(params[:id], self)
@@ -44,7 +44,7 @@ module CIMI::Collections
         end
       end
 
-      operation :create do
+      operation :create, :with_capability => :create_key do
         description "Show specific machine admin"
         control do
           if request.content_type.end_with?("+json")
@@ -60,7 +60,7 @@ module CIMI::Collections
         end
       end
 
-      operation :delete do
+      operation :delete, :with_capability => :destroy_key do
         description "Delete specified MachineAdmin entity"
         control do
           MachineAdmin.delete!(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/machine_configurations.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/machine_configurations.rb b/server/lib/cimi/collections/machine_configurations.rb
index 5b09e6a..d7840df 100644
--- a/server/lib/cimi/collections/machine_configurations.rb
+++ b/server/lib/cimi/collections/machine_configurations.rb
@@ -21,7 +21,7 @@ module CIMI::Collections
     collection :machine_configurations do
       description 'List all machine configurations'
 
-      operation :index do
+      operation :index, :with_capability => :hardware_profiles do
         param :CIMISelect,  :string,  :optional
         description "List all machine configurations"
         control do
@@ -33,7 +33,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :hardware_profile do
         control do
           machine_conf = MachineConfiguration.find(params[:id], self)
           respond_to do |format|

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/machine_images.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/machine_images.rb b/server/lib/cimi/collections/machine_images.rb
index 1296279..f43fe9b 100644
--- a/server/lib/cimi/collections/machine_images.rb
+++ b/server/lib/cimi/collections/machine_images.rb
@@ -16,12 +16,12 @@
 module CIMI::Collections
   class MachineImages < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
 
     collection :machine_images do
       description 'List all machine images'
 
-      operation :index do
+      operation :index, :with_capability => :images do
         description "List all machine configurations"
         param :CIMISelect,  :string,  :optional
         control do
@@ -33,7 +33,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :image do
         description "Show specific machine image."
         control do
           machine_image = MachineImage.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/machines.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb
index cadbcad..6084506 100644
--- a/server/lib/cimi/collections/machines.rb
+++ b/server/lib/cimi/collections/machines.rb
@@ -16,12 +16,12 @@
 module CIMI::Collections
   class Machines < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
 
     collection :machines do
       description 'List all machine'
 
-      operation :index do
+      operation :index, :with_capability => :instances do
         param :CIMISelect,  :string,  :optional
         description "List all machines"
         control do
@@ -33,7 +33,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :instance do
         description "Show specific machine."
         control do
           machine = Machine.find(params[:id], self)
@@ -44,7 +44,7 @@ module CIMI::Collections
         end
       end
 
-      operation :create do
+      operation :create, :with_capability => :create_instance do
         description "Create a new Machine entity."
         control do
           if request.content_type.end_with?("+json")
@@ -60,7 +60,7 @@ module CIMI::Collections
         end
       end
 
-      operation :destroy do
+      operation :destroy, :with_capability => :destroy_instance do
         description "Delete a specified machine."
         param :id,          :string,    :required
         control do
@@ -69,7 +69,7 @@ module CIMI::Collections
         end
       end
 
-      action :stop do
+      action :stop, :with_capability => :stop_instance do
         description "Stop specific machine."
         control do
           machine = Machine.find(params[:id], self)
@@ -85,7 +85,7 @@ module CIMI::Collections
         end
       end
 
-      action :restart do
+      action :restart, :with_capability => :restart_instance do
         description "Start specific machine."
         control do
           machine = Machine.find(params[:id], self)
@@ -101,7 +101,7 @@ module CIMI::Collections
         end
       end
 
-      action :start do
+      action :start, :with_capability => :start_instance do
         description "Start specific machine."
         control do
           machine = Machine.find(params[:id], self)
@@ -120,7 +120,7 @@ module CIMI::Collections
       #NOTE: The routes for attach/detach used here are NOT as specified by CIMI
       #will likely move later. CIMI specifies PUT of the whole Machine description
       #with inclusion/ommission of the volumes you want [att|det]ached
-      action :attach_volume, :http_method => :put do
+      action :attach_volume, :http_method => :put, :with_capability => :attach_storage_volume
do
         description "Attach CIMI Volume(s) to a machine."
         control do
           if request.content_type.end_with?("+json")
@@ -136,7 +136,7 @@ module CIMI::Collections
         end
       end
 
-      action :detach_volume, :http_method => :put do
+      action :detach_volume, :http_method => :put, :with_capability => :detach_storage_volume
do
         description "Detach CIMI Volume(s) from a machine."
         control do
           if request.content_type.end_with?("+json")

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/network_configurations.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/network_configurations.rb b/server/lib/cimi/collections/network_configurations.rb
index 02452a8..62faf3e 100644
--- a/server/lib/cimi/collections/network_configurations.rb
+++ b/server/lib/cimi/collections/network_configurations.rb
@@ -16,10 +16,11 @@
 module CIMI::Collections
   class NetworkConfigurations < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :network_configurations do
 
-      operation :index do
+      operation :index, :with_capability => :network_configurations do
         description 'List all NetworkConfigurations'
         param :CIMISelect, :string, :optional
         control do
@@ -31,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :network_configuration do
         description 'Show a specific NetworkConfiguration'
         control do
           network_config = NetworkConfiguration.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/network_templates.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/network_templates.rb b/server/lib/cimi/collections/network_templates.rb
index 0ff82b2..05d86c2 100644
--- a/server/lib/cimi/collections/network_templates.rb
+++ b/server/lib/cimi/collections/network_templates.rb
@@ -16,10 +16,11 @@
 module CIMI::Collections
   class NetworkTemplates < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :network_templates do
 
-      operation :index do
+      operation :index, :with_capability => :network_templates do
         description 'List all Network Templates in the NetworkTemplateCollection'
         param :CIMISelect, :string, :optional
         control do
@@ -31,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :network_template do
         description 'Show a specific Network Template'
         control do
           network_template = NetworkTemplate.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/networks.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/networks.rb b/server/lib/cimi/collections/networks.rb
index 0aa21e8..4f26b0b 100644
--- a/server/lib/cimi/collections/networks.rb
+++ b/server/lib/cimi/collections/networks.rb
@@ -16,12 +16,12 @@
 module CIMI::Collections
   class Networks < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
 
     collection :networks do
       description 'A Network represents an abstraction of a layer 2 broadcast domain'
 
-      operation :index do
+      operation :index, :with_capability => :networks do
         description "List all Networks"
         param :CIMISelect,  :string,  :optional
         control do
@@ -33,7 +33,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :network do
         description "Show a specific Network"
         control do
           network = Network.find(params[:id], self)
@@ -44,7 +44,7 @@ module CIMI::Collections
         end
       end
 
-      operation :create do
+      operation :create, :with_capability => :create_network do
         description "Create a new Network"
         control do
           if request.content_type.end_with?("json")
@@ -59,7 +59,7 @@ module CIMI::Collections
         end
       end
 
-      operation :destroy do
+      operation :destroy, :with_capability => :delete_network do
         description "Delete a specified Network"
         param :id, :string, :required
         control do
@@ -68,7 +68,7 @@ module CIMI::Collections
         end
       end
 
-      action :start do
+      action :start, :with_capability => :start_network do
         description "Start specific network."
         control do
           network = Network.find(params[:id], self)
@@ -85,7 +85,7 @@ module CIMI::Collections
         end
       end
 
-      action :stop do
+      action :stop, :with_capability => :stop_network do
         description "Stop specific network."
         control do
           network = Network.find(params[:id], self)
@@ -102,7 +102,7 @@ module CIMI::Collections
         end
       end
 
-      action :suspend do
+      action :suspend, :with_capability => :suspend_network do
         description "Suspend specific network."
         control do
           network = Network.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/routing_group_templates.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/routing_group_templates.rb b/server/lib/cimi/collections/routing_group_templates.rb
index 995b1f8..d320d28 100644
--- a/server/lib/cimi/collections/routing_group_templates.rb
+++ b/server/lib/cimi/collections/routing_group_templates.rb
@@ -16,10 +16,11 @@
 module CIMI::Collections
   class RoutingGroupTemplates < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :routing_group_templates do
 
-      operation :index do
+      operation :index, :with_capability => :routing_groups do
         description 'List all RoutingGroupTemplates in the RoutingGroupTemplateCollection'
         param :CIMISelect, :string, :optional
         control do
@@ -31,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :routing_group do
         description 'Show a specific RoutingGroupTemplate'
         control do
           routing_group_template = RoutingGroupTemplate.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/routing_groups.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/routing_groups.rb b/server/lib/cimi/collections/routing_groups.rb
index 5e7ccc5..751290c 100644
--- a/server/lib/cimi/collections/routing_groups.rb
+++ b/server/lib/cimi/collections/routing_groups.rb
@@ -16,10 +16,11 @@
 module CIMI::Collections
   class RoutingGroups < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :routing_groups do
 
-      operation :index do
+      operation :index, :with_capability => :routing_groups do
         description 'List all RoutingGroups in the RoutingGroupsCollection'
         param :CIMISelect, :string, :optional
         control do
@@ -31,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :routing_group do
         description 'Show a specific RoutingGroup'
         control do
           routing_group = RoutingGroup.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/volume_configurations.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/volume_configurations.rb b/server/lib/cimi/collections/volume_configurations.rb
index 055e28c..0887462 100644
--- a/server/lib/cimi/collections/volume_configurations.rb
+++ b/server/lib/cimi/collections/volume_configurations.rb
@@ -16,11 +16,11 @@
 module CIMI::Collections
   class VolumeConfigurations < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
 
     collection :volume_configurations do
 
-      operation :index do
+      operation :index, :with_capability => :storage_volumes do
         description "Get list all VolumeConfigurations"
         param :CIMISelect,  :string,  :optional
         control do
@@ -32,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :storage_volume do
         description "Get a specific VolumeConfiguration"
         control do
           volume_config = VolumeConfiguration.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/volume_images.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/volume_images.rb b/server/lib/cimi/collections/volume_images.rb
index 78432b1..64db9ae 100644
--- a/server/lib/cimi/collections/volume_images.rb
+++ b/server/lib/cimi/collections/volume_images.rb
@@ -16,12 +16,12 @@
 module CIMI::Collections
   class VolumeImages < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
 
     collection :volume_images do
       description 'This entity represents an image that could be place on a pre-loaded volume.'
 
-      operation :index do
+      operation :index, :with_capability => :storage_snapshots do
         description "List all volumes images"
         param :CIMISelect,  :string,  :optional
         control do
@@ -33,7 +33,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :storage_snapshot do
         description "Show a specific volume image"
         control do
           volume_image = VolumeImage.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/volumes.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/volumes.rb b/server/lib/cimi/collections/volumes.rb
index 1c45c9e..80350de 100644
--- a/server/lib/cimi/collections/volumes.rb
+++ b/server/lib/cimi/collections/volumes.rb
@@ -16,10 +16,11 @@
 module CIMI::Collections
   class Volumes < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :volumes do
 
-      operation :index do
+      operation :index, :with_capability => :storage_volumes do
         description "List all volumes"
         param :CIMISelect,  :string,  :optional
         control do
@@ -31,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :storage_volume do
         description "Show specific Volume."
         control do
           volume = Volume.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/vsp_configurations.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/vsp_configurations.rb b/server/lib/cimi/collections/vsp_configurations.rb
index 31acceb..8a76605 100644
--- a/server/lib/cimi/collections/vsp_configurations.rb
+++ b/server/lib/cimi/collections/vsp_configurations.rb
@@ -16,10 +16,11 @@
 module CIMI::Collections
   class VspConfigurations < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :vsp_configurations do
 
-      operation :index do
+      operation :index, :with_capability => :vsp_configurations do
         description 'List all VSPConfigurations in the VSPConfigurationCollection'
         param :CIMISelect, :string, :optional
         control do
@@ -31,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :vsp_configuration do
         description 'Show a specific VSPConfiguration'
         control do
           vsp_config = VSPConfiguration.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/vsp_templates.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/vsp_templates.rb b/server/lib/cimi/collections/vsp_templates.rb
index 503de50..dab7db3 100644
--- a/server/lib/cimi/collections/vsp_templates.rb
+++ b/server/lib/cimi/collections/vsp_templates.rb
@@ -16,12 +16,13 @@
 module CIMI::Collections
   class VspTemplates < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :vsp_templates do
 
       description 'The VSP Template is a set of Configuration values for realizing a VSP.
A VSP Template may be used to create multiple VSPs'
 
-      operation :index do
+      operation :index, :with_capability => :vsp_templates do
         description 'List all VSPTemplates in the VSPTemplateCollection'
         param :CIMISelect, :string, :optional
         control do
@@ -33,7 +34,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :vsp_template do
         description 'Show a specific VSPTemplate'
         control do
           vsp_template = VSPTemplate.find(params[:id], self)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c3833af2/server/lib/cimi/collections/vsps.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/collections/vsps.rb b/server/lib/cimi/collections/vsps.rb
index 52b1a5a..7106c91 100644
--- a/server/lib/cimi/collections/vsps.rb
+++ b/server/lib/cimi/collections/vsps.rb
@@ -16,12 +16,13 @@
 module CIMI::Collections
   class Vsps < Base
 
-    check_capability :for => lambda { |m| driver.respond_to? m }
+    set :capability, lambda { |m| driver.respond_to? m }
+
     collection :vsps do
 
       description 'A VSP represents the connection parameters of a network port'
 
-      operation :index do
+      operation :index, :with_capability => :vsps do
         description 'List all VSPs in the VSPCollection'
         param :CIMISelect, :string, :optional
         control do
@@ -33,7 +34,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show do
+      operation :show, :with_capability => :vsp do
         description 'Show a specific VSP'
         control do
           vsp = VSP.find(params[:id], self)
@@ -44,7 +45,7 @@ module CIMI::Collections
         end
       end
 
-      operation :create do
+      operation :create, :with_capability => :create_vsp do
         description "Create a new VSP"
         control do
           if request.content_type.end_with?("json")
@@ -59,7 +60,7 @@ module CIMI::Collections
         end
       end
 
-      operation :destroy do
+      operation :destroy, :with_capability => :delete_vsp do
         description "Delete a specified VSP"
         control do
           CIMI::Model::VSP.delete!(params[:id], self)
@@ -67,7 +68,7 @@ module CIMI::Collections
         end
       end
 
-      action :start do
+      action :start, :with_capability => :start_vsp do
         description "Start specific VSP."
         param :id,          :string,    :required
         control do
@@ -85,7 +86,7 @@ module CIMI::Collections
         end
       end
 
-      action :stop do
+      action :stop, :with_capability => :stop_vsp do
         description "Stop specific VSP."
         control do
           vsp = VSP.find(params[:id], self)


Mime
View raw message