Show / Hide Table of Contents

Interface IFunction

Inherited Members
IResource.ApplyRemovalPolicy(RemovalPolicy)
IResource.Env
IResource.Stack
IConnectable.Connections
IGrantable.GrantPrincipal
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IFunction : IResource, IConstruct, IDependable, IConnectable, IGrantable
Syntax (vb)
Public Interface IFunction Inherits IResource, IConstruct, IDependable, IConnectable, IGrantable

Synopsis

Properties

Architecture

The system architectures compatible with this lambda function.

FunctionArn

The ARN of the function.

FunctionName

The name of the function.

IsBoundToVpc

Whether or not this Lambda function was bound to a VPC.

LatestVersion

The $LATEST version of this function.

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.

GrantInvoke(IGrantable)

Grant the given identity permissions to invoke this Lambda.

GrantInvokeCompositePrincipal(CompositePrincipal)

Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.

GrantInvokeLatestVersion(IGrantable)

Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.

GrantInvokeUrl(IGrantable)

Grant the given identity permissions to invoke this Lambda Function URL.

GrantInvokeVersion(IGrantable, IVersion)

Grant the given identity permissions to invoke the given version of this Lambda.

Metric(string, IMetricOptions?)

Return the given named metric for this Lambda Return the given named metric for this Function.

MetricDuration(IMetricOptions?)

Metric for the Duration of this Lambda How long execution of this Lambda takes.

MetricErrors(IMetricOptions?)

How many invocations of this Lambda fail.

MetricInvocations(IMetricOptions?)

Metric for the number of invocations of this Lambda How often this Lambda is invoked.

MetricThrottles(IMetricOptions?)

Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.

Properties

Architecture

The system architectures compatible with this lambda function.

Architecture Architecture { get; }
Property Value

Architecture

FunctionArn

The ARN of the function.

string FunctionArn { get; }
Property Value

string

Remarks

Attribute: true

FunctionName

The name of the function.

string FunctionName { get; }
Property Value

string

Remarks

Attribute: true

IsBoundToVpc

Whether or not this Lambda function was bound to a VPC.

bool IsBoundToVpc { get; }
Property Value

bool

Remarks

If this is is false, trying to access the connections object will fail.

LatestVersion

The $LATEST version of this function.

IVersion LatestVersion { get; }
Property Value

IVersion

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.

Node PermissionsNode { get; }
Property Value

Node

ResourceArnsForGrantInvoke

The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().

string[] ResourceArnsForGrantInvoke { get; }
Property Value

string[]

Remarks

This property is for cdk modules to consume only. You should not need to use this property. Instead, use grantInvoke() directly.

Role

The IAM role associated with this function.

IRole? Role { get; }
Property Value

IRole

Methods

AddEventSource(IEventSource)

Adds an event source to this function.

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.

EventSourceMapping AddEventSourceMapping(string id, IEventSourceMappingOptions options)
Parameters
id string

construct ID.

options IEventSourceMappingOptions

mapping options.

Returns

EventSourceMapping

AddFunctionUrl(IFunctionUrlOptions?)

Adds a url to this lambda function.

FunctionUrl AddFunctionUrl(IFunctionUrlOptions? options = null)
Parameters
options IFunctionUrlOptions
Returns

FunctionUrl

AddPermission(string, IPermission)

Adds a permission to the Lambda resource policy.

void AddPermission(string id, IPermission permission)
Parameters
id 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.

void AddToRolePolicy(PolicyStatement statement)
Parameters
statement PolicyStatement

ConfigureAsyncInvoke(IEventInvokeConfigOptions)

Configures options for asynchronous invocation.

void ConfigureAsyncInvoke(IEventInvokeConfigOptions options)
Parameters
options IEventInvokeConfigOptions

GrantInvoke(IGrantable)

Grant the given identity permissions to invoke this Lambda.

Grant GrantInvoke(IGrantable identity)
Parameters
identity IGrantable
Returns

Grant

GrantInvokeCompositePrincipal(CompositePrincipal)

Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.

Grant[] GrantInvokeCompositePrincipal(CompositePrincipal compositePrincipal)
Parameters
compositePrincipal CompositePrincipal
Returns

Grant[]

GrantInvokeLatestVersion(IGrantable)

Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.

Grant GrantInvokeLatestVersion(IGrantable identity)
Parameters
identity IGrantable
Returns

Grant

GrantInvokeUrl(IGrantable)

Grant the given identity permissions to invoke this Lambda Function URL.

Grant GrantInvokeUrl(IGrantable identity)
Parameters
identity IGrantable
Returns

Grant

GrantInvokeVersion(IGrantable, IVersion)

Grant the given identity permissions to invoke the given version of this Lambda.

Grant GrantInvokeVersion(IGrantable identity, IVersion version)
Parameters
identity IGrantable
version IVersion
Returns

Grant

Metric(string, IMetricOptions?)

Return the given named metric for this Lambda Return the given named metric for this Function.

Metric Metric(string metricName, IMetricOptions? props = null)
Parameters
metricName string
props IMetricOptions
Returns

Metric

MetricDuration(IMetricOptions?)

Metric for the Duration of this Lambda How long execution of this Lambda takes.

Metric MetricDuration(IMetricOptions? props = null)
Parameters
props IMetricOptions
Returns

Metric

Remarks

Average over 5 minutes

Default: average over 5 minutes

MetricErrors(IMetricOptions?)

How many invocations of this Lambda fail.

Metric MetricErrors(IMetricOptions? props = null)
Parameters
props IMetricOptions
Returns

Metric

Remarks

Sum over 5 minutes

MetricInvocations(IMetricOptions?)

Metric for the number of invocations of this Lambda How often this Lambda is invoked.

Metric MetricInvocations(IMetricOptions? props = null)
Parameters
props IMetricOptions
Returns

Metric

Remarks

Sum over 5 minutes

Default: sum over 5 minutes

MetricThrottles(IMetricOptions?)

Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.

Metric MetricThrottles(IMetricOptions? props = null)
Parameters
props IMetricOptions
Returns

Metric

Remarks

Sum over 5 minutes

Default: sum over 5 minutes

Back to top Generated by DocFX