Copyright | (c) 2013-2015 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Invokes a specified Lambda function.
This operation requires permission for the 'lambda:InvokeFunction' action.
See: AWS API Reference for Invoke.
- invoke :: Text -> HashMap Text Value -> Invoke
- data Invoke
- iInvocationType :: Lens' Invoke (Maybe InvocationType)
- iLogType :: Lens' Invoke (Maybe LogType)
- iClientContext :: Lens' Invoke (Maybe Text)
- iFunctionName :: Lens' Invoke Text
- iPayload :: Lens' Invoke (HashMap Text Value)
- invokeResponse :: Int -> InvokeResponse
- data InvokeResponse
- irsFunctionError :: Lens' InvokeResponse (Maybe Text)
- irsLogResult :: Lens' InvokeResponse (Maybe Text)
- irsPayload :: Lens' InvokeResponse (Maybe (HashMap Text Value))
- irsStatusCode :: Lens' InvokeResponse Int
Creating a Request
Creates a value of Invoke
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
See: invoke
smart constructor.
Request Lenses
iInvocationType :: Lens' Invoke (Maybe InvocationType) Source
By default, the Invoke
API assumes "RequestResponse" invocation
type. You can optionally request asynchronous execution by specifying
"Event" as the InvocationType
. You can also use this parameter to
request AWS Lambda to not execute the function but do some verification,
such as if the caller is authorized to invoke the function and if the
inputs are valid. You request this by specifying "DryRun" as the
InvocationType
. This is useful in a cross-account scenario when you
want to verify access to a function without running it.
iLogType :: Lens' Invoke (Maybe LogType) Source
You can set this optional parameter to "Tail" in the request only if
you specify the InvocationType
parameter with value
"RequestResponse". In this case, AWS Lambda returns the base64-encoded
last 4 KB of log data produced by your Lambda function in the
'x-amz-log-results' header.
iClientContext :: Lens' Invoke (Maybe Text) Source
Using the ClientContext
you can pass client-specific information to
the Lambda function you are invoking. You can then process the client
information in your Lambda function as you choose through the context
variable. For an example of a ClientContext JSON, go to
PutEvents
in the Amazon Mobile Analytics API Reference and User Guide.
The ClientContext JSON must be base64-encoded.
iFunctionName :: Lens' Invoke Text Source
The Lambda function name.
You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.
iPayload :: Lens' Invoke (HashMap Text Value) Source
JSON that you want to provide to your Lambda function as input.
Destructuring the Response
Creates a value of InvokeResponse
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
data InvokeResponse Source
Upon success, returns an empty response. Otherwise, throws an exception.
See: invokeResponse
smart constructor.
Response Lenses
irsFunctionError :: Lens' InvokeResponse (Maybe Text) Source
Indicates whether an error occurred while executing the Lambda function.
If an error occurred this field will have one of two values; Handled
or Unhandled
. Handled
errors are errors that are reported by the
function while the Unhandled
errors are those detected and reported by
AWS Lambda. Unhandled errors include out of memory errors and function
timeouts. For information about how to report an Handled
error, see
Programming Model.
irsLogResult :: Lens' InvokeResponse (Maybe Text) Source
It is the base64-encoded logs for the Lambda function invocation. This is present only if the invocation type is "RequestResponse" and the logs were requested.
irsPayload :: Lens' InvokeResponse (Maybe (HashMap Text Value)) Source
It is the JSON representation of the object returned by the Lambda function. In This is present only if the invocation type is "RequestResponse".
In the event of a function error this field contains a message
describing the error. For the Handled
errors the Lambda function will
report this message. For Unhandled
errors AWS Lambda reports the
message.
irsStatusCode :: Lens' InvokeResponse Int Source
The HTTP status code will be in the 200 range for successful request. For the "RequestResonse" invocation type this status code will be 200. For the "Event" invocation type this status code will be 202. For the "DryRun" invocation type the status code will be 204.