def invoke(params={})
headers = {}
if client_context = params.delete('ClientContext')
headers['X-Amz-Client-Context'] =
Base64::encode64(Fog::Json.encode(client_context))
end
if client_type = params.delete('InvocationType')
headers['X-Amz-Client-Type'] = client_type
end
if log_type = params.delete('LogType')
headers['X-Amz-Log-Type'] = log_type
end
payload = Fog::JSON.encode(params.delete('Payload'))
function_name = params.delete('FunctionName')
request({
:method => 'POST',
:path => "/functions/#{function_name}/invocations",
:headers => headers,
:body => payload,
:expects => [200, 202, 204]
}.merge(params))
end