1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/compute/requests/aws/modify_image_attributes.rb

38 lines
1.3 KiB
Ruby
Raw Normal View History

2010-05-03 20:10:43 -04:00
module Fog
module Compute
class AWS
2010-05-03 20:10:43 -04:00
class Real
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']
#
#
#
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html]
#
2010-05-03 20:10:43 -04:00
def modify_image_attributes(image_id, attribute, operation_type, options = {})
params = {}
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,
'OperationType' => operation_type,
:idempotent => true,
:parser => Fog::Parsers::Compute::AWS::Basic.new
2010-05-03 20:10:43 -04:00
}.merge!(params))
end
end
end
end
end