2011-08-04 11:12:20 -04:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class AWS
|
|
|
|
class Real
|
|
|
|
|
2011-08-24 21:37:00 -04:00
|
|
|
require 'fog/aws/parsers/compute/basic'
|
2011-08-04 11:12:20 -04:00
|
|
|
|
|
|
|
# Modify instance attributes
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
2011-08-15 01:22:03 -04:00
|
|
|
# * instance_id<~String> - Id of instance to modify
|
2011-08-04 11:12:20 -04:00
|
|
|
# * attributes<~Hash>:
|
|
|
|
# 'InstanceType.Value'<~String> - New instance type
|
|
|
|
# 'Kernel.Value'<~String> - New kernel value
|
|
|
|
# 'Ramdisk.Value'<~String> - New ramdisk value
|
|
|
|
# 'UserData.Value'<~String> - New userdata value
|
|
|
|
# 'DisableApiTermination.Value'<~Boolean> - Change api termination value
|
|
|
|
# 'InstanceInitiatedShutdownBehavior.Value'<~String> - New instance initiated shutdown behaviour, in ['stop', 'terminate']
|
|
|
|
# 'SourceDestCheck.Value'<~Boolean> - New sourcedestcheck value
|
|
|
|
# 'GroupId'<~Array> - One or more groups to add instance to (VPC only)
|
|
|
|
#
|
|
|
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyInstanceAttribute.html]
|
2011-08-31 04:18:43 -04:00
|
|
|
#
|
|
|
|
def modify_instance_attribute(instance_id, attributes)
|
2011-08-04 11:12:20 -04:00
|
|
|
params = {}
|
2011-08-31 04:18:43 -04:00
|
|
|
params.merge!(Fog::AWS.indexed_param('GroupId', attributes.delete('GroupId') || []))
|
|
|
|
params.merge!(attributes)
|
2011-08-04 11:12:20 -04:00
|
|
|
request({
|
|
|
|
'Action' => 'ModifyInstanceAttribute',
|
2011-08-15 01:22:03 -04:00
|
|
|
'InstanceId' => instance_id,
|
2011-08-04 11:12:20 -04:00
|
|
|
:idempotent => true,
|
|
|
|
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
|
|
|
}.merge!(params))
|
|
|
|
end
|
2011-09-02 13:30:10 -04:00
|
|
|
|
2011-08-31 04:18:43 -04:00
|
|
|
def modify_instance_attributes(instance_id, attributes)
|
2011-09-02 13:30:10 -04:00
|
|
|
Fog::Logger.warning("modify_instance_attributes method is deprecated, use 'modify_instance_attribute' instead")
|
2011-08-31 04:18:43 -04:00
|
|
|
modify_instance_attribute(instance_id, attributes)
|
|
|
|
end
|
2011-08-04 11:12:20 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|