lib/nephophobia/compute.rb in nephophobia-0.0.9 vs lib/nephophobia/compute.rb in nephophobia-0.1.0

- old
+ new

@@ -58,46 +58,42 @@ # "DisplayName" => "testserver1", # "DisplayDescription" => "test description" # } def create image_id, params = {} - filter = { - "ImageId" => image_id - }.merge params + response = @client.action "RunInstances", { "ImageId" => image_id }.merge(params) - response = @client.action "RunInstances", filter - ComputeData.new response.body['RunInstancesResponse'] end ## # Removes the given 'instance_id'. # Returns instances response to a state change. # # +instance_id+: A String representing the ID of the instance. def destroy instance_id - filter = { + params = { "InstanceId.1" => instance_id } - response = @client.action "TerminateInstances", filter + response = @client.action "TerminateInstances", params ResponseData.new response.body['TerminateInstancesResponse'] end ## # Returns information about the given 'instance_id'. # # +instance_id+: A String representing the ID of the instance. def find instance_id - filter = { + params = { "InstanceId.1" => instance_id } - response = @client.action "DescribeInstances", filter + response = @client.action "DescribeInstances", params ComputeData.new response.body['DescribeInstancesResponse']['reservationSet']['item'] end ## @@ -105,15 +101,15 @@ # Returns instances response to a state change. # # +instance_id+: A String representing the ID of the instance. def reboot instance_id - filter = { + params = { "InstanceId.1" => instance_id } - response = @client.action "RebootInstances", filter + response = @client.action "RebootInstances", params ResponseData.new response.body['RebootInstancesResponse'] end ## @@ -121,15 +117,15 @@ # Returns instances current and previous state. # # +instance_id+: A String representing the ID of the instance. def start instance_id - filter = { + params = { "InstanceId.1" => instance_id } - response = @client.action "StopInstances", filter + response = @client.action "StopInstances", params ResponseData.new response.body end ## @@ -137,14 +133,14 @@ # Returns instances current and previous state. # # +instance_id+: A String representing the ID of the instance. def stop instance_id - filter = { + params = { "InstanceId.1" => instance_id } - response = @client.action "StartInstances", filter + response = @client.action "StartInstances", params ResponseData.new response.body end end end