def invoke(params={})
response = Excon::Response.new
response.status = 200
response.body = ''
unless function_id = params.delete('FunctionName')
message = 'AccessDeniedException => '
message << 'Unable to determine service/operation name to be authorized'
raise Fog::AWS::Lambda::Error, message
end
client_context = params.delete('ClientContext')
client_type = params.delete('InvocationType')
log_type = params.delete('LogType')
payload = params.delete('Payload')
if (client_context || client_type || log_type)
message = "invoke parameters handling are not yet mocked [light_black](#{caller.first})[/]"
Fog::Logger.warning message
Fog::Mock.not_implemented
end
if payload
message = "payload parameter is ignored since we are not really "
message << "invoking a function [light_black](#{caller.first})[/]"
Fog::Logger.warning message
end
function = self.get_function_configuration('FunctionName' => function_id).body
if function.is_a?(Hash) && function.has_key?('FunctionArn')
response.body = "\"Imagine #{function['FunctionArn']} was invoked\""
else
message = "ResourceNotFoundException => Function not found: #{function_id}"
raise Fog::AWS::Lambda::Error, message
end
response
end