2010-07-23 00:52:27 -04:00
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class AWS
|
2010-07-23 00:52:27 -04:00
|
|
|
class Real
|
|
|
|
|
2011-08-24 21:37:00 -04:00
|
|
|
require 'fog/aws/parsers/compute/start_stop_instances'
|
2010-07-23 00:52:27 -04:00
|
|
|
|
|
|
|
# Stop specified instance
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * instance_id<~Array> - Id of instance to start
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'requestId'<~String> - Id of request
|
|
|
|
# * TODO: fill in the blanks
|
2011-05-19 12:31:56 -04:00
|
|
|
#
|
|
|
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html]
|
2011-08-08 03:29:16 -04:00
|
|
|
def stop_instances(instance_id, force = false)
|
2011-06-20 16:49:37 -04:00
|
|
|
params = Fog::AWS.indexed_param('InstanceId', instance_id)
|
2011-08-08 03:29:16 -04:00
|
|
|
params.merge!('Force' => 'true') if force
|
2010-07-23 00:52:27 -04:00
|
|
|
request({
|
|
|
|
'Action' => 'StopInstances',
|
|
|
|
:idempotent => true,
|
2011-06-16 19:28:54 -04:00
|
|
|
:parser => Fog::Parsers::Compute::AWS::StartStopInstances.new
|
2010-07-23 00:52:27 -04:00
|
|
|
}.merge!(params))
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|