Skip to content

pydantypes.cloud.aws

AWS cloud resource types.

Modules:

  • arn

    AWS ARN types.

  • compute

    AWS compute types.

  • containers

    AWS container types.

  • database

    AWS database types.

  • identity

    AWS identity types.

  • messaging

    AWS messaging types.

  • monitoring

    AWS monitoring types.

  • network

    AWS network types.

  • region

    AWS region types.

  • security

    AWS security types.

  • storage

    AWS storage types.

Classes:

  • Arn

    An AWS ARN with parsed components.

  • EcrRepositoryUri

    An AWS ECR repository URI with parsed components.

  • IamRoleArn

    An IAM Role ARN with parsed role name.

  • Region

    AWS region identifiers.

  • S3Uri

    An S3 URI like s3://bucket/key with parsed properties.

  • SnsTopicArn

    An SNS Topic ARN with parsed topic name.

  • SqsQueueUrl

    An SQS Queue URL with parsed components.

Attributes:

  • AccountId

    A 12-digit AWS Account ID (e.g. 123456789012).

  • AmiId

    An AWS AMI ID (e.g. ami-1234567890abcdef0).

  • CloudFrontDistributionId

    An AWS CloudFront Distribution ID (e.g. E1A2B3C4D5E6F7).

  • CloudWatchLogGroupName

    An AWS CloudWatch Log Group name (e.g. /my-app/production).

  • CognitoUserPoolId

    An AWS Cognito User Pool ID (e.g. us-east-1_AbCdEfGhI).

  • DynamoDbTableName

    An AWS DynamoDB table name (e.g. my-table).

  • EbsSnapshotId

    An AWS EBS Snapshot ID (e.g. snap-1234567890abcdef0).

  • EbsVolumeId

    An AWS EBS Volume ID (e.g. vol-1234567890abcdef0).

  • Ec2InstanceId

    An AWS EC2 instance ID (e.g. i-1234567890abcdef0).

  • EcsClusterName

    An AWS ECS cluster name (e.g. my-ecs-cluster).

  • EksClusterName

    An AWS EKS cluster name (e.g. my-eks-cluster).

  • ElasticIpAllocationId

    An AWS Elastic IP Allocation ID (e.g. eipalloc-1234567890abcdef0).

  • EniId

    An AWS ENI (Elastic Network Interface) ID (e.g. eni-1234567890abcdef0).

  • InternetGatewayId

    An AWS Internet Gateway ID (e.g. igw-1234567890abcdef0).

  • KmsKeyId

    An AWS KMS key ID (UUID or multi-region key ID) (e.g. 12345678-1234-1234-1234-123456789012).

  • LambdaFunctionName

    An AWS Lambda function name (e.g. my-function).

  • NatGatewayId

    An AWS NAT Gateway ID (e.g. nat-1234567890abcdef0).

  • RdsInstanceId

    An AWS RDS instance identifier (lowercase only) (e.g. my-db-instance).

  • Route53HostedZoneId

    An AWS Route53 Hosted Zone ID (e.g. Z1234567890ABC).

  • S3BucketName

    An AWS S3 bucket name (e.g. my-bucket).

  • SecretsManagerSecretName

    An AWS Secrets Manager secret name (e.g. prod/my-app/db-password).

  • SecurityGroupId

    An AWS Security Group ID (e.g. sg-1234567890abcdef0).

  • SsmParameterName

    An AWS SSM Parameter Store parameter name (e.g. /my-app/config/database-url).

  • SubnetId

    An AWS Subnet ID (e.g. subnet-1234567890abcdef0).

  • VpcId

    An AWS VPC ID (e.g. vpc-1234567890abcdef0).

AccountId module-attribute

AccountId = Annotated[str, AfterValidator(_validate_account_id), WithJsonSchema({'type': 'string', 'pattern': '^\\d{12}$', 'description': 'A 12-digit AWS Account ID', 'examples': ['123456789012'], 'title': 'AccountId', 'minLength': 12, 'maxLength': 12})]

A 12-digit AWS Account ID (e.g. 123456789012).

AmiId module-attribute

AmiId = Annotated[str, AfterValidator(_validate_ami_id), WithJsonSchema({'type': 'string', 'pattern': '^ami-[0-9a-f]{8,17}$', 'description': 'An AWS AMI ID', 'examples': ['ami-1234567890abcdef0'], 'title': 'AmiId'})]

An AWS AMI ID (e.g. ami-1234567890abcdef0).

CloudFrontDistributionId module-attribute

CloudFrontDistributionId = Annotated[str, AfterValidator(_validate_cloudfront_distribution_id), WithJsonSchema({'type': 'string', 'pattern': '^E[A-Z0-9]{10,16}$', 'description': 'An AWS CloudFront Distribution ID', 'examples': ['E1A2B3C4D5E6F7'], 'title': 'CloudFrontDistributionId'})]

An AWS CloudFront Distribution ID (e.g. E1A2B3C4D5E6F7).

CloudWatchLogGroupName module-attribute

CloudWatchLogGroupName = Annotated[str, AfterValidator(_validate_cloudwatch_log_group_name), WithJsonSchema({'type': 'string', 'pattern': '^[.\\-_/#A-Za-z0-9]{1,512}$', 'description': 'An AWS CloudWatch Log Group name', 'examples': ['/my-app/production'], 'title': 'CloudWatchLogGroupName', 'maxLength': 512})]

An AWS CloudWatch Log Group name (e.g. /my-app/production).

CognitoUserPoolId module-attribute

CognitoUserPoolId = Annotated[str, AfterValidator(_validate_cognito_user_pool_id), WithJsonSchema({'type': 'string', 'pattern': '^[\\w-]+_[0-9a-zA-Z]+$', 'description': 'An AWS Cognito User Pool ID', 'examples': ['us-east-1_AbCdEfGhI'], 'title': 'CognitoUserPoolId', 'maxLength': 55})]

An AWS Cognito User Pool ID (e.g. us-east-1_AbCdEfGhI).

DynamoDbTableName module-attribute

DynamoDbTableName = Annotated[str, AfterValidator(_validate_dynamodb_table_name), WithJsonSchema({'type': 'string', 'pattern': '^[a-zA-Z0-9._-]{3,255}$', 'description': 'An AWS DynamoDB table name', 'examples': ['my-table'], 'title': 'DynamoDbTableName', 'minLength': 3, 'maxLength': 255})]

An AWS DynamoDB table name (e.g. my-table).

EbsSnapshotId module-attribute

EbsSnapshotId = Annotated[str, AfterValidator(_validate_ebs_snapshot_id), WithJsonSchema({'type': 'string', 'pattern': '^snap-[0-9a-f]{8,17}$', 'description': 'An AWS EBS Snapshot ID', 'examples': ['snap-1234567890abcdef0'], 'title': 'EbsSnapshotId'})]

An AWS EBS Snapshot ID (e.g. snap-1234567890abcdef0).

EbsVolumeId module-attribute

EbsVolumeId = Annotated[str, AfterValidator(_validate_ebs_volume_id), WithJsonSchema({'type': 'string', 'pattern': '^vol-[0-9a-f]{8,17}$', 'description': 'An AWS EBS Volume ID', 'examples': ['vol-1234567890abcdef0'], 'title': 'EbsVolumeId'})]

An AWS EBS Volume ID (e.g. vol-1234567890abcdef0).

Ec2InstanceId module-attribute

Ec2InstanceId = Annotated[str, AfterValidator(_validate_ec2_instance_id), WithJsonSchema({'type': 'string', 'pattern': '^i-[0-9a-f]{8,17}$', 'description': 'An AWS EC2 instance ID', 'examples': ['i-1234567890abcdef0'], 'title': 'Ec2InstanceId'})]

An AWS EC2 instance ID (e.g. i-1234567890abcdef0).

EcsClusterName module-attribute

EcsClusterName = Annotated[str, AfterValidator(_validate_ecs_cluster_name), WithJsonSchema({'type': 'string', 'pattern': '^[a-zA-Z0-9_-]{1,255}$', 'description': 'An AWS ECS cluster name', 'examples': ['my-ecs-cluster'], 'title': 'EcsClusterName', 'maxLength': 255})]

An AWS ECS cluster name (e.g. my-ecs-cluster).

EksClusterName module-attribute

EksClusterName = Annotated[str, AfterValidator(_validate_eks_cluster_name), WithJsonSchema({'type': 'string', 'pattern': '^[a-zA-Z0-9][a-zA-Z0-9_-]{0,99}$', 'description': 'An AWS EKS cluster name', 'examples': ['my-eks-cluster'], 'title': 'EksClusterName', 'maxLength': 100})]

An AWS EKS cluster name (e.g. my-eks-cluster).

ElasticIpAllocationId module-attribute

ElasticIpAllocationId = Annotated[str, AfterValidator(_validate_elastic_ip_allocation_id), WithJsonSchema({'type': 'string', 'pattern': '^eipalloc-[0-9a-f]{8,17}$', 'description': 'An AWS Elastic IP Allocation ID', 'examples': ['eipalloc-1234567890abcdef0'], 'title': 'ElasticIpAllocationId'})]

An AWS Elastic IP Allocation ID (e.g. eipalloc-1234567890abcdef0).

EniId module-attribute

EniId = Annotated[str, AfterValidator(_validate_eni_id), WithJsonSchema({'type': 'string', 'pattern': '^eni-[0-9a-f]{8,17}$', 'description': 'An AWS ENI (Elastic Network Interface) ID', 'examples': ['eni-1234567890abcdef0'], 'title': 'EniId'})]

An AWS ENI (Elastic Network Interface) ID (e.g. eni-1234567890abcdef0).

InternetGatewayId module-attribute

InternetGatewayId = Annotated[str, AfterValidator(_validate_internet_gateway_id), WithJsonSchema({'type': 'string', 'pattern': '^igw-[0-9a-f]{8,17}$', 'description': 'An AWS Internet Gateway ID', 'examples': ['igw-1234567890abcdef0'], 'title': 'InternetGatewayId'})]

An AWS Internet Gateway ID (e.g. igw-1234567890abcdef0).

KmsKeyId module-attribute

KmsKeyId = Annotated[str, AfterValidator(_validate_kms_key_id), WithJsonSchema({'type': 'string', 'pattern': '^(mrk-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$', 'description': 'An AWS KMS key ID (UUID or multi-region key ID)', 'examples': ['12345678-1234-1234-1234-123456789012'], 'title': 'KmsKeyId'})]

An AWS KMS key ID (UUID or multi-region key ID) (e.g. 12345678-1234-1234-1234-123456789012).

LambdaFunctionName module-attribute

LambdaFunctionName = Annotated[str, AfterValidator(_validate_lambda_function_name), WithJsonSchema({'type': 'string', 'pattern': '^[a-zA-Z0-9._-]{1,64}$', 'description': 'An AWS Lambda function name', 'examples': ['my-function'], 'title': 'LambdaFunctionName', 'maxLength': 64})]

An AWS Lambda function name (e.g. my-function).

NatGatewayId module-attribute

NatGatewayId = Annotated[str, AfterValidator(_validate_nat_gateway_id), WithJsonSchema({'type': 'string', 'pattern': '^nat-[0-9a-f]{8,17}$', 'description': 'An AWS NAT Gateway ID', 'examples': ['nat-1234567890abcdef0'], 'title': 'NatGatewayId'})]

An AWS NAT Gateway ID (e.g. nat-1234567890abcdef0).

RdsInstanceId module-attribute

RdsInstanceId = Annotated[str, AfterValidator(_validate_rds_instance_id), WithJsonSchema({'type': 'string', 'pattern': '^[a-z][a-z0-9-]{0,62}$', 'description': 'An AWS RDS instance identifier (lowercase only)', 'examples': ['my-db-instance'], 'title': 'RdsInstanceId', 'maxLength': 63})]

An AWS RDS instance identifier (lowercase only) (e.g. my-db-instance).

Route53HostedZoneId module-attribute

Route53HostedZoneId = Annotated[str, AfterValidator(_validate_route53_hosted_zone_id), WithJsonSchema({'type': 'string', 'pattern': '^Z[A-Z0-9]{1,31}$', 'description': 'An AWS Route53 Hosted Zone ID', 'examples': ['Z1234567890ABC'], 'title': 'Route53HostedZoneId'})]

An AWS Route53 Hosted Zone ID (e.g. Z1234567890ABC).

S3BucketName module-attribute

S3BucketName = Annotated[str, AfterValidator(_validate_s3_bucket_name), WithJsonSchema({'type': 'string', 'pattern': '^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$', 'description': 'An AWS S3 bucket name', 'examples': ['my-bucket'], 'title': 'S3BucketName', 'minLength': 3, 'maxLength': 63})]

An AWS S3 bucket name (e.g. my-bucket).

SecretsManagerSecretName module-attribute

SecretsManagerSecretName = Annotated[str, AfterValidator(_validate_secrets_manager_secret_name), WithJsonSchema({'type': 'string', 'pattern': '^[a-zA-Z0-9/_+=.@-]{1,512}$', 'description': 'An AWS Secrets Manager secret name', 'examples': ['prod/my-app/db-password'], 'title': 'SecretsManagerSecretName', 'maxLength': 512})]

An AWS Secrets Manager secret name (e.g. prod/my-app/db-password).

SecurityGroupId module-attribute

SecurityGroupId = Annotated[str, AfterValidator(_validate_security_group_id), WithJsonSchema({'type': 'string', 'pattern': '^sg-[0-9a-f]{8,17}$', 'description': 'An AWS Security Group ID', 'examples': ['sg-1234567890abcdef0'], 'title': 'SecurityGroupId'})]

An AWS Security Group ID (e.g. sg-1234567890abcdef0).

SsmParameterName module-attribute

SsmParameterName = Annotated[str, AfterValidator(_validate_ssm_parameter_name), WithJsonSchema({'type': 'string', 'pattern': '^[a-zA-Z0-9_./-]+$', 'description': 'An AWS SSM Parameter Store parameter name', 'examples': ['/my-app/config/database-url'], 'title': 'SsmParameterName', 'maxLength': 1011})]

An AWS SSM Parameter Store parameter name (e.g. /my-app/config/database-url).

SubnetId module-attribute

SubnetId = Annotated[str, AfterValidator(_validate_subnet_id), WithJsonSchema({'type': 'string', 'pattern': '^subnet-[0-9a-f]{8,17}$', 'description': 'An AWS Subnet ID', 'examples': ['subnet-1234567890abcdef0'], 'title': 'SubnetId'})]

An AWS Subnet ID (e.g. subnet-1234567890abcdef0).

VpcId module-attribute

VpcId = Annotated[str, AfterValidator(_validate_vpc_id), WithJsonSchema({'type': 'string', 'pattern': '^vpc-[0-9a-f]{8,17}$', 'description': 'An AWS VPC ID', 'examples': ['vpc-1234567890abcdef0'], 'title': 'VpcId'})]

An AWS VPC ID (e.g. vpc-1234567890abcdef0).

Arn

Bases: str

An AWS ARN with parsed components.

Methods:

__get_pydantic_core_schema__ classmethod

__get_pydantic_core_schema__(source_type: Any, handler: GetCoreSchemaHandler) -> CoreSchema

Return the Pydantic core schema for Arn.

Source code in src/pydantypes/cloud/aws/arn.py
@classmethod
def __get_pydantic_core_schema__(
    cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
    """Return the Pydantic core schema for Arn."""
    return _str_type_core_schema(cls, source_type, handler)

__get_pydantic_json_schema__ classmethod

__get_pydantic_json_schema__(_core_schema: CoreSchema, handler: GetJsonSchemaHandler) -> JsonSchemaValue

Return the JSON schema for Arn.

Source code in src/pydantypes/cloud/aws/arn.py
@classmethod
def __get_pydantic_json_schema__(
    cls, _core_schema: CoreSchema, handler: GetJsonSchemaHandler
) -> JsonSchemaValue:
    """Return the JSON schema for Arn."""
    return {
        "type": "string",
        "format": "aws-arn",
        "pattern": cls._pattern.pattern,
        "description": (
            "An AWS ARN in the format arn:partition:service:region:account-id:resource"
        ),
        "examples": ["arn:aws:iam::123456789012:role/MyRole"],
        "title": "Arn",
    }

__new__

__new__(value: str) -> Arn

Create and validate a new Arn instance.

Source code in src/pydantypes/cloud/aws/arn.py
def __new__(cls, value: str) -> Arn:
    """Create and validate a new Arn instance."""
    m = cls._pattern.match(value)
    if not m:
        raise PydanticCustomError(
            "arn",
            "Invalid AWS ARN: {value}",
            {"value": value},
        )
    instance = str.__new__(cls, value)
    instance.aws_partition = m.group(1)
    instance.service = m.group(2)
    instance.region = m.group(3)
    instance.account_id = m.group(4)
    instance.resource = m.group(5)
    return instance

EcrRepositoryUri

Bases: str

An AWS ECR repository URI with parsed components.

Methods:

__get_pydantic_core_schema__ classmethod

__get_pydantic_core_schema__(source_type: Any, handler: GetCoreSchemaHandler) -> CoreSchema

Return the Pydantic core schema for EcrRepositoryUri.

Source code in src/pydantypes/cloud/aws/containers.py
@classmethod
def __get_pydantic_core_schema__(
    cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
    """Return the Pydantic core schema for EcrRepositoryUri."""
    return _str_type_core_schema(cls, source_type, handler)

__get_pydantic_json_schema__ classmethod

__get_pydantic_json_schema__(_core_schema: CoreSchema, handler: GetJsonSchemaHandler) -> JsonSchemaValue

Return the JSON schema for EcrRepositoryUri.

Source code in src/pydantypes/cloud/aws/containers.py
@classmethod
def __get_pydantic_json_schema__(
    cls, _core_schema: CoreSchema, handler: GetJsonSchemaHandler
) -> JsonSchemaValue:
    """Return the JSON schema for EcrRepositoryUri."""
    return {
        "type": "string",
        "format": "aws-ecr-repository-uri",
        "pattern": cls._pattern.pattern,
        "description": "An AWS ECR repository URI",
        "examples": ["123456789012.dkr.ecr.us-east-1.amazonaws.com/my-repo"],
        "title": "EcrRepositoryUri",
    }

__new__

__new__(value: str) -> EcrRepositoryUri

Create and validate a new EcrRepositoryUri instance.

Source code in src/pydantypes/cloud/aws/containers.py
def __new__(cls, value: str) -> EcrRepositoryUri:
    """Create and validate a new EcrRepositoryUri instance."""
    m = cls._pattern.match(value)
    if not m:
        raise PydanticCustomError(
            "ecr_repository_uri",
            "Invalid ECR Repository URI: {value}",
            {"value": value},
        )
    instance = str.__new__(cls, value)
    instance.account_id = m.group(1)
    instance.region = m.group(2)
    instance.repository_name = m.group(3)
    return instance

IamRoleArn

Bases: Arn

An IAM Role ARN with parsed role name.

Methods:

__get_pydantic_core_schema__ classmethod

__get_pydantic_core_schema__(source_type: Any, handler: GetCoreSchemaHandler) -> CoreSchema

Return the Pydantic core schema for IamRoleArn.

Source code in src/pydantypes/cloud/aws/arn.py
@classmethod
def __get_pydantic_core_schema__(
    cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
    """Return the Pydantic core schema for IamRoleArn."""
    return _str_type_core_schema(cls, source_type, handler)

__get_pydantic_json_schema__ classmethod

__get_pydantic_json_schema__(_core_schema: CoreSchema, handler: GetJsonSchemaHandler) -> JsonSchemaValue

Return the JSON schema for IamRoleArn.

Source code in src/pydantypes/cloud/aws/arn.py
@classmethod
def __get_pydantic_json_schema__(
    cls, _core_schema: CoreSchema, handler: GetJsonSchemaHandler
) -> JsonSchemaValue:
    """Return the JSON schema for IamRoleArn."""
    return {
        "type": "string",
        "format": "aws-iam-role-arn",
        "pattern": Arn._pattern.pattern,
        "description": "An AWS IAM Role ARN",
        "examples": ["arn:aws:iam::123456789012:role/MyRole"],
        "title": "IamRoleArn",
    }

__new__

__new__(value: str) -> IamRoleArn

Create and validate a new IamRoleArn instance.

Source code in src/pydantypes/cloud/aws/arn.py
def __new__(cls, value: str) -> IamRoleArn:
    """Create and validate a new IamRoleArn instance."""
    instance = cast(IamRoleArn, Arn.__new__(cls, value))
    if instance.service != "iam" or not instance.resource.startswith("role/"):
        raise PydanticCustomError(
            "iam_role_arn",
            "Invalid IAM Role ARN: expected service 'iam'"
            " with resource 'role/...'. Got: {value}",
            {"value": value},
        )
    instance.role_name = instance.resource.removeprefix("role/")
    return instance

Region

Bases: StrEnum

AWS region identifiers.

S3Uri

Bases: CloudStorageUri

An S3 URI like s3://bucket/key with parsed properties.

Methods:

__get_pydantic_core_schema__ classmethod

__get_pydantic_core_schema__(source_type: Any, handler: GetCoreSchemaHandler) -> CoreSchema

Return the Pydantic core schema for S3Uri.

Source code in src/pydantypes/cloud/aws/storage.py
@classmethod
def __get_pydantic_core_schema__(
    cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
    """Return the Pydantic core schema for S3Uri."""
    return _str_type_core_schema(cls, source_type, handler)

__get_pydantic_json_schema__ classmethod

__get_pydantic_json_schema__(_core_schema: CoreSchema, handler: GetJsonSchemaHandler) -> JsonSchemaValue

Return the JSON schema for S3Uri.

Source code in src/pydantypes/cloud/aws/storage.py
@classmethod
def __get_pydantic_json_schema__(
    cls, _core_schema: CoreSchema, handler: GetJsonSchemaHandler
) -> JsonSchemaValue:
    """Return the JSON schema for S3Uri."""
    return {
        "type": "string",
        "format": "s3-uri",
        "pattern": cls._pattern.pattern,
        "description": "An S3 URI in the format s3://bucket/key",
        "examples": ["s3://my-bucket/path/to/file.csv"],
        "title": "S3Uri",
    }

__new__

__new__(value: str) -> S3Uri

Create and validate a new S3Uri instance.

Source code in src/pydantypes/cloud/aws/storage.py
def __new__(cls, value: str) -> S3Uri:
    """Create and validate a new S3Uri instance."""
    m = cls._pattern.match(value)
    if not m:
        raise PydanticCustomError(
            "s3_uri",
            "Invalid S3 URI: {value}",
            {"value": value},
        )
    bucket = m.group(1)
    _validate_s3_bucket_name(bucket)
    instance = str.__new__(cls, value)
    instance.bucket = bucket
    instance.key = m.group(3) or ""
    return instance

SnsTopicArn

Bases: Arn

An SNS Topic ARN with parsed topic name.

Methods:

__get_pydantic_core_schema__ classmethod

__get_pydantic_core_schema__(source_type: Any, handler: GetCoreSchemaHandler) -> CoreSchema

Return the Pydantic core schema for SnsTopicArn.

Source code in src/pydantypes/cloud/aws/arn.py
@classmethod
def __get_pydantic_core_schema__(
    cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
    """Return the Pydantic core schema for SnsTopicArn."""
    return _str_type_core_schema(cls, source_type, handler)

__get_pydantic_json_schema__ classmethod

__get_pydantic_json_schema__(_core_schema: CoreSchema, handler: GetJsonSchemaHandler) -> JsonSchemaValue

Return the JSON schema for SnsTopicArn.

Source code in src/pydantypes/cloud/aws/arn.py
@classmethod
def __get_pydantic_json_schema__(
    cls, _core_schema: CoreSchema, handler: GetJsonSchemaHandler
) -> JsonSchemaValue:
    """Return the JSON schema for SnsTopicArn."""
    return {
        "type": "string",
        "format": "aws-sns-topic-arn",
        "pattern": Arn._pattern.pattern,
        "description": "An AWS SNS Topic ARN",
        "examples": ["arn:aws:sns:us-east-1:123456789012:my-topic"],
        "title": "SnsTopicArn",
    }

__new__

__new__(value: str) -> SnsTopicArn

Create and validate a new SnsTopicArn instance.

Source code in src/pydantypes/cloud/aws/arn.py
def __new__(cls, value: str) -> SnsTopicArn:
    """Create and validate a new SnsTopicArn instance."""
    instance = cast(SnsTopicArn, Arn.__new__(cls, value))
    if instance.service != "sns":
        raise PydanticCustomError(
            "sns_topic_arn",
            "Invalid SNS Topic ARN: expected service 'sns'. Got: {value}",
            {"value": value},
        )
    instance.topic_name = instance.resource
    return instance

SqsQueueUrl

Bases: str

An SQS Queue URL with parsed components.

Methods:

__get_pydantic_core_schema__ classmethod

__get_pydantic_core_schema__(source_type: Any, handler: GetCoreSchemaHandler) -> CoreSchema

Return the Pydantic core schema for SqsQueueUrl.

Source code in src/pydantypes/cloud/aws/messaging.py
@classmethod
def __get_pydantic_core_schema__(
    cls, source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema:
    """Return the Pydantic core schema for SqsQueueUrl."""
    return _str_type_core_schema(cls, source_type, handler)

__get_pydantic_json_schema__ classmethod

__get_pydantic_json_schema__(_core_schema: CoreSchema, handler: GetJsonSchemaHandler) -> JsonSchemaValue

Return the JSON schema for SqsQueueUrl.

Source code in src/pydantypes/cloud/aws/messaging.py
@classmethod
def __get_pydantic_json_schema__(
    cls, _core_schema: CoreSchema, handler: GetJsonSchemaHandler
) -> JsonSchemaValue:
    """Return the JSON schema for SqsQueueUrl."""
    return {
        "type": "string",
        "format": "aws-sqs-queue-url",
        "pattern": cls._pattern.pattern,
        "description": "An AWS SQS Queue URL",
        "examples": ["https://sqs.us-east-1.amazonaws.com/123456789012/my-queue"],
        "title": "SqsQueueUrl",
    }

__new__

__new__(value: str) -> SqsQueueUrl

Create and validate a new SqsQueueUrl instance.

Source code in src/pydantypes/cloud/aws/messaging.py
def __new__(cls, value: str) -> SqsQueueUrl:
    """Create and validate a new SqsQueueUrl instance."""
    m = cls._pattern.match(value)
    if not m:
        raise PydanticCustomError(
            "sqs_queue_url",
            "Invalid SQS Queue URL: {value}",
            {"value": value},
        )
    queue_name = m.group(3)
    if len(queue_name) > 80:
        raise PydanticCustomError(
            "sqs_queue_url",
            "Invalid SQS Queue URL: queue name exceeds 80 characters. Got: {value}",
            {"value": value},
        )
    instance = str.__new__(cls, value)
    instance.region = m.group(1)
    instance.account_id = m.group(2)
    instance.queue_name = queue_name
    return instance