@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)", date="2022-08-09T19:16:38.881Z") public abstract class FunctionBase extends Resource implements IFunction, IClientVpnConnectionHandler
IFunction.Jsii$Default
IClientVpnConnectionHandler.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
FunctionBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
FunctionBase(software.amazon.jsii.JsiiObjectRef objRef) |
protected |
FunctionBase(software.constructs.Construct scope,
java.lang.String id) |
protected |
FunctionBase(software.constructs.Construct scope,
java.lang.String id,
ResourceProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addEventSource(IEventSource source)
Adds an event source to this function.
|
EventSourceMapping |
addEventSourceMapping(java.lang.String id,
EventSourceMappingOptions options)
Adds an event source that maps to this AWS Lambda function.
|
FunctionUrl |
addFunctionUrl()
Adds a url to this lambda function.
|
FunctionUrl |
addFunctionUrl(FunctionUrlOptions options)
Adds a url to this lambda function.
|
void |
addPermission(java.lang.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.
|
void |
considerWarningOnInvokeFunctionPermissions(Construct scope,
java.lang.String action)
A warning will be added to functions under the following conditions: - permissions that include `lambda:InvokeFunction` are added to the unqualified function.
|
abstract Architecture |
getArchitecture()
The architecture of this Lambda Function.
|
protected abstract java.lang.Boolean |
getCanCreatePermissions()
Whether the addPermission() call adds any permissions.
|
Connections |
getConnections()
Access the Connections object.
|
abstract java.lang.String |
getFunctionArn()
The ARN fo the function.
|
abstract java.lang.String |
getFunctionName()
The name of the function.
|
abstract IPrincipal |
getGrantPrincipal()
The principal this Lambda Function is running as.
|
java.lang.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 java.util.List<java.lang.String> |
getResourceArnsForGrantInvoke()
The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().
|
abstract IRole |
getRole()
The IAM role associated with this function.
|
Grant |
grantInvoke(IGrantable grantee)
Grant the given identity permissions to invoke this Lambda.
|
Grant |
grantInvokeUrl(IGrantable grantee)
Grant the given identity permissions to invoke this Lambda Function URL.
|
Metric |
metric(java.lang.String metricName)
Return the given named metric for this Function.
|
Metric |
metric(java.lang.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.
|
protected void |
warnInvokeFunctionPermissions(Construct scope) |
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected FunctionBase(software.amazon.jsii.JsiiObjectRef objRef)
protected FunctionBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected FunctionBase(software.constructs.Construct scope, java.lang.String id, ResourceProps props)
scope
- This parameter is required.id
- This parameter is required.props
- protected FunctionBase(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.public void addEventSource(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 IFunction
source
- This parameter is required.public EventSourceMapping addEventSourceMapping(java.lang.String id, EventSourceMappingOptions options)
addEventSourceMapping
in interface IFunction
id
- This parameter is required.options
- This parameter is required.public FunctionUrl addFunctionUrl(FunctionUrlOptions options)
addFunctionUrl
in interface IFunction
options
- public FunctionUrl addFunctionUrl()
addFunctionUrl
in interface IFunction
public void addPermission(java.lang.String id, Permission permission)
addPermission
in interface IFunction
id
- The id for the permission construct. This parameter is required.permission
- The permission to grant to this Lambda function. This parameter is required.public void addToRolePolicy(PolicyStatement statement)
addToRolePolicy
in interface IFunction
statement
- This parameter is required.public void configureAsyncInvoke(EventInvokeConfigOptions options)
configureAsyncInvoke
in interface IFunction
options
- This parameter is required.public void considerWarningOnInvokeFunctionPermissions(Construct scope, java.lang.String action)
This applies only to permissions on Lambda functions, not versions or aliases. This function is overridden as a noOp for QualifiedFunctionBase.
scope
- This parameter is required.action
- This parameter is required.public Grant grantInvoke(IGrantable grantee)
grantInvoke
in interface IFunction
grantee
- This parameter is required.public Grant grantInvokeUrl(IGrantable grantee)
grantInvokeUrl
in interface IFunction
grantee
- This parameter is required.public Metric metric(java.lang.String metricName, MetricOptions props)
public Metric metric(java.lang.String metricName)
public Metric metricDuration(MetricOptions props)
Average over 5 minutes
metricDuration
in interface IFunction
props
- public Metric metricDuration()
Average over 5 minutes
metricDuration
in interface IFunction
public Metric metricErrors(MetricOptions props)
Sum over 5 minutes
metricErrors
in interface IFunction
props
- public Metric metricErrors()
Sum over 5 minutes
metricErrors
in interface IFunction
public Metric metricInvocations(MetricOptions props)
Sum over 5 minutes
metricInvocations
in interface IFunction
props
- public Metric metricInvocations()
Sum over 5 minutes
metricInvocations
in interface IFunction
public Metric metricThrottles(MetricOptions props)
Sum over 5 minutes
metricThrottles
in interface IFunction
props
- public Metric metricThrottles()
Sum over 5 minutes
metricThrottles
in interface IFunction
protected void warnInvokeFunctionPermissions(Construct scope)
scope
- This parameter is required.public abstract Architecture getArchitecture()
getArchitecture
in interface IFunction
protected abstract java.lang.Boolean getCanCreatePermissions()
True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.
public Connections getConnections()
Will fail if not a VPC-enabled Lambda Function
getConnections
in interface IConnectable
public abstract java.lang.String getFunctionArn()
getFunctionArn
in interface IClientVpnConnectionHandler
getFunctionArn
in interface IFunction
public abstract java.lang.String getFunctionName()
getFunctionName
in interface IClientVpnConnectionHandler
getFunctionName
in interface IFunction
public abstract IPrincipal getGrantPrincipal()
getGrantPrincipal
in interface IGrantable
public java.lang.Boolean getIsBoundToVpc()
If this is is false
, trying to access the connections
object will fail.
getIsBoundToVpc
in interface IFunction
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
public abstract ConstructNode getPermissionsNode()
getPermissionsNode
in interface IFunction
public abstract java.util.List<java.lang.String> getResourceArnsForGrantInvoke()
getResourceArnsForGrantInvoke
in interface IFunction