Class FunctionBase
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class FunctionBase : Resource, IFunction, IResource, IConnectable, IGrantable, IClientVpnConnectionHandler
Syntax (vb)
Public MustInherit Class FunctionBase
Inherits Resource
Implements IFunction, IResource, IConnectable, IGrantable, IClientVpnConnectionHandler
Synopsis
Constructors
FunctionBase(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
FunctionBase(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
FunctionBase(Construct, String, IResourceProps) |
Properties
Architecture | The architecture of this Lambda Function. |
CanCreatePermissions | Whether the addPermission() call adds any permissions. |
Connections | Access the Connections object. |
FunctionArn | The ARN fo the function. |
FunctionName | The name of the function. |
GrantPrincipal | The principal this Lambda Function is running as. |
IsBoundToVpc | Whether or not this Lambda function was bound to a VPC. |
LatestVersion | The |
PermissionsNode | The construct node where permissions are attached. |
ResourceArnsForGrantInvoke | The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke(). |
Role | The IAM role associated with this function. |
Methods
AddEventSource(IEventSource) | Adds an event source to this function. |
AddEventSourceMapping(String, IEventSourceMappingOptions) | Adds an event source that maps to this AWS Lambda function. |
AddFunctionUrl(IFunctionUrlOptions) | Adds a url to this lambda function. |
AddPermission(String, IPermission) | Adds a permission to the Lambda resource policy. |
AddToRolePolicy(PolicyStatement) | Adds a statement to the IAM role assumed by the instance. |
ConfigureAsyncInvoke(IEventInvokeConfigOptions) | Configures options for asynchronous invocation. |
ConsiderWarningOnInvokeFunctionPermissions(Construct, String) | A warning will be added to functions under the following conditions: - permissions that include |
GrantInvoke(IGrantable) | Grant the given identity permissions to invoke this Lambda. |
GrantInvokeCompositePrincipal(CompositePrincipal) | Grant multiple principals the ability to invoke this Lambda via CompositePrincipal. |
GrantInvokeUrl(IGrantable) | Grant the given identity permissions to invoke this Lambda Function URL. |
Metric(String, IMetricOptions) | Return the given named metric for this Function. |
MetricDuration(IMetricOptions) | How long execution of this Lambda takes. |
MetricErrors(IMetricOptions) | How many invocations of this Lambda fail. |
MetricInvocations(IMetricOptions) | How often this Lambda is invoked. |
MetricThrottles(IMetricOptions) | How often this Lambda is throttled. |
WarnInvokeFunctionPermissions(Construct) |
Constructors
FunctionBase(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected FunctionBase(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
FunctionBase(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected FunctionBase(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
FunctionBase(Construct, String, IResourceProps)
protected FunctionBase(Construct scope, string id, IResourceProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IResourceProps
Properties
Architecture
The architecture of this Lambda Function.
public abstract Architecture Architecture { get; }
Property Value
CanCreatePermissions
Whether the addPermission() call adds any permissions.
protected abstract bool CanCreatePermissions { get; }
Property Value
System.Boolean
Remarks
True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.
Connections
Access the Connections object.
public virtual Connections_ Connections { get; }
Property Value
Remarks
Will fail if not a VPC-enabled Lambda Function
FunctionArn
The ARN fo the function.
public abstract string FunctionArn { get; }
Property Value
System.String
FunctionName
The name of the function.
public abstract string FunctionName { get; }
Property Value
System.String
GrantPrincipal
The principal this Lambda Function is running as.
public abstract IPrincipal GrantPrincipal { get; }
Property Value
IsBoundToVpc
Whether or not this Lambda function was bound to a VPC.
public virtual bool IsBoundToVpc { get; }
Property Value
System.Boolean
Remarks
If this is is false
, trying to access the connections
object will fail.
LatestVersion
The $LATEST
version of this function.
public virtual IVersion LatestVersion { get; }
Property Value
Remarks
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.
PermissionsNode
The construct node where permissions are attached.
public abstract Node PermissionsNode { get; }
Property Value
Constructs.Node
ResourceArnsForGrantInvoke
The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().
public abstract string[] ResourceArnsForGrantInvoke { get; }
Property Value
System.String[]
Role
The IAM role associated with this function.
public abstract IRole Role { get; }
Property Value
Remarks
Undefined if the function was imported without a role.
Methods
AddEventSource(IEventSource)
Adds an event source to this function.
public virtual void AddEventSource(IEventSource source)
Parameters
- source IEventSource
Remarks
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));
AddEventSourceMapping(String, IEventSourceMappingOptions)
Adds an event source that maps to this AWS Lambda function.
public virtual EventSourceMapping AddEventSourceMapping(string id, IEventSourceMappingOptions options)
Parameters
- id System.String
- options IEventSourceMappingOptions
Returns
AddFunctionUrl(IFunctionUrlOptions)
Adds a url to this lambda function.
public virtual FunctionUrl AddFunctionUrl(IFunctionUrlOptions options = null)
Parameters
- options IFunctionUrlOptions
Returns
AddPermission(String, IPermission)
Adds a permission to the Lambda resource policy.
public virtual void AddPermission(string id, IPermission permission)
Parameters
- id System.String
The id for the permission construct.
- permission IPermission
The permission to grant to this Lambda function.
Remarks
See: Permission for details.
AddToRolePolicy(PolicyStatement)
Adds a statement to the IAM role assumed by the instance.
public virtual void AddToRolePolicy(PolicyStatement statement)
Parameters
- statement PolicyStatement
ConfigureAsyncInvoke(IEventInvokeConfigOptions)
Configures options for asynchronous invocation.
public virtual void ConfigureAsyncInvoke(IEventInvokeConfigOptions options)
Parameters
- options IEventInvokeConfigOptions
ConsiderWarningOnInvokeFunctionPermissions(Construct, String)
A warning will be added to functions under the following conditions: - permissions that include lambda:InvokeFunction
are added to the unqualified function.
public virtual void ConsiderWarningOnInvokeFunctionPermissions(Construct scope, string action)
Parameters
- scope Constructs.Construct
- action System.String
Remarks
This applies only to permissions on Lambda functions, not versions or aliases. This function is overridden as a noOp for QualifiedFunctionBase.
GrantInvoke(IGrantable)
Grant the given identity permissions to invoke this Lambda.
public virtual Grant GrantInvoke(IGrantable grantee)
Parameters
- grantee IGrantable
Returns
GrantInvokeCompositePrincipal(CompositePrincipal)
Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.
public virtual Grant[] GrantInvokeCompositePrincipal(CompositePrincipal compositePrincipal)
Parameters
- compositePrincipal CompositePrincipal
Returns
Grant[]
GrantInvokeUrl(IGrantable)
Grant the given identity permissions to invoke this Lambda Function URL.
public virtual Grant GrantInvokeUrl(IGrantable grantee)
Parameters
- grantee IGrantable
Returns
Metric(String, IMetricOptions)
Return the given named metric for this Function.
public virtual Metric Metric(string metricName, IMetricOptions props = null)
Parameters
- metricName System.String
- props IMetricOptions
Returns
MetricDuration(IMetricOptions)
How long execution of this Lambda takes.
public virtual Metric MetricDuration(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Average over 5 minutes
MetricErrors(IMetricOptions)
How many invocations of this Lambda fail.
public virtual Metric MetricErrors(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Sum over 5 minutes
MetricInvocations(IMetricOptions)
How often this Lambda is invoked.
public virtual Metric MetricInvocations(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Sum over 5 minutes
MetricThrottles(IMetricOptions)
How often this Lambda is throttled.
public virtual Metric MetricThrottles(IMetricOptions props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Sum over 5 minutes
WarnInvokeFunctionPermissions(Construct)
protected virtual void WarnInvokeFunctionPermissions(Construct scope)
Parameters
- scope Constructs.Construct