Interface IFunction
- All Superinterfaces:
IConnectable
,software.constructs.IConstruct
,software.constructs.IDependable
,IGrantable
,IResource
,software.amazon.jsii.JsiiSerializable
- All Known Subinterfaces:
IAlias
,IAlias.Jsii$Default
,IFunction.Jsii$Default
,IVersion
,IVersion.Jsii$Default
- All Known Implementing Classes:
Alias
,DockerImageFunction
,EdgeFunction
,Function
,FunctionBase
,GoFunction
,IAlias.Jsii$Proxy
,IFunction.Jsii$Proxy
,IVersion.Jsii$Proxy
,NodejsFunction
,PythonFunction
,QualifiedFunctionBase
,SingletonFunction
,TriggerFunction
,Version
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Internal default implementation forIFunction
.static final class
A proxy class which represents a concrete javascript instance of this type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventSource
(IEventSource source) Adds an event source to this function.addEventSourceMapping
(String id, EventSourceMappingOptions options) Adds an event source that maps to this AWS Lambda function.Adds a url to this lambda function.addFunctionUrl
(FunctionUrlOptions options) Adds a url to this lambda function.void
addPermission
(String id, Permission permission) Adds a permission to the Lambda resource policy.void
addToRolePolicy
(PolicyStatement statement) Adds a statement to the IAM role assumed by the instance.void
Configures options for asynchronous invocation.The system architectures compatible with this lambda function.The ARN of the function.The name of the function.Whether or not this Lambda function was bound to a VPC.The$LATEST
version of this function.software.constructs.Node
The construct node where permissions are attached.The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().default IRole
getRole()
The IAM role associated with this function.grantInvoke
(IGrantable identity) Grant the given identity permissions to invoke this Lambda.grantInvokeCompositePrincipal
(CompositePrincipal compositePrincipal) Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.grantInvokeLatestVersion
(IGrantable identity) Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.grantInvokeUrl
(IGrantable identity) Grant the given identity permissions to invoke this Lambda Function URL.grantInvokeVersion
(IGrantable identity, IVersion version) Grant the given identity permissions to invoke the given version of this Lambda.Return the given named metric for this Lambda Return the given named metric for this Function.metric
(String metricName, MetricOptions props) Return the given named metric for this Lambda Return the given named metric for this Function.Metric for the Duration of this Lambda How long execution of this Lambda takes.metricDuration
(MetricOptions props) Metric for the Duration of this Lambda How long execution of this Lambda takes.How many invocations of this Lambda fail.metricErrors
(MetricOptions props) How many invocations of this Lambda fail.Metric for the number of invocations of this Lambda How often this Lambda is invoked.metricInvocations
(MetricOptions props) Metric for the number of invocations of this Lambda How often this Lambda is invoked.Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.metricThrottles
(MetricOptions props) Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.Methods inherited from interface software.amazon.awscdk.services.ec2.IConnectable
getConnections
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.services.iam.IGrantable
getGrantPrincipal
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getArchitecture
The system architectures compatible with this lambda function. -
getFunctionArn
The ARN of the function. -
getFunctionName
The name of the function. -
getIsBoundToVpc
Whether or not this Lambda function was bound to a VPC.If this is is
false
, trying to access theconnections
object will fail. -
getLatestVersion
The$LATEST
version of this function.Note that this is reference to a non-specific AWS Lambda version, which means the function this version refers to can return different results in different invocations.
To obtain a reference to an explicit version which references the current function configuration, use
lambdaFunction.currentVersion
instead. -
getPermissionsNode
@Stability(Stable) @NotNull software.constructs.Node getPermissionsNode()The construct node where permissions are attached. -
getResourceArnsForGrantInvoke
The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().This property is for cdk modules to consume only. You should not need to use this property. Instead, use grantInvoke() directly.
-
getRole
The IAM role associated with this function. -
addEventSource
Adds an event source to this function.Event sources are implemented in the aws-cdk-lib/aws-lambda-event-sources module.
The following example adds an SQS Queue as an event source:
import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; myFunction.addEventSource(new SqsEventSource(myQueue));
- Parameters:
source
- This parameter is required.
-
addEventSourceMapping
@Stability(Stable) @NotNull EventSourceMapping addEventSourceMapping(@NotNull String id, @NotNull EventSourceMappingOptions options) Adds an event source that maps to this AWS Lambda function.- Parameters:
id
- construct ID. This parameter is required.options
- mapping options. This parameter is required.
-
addFunctionUrl
Adds a url to this lambda function.- Parameters:
options
-
-
addFunctionUrl
Adds a url to this lambda function. -
addPermission
Adds a permission to the Lambda resource policy.- Parameters:
id
- The id for the permission construct. This parameter is required.permission
- The permission to grant to this Lambda function. This parameter is required.- See Also:
-
addToRolePolicy
Adds a statement to the IAM role assumed by the instance.- Parameters:
statement
- This parameter is required.
-
configureAsyncInvoke
Configures options for asynchronous invocation.- Parameters:
options
- This parameter is required.
-
grantInvoke
Grant the given identity permissions to invoke this Lambda.- Parameters:
identity
- This parameter is required.
-
grantInvokeCompositePrincipal
@Stability(Stable) @NotNull List<Grant> grantInvokeCompositePrincipal(@NotNull CompositePrincipal compositePrincipal) Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.- Parameters:
compositePrincipal
- This parameter is required.
-
grantInvokeLatestVersion
Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.- Parameters:
identity
- This parameter is required.
-
grantInvokeUrl
Grant the given identity permissions to invoke this Lambda Function URL.- Parameters:
identity
- This parameter is required.
-
grantInvokeVersion
@Stability(Stable) @NotNull Grant grantInvokeVersion(@NotNull IGrantable identity, @NotNull IVersion version) Grant the given identity permissions to invoke the given version of this Lambda.- Parameters:
identity
- This parameter is required.version
- This parameter is required.
-
metric
@Stability(Stable) @NotNull Metric metric(@NotNull String metricName, @Nullable MetricOptions props) Return the given named metric for this Lambda Return the given named metric for this Function.- Parameters:
metricName
- This parameter is required.props
-
-
metric
Return the given named metric for this Lambda Return the given named metric for this Function.- Parameters:
metricName
- This parameter is required.
-
metricDuration
Metric for the Duration of this Lambda How long execution of this Lambda takes.Average over 5 minutes
Default: average over 5 minutes
- Parameters:
props
-
-
metricDuration
Metric for the Duration of this Lambda How long execution of this Lambda takes.Average over 5 minutes
Default: average over 5 minutes
-
metricErrors
How many invocations of this Lambda fail.Sum over 5 minutes
- Parameters:
props
-
-
metricErrors
How many invocations of this Lambda fail.Sum over 5 minutes
-
metricInvocations
Metric for the number of invocations of this Lambda How often this Lambda is invoked.Sum over 5 minutes
Default: sum over 5 minutes
- Parameters:
props
-
-
metricInvocations
Metric for the number of invocations of this Lambda How often this Lambda is invoked.Sum over 5 minutes
Default: sum over 5 minutes
-
metricThrottles
Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.Sum over 5 minutes
Default: sum over 5 minutes
- Parameters:
props
-
-
metricThrottles
Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.Sum over 5 minutes
Default: sum over 5 minutes
-