Typing#

AWS type definitions for Lambda functions, Cognito, Mobile clients, and Systems Manager. This module provides comprehensive TypedDict definitions for AWS services to enable type checking and IDE autocompletion.

Lambda Types#

Lambda Context#

class core_aws.typing_.lambdas.context.ClientContext(client: MobileClient, custom: Dict[str, Any], env: Dict[str, Any])[source]#

Bases: object

Client context that’s provided to Lambda by the client application.

client: MobileClient#

Client context that’s provided to Lambda by the client application.

custom: Dict[str, Any]#

Custom values set by the mobile client application.

env: Dict[str, Any]#

Environment information provided by the AWS SDK.

__init__(client: MobileClient, custom: Dict[str, Any], env: Dict[str, Any]) None#
class core_aws.typing_.lambdas.context.LambdaContext(function_name: str, function_version: str, invoked_function_arn: str, memory_limit_in_mb: int, aws_request_id: str, log_group_name: str, log_stream_name: str, timeout_seconds: int = 900, identity: CognitoIdentity | None = None, client_context: ClientContext | None = None)[source]#

Bases: object

Provides methods and properties that provide information about the invocation, function, and execution environment.

function_name: str#

The name of the Lambda function.

function_version: str#

The version of the function.

invoked_function_arn: str#

The Amazon Resource Name (ARN) that’s used to invoke the function. Indicates if the invoker specified a version number or alias.

memory_limit_in_mb: int#

The amount of memory that’s allocated for the function.

aws_request_id: str#

The identifier of the invocation request.

__init__(function_name: str, function_version: str, invoked_function_arn: str, memory_limit_in_mb: int, aws_request_id: str, log_group_name: str, log_stream_name: str, timeout_seconds: int = 900, identity: CognitoIdentity | None = None, client_context: ClientContext | None = None) None#
log_group_name: str#

The log group for the function.

log_stream_name: str#

The log stream for the function instance.

timeout_seconds: int = 900#

900s / 15 minutes).

Type:

The function timeout in seconds (default

identity: CognitoIdentity | None = None#

Information about the Amazon Cognito identity that authorized the request (mobile apps).

client_context: ClientContext | None = None#

Client context that’s provided to Lambda by the client application (mobile apps).

_start_time_ms: int#

Track execution start time for timeout calculation.

Type:

Internal

_timeout_ms: int#

Calculated timeout in milliseconds.

Type:

Internal

get_remaining_time_in_millis() int[source]#

Returns the number of milliseconds left before the execution times out. :return: Remaining time in milliseconds. Returns 0 if timeout has been exceeded.

Lambda Events#

AWS Lambda event type definitions.

This module provides TypedDict definitions for Lambda events from various AWS services: - SQS (Simple Queue Service) - SNS (Simple Notification Service) - Kinesis Data Streams

These types match the actual event structures that AWS Lambda functions receive.

class core_aws.typing_.lambdas.events.SQSEvent[source]#

Bases: TypedDict

Lambda event from SQS queue trigger.

Records: List[SQSRecord]#

List of SQS message records (batch).

class core_aws.typing_.lambdas.events.SQSRecord[source]#

Bases: TypedDict

A single SQS message record in a Lambda event.

messageId: str#

Unique identifier for the message.

receiptHandle: str#

Token for deleting the message from the queue.

body: str#

Message body (usually JSON string).

attributes: SQSMessageAttributes#

SQS message attributes.

messageAttributes: Dict[str, Any]#

Custom message attributes.

md5OfMessageAttributes: str | None#

MD5 hash of the message attributes.

md5OfBody: str#

MD5 hash of the message body.

eventSource: str#

sqs’).

Type:

Event source identifier (always ‘aws

eventSourceARN: str#

ARN of the source SQS queue.

awsRegion: str#

AWS region where the queue is located.

class core_aws.typing_.lambdas.events.SQSMessageAttributes[source]#

Bases: TypedDict

SQS message attributes from the queue.

ApproximateReceiveCount: str#

Number of times a message has been received but not deleted.

SentTimestamp: str#

Time when the message was sent (epoch milliseconds).

SenderId: str#

AWS account ID or IAM role ID of the sender.

ApproximateFirstReceiveTimestamp: str#

Time when the message was first received (epoch milliseconds).

class core_aws.typing_.lambdas.events.SNSEvent[source]#

Bases: TypedDict

Lambda event from SNS topic trigger.

Records: List[SNSRecord]#

List of SNS notification records.

class core_aws.typing_.lambdas.events.SNSRecord[source]#

Bases: TypedDict

A single SNS notification record in a Lambda event.

EventSource: str#

sns’).

Type:

Event source identifier (always ‘aws

EventVersion: str#

Event format version.

EventSubscriptionArn: str#

ARN of the subscription that triggered the Lambda.

Sns: SNSMessage#

SNS message details.

class core_aws.typing_.lambdas.events.SNSMessage[source]#

Bases: TypedDict

SNS message details within a Lambda event.

Type: str#

Message type (usually ‘Notification’).

MessageId: str#

Unique identifier for the message.

TopicArn: str#

ARN of the SNS topic.

Subject: str | None#

Optional message subject.

Message: str#

Message body (usually JSON string).

Timestamp: str#

ISO 8601 timestamp when the message was published.

SignatureVersion: str#

Version of the signature algorithm.

Signature: str#

Message signature for verification.

SigningCertUrl: str#

URL to the signing certificate.

UnsubscribeUrl: str#

URL to unsubscribe from the topic.

MessageAttributes: Dict[str, Any]#

Custom message attributes.

class core_aws.typing_.lambdas.events.KinesisEvent[source]#

Bases: TypedDict

Lambda event from Kinesis Data Streams trigger.

Records: List[KinesisRecord]#

List of Kinesis stream records.

class core_aws.typing_.lambdas.events.KinesisRecord[source]#

Bases: TypedDict

A single Kinesis stream record in a Lambda event.

kinesis: KinesisData#

Kinesis stream data.

eventSource: str#

kinesis’).

Type:

Event source identifier (always ‘aws

eventVersion: str#

Event format version.

eventID: str#

Unique event identifier.

eventName: str#

record’).

Type:

Event name (usually ‘aws

Type:

kinesis

invokeIdentityArn: str#

ARN of the IAM role used to invoke the Lambda function.

awsRegion: str#

AWS region where the stream is located.

eventSourceARN: str#

ARN of the Kinesis stream.

class core_aws.typing_.lambdas.events.KinesisData[source]#

Bases: TypedDict

Kinesis stream record data.

kinesisSchemaVersion: str#

Schema version of the Kinesis data structure.

partitionKey: str#

Partition key for the record.

sequenceNumber: str#

Unique sequence number for the record in the shard.

data: str#

Base64-encoded data blob.

approximateArrivalTimestamp: float#

Approximate time when the record was added to the stream (Unix timestamp).

Cognito Types#

class core_aws.typing_.cognito.identity.CognitoIdentity(cognito_identity_id: str, cognito_identity_pool_id: str)[source]#

Bases: object

Information related to the AWS Cognito identity that authorize the request.

cognito_identity_id: str#

The authenticated Amazon Cognito identity.

__init__(cognito_identity_id: str, cognito_identity_pool_id: str) None#
cognito_identity_pool_id: str#

The Amazon Cognito identity pool that authorized the invocation.

Mobile Client Types#

class core_aws.typing_.mobile.client.MobileClient(installation_id: str, app_title: str, app_version_name: str, app_version_code: str, app_package_name: str)[source]#

Bases: object

Mobile Client context that is provided by the client application.

installation_id: str#

Unique identifier for the app installation.

app_title: str#

Application title/name.

__init__(installation_id: str, app_title: str, app_version_name: str, app_version_code: str, app_package_name: str) None#
app_version_name: str#

Human-readable version (e.g., ‘1.2.3’).

app_version_code: str#

Build/version code (numeric identifier).

app_package_name: str#

Package identifier (e.g., ‘com.example.app’).

SSM Types#

Type definitions for AWS Systems Manager (SSM) Parameter Store.

This module provides TypedDict definitions for SSM parameter structures returned by boto3 SSM client operations.

class core_aws.typing_.ssm.parameter.SSMParameter[source]#

Bases: TypedDict

Type definition for an AWS SSM Parameter.

Represents the structure of a parameter object returned by AWS Systems Manager Parameter Store operations such as get_parameter() and get_parameters_by_path().

Reference:

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm/client/get_parameter.html

Example

parameter: SSMParameter = {
    "Name": "/myapp/prod/database_url",
    "Type": "SecureString",
    "Value": "postgresql://...",
    "Version": 1,
    "LastModifiedDate": datetime(2024, 1, 1),
    "ARN": "arn:aws:ssm:us-east-1:123456789012:parameter/myapp/prod/database_url"
}
Name: str#

The name/path of the parameter (e.g., ‘/myapp/prod/database_url’).

Type: Literal['String', 'StringList', 'SecureString']#

String, StringList, or SecureString.

Type:

The parameter type

Value: str#

The parameter value. Decrypted if the parameter is a SecureString.

Version: int#

The version number of the parameter.

LastModifiedDate: datetime#

The date and time the parameter was last modified.

ARN: str#

The Amazon Resource Name (ARN) of the parameter.

Selector: str#

The parameter version or label used in the request (optional). Either a version number or a label like ‘:latest’.

SourceResult: str#

The raw result or response from the source (optional).

DataType: str#

The data type of the parameter (optional). Values: ‘text’ (default), ‘aws:ec2:image’.