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 a principal 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.