public class InvokeRequest extends AmazonWebServiceRequest implements Serializable
Invokes a Lambda function. For an example, see Create the Lambda Function and Test It Manually.
Specify just a function name to invoke the latest version of the function. To
invoke a published version, use the Qualifier
parameter to
specify a version or alias.
If you use the RequestResponse
(synchronous) invocation option,
the function will be invoked only once. If you use the Event
(asynchronous) invocation option, the function will be invoked at least once
in response to an event and the function must be idempotent to handle this.
For functions with a long timeout, your client may 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.
The TooManyRequestsException
noted below will return the
following: ConcurrentInvocationLimitExceeded
will be returned if
you have no functions with reserved concurrency and have exceeded your
account concurrent limit or if a function without reserved concurrency
exceeds the account's unreserved concurrency limit.
ReservedFunctionConcurrentInvocationLimitExceeded
will be
returned when a function with reserved concurrency exceeds its configured
concurrency limit.
Constructor and Description |
---|
InvokeRequest() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getClientContext()
Using the
ClientContext you can pass client-specific
information to the Lambda function you are invoking. |
String |
getFunctionName()
The name of the Lambda function.
|
String |
getInvocationType()
Choose from the following options.
|
String |
getLogType()
You can set this optional parameter to
Tail in the request
only if you specify the InvocationType parameter with value
RequestResponse . |
ByteBuffer |
getPayload()
JSON that you want to provide to your Lambda function as input.
|
String |
getQualifier()
Specify a version or alias to invoke a published version of the function.
|
int |
hashCode() |
void |
setClientContext(String clientContext)
Using the
ClientContext you can pass client-specific
information to the Lambda function you are invoking. |
void |
setFunctionName(String functionName)
The name of the Lambda function.
|
void |
setInvocationType(InvocationType invocationType)
Choose from the following options.
|
void |
setInvocationType(String invocationType)
Choose from the following options.
|
void |
setLogType(LogType logType)
You can set this optional parameter to
Tail in the request
only if you specify the InvocationType parameter with value
RequestResponse . |
void |
setLogType(String logType)
You can set this optional parameter to
Tail in the request
only if you specify the InvocationType parameter with value
RequestResponse . |
void |
setPayload(ByteBuffer payload)
JSON that you want to provide to your Lambda function as input.
|
void |
setQualifier(String qualifier)
Specify a version or alias to invoke a published version of the function.
|
String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
InvokeRequest |
withClientContext(String clientContext)
Using the
ClientContext you can pass client-specific
information to the Lambda function you are invoking. |
InvokeRequest |
withFunctionName(String functionName)
The name of the Lambda function.
|
InvokeRequest |
withInvocationType(InvocationType invocationType)
Choose from the following options.
|
InvokeRequest |
withInvocationType(String invocationType)
Choose from the following options.
|
InvokeRequest |
withLogType(LogType logType)
You can set this optional parameter to
Tail in the request
only if you specify the InvocationType parameter with value
RequestResponse . |
InvokeRequest |
withLogType(String logType)
You can set this optional parameter to
Tail in the request
only if you specify the InvocationType parameter with value
RequestResponse . |
InvokeRequest |
withPayload(ByteBuffer payload)
JSON that you want to provide to your Lambda function as input.
|
InvokeRequest |
withQualifier(String qualifier)
Specify a version or alias to invoke a published version of the function.
|
clone, copyBaseTo, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public String getFunctionName()
The name of the Lambda function.
Name formats
Function name - MyFunction
.
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:MyFunction
.
Partial ARN - 123456789012:function:MyFunction
.
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.
Name formats
Function name - MyFunction
.
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:MyFunction
.
Partial ARN -
123456789012:function:MyFunction
.
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(String functionName)
The name of the Lambda function.
Name formats
Function name - MyFunction
.
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:MyFunction
.
Partial ARN - 123456789012:function:MyFunction
.
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.
Name formats
Function name - MyFunction
.
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:MyFunction
.
Partial ARN -
123456789012:function:MyFunction
.
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(String functionName)
The name of the Lambda function.
Name formats
Function name - MyFunction
.
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:MyFunction
.
Partial ARN - 123456789012:function:MyFunction
.
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.
Name formats
Function name - MyFunction
.
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:MyFunction
.
Partial ARN -
123456789012:function:MyFunction
.
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 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.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if configured).
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.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if configured).
DryRun
- Validate parameter values and verify that
the user or role has permission to invoke the function.
InvocationType
public void setInvocationType(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.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if configured).
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.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if configured).
DryRun
- Validate parameter values and verify
that the user or role has permission to invoke the function.
InvocationType
public InvokeRequest withInvocationType(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.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if configured).
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.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if configured).
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.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if configured).
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.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if configured).
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.
Event
- Invoke the function asynchronously. Send events that
fail multiple times to the function's dead-letter queue (if configured).
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.
Event
- Invoke the function asynchronously. Send
events that fail multiple times to the function's dead-letter
queue (if configured).
DryRun
- Validate parameter values and verify
that the user or role has permission to invoke the function.
InvocationType
public String getLogType()
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-result
header.
Constraints:
Allowed Values: None, Tail
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-result
header.
LogType
public void setLogType(String logType)
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-result
header.
Constraints:
Allowed Values: None, Tail
logType
-
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-result
header.
LogType
public InvokeRequest withLogType(String logType)
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-result
header.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Allowed Values: None, Tail
logType
-
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-result
header.
LogType
public void setLogType(LogType logType)
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-result
header.
Constraints:
Allowed Values: None, Tail
logType
-
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-result
header.
LogType
public InvokeRequest withLogType(LogType logType)
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-result
header.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Allowed Values: None, Tail
logType
-
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-result
header.
LogType
public String getClientContext()
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,
see PutEvents in the Amazon Mobile Analytics API Reference and User
Guide.
The ClientContext JSON must be base64-encoded and has a maximum size of 3583 bytes.
ClientContext
information is returned only if you use the
synchronous (RequestResponse
) invocation type.
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, see PutEvents in the Amazon Mobile Analytics API Reference
and User Guide.
The ClientContext JSON must be base64-encoded and has a maximum size of 3583 bytes.
ClientContext
information is returned only if you
use the synchronous (RequestResponse
) invocation
type.
public void setClientContext(String clientContext)
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,
see PutEvents in the Amazon Mobile Analytics API Reference and User
Guide.
The ClientContext JSON must be base64-encoded and has a maximum size of 3583 bytes.
ClientContext
information is returned only if you use the
synchronous (RequestResponse
) invocation type.
clientContext
-
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, see PutEvents in the Amazon Mobile Analytics API Reference
and User Guide.
The ClientContext JSON must be base64-encoded and has a maximum size of 3583 bytes.
ClientContext
information is returned only if you
use the synchronous (RequestResponse
) invocation
type.
public InvokeRequest withClientContext(String clientContext)
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,
see PutEvents in the Amazon Mobile Analytics API Reference and User
Guide.
The ClientContext JSON must be base64-encoded and has a maximum size of 3583 bytes.
ClientContext
information is returned only if you use the
synchronous (RequestResponse
) invocation type.
Returns a reference to this object so that method calls can be chained together.
clientContext
-
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, see PutEvents in the Amazon Mobile Analytics API Reference
and User Guide.
The ClientContext JSON must be base64-encoded and has a maximum size of 3583 bytes.
ClientContext
information is returned only if you
use the synchronous (RequestResponse
) invocation
type.
public ByteBuffer getPayload()
JSON that you want to provide to your Lambda function as input.
JSON that you want to provide to your Lambda function as input.
public void setPayload(ByteBuffer payload)
JSON that you want to provide to your Lambda function as input.
payload
- JSON that you want to provide to your Lambda function as input.
public InvokeRequest withPayload(ByteBuffer payload)
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
- JSON that you want to provide to your Lambda function as input.
public 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(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(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 String toString()
toString
in class Object
Object.toString()
Copyright © 2019. All rights reserved.