Interface IFunction
Inherited Members
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.AWS.Lambda.dll
Syntax (csharp)
public interface IFunction : IResource, IConstruct, IConstruct, IDependable, IConnectable, IGrantable
Syntax (vb)
Public Interface IFunction
Inherits IResource, IConstruct, IConstruct, IDependable, IConnectable, IGrantable
Synopsis
Properties
FunctionArn | The ARN fo the function. |
FunctionName | The name of the function. |
IsBoundToVpc | Whether or not this Lambda function was bound to a VPC. |
LatestVersion | The |
PermissionsNode | The construct node where permissions are attached. |
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. |
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. |
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
FunctionArn
The ARN fo the function.
string FunctionArn { get; }
Property Value
System.String
Remarks
Attribute: true
FunctionName
The name of the function.
string FunctionName { get; }
Property Value
System.String
Remarks
Attribute: true
IsBoundToVpc
Whether or not this Lambda function was bound to a VPC.
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.
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.
ConstructNode PermissionsNode { get; }
Property Value
Role
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/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));
AddEventSourceMapping(String, IEventSourceMappingOptions)
Adds an event source that maps to this AWS Lambda function.
EventSourceMapping AddEventSourceMapping(string id, IEventSourceMappingOptions options)
Parameters
- id System.String
construct ID.
- options IEventSourceMappingOptions
mapping options.
Returns
AddPermission(String, IPermission)
Adds a permission to the Lambda resource policy.
void AddPermission(string id, IPermission permission)
Parameters
- id System.String
The id ƒor 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
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 System.String
- props IMetricOptions
Returns
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
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
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
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
Remarks
Sum over 5 minutes
Default: sum over 5 minutes