2010-05-03 20:10:43 -04:00
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class AWS
|
2010-05-03 20:10:43 -04:00
|
|
|
class Real
|
|
|
|
|
2011-02-22 22:05:14 -05:00
|
|
|
require 'fog/compute/parsers/aws/basic'
|
|
|
|
|
2010-05-03 20:10:43 -04:00
|
|
|
# Modify image attributes
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * image_id<~String> - Id of machine image to modify
|
|
|
|
# * attribute<~String> - Attribute to modify, in ['launchPermission', 'productCodes']
|
|
|
|
# * operation_type<~String> - Operation to perform on attribute, in ['add', 'remove']
|
|
|
|
#
|
2011-05-19 12:31:56 -04:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html]
|
|
|
|
#
|
2011-08-03 18:20:39 -04:00
|
|
|
def modify_image_attribute(image_id, attribute, operation_type, options = {})
|
2010-05-03 20:10:43 -04:00
|
|
|
params = {}
|
2011-06-20 16:49:37 -04:00
|
|
|
params.merge!(Fog::AWS.indexed_param('UserId', options['UserId']))
|
|
|
|
params.merge!(Fog::AWS.indexed_param('UserGroup', options['UserGroup']))
|
|
|
|
params.merge!(Fog::AWS.indexed_param('ProductCode', options['ProductCode']))
|
2010-05-03 20:10:43 -04:00
|
|
|
request({
|
|
|
|
'Action' => 'ModifyImageAttribute',
|
|
|
|
'Attribute' => attribute,
|
|
|
|
'ImageId' => image_id,
|
2010-05-03 21:31:30 -04:00
|
|
|
'OperationType' => operation_type,
|
2010-05-24 17:22:35 -04:00
|
|
|
:idempotent => true,
|
2011-06-16 19:28:54 -04:00
|
|
|
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
2010-05-03 20:10:43 -04:00
|
|
|
}.merge!(params))
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|