Skip to content

LambdaClient#

Index > Lambda > LambdaClient

Auto-generated documentation for Lambda type annotations stubs module mypy-boto3-lambda.

LambdaClient#

Type annotations and code completion for boto3.client("lambda"). boto3 documentation

# LambdaClient usage example

from boto3.session import Session
from mypy_boto3_lambda.client import LambdaClient

def get_lambda_client() -> LambdaClient:
    return Session().client("lambda")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("lambda").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("lambda")

try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.CodeSigningConfigNotFoundException,
    client.exceptions.CodeStorageExceededException,
    client.exceptions.CodeVerificationFailedException,
    client.exceptions.EC2AccessDeniedException,
    client.exceptions.EC2ThrottledException,
    client.exceptions.EC2UnexpectedException,
    client.exceptions.EFSIOException,
    client.exceptions.EFSMountConnectivityException,
    client.exceptions.EFSMountFailureException,
    client.exceptions.EFSMountTimeoutException,
    client.exceptions.ENILimitReachedException,
    client.exceptions.InvalidCodeSignatureException,
    client.exceptions.InvalidParameterValueException,
    client.exceptions.InvalidRequestContentException,
    client.exceptions.InvalidRuntimeException,
    client.exceptions.InvalidSecurityGroupIDException,
    client.exceptions.InvalidSubnetIDException,
    client.exceptions.InvalidZipFileException,
    client.exceptions.KMSAccessDeniedException,
    client.exceptions.KMSDisabledException,
    client.exceptions.KMSInvalidStateException,
    client.exceptions.KMSNotFoundException,
    client.exceptions.PolicyLengthExceededException,
    client.exceptions.PreconditionFailedException,
    client.exceptions.ProvisionedConcurrencyConfigNotFoundException,
    client.exceptions.RecursiveInvocationException,
    client.exceptions.RequestTooLargeException,
    client.exceptions.ResourceConflictException,
    client.exceptions.ResourceInUseException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.ResourceNotReadyException,
    client.exceptions.ServiceException,
    client.exceptions.SnapStartException,
    client.exceptions.SnapStartNotReadyException,
    client.exceptions.SnapStartTimeoutException,
    client.exceptions.SubnetIPAddressLimitReachedException,
    client.exceptions.TooManyRequestsException,
    client.exceptions.UnsupportedMediaTypeException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_lambda.client import Exceptions

def handle_error(exc: Exceptions.ClientError) -> None:
    ...

Methods#

add_layer_version_permission#

Adds permissions to the resource-based policy of a version of an Lambda layer.

Type annotations and code completion for boto3.client("lambda").add_layer_version_permission method. boto3 documentation

# add_layer_version_permission method definition

def add_layer_version_permission(
    self,
    *,
    LayerName: str,
    VersionNumber: int,
    StatementId: str,
    Action: str,
    Principal: str,
    OrganizationId: str = ...,
    RevisionId: str = ...,
) -> AddLayerVersionPermissionResponseTypeDef:  # (1)
    ...
  1. See AddLayerVersionPermissionResponseTypeDef
# add_layer_version_permission method usage example with argument unpacking

kwargs: AddLayerVersionPermissionRequestRequestTypeDef = {  # (1)
    "LayerName": ...,
    "VersionNumber": ...,
    "StatementId": ...,
    "Action": ...,
    "Principal": ...,
}

parent.add_layer_version_permission(**kwargs)
  1. See AddLayerVersionPermissionRequestRequestTypeDef

add_permission#

Grants an Amazon Web Service, Amazon Web Services account, or Amazon Web Services organization permission to use a function.

Type annotations and code completion for boto3.client("lambda").add_permission method. boto3 documentation

# add_permission method definition

def add_permission(
    self,
    *,
    FunctionName: str,
    StatementId: str,
    Action: str,
    Principal: str,
    SourceArn: str = ...,
    SourceAccount: str = ...,
    EventSourceToken: str = ...,
    Qualifier: str = ...,
    RevisionId: str = ...,
    PrincipalOrgID: str = ...,
    FunctionUrlAuthType: FunctionUrlAuthTypeType = ...,  # (1)
) -> AddPermissionResponseTypeDef:  # (2)
    ...
  1. See FunctionUrlAuthTypeType
  2. See AddPermissionResponseTypeDef
# add_permission method usage example with argument unpacking

kwargs: AddPermissionRequestRequestTypeDef = {  # (1)
    "FunctionName": ...,
    "StatementId": ...,
    "Action": ...,
    "Principal": ...,
}

parent.add_permission(**kwargs)
  1. See AddPermissionRequestRequestTypeDef

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("lambda").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("lambda").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

create_alias#

Creates an alias for a Lambda function version.

Type annotations and code completion for boto3.client("lambda").create_alias method. boto3 documentation

# create_alias method definition

def create_alias(
    self,
    *,
    FunctionName: str,
    Name: str,
    FunctionVersion: str,
    Description: str = ...,
    RoutingConfig: Union[AliasRoutingConfigurationTypeDef, AliasRoutingConfigurationExtraOutputTypeDef] = ...,  # (1)
) -> AliasConfigurationResponseTypeDef:  # (2)
    ...
  1. See AliasRoutingConfigurationTypeDef AliasRoutingConfigurationExtraOutputTypeDef
  2. See AliasConfigurationResponseTypeDef
# create_alias method usage example with argument unpacking

kwargs: CreateAliasRequestRequestTypeDef = {  # (1)
    "FunctionName": ...,
    "Name": ...,
    "FunctionVersion": ...,
}

parent.create_alias(**kwargs)
  1. See CreateAliasRequestRequestTypeDef

create_code_signing_config#

Creates a code signing configuration.

Type annotations and code completion for boto3.client("lambda").create_code_signing_config method. boto3 documentation

# create_code_signing_config method definition

def create_code_signing_config(
    self,
    *,
    AllowedPublishers: Union[AllowedPublishersTypeDef, AllowedPublishersExtraOutputTypeDef],  # (1)
    Description: str = ...,
    CodeSigningPolicies: CodeSigningPoliciesTypeDef = ...,  # (2)
) -> CreateCodeSigningConfigResponseTypeDef:  # (3)
    ...
  1. See AllowedPublishersTypeDef AllowedPublishersExtraOutputTypeDef
  2. See CodeSigningPoliciesTypeDef
  3. See CreateCodeSigningConfigResponseTypeDef
# create_code_signing_config method usage example with argument unpacking

kwargs: CreateCodeSigningConfigRequestRequestTypeDef = {  # (1)
    "AllowedPublishers": ...,
}

parent.create_code_signing_config(**kwargs)
  1. See CreateCodeSigningConfigRequestRequestTypeDef

create_event_source_mapping#

Creates a mapping between an event source and an Lambda function.

Type annotations and code completion for boto3.client("lambda").create_event_source_mapping method. boto3 documentation

# create_event_source_mapping method definition

def create_event_source_mapping(
    self,
    *,
    FunctionName: str,
    EventSourceArn: str = ...,
    Enabled: bool = ...,
    BatchSize: int = ...,
    FilterCriteria: Union[FilterCriteriaTypeDef, FilterCriteriaExtraOutputTypeDef] = ...,  # (1)
    MaximumBatchingWindowInSeconds: int = ...,
    ParallelizationFactor: int = ...,
    StartingPosition: EventSourcePositionType = ...,  # (2)
    StartingPositionTimestamp: Union[datetime, str] = ...,
    DestinationConfig: DestinationConfigTypeDef = ...,  # (3)
    MaximumRecordAgeInSeconds: int = ...,
    BisectBatchOnFunctionError: bool = ...,
    MaximumRetryAttempts: int = ...,
    TumblingWindowInSeconds: int = ...,
    Topics: Sequence[str] = ...,
    Queues: Sequence[str] = ...,
    SourceAccessConfigurations: Sequence[SourceAccessConfigurationTypeDef] = ...,  # (4)
    SelfManagedEventSource: Union[SelfManagedEventSourceTypeDef, SelfManagedEventSourceExtraOutputTypeDef] = ...,  # (5)
    FunctionResponseTypes: Sequence[FunctionResponseTypeType] = ...,  # (6)
    AmazonManagedKafkaEventSourceConf