@Generated(value="jsii-pacmak/1.24.0 (build b722f66)", date="2021-03-11T13:46:44.564Z") @Stability(value=Stable) public abstract class FunctionBase extends Resource implements IFunction
software.constructs.Construct.Buildersoftware.amazon.jsii.JsiiObject.InitializationModeIFunction.Jsii$Default| Modifier | Constructor and Description |
|---|---|
protected |
FunctionBase(software.constructs.Construct scope,
String id) |
protected |
FunctionBase(software.constructs.Construct scope,
String id,
ResourceProps props) |
protected |
FunctionBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
FunctionBase(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventSource(IEventSource source)
Adds an event source to this function.
|
EventSourceMapping |
addEventSourceMapping(String id,
EventSourceMappingOptions options)
Adds an event source that maps to this AWS 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 |
configureAsyncInvoke(EventInvokeConfigOptions options)
Configures options for asynchronous invocation.
|
protected abstract Boolean |
getCanCreatePermissions()
Whether the addPermission() call adds any permissions.
|
Connections |
getConnections()
Access the Connections object.
|
abstract String |
getFunctionArn()
The ARN fo the function.
|
abstract String |
getFunctionName()
The name of the function.
|
abstract IPrincipal |
getGrantPrincipal()
The principal this Lambda Function is running as.
|
Boolean |
getIsBoundToVpc()
Whether or not this Lambda function was bound to a VPC.
|
IVersion |
getLatestVersion()
The `$LATEST` version of this function.
|
abstract ConstructNode |
getPermissionsNode()
The construct node where permissions are attached.
|
abstract IRole |
getRole()
The IAM role associated with this function.
|
Grant |
grantInvoke(IGrantable grantee)
Grant the given identity permissions to invoke this Lambda.
|
Metric |
metric(String metricName)
Return the given named metric for this Function.
|
Metric |
metric(String metricName,
MetricOptions props)
Return the given named metric for this Function.
|
Metric |
metricDuration()
How long execution of this Lambda takes.
|
Metric |
metricDuration(MetricOptions props)
How long execution of this Lambda takes.
|
Metric |
metricErrors()
How many invocations of this Lambda fail.
|
Metric |
metricErrors(MetricOptions props)
How many invocations of this Lambda fail.
|
Metric |
metricInvocations()
How often this Lambda is invoked.
|
Metric |
metricInvocations(MetricOptions props)
How often this Lambda is invoked.
|
Metric |
metricThrottles()
How often this Lambda is throttled.
|
Metric |
metricThrottles(MetricOptions props)
How often this Lambda is throttled.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourcegetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validatejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetNodeprotected FunctionBase(software.amazon.jsii.JsiiObjectRef objRef)
protected FunctionBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
protected FunctionBase(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
ResourceProps props)
scope - This parameter is required.id - This parameter is required.props - @Stability(value=Stable)
protected FunctionBase(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - This parameter is required.id - This parameter is required.@Stability(value=Stable)
public void addEventSource(@NotNull
IEventSource source)
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));
addEventSource in interface IFunctionsource - This parameter is required.@Stability(value=Stable) @NotNull public EventSourceMapping addEventSourceMapping(@NotNull String id, @NotNull EventSourceMappingOptions options)
addEventSourceMapping in interface IFunctionid - This parameter is required.options - This parameter is required.@Stability(value=Stable)
public void addPermission(@NotNull
String id,
@NotNull
Permission permission)
addPermission in interface IFunctionid - The id ƒor the permission construct. This parameter is required.permission - The permission to grant to this Lambda function. This parameter is required.for details.@Stability(value=Stable)
public void addToRolePolicy(@NotNull
PolicyStatement statement)
addToRolePolicy in interface IFunctionstatement - This parameter is required.@Stability(value=Stable)
public void configureAsyncInvoke(@NotNull
EventInvokeConfigOptions options)
configureAsyncInvoke in interface IFunctionoptions - This parameter is required.@Stability(value=Stable) @NotNull public Grant grantInvoke(@NotNull IGrantable grantee)
grantInvoke in interface IFunctiongrantee - This parameter is required.@Stability(value=Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props)
@Stability(value=Stable) @NotNull public Metric metric(@NotNull String metricName)
@Stability(value=Stable) @NotNull public Metric metricDuration(@Nullable MetricOptions props)
Average over 5 minutes
metricDuration in interface IFunctionprops - @Stability(value=Stable) @NotNull public Metric metricDuration()
Average over 5 minutes
metricDuration in interface IFunction@Stability(value=Stable) @NotNull public Metric metricErrors(@Nullable MetricOptions props)
Sum over 5 minutes
metricErrors in interface IFunctionprops - @Stability(value=Stable) @NotNull public Metric metricErrors()
Sum over 5 minutes
metricErrors in interface IFunction@Stability(value=Stable) @NotNull public Metric metricInvocations(@Nullable MetricOptions props)
Sum over 5 minutes
metricInvocations in interface IFunctionprops - @Stability(value=Stable) @NotNull public Metric metricInvocations()
Sum over 5 minutes
metricInvocations in interface IFunction@Stability(value=Stable) @NotNull public Metric metricThrottles(@Nullable MetricOptions props)
Sum over 5 minutes
metricThrottles in interface IFunctionprops - @Stability(value=Stable) @NotNull public Metric metricThrottles()
Sum over 5 minutes
metricThrottles in interface IFunction@Stability(value=Stable) @NotNull protected abstract Boolean getCanCreatePermissions()
True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.
@Stability(value=Stable) @NotNull public Connections getConnections()
Will fail if not a VPC-enabled Lambda Function
getConnections in interface IConnectable@Stability(value=Stable) @NotNull public abstract String getFunctionArn()
getFunctionArn in interface IFunction@Stability(value=Stable) @NotNull public abstract String getFunctionName()
getFunctionName in interface IFunction@Stability(value=Stable) @NotNull public abstract IPrincipal getGrantPrincipal()
getGrantPrincipal in interface IGrantable@Stability(value=Stable) @NotNull public Boolean getIsBoundToVpc()
If this is is false, trying to access the connections object will fail.
getIsBoundToVpc in interface IFunction@Stability(value=Stable) @NotNull public IVersion getLatestVersion()
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.
getLatestVersion in interface IFunction@Stability(value=Stable) @NotNull public abstract ConstructNode getPermissionsNode()
getPermissionsNode in interface IFunctionCopyright © 2021. All rights reserved.