QualifiedFunctionBase — AWS Cloud Development Kit 1.204.0 documentation (original) (raw)

AWS Cloud Development Kit

class aws_cdk.aws_lambda.QualifiedFunctionBase(scope, id, *, account=None, environment_from_arn=None, physical_name=None, region=None)

Bases: FunctionBase

Parameters:

Methods

add_event_source(source)

Adds an event source to this function.

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));

Parameters:

source (IEventSource)

Return type:

None

add_event_source_mapping(id, *, batch_size=None, bisect_batch_on_error=None, enabled=None, event_source_arn=None, kafka_bootstrap_servers=None, kafka_topic=None, max_batching_window=None, max_record_age=None, on_failure=None, parallelization_factor=None, report_batch_item_failures=None, retry_attempts=None, source_access_configurations=None, starting_position=None, tumbling_window=None)

Adds an event source that maps to this AWS Lambda function.

Parameters:

Return type:

EventSourceMapping

add_function_url(*, auth_type=None, cors=None)

Adds a url to this lambda function.

Parameters:

Return type:

FunctionUrl

add_permission(id, *, principal, action=None, event_source_token=None, function_url_auth_type=None, scope=None, source_account=None, source_arn=None)

Adds a permission to the Lambda resource policy.

Parameters:

See:

Permission for details.

Return type:

None

add_to_role_policy(statement)

Adds a statement to the IAM role assumed by the instance.

Parameters:

statement (PolicyStatement)

Return type:

None

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy)

Return type:

None

configure_async_invoke(*, max_event_age=None, on_failure=None, on_success=None, retry_attempts=None)

Configures options for asynchronous invocation.

Parameters:

Return type:

None

consider_warning_on_invoke_function_permissions(_scope, _action)

A warning will be added to functions under the following conditions: - permissions that include lambda:InvokeFunction are added to the unqualified function.

This applies only to permissions on Lambda functions, not versions or aliases. This function is overridden as a noOp for QualifiedFunctionBase.

Parameters:

Return type:

None

grant_invoke(grantee)

Grant the given identity permissions to invoke this Lambda.

Parameters:

grantee (IGrantable)

Return type:

Grant

grant_invoke_url(grantee)

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

Parameters:

grantee (IGrantable)

Return type:

Grant

metric(metric_name, *, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)

Return the given named metric for this Function.

Parameters:

Return type:

Metric

metric_duration(*, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)

How long execution of this Lambda takes.

Average over 5 minutes

Parameters:

Return type:

Metric

metric_errors(*, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)

How many invocations of this Lambda fail.

Sum over 5 minutes

Parameters:

Return type:

Metric

metric_invocations(*, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)

How often this Lambda is invoked.

Sum over 5 minutes

Parameters:

Return type:

Metric

metric_throttles(*, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)

How often this Lambda is throttled.

Sum over 5 minutes

Parameters:

Return type:

Metric

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

architecture

The architecture of this Lambda Function.

connections

Access the Connections object.

Will fail if not a VPC-enabled Lambda Function

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

function_arn

The ARN fo the function.

function_name

The name of the function.

grant_principal

The principal this Lambda Function is running as.

is_bound_to_vpc

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

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

lambda_

latest_version

The $LATEST version of this function.

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.

node

The construct tree node associated with this construct.

permissions_node

The construct node where permissions are attached.

resource_arns_for_grant_invoke

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

role

The IAM role associated with this function.

Undefined if the function was imported without a role.

stack

The stack in which this resource is defined.

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any)

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct)

Return type:

bool