public class InvokeRequest extends AmazonWebServiceRequest implements java.io.Serializable
Invokes a Lambda function. You can invoke a function synchronously (and wait
for the response), or asynchronously. To invoke a function asynchronously,
set InvocationType
to Event
.
For synchronous invocation, details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the execution log and trace.
When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client, event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error, Lambda executes the function up to two more times. For more information, see Retry Behavior.
For asynchronous invocation, Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a dead-letter queue.
The status code in the API response doesn't reflect function errors. Error
codes are reserved for errors that prevent your function from executing, such
as permissions errors, limit
errors, or issues with your function's code and configuration. For
example, Lambda returns TooManyRequestsException
if executing
the function would cause you to exceed a concurrency limit at either the
account level (ConcurrentInvocationLimitExceeded
) or function
level (ReservedFunctionConcurrentInvocationLimitExceeded
).
For functions with a long timeout, your client might be disconnected during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings.
This operation requires permission for the lambda:InvokeFunction action.
Constructor and Description |
---|
InvokeRequest() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getClientContext()
Up to 3583 bytes of base64-encoded data about the invoking client to pass
to the function in the context object.
|
java.lang.String |
getFunctionName()
The name of the Lambda function, version, or alias.
|
java.lang.String |
getInvocationType()
Choose from the following options.
|
java.lang.String |
getLogType()
Set to
Tail to include the execution log in the response. |
java.nio.ByteBuffer |
getPayload()
The JSON that you want to provide to your Lambda function as input.
|
java.lang.String |
getQualifier()
Specify a version or alias to invoke a published version of the function.
|
int |
hashCode() |
void |
setClientContext(java.lang.String clientContext)
Up to 3583 bytes of base64-encoded data about the invoking client to pass
to the function in the context object.
|
void |
setFunctionName(java.lang.String functionName)
The name of the Lambda function, version, or alias.
|
void |
setInvocationType(InvocationType invocationType)
Choose from the following options.
|
void |
setInvocationType(java.lang.String invocationType)
Choose from the following options.
|
void |
setLogType(LogType logType)
Set to
Tail to include the execution log in the response. |
void |
setLogType(java.lang.String logType)
Set to
Tail to include the execution log in the response. |
void |
setPayload(java.nio.ByteBuffer payload)
The JSON that you want to provide to your Lambda function as input.
|
void |
setQualifier(java.lang.String qualifier)
Specify a version or alias to invoke a published version of the function.
|
java.lang.String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
InvokeRequest |
withClientContext(java.lang.String clientContext)
Up to 3583 bytes of base64-encoded data about the invoking client to pass
to the function in the context object.
|
InvokeRequest |
withFunctionName(java.lang.String functionName)
The name of the Lambda function, version, or alias.
|
InvokeRequest |
withInvocationType(InvocationType invocationType)
Choose from the following options.
|
InvokeRequest |
withInvocationType(java.lang.String invocationType)
Choose from the following options.
|
InvokeRequest |
withLogType(LogType logType)
Set to
Tail to include the execution log in the response. |
InvokeRequest |
withLogType(java.lang.String logType)
Set to
Tail to include the execution log in the response. |
InvokeRequest |
withPayload(java.nio.ByteBuffer payload)
The JSON that you want to provide to your Lambda function as input.
|
InvokeRequest |
withQualifier(java.lang.String qualifier)
Specify a version or alias to invoke a published version of the function.
|
clone, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public java.lang.String getFunctionName()
The name of the Lambda function, version, or alias.
Name formats
Function name - my-function
(name-only),
my-function:v1
(with alias).
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:my-function
.
Partial ARN - 123456789012:function:my-function
.
You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
Constraints:
Length: 1 - 170
Pattern:
(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{
1}:)?(\d{12}
:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?
The name of the Lambda function, version, or alias.
Name formats
Function name - my-function
(name-only),
my-function:v1
(with alias).
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:my-function
.
Partial ARN -
123456789012:function:my-function
.
You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
public void setFunctionName(java.lang.String functionName)
The name of the Lambda function, version, or alias.
Name formats
Function name - my-function
(name-only),
my-function:v1
(with alias).
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:my-function
.
Partial ARN - 123456789012:function:my-function
.
You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
Constraints:
Length: 1 - 170
Pattern:
(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{
1}:)?(\d{12}
:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?
functionName
- The name of the Lambda function, version, or alias.
Name formats
Function name - my-function
(name-only),
my-function:v1
(with alias).
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:my-function
.
Partial ARN -
123456789012:function:my-function
.
You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
public InvokeRequest withFunctionName(java.lang.String functionName)
The name of the Lambda function, version, or alias.
Name formats
Function name - my-function
(name-only),
my-function:v1
(with alias).
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:my-function
.
Partial ARN - 123456789012:function:my-function
.
You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 170
Pattern:
(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{
1}:)?(\d{12}
:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?
functionName
- The name of the Lambda function, version, or alias.
Name formats
Function name - my-function
(name-only),
my-function:v1
(with alias).
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:my-function
.
Partial ARN -
123456789012:function:my-function
.
You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
public java.lang.String getInvocationType()
Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function returns a
response or times out. The API response includes the function response
and additional data.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if it's
configured). The API response only includes a status code.
DryRun
- Validate parameter values and verify that the user
or role has permission to invoke the function.
Constraints:
Allowed Values: Event, RequestResponse, DryRun
Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function
returns a response or times out. The API response includes the
function response and additional data.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if it's configured). The API response only includes a
status code.
DryRun
- Validate parameter values and verify that
the user or role has permission to invoke the function.
InvocationType
public void setInvocationType(java.lang.String invocationType)
Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function returns a
response or times out. The API response includes the function response
and additional data.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if it's
configured). The API response only includes a status code.
DryRun
- Validate parameter values and verify that the user
or role has permission to invoke the function.
Constraints:
Allowed Values: Event, RequestResponse, DryRun
invocationType
- Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function
returns a response or times out. The API response includes the
function response and additional data.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if it's configured). The API response only includes a
status code.
DryRun
- Validate parameter values and verify
that the user or role has permission to invoke the function.
InvocationType
public InvokeRequest withInvocationType(java.lang.String invocationType)
Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function returns a
response or times out. The API response includes the function response
and additional data.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if it's
configured). The API response only includes a status code.
DryRun
- Validate parameter values and verify that the user
or role has permission to invoke the function.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Allowed Values: Event, RequestResponse, DryRun
invocationType
- Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function
returns a response or times out. The API response includes the
function response and additional data.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if it's configured). The API response only includes a
status code.
DryRun
- Validate parameter values and verify
that the user or role has permission to invoke the function.
InvocationType
public void setInvocationType(InvocationType invocationType)
Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function returns a
response or times out. The API response includes the function response
and additional data.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if it's
configured). The API response only includes a status code.
DryRun
- Validate parameter values and verify that the user
or role has permission to invoke the function.
Constraints:
Allowed Values: Event, RequestResponse, DryRun
invocationType
- Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function
returns a response or times out. The API response includes the
function response and additional data.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if it's configured). The API response only includes a
status code.
DryRun
- Validate parameter values and verify
that the user or role has permission to invoke the function.
InvocationType
public InvokeRequest withInvocationType(InvocationType invocationType)
Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function returns a
response or times out. The API response includes the function response
and additional data.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if it's
configured). The API response only includes a status code.
DryRun
- Validate parameter values and verify that the user
or role has permission to invoke the function.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Allowed Values: Event, RequestResponse, DryRun
invocationType
- Choose from the following options.
RequestResponse
(default) - Invoke the function
synchronously. Keep the connection open until the function
returns a response or times out. The API response includes the
function response and additional data.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if it's configured). The API response only includes a
status code.
DryRun
- Validate parameter values and verify
that the user or role has permission to invoke the function.
InvocationType
public java.lang.String getLogType()
Set to Tail
to include the execution log in the response.
Constraints:
Allowed Values: None, Tail
Set to Tail
to include the execution log in the
response.
LogType
public void setLogType(java.lang.String logType)
Set to Tail
to include the execution log in the response.
Constraints:
Allowed Values: None, Tail
logType
-
Set to Tail
to include the execution log in the
response.
LogType
public InvokeRequest withLogType(java.lang.String logType)
Set to Tail
to include the execution log in the response.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Allowed Values: None, Tail
logType
-
Set to Tail
to include the execution log in the
response.
LogType
public void setLogType(LogType logType)
Set to Tail
to include the execution log in the response.
Constraints:
Allowed Values: None, Tail
logType
-
Set to Tail
to include the execution log in the
response.
LogType
public InvokeRequest withLogType(LogType logType)
Set to Tail
to include the execution log in the response.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Allowed Values: None, Tail
logType
-
Set to Tail
to include the execution log in the
response.
LogType
public java.lang.String getClientContext()
Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
public void setClientContext(java.lang.String clientContext)
Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
clientContext
- Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
public InvokeRequest withClientContext(java.lang.String clientContext)
Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
Returns a reference to this object so that method calls can be chained together.
clientContext
- Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
public java.nio.ByteBuffer getPayload()
The JSON that you want to provide to your Lambda function as input.
The JSON that you want to provide to your Lambda function as input.
public void setPayload(java.nio.ByteBuffer payload)
The JSON that you want to provide to your Lambda function as input.
payload
- The JSON that you want to provide to your Lambda function as input.
public InvokeRequest withPayload(java.nio.ByteBuffer payload)
The JSON that you want to provide to your Lambda function as input.
Returns a reference to this object so that method calls can be chained together.
payload
- The JSON that you want to provide to your Lambda function as input.
public java.lang.String getQualifier()
Specify a version or alias to invoke a published version of the function.
Constraints:
Length: 1 - 128
Pattern: (|[a-zA-Z0-9$_-]+)
Specify a version or alias to invoke a published version of the function.
public void setQualifier(java.lang.String qualifier)
Specify a version or alias to invoke a published version of the function.
Constraints:
Length: 1 - 128
Pattern: (|[a-zA-Z0-9$_-]+)
qualifier
- Specify a version or alias to invoke a published version of the function.
public InvokeRequest withQualifier(java.lang.String qualifier)
Specify a version or alias to invoke a published version of the function.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 128
Pattern: (|[a-zA-Z0-9$_-]+)
qualifier
- Specify a version or alias to invoke a published version of the function.
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.