From: Michal Fojtik <[email protected]> * Removed duplicated :id parameters used in some destroy operations
* Added :id parameters to non-standard operations Signed-off-by: Michal fojtik <[email protected]> --- server/lib/cimi/collections/machines.rb | 8 +++++++- server/lib/cimi/collections/network_ports.rb | 1 + server/lib/cimi/collections/networks.rb | 5 ++++- server/lib/cimi/collections/volumes.rb | 1 - 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb index 74a31dc..89806fa 100644 --- a/server/lib/cimi/collections/machines.rb +++ b/server/lib/cimi/collections/machines.rb @@ -62,7 +62,6 @@ module CIMI::Collections operation :destroy, :with_capability => :destroy_instance do description "Delete a specified machine." - param :id, :string, :required control do Machine.delete!(params[:id], self) no_content_with_status(200) @@ -71,6 +70,7 @@ module CIMI::Collections action :stop, :with_capability => :stop_instance do description "Stop specific machine." + param :id, :string, :required control do machine = Machine.find(params[:id], self) if request.content_type.end_with?("+json") @@ -87,6 +87,7 @@ module CIMI::Collections action :restart, :with_capability => :restart_instance do description "Start specific machine." + param :id, :string, :required control do machine = Machine.find(params[:id], self) if request.content_type.end_with?("+json") @@ -103,6 +104,7 @@ module CIMI::Collections action :start, :with_capability => :start_instance do description "Start specific machine." + param :id, :string, :required control do machine = Machine.find(params[:id], self) if request.content_type.end_with?("+json") @@ -119,6 +121,7 @@ module CIMI::Collections operation :disks, :with_capability => :hardware_profiles do description "Retrieve the Machine's DiskCollection" + param :id, :string, :required control do disks = DiskCollection.default(params[:id], self) respond_to do |format| @@ -130,6 +133,7 @@ module CIMI::Collections operation :volumes, :with_capability => :storage_volumes do description "Retrieve the Machine's MachineVolumeCollection" + param :id, :string, :required control do volumes = MachineVolumeCollection.default(params[:id], self) respond_to do |format| @@ -144,6 +148,7 @@ module CIMI::Collections #with inclusion/ommission of the volumes you want [att|det]ached action :attach_volume, :http_method => :put, :with_capability => :attach_storage_volume do description "Attach CIMI Volume(s) to a machine." + param :id, :string, :required control do if request.content_type.end_with?("+json") volumes_to_attach = Volume.find_to_attach_from_json(request.body.read, self) @@ -160,6 +165,7 @@ module CIMI::Collections action :detach_volume, :http_method => :put, :with_capability => :detach_storage_volume do description "Detach CIMI Volume(s) from a machine." + param :id, :string, :required control do if request.content_type.end_with?("+json") volumes_to_detach = Volume.find_to_attach_from_json(request.body.read, self) diff --git a/server/lib/cimi/collections/network_ports.rb b/server/lib/cimi/collections/network_ports.rb index ef6e240..e739f11 100644 --- a/server/lib/cimi/collections/network_ports.rb +++ b/server/lib/cimi/collections/network_ports.rb @@ -88,6 +88,7 @@ module CIMI::Collections action :stop, :with_capability => :stop_network_port do description "Stop specific NetworkPort." + param :id, :string, :required control do network_port = NetworkPort.find(params[:id], self) report_error(404) unless network_port diff --git a/server/lib/cimi/collections/networks.rb b/server/lib/cimi/collections/networks.rb index c11e188..1fac7ad 100644 --- a/server/lib/cimi/collections/networks.rb +++ b/server/lib/cimi/collections/networks.rb @@ -61,7 +61,6 @@ module CIMI::Collections operation :destroy, :with_capability => :delete_network do description "Delete a specified Network" - param :id, :string, :required control do Network.delete!(params[:id], self) no_content_with_status(200) @@ -70,6 +69,7 @@ module CIMI::Collections action :start, :with_capability => :start_network do description "Start specific network." + param :id, :string, :required control do network = Network.find(params[:id], self) report_error(404) unless network @@ -87,6 +87,7 @@ module CIMI::Collections action :stop, :with_capability => :stop_network do description "Stop specific network." + param :id, :string, :required control do network = Network.find(params[:id], self) report_error(404) unless network @@ -104,6 +105,7 @@ module CIMI::Collections action :suspend, :with_capability => :suspend_network do description "Suspend specific network." + param :id, :string, :required control do network = Network.find(params[:id], self) report_error(404) unless network @@ -121,6 +123,7 @@ module CIMI::Collections operation :network_ports, :with_capability => :network_ports do description "Retrieve the Network's NetworkPortCollection" + param :id, :string, :required control do network_ports = NetworkPortCollection.for_network(params[:id], self) respond_to do |format| diff --git a/server/lib/cimi/collections/volumes.rb b/server/lib/cimi/collections/volumes.rb index 80350de..0baea47 100644 --- a/server/lib/cimi/collections/volumes.rb +++ b/server/lib/cimi/collections/volumes.rb @@ -67,7 +67,6 @@ module CIMI::Collections operation :destroy do description "Delete a specified Volume" - param :id, :string, :required control do Volume.delete!(params[:id], self) no_content_with_status(200) -- 1.7.10.2
