def update_event_source_mapping(params={})
mapping_id = params.delete('UUID')
mapping = self.data[:event_source_mappings][mapping_id]
unless mapping
message = 'ResourceNotFoundException => '
message << 'The resource you requested does not exist.'
raise Fog::AWS::Lambda::Error, message
end
function_name = params.delete('FunctionName')
function = {}
if function_name
function_opts = { 'FunctionName' => function_name }
function = self.get_function_configuration(function_opts).body
function_arn = function['FunctionArn']
end
batch_size = params.delete('BatchSize')
enabled = params.delete('Enabled')
update = {}
if function_name && !function.empty? && function_arn
update.merge!('FunctionArn' => function_arn)
end
update.merge!('BatchSize' => batch_size) if batch_size
update.merge!('Enabled' => enabled) if !enabled.nil?
mapping.merge!(update)
mapping['State'] = 'Disabling' if enabled.eql?(false)
mapping['State'] = 'Enabling' if enabled.eql?(true)
response = Excon::Response.new
response.status = 202
response.body = mapping
response
end