Class FunctionBase
- All Implemented Interfaces:
- IConstruct,- IDependable,- IResource,- IClientVpnConnectionHandler,- IConnectable,- IGrantable,- IFunction,- software.amazon.jsii.JsiiSerializable,- software.constructs.IConstruct
- Direct Known Subclasses:
- Function,- QualifiedFunctionBase,- SingletonFunction
- 
Nested Class SummaryNested classes/interfaces inherited from class software.constructs.Constructsoftware.constructs.Construct.BuilderNested classes/interfaces inherited from class software.amazon.jsii.JsiiObjectsoftware.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IClientVpnConnectionHandlerIClientVpnConnectionHandler.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstructIConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstructsoftware.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.lambda.IFunctionIFunction.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IResourceIResource.Jsii$Default
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedFunctionBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedFunctionBase(software.amazon.jsii.JsiiObjectRef objRef) protectedFunctionBase(software.constructs.Construct scope, String id) protectedFunctionBase(software.constructs.Construct scope, String id, ResourceProps props) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddEventSource(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.voidaddPermission(String id, Permission permission) Adds a permission to the Lambda resource policy.voidaddToRolePolicy(PolicyStatement statement) Adds a statement to the IAM role assumed by the instance.voidConfigures options for asynchronous invocation.voidconsiderWarningOnInvokeFunctionPermissions(Construct scope, String action) A warning will be added to functions under the following conditions: - permissions that includelambda:InvokeFunctionare added to the unqualified function.abstract ArchitectureThe architecture of this Lambda Function.protected abstract BooleanWhether the addPermission() call adds any permissions.Access the Connections object.abstract StringThe ARN fo the function.abstract StringThe name of the function.abstract IPrincipalThe principal this Lambda Function is running as.Whether or not this Lambda function was bound to a VPC.The$LATESTversion of this function.abstract ConstructNodeThe construct node where permissions are attached.The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().abstract IRolegetRole()The IAM role associated with this function.grantInvoke(IGrantable grantee) Grant the given identity permissions to invoke this Lambda.grantInvokeUrl(IGrantable grantee) Grant the given identity permissions to invoke this Lambda Function URL.Return the given named metric for this Function.metric(String metricName, MetricOptions props) Return the given named metric for this Function.How long execution of this Lambda takes.metricDuration(MetricOptions props) How long execution of this Lambda takes.How many invocations of this Lambda fail.metricErrors(MetricOptions props) How many invocations of this Lambda fail.How often this Lambda is invoked.metricInvocations(MetricOptions props) How often this Lambda is invoked.How often this Lambda is throttled.metricThrottles(MetricOptions props) How often this Lambda is throttled.protected voidMethods inherited from class software.amazon.awscdk.core.ResourceapplyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourceMethods inherited from class software.amazon.awscdk.core.ConstructgetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods inherited from class software.constructs.ConstructtoStringMethods inherited from class software.amazon.jsii.JsiiObjectjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.core.IConstructgetNodeMethods inherited from interface software.amazon.awscdk.core.IResourceapplyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable$jsii$toJson
- 
Constructor Details- 
FunctionBaseprotected FunctionBase(software.amazon.jsii.JsiiObjectRef objRef) 
- 
FunctionBaseprotected FunctionBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) 
- 
FunctionBase@Stability(Stable) protected FunctionBase(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable ResourceProps props) - Parameters:
- scope- This parameter is required.
- id- This parameter is required.
- props-
 
- 
FunctionBase@Stability(Stable) protected FunctionBase(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
- scope- This parameter is required.
- id- This parameter is required.
 
 
- 
- 
Method Details- 
addEventSourceAdds an event source to this function.Event sources are implemented in the @aws-cdk/aws-lambda-event-sources module. The following example adds an SQS Queue as an event source: import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources'; myFunction.addEventSource(new SqsEventSource(myQueue));- Specified by:
- addEventSourcein interface- IFunction
- Parameters:
- source- This parameter is required.
 
- 
addEventSourceMapping@Stability(Stable) @NotNull public EventSourceMapping addEventSourceMapping(@NotNull String id, @NotNull EventSourceMappingOptions options) Adds an event source that maps to this AWS Lambda function.- Specified by:
- addEventSourceMappingin interface- IFunction
- Parameters:
- id- This parameter is required.
- options- This parameter is required.
 
- 
addFunctionUrlAdds a url to this lambda function.- Specified by:
- addFunctionUrlin interface- IFunction
- Parameters:
- options-
 
- 
addFunctionUrlAdds a url to this lambda function.- Specified by:
- addFunctionUrlin interface- IFunction
 
- 
addPermissionAdds a permission to the Lambda resource policy.- Specified by:
- addPermissionin interface- IFunction
- 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:
 
- 
addToRolePolicyAdds a statement to the IAM role assumed by the instance.- Specified by:
- addToRolePolicyin interface- IFunction
- Parameters:
- statement- This parameter is required.
 
- 
configureAsyncInvokeConfigures options for asynchronous invocation.- Specified by:
- configureAsyncInvokein interface- IFunction
- Parameters:
- options- This parameter is required.
 
- 
considerWarningOnInvokeFunctionPermissions@Stability(Stable) public void considerWarningOnInvokeFunctionPermissions(@NotNull Construct scope, @NotNull String action) A warning will be added to functions under the following conditions: - permissions that includelambda:InvokeFunctionare added to the unqualified function.- function.currentVersion is invoked before or after the permission is created.
 This applies only to permissions on Lambda functions, not versions or aliases. This function is overridden as a noOp for QualifiedFunctionBase. - Parameters:
- scope- This parameter is required.
- action- This parameter is required.
 
- 
grantInvokeGrant the given identity permissions to invoke this Lambda.- Specified by:
- grantInvokein interface- IFunction
- Parameters:
- grantee- This parameter is required.
 
- 
grantInvokeUrlGrant the given identity permissions to invoke this Lambda Function URL.- Specified by:
- grantInvokeUrlin interface- IFunction
- Parameters:
- grantee- This parameter is required.
 
- 
metric@Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props) Return the given named metric for this Function.
- 
metricReturn the given named metric for this Function.
- 
metricDurationHow long execution of this Lambda takes.Average over 5 minutes - Specified by:
- metricDurationin interface- IFunction
- Parameters:
- props-
 
- 
metricDurationHow long execution of this Lambda takes.Average over 5 minutes - Specified by:
- metricDurationin interface- IFunction
 
- 
metricErrorsHow many invocations of this Lambda fail.Sum over 5 minutes - Specified by:
- metricErrorsin interface- IFunction
- Parameters:
- props-
 
- 
metricErrorsHow many invocations of this Lambda fail.Sum over 5 minutes - Specified by:
- metricErrorsin interface- IFunction
 
- 
metricInvocationsHow often this Lambda is invoked.Sum over 5 minutes - Specified by:
- metricInvocationsin interface- IFunction
- Parameters:
- props-
 
- 
metricInvocationsHow often this Lambda is invoked.Sum over 5 minutes - Specified by:
- metricInvocationsin interface- IFunction
 
- 
metricThrottlesHow often this Lambda is throttled.Sum over 5 minutes - Specified by:
- metricThrottlesin interface- IFunction
- Parameters:
- props-
 
- 
metricThrottlesHow often this Lambda is throttled.Sum over 5 minutes - Specified by:
- metricThrottlesin interface- IFunction
 
- 
warnInvokeFunctionPermissions- Parameters:
- scope- This parameter is required.
 
- 
getArchitectureThe architecture of this Lambda Function.- Specified by:
- getArchitecturein interface- IFunction
 
- 
getCanCreatePermissionsWhether the addPermission() call adds any permissions.True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts. 
- 
getConnectionsAccess the Connections object.Will fail if not a VPC-enabled Lambda Function - Specified by:
- getConnectionsin interface- IConnectable
 
- 
getFunctionArnThe ARN fo the function.- Specified by:
- getFunctionArnin interface- IClientVpnConnectionHandler
- Specified by:
- getFunctionArnin interface- IFunction
 
- 
getFunctionNameThe name of the function.- Specified by:
- getFunctionNamein interface- IClientVpnConnectionHandler
- Specified by:
- getFunctionNamein interface- IFunction
 
- 
getGrantPrincipalThe principal this Lambda Function is running as.- Specified by:
- getGrantPrincipalin interface- IGrantable
 
- 
getIsBoundToVpcWhether or not this Lambda function was bound to a VPC.If this is is false, trying to access theconnectionsobject will fail.- Specified by:
- getIsBoundToVpcin interface- IFunction
 
- 
getLatestVersionThe$LATESTversion 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.currentVersioninstead.- Specified by:
- getLatestVersionin interface- IFunction
 
- 
getPermissionsNodeThe construct node where permissions are attached.- Specified by:
- getPermissionsNodein interface- IFunction
 
- 
getResourceArnsForGrantInvokeThe ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().- Specified by:
- getResourceArnsForGrantInvokein interface- IFunction
 
- 
getRoleThe IAM role associated with this function.Undefined if the function was imported without a role. 
 
-