From bf01e526c61b27c7e5dace745413fc5ef58c0f60 Mon Sep 17 00:00:00 2001 From: Chris Rehn <1280602+hoffa@users.noreply.github.com> Date: Tue, 22 Nov 2022 09:58:40 -0800 Subject: [PATCH] chore: refactor schema (#2639) --- .coveragerc | 3 + samtranslator/model/api/api_generator.py | 2 +- samtranslator/schema/any_cfn_resource.py | 9 + samtranslator/schema/aws_serverless_api.py | 178 ++ .../schema/aws_serverless_application.py | 24 + .../schema/aws_serverless_connector.py | 27 + .../schema/aws_serverless_function.py | 455 ++++++ .../schema/aws_serverless_httpapi.py | 115 ++ .../schema/aws_serverless_layerversion.py | 28 + .../schema/aws_serverless_simpletable.py | 27 + .../schema/aws_serverless_statemachine.py | 142 ++ samtranslator/schema/common.py | 25 + samtranslator/schema/schema.json | 1443 +++++++++++------ samtranslator/schema/schema.py | 939 +---------- 14 files changed, 2029 insertions(+), 1388 deletions(-) create mode 100644 samtranslator/schema/any_cfn_resource.py create mode 100644 samtranslator/schema/aws_serverless_api.py create mode 100644 samtranslator/schema/aws_serverless_application.py create mode 100644 samtranslator/schema/aws_serverless_connector.py create mode 100644 samtranslator/schema/aws_serverless_function.py create mode 100644 samtranslator/schema/aws_serverless_httpapi.py create mode 100644 samtranslator/schema/aws_serverless_layerversion.py create mode 100644 samtranslator/schema/aws_serverless_simpletable.py create mode 100644 samtranslator/schema/aws_serverless_statemachine.py create mode 100644 samtranslator/schema/common.py diff --git a/.coveragerc b/.coveragerc index e7df5c447..ddb6983b7 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,8 @@ [run] branch = True +omit = + # Schema tested by `make check-black` + samtranslator/schema/* [report] exclude_lines = pragma: no cover diff --git a/samtranslator/model/api/api_generator.py b/samtranslator/model/api/api_generator.py index 399858e1e..55ae276fb 100644 --- a/samtranslator/model/api/api_generator.py +++ b/samtranslator/model/api/api_generator.py @@ -20,7 +20,7 @@ from samtranslator.model.exceptions import InvalidResourceException, InvalidTemplateException from samtranslator.model.s3_utils.uri_parser import parse_s3_uri from samtranslator.region_configuration import RegionConfiguration -from samtranslator.schema.schema import PassThrough +from samtranslator.schema.common import PassThrough from samtranslator.swagger.swagger import SwaggerEditor from samtranslator.model.intrinsics import is_intrinsic, fnSub from samtranslator.model.lambda_ import LambdaPermission diff --git a/samtranslator/schema/any_cfn_resource.py b/samtranslator/schema/any_cfn_resource.py new file mode 100644 index 000000000..713fc2bad --- /dev/null +++ b/samtranslator/schema/any_cfn_resource.py @@ -0,0 +1,9 @@ +import pydantic + +from samtranslator.schema.common import LenientBaseModel + +constr = pydantic.constr + +# Match anything not containing Serverless +class Resource(LenientBaseModel): + Type: constr(regex=r"^((?!::Serverless::).)*$") # type: ignore diff --git a/samtranslator/schema/aws_serverless_api.py b/samtranslator/schema/aws_serverless_api.py new file mode 100644 index 000000000..ef810954c --- /dev/null +++ b/samtranslator/schema/aws_serverless_api.py @@ -0,0 +1,178 @@ +from typing import Optional, Any, Dict, Union, List + +from typing_extensions import Literal + +from samtranslator.schema.common import PassThrough, BaseModel, SamIntrinsic, Unknown + + +class ResourcePolicy(BaseModel): + AwsAccountBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + AwsAccountWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + CustomStatements: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpcBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpcWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpceBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpceWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + IpRangeBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IpRangeWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + SourceVpcBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + SourceVpcWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + + +class CognitoAuthorizerIdentity(BaseModel): + Header: Optional[str] + ReauthorizeEvery: Optional[Union[int, SamIntrinsic]] + ValidationExpression: Optional[str] + + +class CognitoAuthorizer(BaseModel): + AuthorizationScopes: Optional[List[str]] + Identity: Optional[CognitoAuthorizerIdentity] + UserPoolArn: Union[str, SamIntrinsic] + + +class LambdaTokenAuthorizerIdentity(BaseModel): + ReauthorizeEvery: Optional[Union[int, SamIntrinsic]] + ValidationExpression: Optional[str] + Header: Optional[ + str + ] # TODO: This doesn't exist in docs: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-api-lambdatokenauthorizationidentity.html + + +class LambdaRequestAuthorizerIdentity(BaseModel): + Context: Optional[List[str]] + Headers: Optional[List[str]] + QueryStrings: Optional[List[str]] + ReauthorizeEvery: Optional[Union[int, SamIntrinsic]] + StageVariables: Optional[List[str]] + + +class LambdaTokenAuthorizer(BaseModel): + AuthorizationScopes: Optional[List[str]] + FunctionArn: Union[str, SamIntrinsic] + FunctionInvokeRole: Optional[str] + FunctionPayloadType: Optional[Literal["REQUEST", "TOKEN"]] + Identity: Optional[LambdaTokenAuthorizerIdentity] + + +class LambdaRequestAuthorizer(BaseModel): + AuthorizationScopes: Optional[List[str]] + FunctionArn: Union[str, SamIntrinsic] + FunctionInvokeRole: Optional[str] + FunctionPayloadType: Optional[Literal["REQUEST", "TOKEN"]] + Identity: Optional[LambdaRequestAuthorizerIdentity] + + +class UsagePlan(BaseModel): + CreateUsagePlan: Literal["PER_API", "SHARED", "NONE"] + Description: Optional[PassThrough] + Quota: Optional[PassThrough] + Tags: Optional[PassThrough] + Throttle: Optional[PassThrough] + UsagePlanName: Optional[PassThrough] + + +class Auth(BaseModel): + AddDefaultAuthorizerToCorsPreflight: Optional[bool] + ApiKeyRequired: Optional[bool] + Authorizers: Optional[ + Dict[ + str, + Union[ + CognitoAuthorizer, + LambdaTokenAuthorizer, + LambdaRequestAuthorizer, + ], + ] + ] + DefaultAuthorizer: Optional[str] + InvokeRole: Optional[str] + ResourcePolicy: Optional[ResourcePolicy] + UsagePlan: Optional[UsagePlan] + + +class Cors(BaseModel): + AllowCredentials: Optional[bool] + AllowHeaders: Optional[str] + AllowMethods: Optional[str] + AllowOrigin: str + MaxAge: Optional[str] + + +class Route53(BaseModel): + DistributionDomainName: Optional[PassThrough] + EvaluateTargetHealth: Optional[PassThrough] + HostedZoneId: Optional[PassThrough] + HostedZoneName: Optional[PassThrough] + IpV6: Optional[bool] + + +class Domain(BaseModel): + BasePath: Optional[PassThrough] + CertificateArn: PassThrough + DomainName: PassThrough + EndpointConfiguration: Optional[Union[Literal["REGIONAL", "EDGE"], SamIntrinsic]] + MutualTlsAuthentication: Optional[PassThrough] + OwnershipVerificationCertificateArn: Optional[PassThrough] + Route53: Optional[Route53] + SecurityPolicy: Optional[PassThrough] + + +class Properties(BaseModel): + AccessLogSetting: Optional[PassThrough] + ApiKeySourceType: Optional[PassThrough] + Auth: Optional[Auth] + BinaryMediaTypes: Optional[PassThrough] + CacheClusterEnabled: Optional[PassThrough] + CacheClusterSize: Optional[PassThrough] + CanarySetting: Optional[PassThrough] + Cors: Optional[Union[str, Cors]] + DefinitionBody: Optional[PassThrough] + DefinitionUri: Optional[PassThrough] + Description: Optional[PassThrough] + DisableExecuteApiEndpoint: Optional[PassThrough] + Domain: Optional[Domain] + EndpointConfiguration: Optional[PassThrough] + FailOnWarnings: Optional[PassThrough] + GatewayResponses: Optional[SamIntrinsic] + MethodSettings: Optional[PassThrough] + MinimumCompressionSize: Optional[PassThrough] + Mode: Optional[PassThrough] + Models: Optional[SamIntrinsic] + Name: Optional[PassThrough] + OpenApiVersion: Optional[Union[float, str]] # TODO: float doesn't exist in documentation + StageName: Union[str, SamIntrinsic] + Tags: Optional[PassThrough] + TracingEnabled: Optional[PassThrough] + Variables: Optional[PassThrough] + + +class Globals(BaseModel): + Auth: Unknown + Name: Unknown + DefinitionUri: Unknown + CacheClusterEnabled: Unknown + CacheClusterSize: Unknown + Variables: Unknown + EndpointConfiguration: Unknown + MethodSettings: Unknown + BinaryMediaTypes: Unknown + MinimumCompressionSize: Unknown + Cors: Unknown + GatewayResponses: Unknown + AccessLogSetting: Unknown + CanarySetting: Unknown + TracingEnabled: Unknown + OpenApiVersion: Unknown + Domain: Unknown + + +class Resource(BaseModel): + Type: Literal["AWS::Serverless::Api"] + Properties: Properties + Condition: Optional[PassThrough] + DeletionPolicy: Optional[PassThrough] + UpdatePolicy: Optional[PassThrough] + UpdateReplacePolicy: Optional[PassThrough] + DependsOn: Optional[PassThrough] + Metadata: Optional[PassThrough] diff --git a/samtranslator/schema/aws_serverless_application.py b/samtranslator/schema/aws_serverless_application.py new file mode 100644 index 000000000..d4ec5a312 --- /dev/null +++ b/samtranslator/schema/aws_serverless_application.py @@ -0,0 +1,24 @@ +from typing import Optional, Any, Dict, Union + +from typing_extensions import Literal + +from samtranslator.schema.common import PassThrough, BaseModel, SamIntrinsic + + +class Location(BaseModel): + ApplicationId: Union[str, SamIntrinsic] + SemanticVersion: Union[str, SamIntrinsic] + + +class Properties(BaseModel): + Location: Union[str, Location] + NotificationARNs: Optional[PassThrough] + Parameters: Optional[PassThrough] + Tags: Optional[Dict[str, Any]] + TimeoutInMinutes: Optional[PassThrough] + + +class Resource(BaseModel): + Type: Literal["AWS::Serverless::Application"] + Properties: Properties + Condition: Optional[PassThrough] diff --git a/samtranslator/schema/aws_serverless_connector.py b/samtranslator/schema/aws_serverless_connector.py new file mode 100644 index 000000000..11cd74fb2 --- /dev/null +++ b/samtranslator/schema/aws_serverless_connector.py @@ -0,0 +1,27 @@ +from typing import Optional, List + +from typing_extensions import Literal + +from samtranslator.schema.common import PassThrough, BaseModel + + +class ResourceReference(BaseModel): + Id: Optional[str] + Arn: Optional[PassThrough] + Name: Optional[PassThrough] + Qualifier: Optional[PassThrough] + QueueUrl: Optional[PassThrough] + ResourceId: Optional[PassThrough] + RoleName: Optional[PassThrough] + Type: Optional[str] + + +class Properties(BaseModel): + Source: ResourceReference + Destination: ResourceReference + Permissions: List[Literal["Read", "Write"]] + + +class Resource(BaseModel): + Type: Literal["AWS::Serverless::Connector"] + Properties: Properties diff --git a/samtranslator/schema/aws_serverless_function.py b/samtranslator/schema/aws_serverless_function.py new file mode 100644 index 000000000..0ab558154 --- /dev/null +++ b/samtranslator/schema/aws_serverless_function.py @@ -0,0 +1,455 @@ +from typing import Optional, Any, Dict, Union, List + +from typing_extensions import Literal + +from samtranslator.schema.common import PassThrough, BaseModel, SamIntrinsic, Unknown + + +class ResourcePolicy(BaseModel): + AwsAccountBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + AwsAccountWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + CustomStatements: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpcBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpcWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpceBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpceWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + IpRangeBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IpRangeWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + SourceVpcBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + SourceVpcWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + + +class CodeUri(BaseModel): + Bucket: Union[str, SamIntrinsic] + Key: Union[str, SamIntrinsic] + Version: Optional[Union[str, SamIntrinsic]] + + +class Hooks(BaseModel): + PostTraffic: Optional[Union[str, SamIntrinsic]] + PreTraffic: Optional[Union[str, SamIntrinsic]] + + +class DeploymentPreference(BaseModel): + Alarms: Optional[Union[List[SamIntrinsic], SamIntrinsic]] + Enabled: Optional[Union[bool, SamIntrinsic]] + Hooks: Optional[Hooks] + PassthroughCondition: Optional[Union[bool, SamIntrinsic]] + Role: Optional[Union[str, SamIntrinsic]] + TriggerConfigurations: Optional[PassThrough] + Type: Optional[ + Union[str, SamIntrinsic] + ] # TODO: Should investigate whether this is a required field. This is a required field on documentation. However, we don't seem to use this field. + + +class DeadLetterQueue(BaseModel): + TargetArn: str + Type: Literal["SNS", "SQS"] + + +class EventInvokeConfig(BaseModel): + DestinationConfig: Optional[PassThrough] + MaximumEventAgeInSeconds: Optional[int] + MaximumRetryAttempts: Optional[int] + + +class S3EventProperties(BaseModel): + Bucket: Union[str, SamIntrinsic] + Events: PassThrough + Filter: Optional[PassThrough] + + +class S3Event(BaseModel): + Properties: S3EventProperties + Type: Literal["S3"] + + +class SqsSubscription(BaseModel): + BatchSize: Optional[Union[str, SamIntrinsic]] + Enabled: Optional[bool] + QueueArn: Union[str, SamIntrinsic] + QueuePolicyLogicalId: Optional[str] + QueueUrl: Union[str, SamIntrinsic] + + +class SNSEventProperties(BaseModel): + FilterPolicy: Optional[PassThrough] + Region: Optional[PassThrough] + SqsSubscription: Optional[Union[bool, SqsSubscription]] + Topic: PassThrough + + +class SNSEvent(BaseModel): + Properties: SNSEventProperties + Type: Literal["SNS"] + + +class FunctionUrlConfig(BaseModel): + AuthType: Union[str, SamIntrinsic] + Cors: Optional[PassThrough] + + +class KinesisEventProperties(BaseModel): + BatchSize: Optional[PassThrough] + BisectBatchOnFunctionError: Optional[PassThrough] + DestinationConfig: Optional[PassThrough] + Enabled: Optional[PassThrough] + FilterCriteria: Optional[PassThrough] + FunctionResponseTypes: Optional[PassThrough] + MaximumBatchingWindowInSeconds: Optional[PassThrough] + MaximumRecordAgeInSeconds: Optional[PassThrough] + MaximumRetryAttempts: Optional[PassThrough] + ParallelizationFactor: Optional[PassThrough] + StartingPosition: PassThrough + Stream: PassThrough + TumblingWindowInSeconds: Optional[PassThrough] + + +class KinesisEvent(BaseModel): + Type: Literal["Kinesis"] + Properties: KinesisEventProperties + + +class DynamoDBEventProperties(BaseModel): + BatchSize: Optional[PassThrough] + BisectBatchOnFunctionError: Optional[PassThrough] + DestinationConfig: Optional[PassThrough] + Enabled: Optional[PassThrough] + FilterCriteria: Optional[PassThrough] + FunctionResponseTypes: Optional[PassThrough] + MaximumBatchingWindowInSeconds: Optional[PassThrough] + MaximumRecordAgeInSeconds: Optional[PassThrough] + MaximumRetryAttempts: Optional[PassThrough] + ParallelizationFactor: Optional[PassThrough] + StartingPosition: PassThrough + Stream: PassThrough + TumblingWindowInSeconds: Optional[PassThrough] + + +class DynamoDBEvent(BaseModel): + Type: Literal["DynamoDB"] + Properties: DynamoDBEventProperties + + +class SQSEventProperties(BaseModel): + BatchSize: Optional[PassThrough] + Enabled: Optional[PassThrough] + FilterCriteria: Optional[PassThrough] + MaximumBatchingWindowInSeconds: Optional[PassThrough] + Queue: PassThrough + + +class SQSEvent(BaseModel): + Type: Literal["SQS"] + Properties: SQSEventProperties + + +class ApiAuth(BaseModel): + ApiKeyRequired: Optional[bool] + AuthorizationScopes: Optional[List[str]] + Authorizer: Optional[str] + InvokeRole: Optional[Union[str, SamIntrinsic]] + ResourcePolicy: Optional[ResourcePolicy] + + +class RequestModel(BaseModel): + Model: str + Required: Optional[bool] + ValidateBody: Optional[bool] + ValidateParameters: Optional[bool] + + +class RequestParameters(BaseModel): + Caching: Optional[bool] + Required: Optional[bool] + + +class ApiEventProperties(BaseModel): + Auth: Optional[ApiAuth] + Method: str + Path: str + RequestModel: Optional[RequestModel] + RequestParameters: Optional[Union[str, RequestParameters]] + RestApiId: Optional[Union[str, SamIntrinsic]] + + +class ApiEvent(BaseModel): + Type: Literal["Api"] + Properties: ApiEventProperties + + +class CloudWatchEventProperties(BaseModel): + Enabled: Optional[bool] + EventBusName: Optional[PassThrough] + Input: Optional[PassThrough] + InputPath: Optional[PassThrough] + Pattern: Optional[PassThrough] + State: Optional[PassThrough] + + +class CloudWatchEvent(BaseModel): + Type: Literal["CloudWatchEvent"] + Properties: CloudWatchEventProperties + + +class DeadLetterConfig(BaseModel): + Arn: Optional[PassThrough] + QueueLogicalId: Optional[str] + Type: Optional[Literal["SQS"]] + + +class EventsScheduleProperties(BaseModel): + DeadLetterConfig: Optional[DeadLetterConfig] + Description: Optional[PassThrough] + Enabled: Optional[bool] + Input: Optional[PassThrough] + Name: Optional[PassThrough] + RetryPolicy: Optional[PassThrough] + Schedule: Optional[PassThrough] + State: Optional[PassThrough] + + +class ScheduleEvent(BaseModel): + Type: Literal["Schedule"] + Properties: EventsScheduleProperties + + +class EventBridgeRuleEventProperties(BaseModel): + DeadLetterConfig: Optional[DeadLetterConfig] + EventBusName: Optional[PassThrough] + Input: Optional[PassThrough] + InputPath: Optional[PassThrough] + Pattern: PassThrough + RetryPolicy: Optional[PassThrough] + Target: Optional[PassThrough] + + +class EventBridgeRuleEvent(BaseModel): + Type: Literal["EventBridgeRule"] + Properties: EventBridgeRuleEventProperties + + +class CloudWatchLogsEventProperties(BaseModel): + FilterPattern: PassThrough + LogGroupName: PassThrough + + +class CloudWatchLogsEvent(BaseModel): + Type: Literal["CloudWatchLogs"] + Properties: CloudWatchLogsEventProperties + + +class IoTRuleEventProperties(BaseModel): + AwsIotSqlVersion: Optional[PassThrough] + Sql: PassThrough + + +class IoTRuleEvent(BaseModel): + Type: Literal["IoTRule"] + Properties: IoTRuleEventProperties + + +class AlexaSkillEventProperties(BaseModel): + SkillId: Optional[str] + + +class AlexaSkillEvent(BaseModel): + Type: Literal["AlexaSkill"] + Properties: Optional[AlexaSkillEventProperties] + + +class CognitoEventProperties(BaseModel): + Trigger: PassThrough + UserPool: Union[str, SamIntrinsic] + + +class CognitoEvent(BaseModel): + Type: Literal["Cognito"] + Properties: CognitoEventProperties + + +class HttpApiAuth(BaseModel): + AuthorizationScopes: Optional[List[str]] + Authorizer: Optional[str] + + +class HttpApiEventProperties(BaseModel): + ApiId: Optional[Union[str, SamIntrinsic]] + Auth: Optional[HttpApiAuth] + Method: Optional[str] + Path: Optional[str] + PayloadFormatVersion: Optional[Union[str, SamIntrinsic]] + RouteSettings: Optional[PassThrough] + TimeoutInMillis: Optional[Union[int, SamIntrinsic]] + + +class HttpApiEvent(BaseModel): + Type: Literal["HttpApi"] + Properties: Optional[HttpApiEventProperties] + + +class MSKEventProperties(BaseModel): + ConsumerGroupId: Optional[PassThrough] + FilterCriteria: Optional[PassThrough] + MaximumBatchingWindowInSeconds: Optional[PassThrough] + StartingPosition: PassThrough + Stream: PassThrough + Topics: PassThrough + + +class MSKEvent(BaseModel): + Type: Literal["MSK"] + Properties: MSKEventProperties + + +class MQEventProperties(BaseModel): + BatchSize: Optional[PassThrough] + Broker: PassThrough + Enabled: Optional[PassThrough] + FilterCriteria: Optional[PassThrough] + MaximumBatchingWindowInSeconds: Optional[PassThrough] + Queues: PassThrough + SecretsManagerKmsKeyId: Optional[str] + SourceAccessConfigurations: PassThrough + + +class MQEvent(BaseModel): + Type: Literal["MQ"] + Properties: MQEventProperties + + +class SelfManagedKafkaEventProperties(BaseModel): + BatchSize: Optional[PassThrough] + ConsumerGroupId: Optional[PassThrough] + Enabled: Optional[PassThrough] + FilterCriteria: Optional[PassThrough] + KafkaBootstrapServers: Optional[List[Union[str, SamIntrinsic]]] + SourceAccessConfigurations: PassThrough + Topics: PassThrough + + +class SelfManagedKafkaEvent(BaseModel): + Type: Literal["SelfManagedKafka"] + Properties: SelfManagedKafkaEventProperties + + +# TODO: Same as ScheduleV2EventProperties in state machine? +class ScheduleV2EventProperties(BaseModel): + # pylint: disable=duplicate-code + DeadLetterConfig: Optional[DeadLetterConfig] + Description: Optional[PassThrough] + EndDate: Optional[PassThrough] + FlexibleTimeWindow: Optional[PassThrough] + GroupName: Optional[PassThrough] + Input: Optional[PassThrough] + KmsKeyArn: Optional[PassThrough] + Name: Optional[PassThrough] + PermissionsBoundary: Optional[PassThrough] + RetryPolicy: Optional[PassThrough] + RoleArn: Optional[PassThrough] # TODO: Add to docs + ScheduleExpression: Optional[PassThrough] + ScheduleExpressionTimezone: Optional[PassThrough] + StartDate: Optional[PassThrough] + State: Optional[PassThrough] + + +class ScheduleV2Event(BaseModel): + Type: Literal["ScheduleV2"] + Properties: ScheduleV2EventProperties + + +class Properties(BaseModel): + Architectures: Optional[PassThrough] + AssumeRolePolicyDocument: Optional[Dict[str, Any]] + AutoPublishAlias: Optional[Union[str, SamIntrinsic]] + AutoPublishCodeSha256: Optional[Union[str, SamIntrinsic]] + CodeSigningConfigArn: Optional[Union[str, SamIntrinsic]] + CodeUri: Optional[Union[str, CodeUri]] + DeadLetterQueue: Optional[Union[SamIntrinsic, DeadLetterQueue]] + DeploymentPreference: Optional[DeploymentPreference] + Description: Optional[PassThrough] + Environment: Optional[PassThrough] + EphemeralStorage: Optional[PassThrough] + EventInvokeConfig: Optional[EventInvokeConfig] + Events: Optional[ + Dict[ + str, + Union[ + S3Event, + SNSEvent, + KinesisEvent, + DynamoDBEvent, + SQSEvent, + ApiEvent, + ScheduleEvent, + ScheduleV2Event, + CloudWatchEvent, + EventBridgeRuleEvent, + CloudWatchLogsEvent, + IoTRuleEvent, + AlexaSkillEvent, + CognitoEvent, + HttpApiEvent, + MSKEvent, + MQEvent, + SelfManagedKafkaEvent, + ], + ] + ] + FileSystemConfigs: Optional[PassThrough] + FunctionName: Optional[PassThrough] + FunctionUrlConfig: Optional[FunctionUrlConfig] + Handler: Optional[PassThrough] + ImageConfig: Optional[PassThrough] + ImageUri: Optional[PassThrough] + InlineCode: Optional[PassThrough] + KmsKeyArn: Optional[PassThrough] + Layers: Optional[PassThrough] + MemorySize: Optional[PassThrough] + PackageType: Optional[PassThrough] + PermissionsBoundary: Optional[PassThrough] + Policies: Optional[Union[str, List[Union[str, SamIntrinsic]], SamIntrinsic]] + ProvisionedConcurrencyConfig: Optional[PassThrough] + ReservedConcurrentExecutions: Optional[PassThrough] + Role: Optional[Union[str, SamIntrinsic]] + Runtime: Optional[PassThrough] + Tags: Optional[Dict[str, Any]] + Timeout: Optional[PassThrough] + Tracing: Optional[Union[str, SamIntrinsic]] + VersionDescription: Optional[PassThrough] + VpcConfig: Optional[PassThrough] + + +class Globals(BaseModel): + Handler: Unknown + Runtime: Unknown + CodeUri: Unknown + DeadLetterQueue: Unknown + Description: Unknown + MemorySize: Unknown + Timeout: Unknown + VpcConfig: Unknown + Environment: Unknown + Tags: Unknown + Tracing: Unknown + KmsKeyArn: Unknown + Layers: Unknown + AutoPublishAlias: Unknown + DeploymentPreference: Unknown + PermissionsBoundary: Unknown + ReservedConcurrentExecutions: Unknown + ProvisionedConcurrencyConfig: Unknown + AssumeRolePolicyDocument: Unknown + EventInvokeConfig: Unknown + Architectures: Unknown + EphemeralStorage: Unknown + + +class Resource(BaseModel): + Type: Literal["AWS::Serverless::Function"] + Properties: Optional[Properties] + DeletionPolicy: Optional[PassThrough] + UpdateReplacePolicy: Optional[PassThrough] + Condition: Optional[PassThrough] + DependsOn: Optional[PassThrough] + Metadata: Optional[PassThrough] diff --git a/samtranslator/schema/aws_serverless_httpapi.py b/samtranslator/schema/aws_serverless_httpapi.py new file mode 100644 index 000000000..2f523ebc9 --- /dev/null +++ b/samtranslator/schema/aws_serverless_httpapi.py @@ -0,0 +1,115 @@ +from typing import Optional, Any, Dict, Union, List + +from typing_extensions import Literal + +from samtranslator.schema.common import PassThrough, BaseModel, SamIntrinsic, Unknown + + +class OAuth2Authorizer(BaseModel): + AuthorizationScopes: Optional[List[str]] + IdentitySource: Optional[str] + JwtConfiguration: Optional[PassThrough] + + +class LambdaAuthorizerIdentity(BaseModel): + Context: Optional[List[str]] + Headers: Optional[List[str]] + QueryStrings: Optional[List[str]] + ReauthorizeEvery: Optional[int] + StageVariables: Optional[List[str]] + + +class LambdaAuthorizer(BaseModel): + # TODO: Many tests use floats for the version string; docs only mention string + AuthorizerPayloadFormatVersion: Union[Literal["1.0", "2.0"], float] + EnableSimpleResponses: Optional[bool] + FunctionArn: SamIntrinsic + FunctionInvokeRole: Optional[Union[str, SamIntrinsic]] + Identity: Optional[LambdaAuthorizerIdentity] + + +class Auth(BaseModel): + # TODO: Docs doesn't say it's a map + Authorizers: Optional[ + Dict[ + str, + Union[ + OAuth2Authorizer, + LambdaAuthorizer, + ], + ] + ] + DefaultAuthorizer: Optional[str] + EnableIamAuthorizer: Optional[bool] + + +class CorsConfiguration(BaseModel): + AllowCredentials: Optional[bool] + AllowHeaders: Optional[List[str]] + AllowMethods: Optional[List[str]] + AllowOrigins: Optional[List[str]] + ExposeHeaders: Optional[List[str]] + MaxAge: Optional[int] + + +class DefinitionUri(BaseModel): + Bucket: str + Key: str + Version: Optional[str] + + +class Route53(BaseModel): + DistributionDomainName: Optional[PassThrough] + EvaluateTargetHealth: Optional[PassThrough] + HostedZoneId: Optional[PassThrough] + HostedZoneName: Optional[PassThrough] + IpV6: Optional[bool] + + +class Domain(BaseModel): + BasePath: Optional[List[str]] + CertificateArn: PassThrough + DomainName: PassThrough + EndpointConfiguration: Optional[Union[Literal["REGIONAL"], SamIntrinsic]] + MutualTlsAuthentication: Optional[PassThrough] + OwnershipVerificationCertificateArn: Optional[PassThrough] + Route53: Optional[Route53] + SecurityPolicy: Optional[PassThrough] + + +class Properties(BaseModel): + AccessLogSettings: Optional[PassThrough] + Auth: Optional[Auth] + # TODO: Also string like in the docs? + CorsConfiguration: Optional[Union[SamIntrinsic, CorsConfiguration]] + DefaultRouteSettings: Optional[PassThrough] + DefinitionBody: Optional[Dict[str, Any]] + DefinitionUri: Optional[Union[str, DefinitionUri]] + Description: Optional[str] + DisableExecuteApiEndpoint: Optional[PassThrough] + Domain: Optional[Domain] + FailOnWarnings: Optional[PassThrough] + RouteSettings: Optional[PassThrough] + StageName: Optional[PassThrough] + StageVariables: Optional[PassThrough] + Tags: Optional[Dict[str, Any]] + Name: Optional[PassThrough] # TODO: Add to docs + + +class Globals(BaseModel): + Auth: Unknown + AccessLogSettings: Unknown + StageVariables: Unknown + Tags: Unknown + RouteSettings: Unknown + FailOnWarnings: Unknown + Domain: Unknown + CorsConfiguration: Unknown + DefaultRouteSettings: Unknown + + +class Resource(BaseModel): + Type: Literal["AWS::Serverless::HttpApi"] + Properties: Optional[Properties] + Metadata: Optional[PassThrough] + Condition: Optional[PassThrough] diff --git a/samtranslator/schema/aws_serverless_layerversion.py b/samtranslator/schema/aws_serverless_layerversion.py new file mode 100644 index 000000000..0ebd31e79 --- /dev/null +++ b/samtranslator/schema/aws_serverless_layerversion.py @@ -0,0 +1,28 @@ +from typing import Optional, Union + +from typing_extensions import Literal + +from samtranslator.schema.common import PassThrough, BaseModel, SamIntrinsic + + +class ContentUri(BaseModel): + Bucket: PassThrough + Key: PassThrough + Version: Optional[PassThrough] + + +class Properties(BaseModel): + CompatibleArchitectures: Optional[PassThrough] + CompatibleRuntimes: Optional[PassThrough] + ContentUri: Union[str, ContentUri] + Description: Optional[PassThrough] + LayerName: Optional[PassThrough] + LicenseInfo: Optional[PassThrough] + RetentionPolicy: Optional[Union[str, SamIntrinsic]] + + +class Resource(BaseModel): + Type: Literal["AWS::Serverless::LayerVersion"] + Properties: Properties + Condition: Optional[PassThrough] + DeletionPolicy: Optional[PassThrough] diff --git a/samtranslator/schema/aws_serverless_simpletable.py b/samtranslator/schema/aws_serverless_simpletable.py new file mode 100644 index 000000000..cf86f35c4 --- /dev/null +++ b/samtranslator/schema/aws_serverless_simpletable.py @@ -0,0 +1,27 @@ +from typing import Optional, Any, Dict + +from typing_extensions import Literal + +from samtranslator.schema.common import PassThrough, BaseModel, Unknown + + +class PrimaryKey(BaseModel): + Name: PassThrough + Type: PassThrough + + +class Properties(BaseModel): + PrimaryKey: Optional[PrimaryKey] + ProvisionedThroughput: Optional[PassThrough] + SSESpecification: Optional[PassThrough] + TableName: Optional[PassThrough] + Tags: Optional[Dict[str, Any]] + + +class Globals(BaseModel): + SSESpecification: Unknown + + +class Resource(BaseModel): + Type: Literal["AWS::Serverless::SimpleTable"] + Properties: Optional[Properties] diff --git a/samtranslator/schema/aws_serverless_statemachine.py b/samtranslator/schema/aws_serverless_statemachine.py new file mode 100644 index 000000000..eecd6b797 --- /dev/null +++ b/samtranslator/schema/aws_serverless_statemachine.py @@ -0,0 +1,142 @@ +from typing import Optional, Any, Dict, Union, List + +from typing_extensions import Literal + +from samtranslator.schema.common import PassThrough, BaseModel, SamIntrinsic + + +class DeadLetterConfig(BaseModel): + Arn: Optional[PassThrough] + QueueLogicalId: Optional[str] + Type: Optional[Literal["SQS"]] + + +class ScheduleEventProperties(BaseModel): + DeadLetterConfig: Optional[DeadLetterConfig] + Description: Optional[PassThrough] + Enabled: Optional[bool] + Input: Optional[PassThrough] + Name: Optional[PassThrough] + RetryPolicy: Optional[PassThrough] + Schedule: Optional[PassThrough] + State: Optional[PassThrough] + + +class ScheduleEvent(BaseModel): + Type: Literal["Schedule"] + Properties: ScheduleEventProperties + + +class ScheduleV2EventProperties(BaseModel): + DeadLetterConfig: Optional[DeadLetterConfig] + Description: Optional[PassThrough] + EndDate: Optional[PassThrough] + FlexibleTimeWindow: Optional[PassThrough] + GroupName: Optional[PassThrough] + Input: Optional[PassThrough] + KmsKeyArn: Optional[PassThrough] + Name: Optional[PassThrough] + PermissionsBoundary: Optional[PassThrough] + RetryPolicy: Optional[PassThrough] + RoleArn: Optional[PassThrough] # TODO: Add to docs + ScheduleExpression: Optional[PassThrough] + ScheduleExpressionTimezone: Optional[PassThrough] + StartDate: Optional[PassThrough] + State: Optional[PassThrough] + + +class ScheduleV2Event(BaseModel): + Type: Literal["ScheduleV2"] + Properties: ScheduleV2EventProperties + + +class ResourcePolicy(BaseModel): + AwsAccountBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + AwsAccountWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + CustomStatements: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpcBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpcWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpceBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IntrinsicVpceWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + IpRangeBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + IpRangeWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + SourceVpcBlacklist: Optional[List[Union[str, Dict[str, Any]]]] + SourceVpcWhitelist: Optional[List[Union[str, Dict[str, Any]]]] + + +class CloudWatchEventProperties(BaseModel): + EventBusName: Optional[PassThrough] + Input: Optional[PassThrough] + InputPath: Optional[PassThrough] + Pattern: Optional[PassThrough] + + +class CloudWatchEvent(BaseModel): + Type: Literal["CloudWatchEvent"] + Properties: CloudWatchEventProperties + + +class EventBridgeRuleEventProperties(BaseModel): + DeadLetterConfig: Optional[DeadLetterConfig] + EventBusName: Optional[PassThrough] + Input: Optional[PassThrough] + InputPath: Optional[PassThrough] + Pattern: Optional[PassThrough] + RetryPolicy: Optional[PassThrough] + + +class EventBridgeRuleEvent(BaseModel): + Type: Literal["EventBridgeRule"] + Properties: EventBridgeRuleEventProperties + + +class Auth(BaseModel): + ApiKeyRequired: Optional[bool] + AuthorizationScopes: Optional[List[str]] + Authorizer: Optional[str] + ResourcePolicy: Optional[ResourcePolicy] + + +class ApiEventProperties(BaseModel): + Auth: Optional[Auth] + Method: str + Path: str + RestApiId: Optional[SamIntrinsic] + UnescapeMappingTemplate: Optional[bool] # TODO: Add to docs + + +class ApiEvent(BaseModel): + Type: Literal["Api"] + Properties: ApiEventProperties + + +class Properties(BaseModel): + Definition: Optional[Dict[str, Any]] + DefinitionSubstitutions: Optional[Dict[str, Any]] + DefinitionUri: Optional[Union[str, PassThrough]] + Events: Optional[ + Dict[ + str, + Union[ + ScheduleEvent, + ScheduleV2Event, + CloudWatchEvent, + EventBridgeRuleEvent, + ApiEvent, + ], + ] + ] + Logging: Optional[PassThrough] + Name: Optional[PassThrough] + PermissionsBoundary: Optional[PassThrough] + Policies: Optional[Union[str, List[str], Dict[str, Any], List[Dict[str, Any]]]] + Role: Optional[PassThrough] + Tags: Optional[Dict[str, Any]] + Tracing: Optional[PassThrough] + Type: Optional[PassThrough] + + +class Resource(BaseModel): + Type: Literal["AWS::Serverless::StateMachine"] + Properties: Properties + Condition: Optional[PassThrough] diff --git a/samtranslator/schema/common.py b/samtranslator/schema/common.py new file mode 100644 index 000000000..527403c71 --- /dev/null +++ b/samtranslator/schema/common.py @@ -0,0 +1,25 @@ +from typing import Any, Dict, Optional + +import pydantic +from pydantic import Extra + +# Value passed directly to CloudFormation; not used by SAM +PassThrough = Any # TODO: Make it behave like typescript's unknown + +# Intrinsic resolvable by the SAM transform +SamIntrinsic = Dict[str, Any] + +# TODO: Get rid of this in favor of proper types +Unknown = Optional[Any] + +LenientBaseModel = pydantic.BaseModel + + +class BaseModel(LenientBaseModel): + """ + By default strict + https://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally + """ + + class Config: + extra = Extra.forbid diff --git a/samtranslator/schema/schema.json b/samtranslator/schema/schema.json index 2d8c92f35..adf038b3e 100644 --- a/samtranslator/schema/schema.json +++ b/samtranslator/schema/schema.json @@ -3,7 +3,7 @@ "type": "object", "properties": { "Globals": { - "$ref": "#/definitions/Globals" + "$ref": "#/definitions/__main____Globals" }, "Resources": { "title": "Resources", @@ -11,31 +11,31 @@ "additionalProperties": { "anyOf": [ { - "$ref": "#/definitions/AwsServerlessConnector" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_connector__Resource" }, { - "$ref": "#/definitions/AwsServerlessFunction" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__Resource" }, { - "$ref": "#/definitions/AwsServerlessSimpleTable" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_simpletable__Resource" }, { - "$ref": "#/definitions/AwsServerlessStateMachine" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__Resource" }, { - "$ref": "#/definitions/AwsServerlessLayerVersion" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_layerversion__Resource" }, { - "$ref": "#/definitions/AwsServerlessApi" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_api__Resource" }, { - "$ref": "#/definitions/AwsServerlessHttpApi" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_httpapi__Resource" }, { - "$ref": "#/definitions/AwsServerlessApplication" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_application__Resource" }, { - "$ref": "#/definitions/AnyNonServerlessResource" + "$ref": "#/definitions/samtranslator__schema__any_cfn_resource__Resource" } ] } @@ -45,8 +45,8 @@ "Resources" ], "definitions": { - "GlobalsFunction": { - "title": "GlobalsFunction", + "samtranslator__schema__aws_serverless_function__Globals": { + "title": "Globals", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -119,8 +119,8 @@ }, "additionalProperties": false }, - "GlobalsApi": { - "title": "GlobalsApi", + "samtranslator__schema__aws_serverless_api__Globals": { + "title": "Globals", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -178,8 +178,8 @@ }, "additionalProperties": false }, - "GlobalsHttpApi": { - "title": "GlobalsHttpApi", + "samtranslator__schema__aws_serverless_httpapi__Globals": { + "title": "Globals", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -213,8 +213,8 @@ }, "additionalProperties": false }, - "GlobalsSimpleTable": { - "title": "GlobalsSimpleTable", + "samtranslator__schema__aws_serverless_simpletable__Globals": { + "title": "Globals", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -224,22 +224,22 @@ }, "additionalProperties": false }, - "Globals": { + "__main____Globals": { "title": "Globals", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "Function": { - "$ref": "#/definitions/GlobalsFunction" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__Globals" }, "Api": { - "$ref": "#/definitions/GlobalsApi" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_api__Globals" }, "HttpApi": { - "$ref": "#/definitions/GlobalsHttpApi" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_httpapi__Globals" }, "SimpleTable": { - "$ref": "#/definitions/GlobalsSimpleTable" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_simpletable__Globals" } }, "additionalProperties": false @@ -278,8 +278,8 @@ }, "additionalProperties": false }, - "ConnectorProperties": { - "title": "ConnectorProperties", + "samtranslator__schema__aws_serverless_connector__Properties": { + "title": "Properties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -308,8 +308,8 @@ ], "additionalProperties": false }, - "AwsServerlessConnector": { - "title": "AwsServerlessConnector", + "samtranslator__schema__aws_serverless_connector__Resource": { + "title": "Resource", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -321,7 +321,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/ConnectorProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_connector__Properties" } }, "required": [ @@ -330,8 +330,8 @@ ], "additionalProperties": false }, - "FunctionCodeUri": { - "title": "FunctionCodeUri", + "CodeUri": { + "title": "CodeUri", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -375,8 +375,8 @@ ], "additionalProperties": false }, - "FunctionDeadLetterQueue": { - "title": "FunctionDeadLetterQueue", + "DeadLetterQueue": { + "title": "DeadLetterQueue", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -399,8 +399,8 @@ ], "additionalProperties": false }, - "FunctionDeploymentPreferenceHooks": { - "title": "FunctionDeploymentPreferenceHooks", + "Hooks": { + "title": "Hooks", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -429,8 +429,8 @@ }, "additionalProperties": false }, - "FunctionDeploymentPreference": { - "title": "FunctionDeploymentPreference", + "DeploymentPreference": { + "title": "DeploymentPreference", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -460,7 +460,7 @@ ] }, "Hooks": { - "$ref": "#/definitions/FunctionDeploymentPreferenceHooks" + "$ref": "#/definitions/Hooks" }, "PassthroughCondition": { "title": "Passthroughcondition", @@ -501,8 +501,8 @@ }, "additionalProperties": false }, - "FunctionEventInvokeConfig": { - "title": "FunctionEventInvokeConfig", + "EventInvokeConfig": { + "title": "EventInvokeConfig", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -520,8 +520,8 @@ }, "additionalProperties": false }, - "FunctionS3Properties": { - "title": "FunctionS3Properties", + "S3EventProperties": { + "title": "S3EventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -548,13 +548,13 @@ ], "additionalProperties": false }, - "FunctionS3Event": { - "title": "FunctionS3Event", + "S3Event": { + "title": "S3Event", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "Properties": { - "$ref": "#/definitions/FunctionS3Properties" + "$ref": "#/definitions/S3EventProperties" }, "Type": { "title": "Type", @@ -623,8 +623,8 @@ ], "additionalProperties": false }, - "FunctionSNSProperties": { - "title": "FunctionSNSProperties", + "SNSEventProperties": { + "title": "SNSEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -651,13 +651,13 @@ }, "additionalProperties": false }, - "FunctionSNSEvent": { - "title": "FunctionSNSEvent", + "SNSEvent": { + "title": "SNSEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "Properties": { - "$ref": "#/definitions/FunctionSNSProperties" + "$ref": "#/definitions/SNSEventProperties" }, "Type": { "title": "Type", @@ -673,8 +673,8 @@ ], "additionalProperties": false }, - "FunctionKinesisProperties": { - "title": "FunctionKinesisProperties", + "KinesisEventProperties": { + "title": "KinesisEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -720,8 +720,8 @@ }, "additionalProperties": false }, - "FunctionKinesisEvent": { - "title": "FunctionKinesisEvent", + "KinesisEvent": { + "title": "KinesisEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -733,7 +733,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionKinesisProperties" + "$ref": "#/definitions/KinesisEventProperties" } }, "required": [ @@ -742,8 +742,8 @@ ], "additionalProperties": false }, - "FunctionDynamoDBProperties": { - "title": "FunctionDynamoDBProperties", + "DynamoDBEventProperties": { + "title": "DynamoDBEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -789,8 +789,8 @@ }, "additionalProperties": false }, - "FunctionDynamoDBEvent": { - "title": "FunctionDynamoDBEvent", + "DynamoDBEvent": { + "title": "DynamoDBEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -802,7 +802,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionDynamoDBProperties" + "$ref": "#/definitions/DynamoDBEventProperties" } }, "required": [ @@ -811,8 +811,8 @@ ], "additionalProperties": false }, - "FunctionSqsProperties": { - "title": "FunctionSqsProperties", + "SQSEventProperties": { + "title": "SQSEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -834,8 +834,8 @@ }, "additionalProperties": false }, - "FunctionSqsEvent": { - "title": "FunctionSqsEvent", + "SQSEvent": { + "title": "SQSEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -847,7 +847,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionSqsProperties" + "$ref": "#/definitions/SQSEventProperties" } }, "required": [ @@ -856,7 +856,7 @@ ], "additionalProperties": false }, - "ResourcePolicy": { + "samtranslator__schema__aws_serverless_function__ResourcePolicy": { "title": "ResourcePolicy", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", @@ -1018,8 +1018,8 @@ }, "additionalProperties": false }, - "FunctionApiFunctionAuth": { - "title": "FunctionApiFunctionAuth", + "ApiAuth": { + "title": "ApiAuth", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1050,13 +1050,13 @@ ] }, "ResourcePolicy": { - "$ref": "#/definitions/ResourcePolicy" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__ResourcePolicy" } }, "additionalProperties": false }, - "FunctionRequestModel": { - "title": "FunctionRequestModel", + "RequestModel": { + "title": "RequestModel", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1082,8 +1082,8 @@ ], "additionalProperties": false }, - "FunctionRequestParameter": { - "title": "FunctionRequestParameter", + "RequestParameters": { + "title": "RequestParameters", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1098,13 +1098,13 @@ }, "additionalProperties": false }, - "FunctionApiProperties": { - "title": "FunctionApiProperties", + "samtranslator__schema__aws_serverless_function__ApiEventProperties": { + "title": "ApiEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "Auth": { - "$ref": "#/definitions/FunctionApiFunctionAuth" + "$ref": "#/definitions/ApiAuth" }, "Method": { "title": "Method", @@ -1115,7 +1115,7 @@ "type": "string" }, "RequestModel": { - "$ref": "#/definitions/FunctionRequestModel" + "$ref": "#/definitions/RequestModel" }, "RequestParameters": { "title": "Requestparameters", @@ -1124,7 +1124,7 @@ "type": "string" }, { - "$ref": "#/definitions/FunctionRequestParameter" + "$ref": "#/definitions/RequestParameters" } ] }, @@ -1146,8 +1146,8 @@ ], "additionalProperties": false }, - "FunctionApiEvent": { - "title": "FunctionApiEvent", + "samtranslator__schema__aws_serverless_function__ApiEvent": { + "title": "ApiEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1159,7 +1159,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionApiProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__ApiEventProperties" } }, "required": [ @@ -1168,8 +1168,8 @@ ], "additionalProperties": false }, - "EventsDeadLetterConfig": { - "title": "EventsDeadLetterConfig", + "samtranslator__schema__aws_serverless_function__DeadLetterConfig": { + "title": "DeadLetterConfig", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1196,7 +1196,7 @@ "type": "object", "properties": { "DeadLetterConfig": { - "$ref": "#/definitions/EventsDeadLetterConfig" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__DeadLetterConfig" }, "Description": { "title": "Description" @@ -1223,8 +1223,8 @@ }, "additionalProperties": false }, - "EventsSchedule": { - "title": "EventsSchedule", + "samtranslator__schema__aws_serverless_function__ScheduleEvent": { + "title": "ScheduleEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1245,13 +1245,13 @@ ], "additionalProperties": false }, - "EventsScheduleV2Properties": { - "title": "EventsScheduleV2Properties", + "samtranslator__schema__aws_serverless_function__ScheduleV2EventProperties": { + "title": "ScheduleV2EventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "DeadLetterConfig": { - "$ref": "#/definitions/EventsDeadLetterConfig" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__DeadLetterConfig" }, "Description": { "title": "Description" @@ -1298,8 +1298,8 @@ }, "additionalProperties": false }, - "EventsScheduleV2": { - "title": "EventsScheduleV2", + "samtranslator__schema__aws_serverless_function__ScheduleV2Event": { + "title": "ScheduleV2Event", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1311,7 +1311,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/EventsScheduleV2Properties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__ScheduleV2EventProperties" } }, "required": [ @@ -1320,8 +1320,8 @@ ], "additionalProperties": false }, - "FunctionCloudWatchProperties": { - "title": "FunctionCloudWatchProperties", + "samtranslator__schema__aws_serverless_function__CloudWatchEventProperties": { + "title": "CloudWatchEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1347,8 +1347,8 @@ }, "additionalProperties": false }, - "FunctionCloudWatchEvent": { - "title": "FunctionCloudWatchEvent", + "samtranslator__schema__aws_serverless_function__CloudWatchEvent": { + "title": "CloudWatchEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1360,7 +1360,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionCloudWatchProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__CloudWatchEventProperties" } }, "required": [ @@ -1369,13 +1369,13 @@ ], "additionalProperties": false }, - "FunctionEventBridgeRuleProperties": { - "title": "FunctionEventBridgeRuleProperties", + "samtranslator__schema__aws_serverless_function__EventBridgeRuleEventProperties": { + "title": "EventBridgeRuleEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "DeadLetterConfig": { - "$ref": "#/definitions/EventsDeadLetterConfig" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__DeadLetterConfig" }, "EventBusName": { "title": "Eventbusname" @@ -1398,8 +1398,8 @@ }, "additionalProperties": false }, - "FunctionEventBridgeRuleEvent": { - "title": "FunctionEventBridgeRuleEvent", + "samtranslator__schema__aws_serverless_function__EventBridgeRuleEvent": { + "title": "EventBridgeRuleEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1411,7 +1411,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionEventBridgeRuleProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__EventBridgeRuleEventProperties" } }, "required": [ @@ -1420,8 +1420,8 @@ ], "additionalProperties": false }, - "FunctionCloudWatchLogsProperties": { - "title": "FunctionCloudWatchLogsProperties", + "CloudWatchLogsEventProperties": { + "title": "CloudWatchLogsEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1434,8 +1434,8 @@ }, "additionalProperties": false }, - "FunctionCloudWatchLogsEvent": { - "title": "FunctionCloudWatchLogsEvent", + "CloudWatchLogsEvent": { + "title": "CloudWatchLogsEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1447,7 +1447,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionCloudWatchLogsProperties" + "$ref": "#/definitions/CloudWatchLogsEventProperties" } }, "required": [ @@ -1456,8 +1456,8 @@ ], "additionalProperties": false }, - "FunctionIoTRuleProperties": { - "title": "FunctionIoTRuleProperties", + "IoTRuleEventProperties": { + "title": "IoTRuleEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1470,8 +1470,8 @@ }, "additionalProperties": false }, - "FunctionIoTRuleEvent": { - "title": "FunctionIoTRuleEvent", + "IoTRuleEvent": { + "title": "IoTRuleEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1483,7 +1483,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionIoTRuleProperties" + "$ref": "#/definitions/IoTRuleEventProperties" } }, "required": [ @@ -1492,8 +1492,8 @@ ], "additionalProperties": false }, - "FunctionAlexaSkillProperties": { - "title": "FunctionAlexaSkillProperties", + "AlexaSkillEventProperties": { + "title": "AlexaSkillEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1504,8 +1504,8 @@ }, "additionalProperties": false }, - "FunctionAlexaSkillEvent": { - "title": "FunctionAlexaSkillEvent", + "AlexaSkillEvent": { + "title": "AlexaSkillEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1517,7 +1517,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionAlexaSkillProperties" + "$ref": "#/definitions/AlexaSkillEventProperties" } }, "required": [ @@ -1525,8 +1525,8 @@ ], "additionalProperties": false }, - "FunctionCognitoProperties": { - "title": "FunctionCognitoProperties", + "CognitoEventProperties": { + "title": "CognitoEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1550,8 +1550,8 @@ ], "additionalProperties": false }, - "FunctionCognitoEvent": { - "title": "FunctionCognitoEvent", + "CognitoEvent": { + "title": "CognitoEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1563,7 +1563,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionCognitoProperties" + "$ref": "#/definitions/CognitoEventProperties" } }, "required": [ @@ -1572,8 +1572,8 @@ ], "additionalProperties": false }, - "FunctionHttpApiAuth": { - "title": "FunctionHttpApiAuth", + "HttpApiAuth": { + "title": "HttpApiAuth", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1591,8 +1591,8 @@ }, "additionalProperties": false }, - "FunctionHttpApiProperties": { - "title": "FunctionHttpApiProperties", + "HttpApiEventProperties": { + "title": "HttpApiEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1608,7 +1608,7 @@ ] }, "Auth": { - "$ref": "#/definitions/FunctionHttpApiAuth" + "$ref": "#/definitions/HttpApiAuth" }, "Method": { "title": "Method", @@ -1646,8 +1646,8 @@ }, "additionalProperties": false }, - "FunctionHttpApiEvent": { - "title": "FunctionHttpApiEvent", + "HttpApiEvent": { + "title": "HttpApiEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1659,7 +1659,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionHttpApiProperties" + "$ref": "#/definitions/HttpApiEventProperties" } }, "required": [ @@ -1667,8 +1667,8 @@ ], "additionalProperties": false }, - "FunctionMSKProperties": { - "title": "FunctionMSKProperties", + "MSKEventProperties": { + "title": "MSKEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1693,8 +1693,8 @@ }, "additionalProperties": false }, - "FunctionMSKEvent": { - "title": "FunctionMSKEvent", + "MSKEvent": { + "title": "MSKEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1706,7 +1706,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionMSKProperties" + "$ref": "#/definitions/MSKEventProperties" } }, "required": [ @@ -1715,8 +1715,8 @@ ], "additionalProperties": false }, - "FunctionMQProperties": { - "title": "FunctionMQProperties", + "MQEventProperties": { + "title": "MQEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1748,8 +1748,8 @@ }, "additionalProperties": false }, - "FunctionMQEvent": { - "title": "FunctionMQEvent", + "MQEvent": { + "title": "MQEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1761,7 +1761,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionMQProperties" + "$ref": "#/definitions/MQEventProperties" } }, "required": [ @@ -1770,8 +1770,8 @@ ], "additionalProperties": false }, - "FunctionSelfManagedKafkaProperties": { - "title": "FunctionSelfManagedKafkaProperties", + "SelfManagedKafkaEventProperties": { + "title": "SelfManagedKafkaEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1810,8 +1810,8 @@ }, "additionalProperties": false }, - "FunctionSelfManagedKafkaEvent": { - "title": "FunctionSelfManagedKafkaEvent", + "SelfManagedKafkaEvent": { + "title": "SelfManagedKafkaEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1823,7 +1823,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionSelfManagedKafkaProperties" + "$ref": "#/definitions/SelfManagedKafkaEventProperties" } }, "required": [ @@ -1857,8 +1857,8 @@ ], "additionalProperties": false }, - "FunctionProperties": { - "title": "FunctionProperties", + "samtranslator__schema__aws_serverless_function__Properties": { + "title": "Properties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -1909,7 +1909,7 @@ "type": "string" }, { - "$ref": "#/definitions/FunctionCodeUri" + "$ref": "#/definitions/CodeUri" } ] }, @@ -1920,12 +1920,12 @@ "type": "object" }, { - "$ref": "#/definitions/FunctionDeadLetterQueue" + "$ref": "#/definitions/DeadLetterQueue" } ] }, "DeploymentPreference": { - "$ref": "#/definitions/FunctionDeploymentPreference" + "$ref": "#/definitions/DeploymentPreference" }, "Description": { "title": "Description" @@ -1937,7 +1937,7 @@ "title": "Ephemeralstorage" }, "EventInvokeConfig": { - "$ref": "#/definitions/FunctionEventInvokeConfig" + "$ref": "#/definitions/EventInvokeConfig" }, "Events": { "title": "Events", @@ -1945,58 +1945,58 @@ "additionalProperties": { "anyOf": [ { - "$ref": "#/definitions/FunctionS3Event" + "$ref": "#/definitions/S3Event" }, { - "$ref": "#/definitions/FunctionSNSEvent" + "$ref": "#/definitions/SNSEvent" }, { - "$ref": "#/definitions/FunctionKinesisEvent" + "$ref": "#/definitions/KinesisEvent" }, { - "$ref": "#/definitions/FunctionDynamoDBEvent" + "$ref": "#/definitions/DynamoDBEvent" }, { - "$ref": "#/definitions/FunctionSqsEvent" + "$ref": "#/definitions/SQSEvent" }, { - "$ref": "#/definitions/FunctionApiEvent" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__ApiEvent" }, { - "$ref": "#/definitions/EventsSchedule" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__ScheduleEvent" }, { - "$ref": "#/definitions/EventsScheduleV2" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__ScheduleV2Event" }, { - "$ref": "#/definitions/FunctionCloudWatchEvent" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__CloudWatchEvent" }, { - "$ref": "#/definitions/FunctionEventBridgeRuleEvent" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__EventBridgeRuleEvent" }, { - "$ref": "#/definitions/FunctionCloudWatchLogsEvent" + "$ref": "#/definitions/CloudWatchLogsEvent" }, { - "$ref": "#/definitions/FunctionIoTRuleEvent" + "$ref": "#/definitions/IoTRuleEvent" }, { - "$ref": "#/definitions/FunctionAlexaSkillEvent" + "$ref": "#/definitions/AlexaSkillEvent" }, { - "$ref": "#/definitions/FunctionCognitoEvent" + "$ref": "#/definitions/CognitoEvent" }, { - "$ref": "#/definitions/FunctionHttpApiEvent" + "$ref": "#/definitions/HttpApiEvent" }, { - "$ref": "#/definitions/FunctionMSKEvent" + "$ref": "#/definitions/MSKEvent" }, { - "$ref": "#/definitions/FunctionMQEvent" + "$ref": "#/definitions/MQEvent" }, { - "$ref": "#/definitions/FunctionSelfManagedKafkaEvent" + "$ref": "#/definitions/SelfManagedKafkaEvent" } ] } @@ -2108,8 +2108,8 @@ }, "additionalProperties": false }, - "AwsServerlessFunction": { - "title": "AwsServerlessFunction", + "samtranslator__schema__aws_serverless_function__Resource": { + "title": "Resource", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2121,7 +2121,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/FunctionProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_function__Properties" }, "DeletionPolicy": { "title": "Deletionpolicy" @@ -2144,8 +2144,8 @@ ], "additionalProperties": false }, - "SimpleTablePrimaryKey": { - "title": "SimpleTablePrimaryKey", + "PrimaryKey": { + "title": "PrimaryKey", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2158,13 +2158,13 @@ }, "additionalProperties": false }, - "SimpleTableProperties": { - "title": "SimpleTableProperties", + "samtranslator__schema__aws_serverless_simpletable__Properties": { + "title": "Properties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "PrimaryKey": { - "$ref": "#/definitions/SimpleTablePrimaryKey" + "$ref": "#/definitions/PrimaryKey" }, "ProvisionedThroughput": { "title": "Provisionedthroughput" @@ -2182,8 +2182,8 @@ }, "additionalProperties": false }, - "AwsServerlessSimpleTable": { - "title": "AwsServerlessSimpleTable", + "samtranslator__schema__aws_serverless_simpletable__Resource": { + "title": "Resource", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2195,7 +2195,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/SimpleTableProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_simpletable__Properties" } }, "required": [ @@ -2203,40 +2203,75 @@ ], "additionalProperties": false }, - "StateMachineEventsCloudWatchEventProperties": { - "title": "StateMachineEventsCloudWatchEventProperties", + "samtranslator__schema__aws_serverless_statemachine__DeadLetterConfig": { + "title": "DeadLetterConfig", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { - "EventBusName": { - "title": "Eventbusname" + "Arn": { + "title": "Arn" + }, + "QueueLogicalId": { + "title": "Queuelogicalid", + "type": "string" + }, + "Type": { + "title": "Type", + "enum": [ + "SQS" + ], + "type": "string" + } + }, + "additionalProperties": false + }, + "ScheduleEventProperties": { + "title": "ScheduleEventProperties", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "DeadLetterConfig": { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__DeadLetterConfig" + }, + "Description": { + "title": "Description" + }, + "Enabled": { + "title": "Enabled", + "type": "boolean" }, "Input": { "title": "Input" }, - "InputPath": { - "title": "Inputpath" + "Name": { + "title": "Name" }, - "Pattern": { - "title": "Pattern" + "RetryPolicy": { + "title": "Retrypolicy" + }, + "Schedule": { + "title": "Schedule" + }, + "State": { + "title": "State" } }, "additionalProperties": false }, - "StateMachineEventsCloudWatchEvent": { - "title": "StateMachineEventsCloudWatchEvent", + "samtranslator__schema__aws_serverless_statemachine__ScheduleEvent": { + "title": "ScheduleEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "Type": { "title": "Type", "enum": [ - "CloudWatchEvent" + "Schedule" ], "type": "string" }, "Properties": { - "$ref": "#/definitions/StateMachineEventsCloudWatchEventProperties" + "$ref": "#/definitions/ScheduleEventProperties" } }, "required": [ @@ -2245,36 +2280,86 @@ ], "additionalProperties": false }, - "StateMachineEventsEventBridgeRuleDeadLetterConfig": { - "title": "StateMachineEventsEventBridgeRuleDeadLetterConfig", + "samtranslator__schema__aws_serverless_statemachine__ScheduleV2EventProperties": { + "title": "ScheduleV2EventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { - "Arn": { - "title": "Arn" + "DeadLetterConfig": { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__DeadLetterConfig" }, - "QueueLogicalId": { - "title": "Queuelogicalid", - "type": "string" + "Description": { + "title": "Description" + }, + "EndDate": { + "title": "Enddate" + }, + "FlexibleTimeWindow": { + "title": "Flexibletimewindow" + }, + "GroupName": { + "title": "Groupname" + }, + "Input": { + "title": "Input" + }, + "KmsKeyArn": { + "title": "Kmskeyarn" + }, + "Name": { + "title": "Name" + }, + "PermissionsBoundary": { + "title": "Permissionsboundary" + }, + "RetryPolicy": { + "title": "Retrypolicy" + }, + "RoleArn": { + "title": "Rolearn" + }, + "ScheduleExpression": { + "title": "Scheduleexpression" + }, + "ScheduleExpressionTimezone": { + "title": "Scheduleexpressiontimezone" + }, + "StartDate": { + "title": "Startdate" }, + "State": { + "title": "State" + } + }, + "additionalProperties": false + }, + "samtranslator__schema__aws_serverless_statemachine__ScheduleV2Event": { + "title": "ScheduleV2Event", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { "Type": { "title": "Type", "enum": [ - "SQS" + "ScheduleV2" ], "type": "string" + }, + "Properties": { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__ScheduleV2EventProperties" } }, + "required": [ + "Type", + "Properties" + ], "additionalProperties": false }, - "StateMachineEventsEventBridgeRuleProperties": { - "title": "StateMachineEventsEventBridgeRuleProperties", + "samtranslator__schema__aws_serverless_statemachine__CloudWatchEventProperties": { + "title": "CloudWatchEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { - "DeadLetterConfig": { - "$ref": "#/definitions/StateMachineEventsEventBridgeRuleDeadLetterConfig" - }, "EventBusName": { "title": "Eventbusname" }, @@ -2286,27 +2371,24 @@ }, "Pattern": { "title": "Pattern" - }, - "RetryPolicy": { - "title": "Retrypolicy" } }, "additionalProperties": false }, - "StateMachineEventsEventBridgeRule": { - "title": "StateMachineEventsEventBridgeRule", + "samtranslator__schema__aws_serverless_statemachine__CloudWatchEvent": { + "title": "CloudWatchEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "Type": { "title": "Type", "enum": [ - "EventBridgeRule" + "CloudWatchEvent" ], "type": "string" }, "Properties": { - "$ref": "#/definitions/StateMachineEventsEventBridgeRuleProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__CloudWatchEventProperties" } }, "required": [ @@ -2315,77 +2397,46 @@ ], "additionalProperties": false }, - "StateMachineEventsApiAuth": { - "title": "StateMachineEventsApiAuth", + "samtranslator__schema__aws_serverless_statemachine__EventBridgeRuleEventProperties": { + "title": "EventBridgeRuleEventProperties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { - "ApiKeyRequired": { - "title": "Apikeyrequired", - "type": "boolean" - }, - "AuthorizationScopes": { - "title": "Authorizationscopes", - "type": "array", - "items": { - "type": "string" - } - }, - "Authorizer": { - "title": "Authorizer", - "type": "string" + "DeadLetterConfig": { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__DeadLetterConfig" }, - "ResourcePolicy": { - "$ref": "#/definitions/ResourcePolicy" - } - }, - "additionalProperties": false - }, - "StateMachineEventsApiProperties": { - "title": "StateMachineEventsApiProperties", - "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", - "type": "object", - "properties": { - "Auth": { - "$ref": "#/definitions/StateMachineEventsApiAuth" + "EventBusName": { + "title": "Eventbusname" }, - "Method": { - "title": "Method", - "type": "string" + "Input": { + "title": "Input" }, - "Path": { - "title": "Path", - "type": "string" + "InputPath": { + "title": "Inputpath" }, - "RestApiId": { - "title": "Restapiid", - "type": "object" + "Pattern": { + "title": "Pattern" }, - "UnescapeMappingTemplate": { - "title": "Unescapemappingtemplate", - "type": "boolean" + "RetryPolicy": { + "title": "Retrypolicy" } }, - "required": [ - "Method", - "Path" - ], "additionalProperties": false }, - "StateMachineEventsApi": { - "title": "StateMachineEventsApi", + "samtranslator__schema__aws_serverless_statemachine__EventBridgeRuleEvent": { + "title": "EventBridgeRuleEvent", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { "Type": { "title": "Type", "enum": [ - "Api" + "EventBridgeRule" ], "type": "string" }, "Properties": { - "$ref": "#/definitions/StateMachineEventsApiProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__EventBridgeRuleEventProperties" } }, "required": [ @@ -2394,85 +2445,326 @@ ], "additionalProperties": false }, - "StateMachineProperties": { - "title": "StateMachineProperties", + "samtranslator__schema__aws_serverless_statemachine__ResourcePolicy": { + "title": "ResourcePolicy", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { - "Definition": { - "title": "Definition", - "type": "object" - }, - "DefinitionSubstitutions": { - "title": "Definitionsubstitutions", - "type": "object" - }, - "DefinitionUri": { - "title": "Definitionuri", - "anyOf": [ - { - "type": "string" - }, - {} - ] - }, - "Events": { - "title": "Events", - "type": "object", - "additionalProperties": { + "AwsAccountBlacklist": { + "title": "Awsaccountblacklist", + "type": "array", + "items": { "anyOf": [ { - "$ref": "#/definitions/EventsSchedule" - }, - { - "$ref": "#/definitions/EventsScheduleV2" + "type": "string" }, { - "$ref": "#/definitions/StateMachineEventsCloudWatchEvent" - }, + "type": "object" + } + ] + } + }, + "AwsAccountWhitelist": { + "title": "Awsaccountwhitelist", + "type": "array", + "items": { + "anyOf": [ { - "$ref": "#/definitions/StateMachineEventsEventBridgeRule" + "type": "string" }, { - "$ref": "#/definitions/StateMachineEventsApi" + "type": "object" } ] } }, - "Logging": { - "title": "Logging" - }, - "Name": { - "title": "Name" - }, - "PermissionsBoundary": { - "title": "Permissionsboundary" - }, - "Policies": { - "title": "Policies", - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { + "CustomStatements": { + "title": "Customstatements", + "type": "array", + "items": { + "anyOf": [ + { "type": "string" - } - }, - { - "type": "object" - }, - { - "type": "array", - "items": { + }, + { "type": "object" } - } - ] + ] + } }, - "Role": { - "title": "Role" + "IntrinsicVpcBlacklist": { + "title": "Intrinsicvpcblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IntrinsicVpcWhitelist": { + "title": "Intrinsicvpcwhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IntrinsicVpceBlacklist": { + "title": "Intrinsicvpceblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IntrinsicVpceWhitelist": { + "title": "Intrinsicvpcewhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IpRangeBlacklist": { + "title": "Iprangeblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IpRangeWhitelist": { + "title": "Iprangewhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "SourceVpcBlacklist": { + "title": "Sourcevpcblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "SourceVpcWhitelist": { + "title": "Sourcevpcwhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + } + }, + "additionalProperties": false + }, + "samtranslator__schema__aws_serverless_statemachine__Auth": { + "title": "Auth", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "ApiKeyRequired": { + "title": "Apikeyrequired", + "type": "boolean" + }, + "AuthorizationScopes": { + "title": "Authorizationscopes", + "type": "array", + "items": { + "type": "string" + } + }, + "Authorizer": { + "title": "Authorizer", + "type": "string" + }, + "ResourcePolicy": { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__ResourcePolicy" + } + }, + "additionalProperties": false + }, + "samtranslator__schema__aws_serverless_statemachine__ApiEventProperties": { + "title": "ApiEventProperties", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "Auth": { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__Auth" + }, + "Method": { + "title": "Method", + "type": "string" + }, + "Path": { + "title": "Path", + "type": "string" + }, + "RestApiId": { + "title": "Restapiid", + "type": "object" + }, + "UnescapeMappingTemplate": { + "title": "Unescapemappingtemplate", + "type": "boolean" + } + }, + "required": [ + "Method", + "Path" + ], + "additionalProperties": false + }, + "samtranslator__schema__aws_serverless_statemachine__ApiEvent": { + "title": "ApiEvent", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "Type": { + "title": "Type", + "enum": [ + "Api" + ], + "type": "string" + }, + "Properties": { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__ApiEventProperties" + } + }, + "required": [ + "Type", + "Properties" + ], + "additionalProperties": false + }, + "samtranslator__schema__aws_serverless_statemachine__Properties": { + "title": "Properties", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "Definition": { + "title": "Definition", + "type": "object" + }, + "DefinitionSubstitutions": { + "title": "Definitionsubstitutions", + "type": "object" + }, + "DefinitionUri": { + "title": "Definitionuri", + "anyOf": [ + { + "type": "string" + }, + {} + ] + }, + "Events": { + "title": "Events", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__ScheduleEvent" + }, + { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__ScheduleV2Event" + }, + { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__CloudWatchEvent" + }, + { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__EventBridgeRuleEvent" + }, + { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__ApiEvent" + } + ] + } + }, + "Logging": { + "title": "Logging" + }, + "Name": { + "title": "Name" + }, + "PermissionsBoundary": { + "title": "Permissionsboundary" + }, + "Policies": { + "title": "Policies", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object" + }, + { + "type": "array", + "items": { + "type": "object" + } + } + ] + }, + "Role": { + "title": "Role" }, "Tags": { "title": "Tags", @@ -2487,8 +2779,8 @@ }, "additionalProperties": false }, - "AwsServerlessStateMachine": { - "title": "AwsServerlessStateMachine", + "samtranslator__schema__aws_serverless_statemachine__Resource": { + "title": "Resource", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2500,7 +2792,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/StateMachineProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_statemachine__Properties" }, "Condition": { "title": "Condition" @@ -2512,8 +2804,8 @@ ], "additionalProperties": false }, - "LayerVersionContentUri": { - "title": "LayerVersionContentUri", + "ContentUri": { + "title": "ContentUri", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2529,8 +2821,8 @@ }, "additionalProperties": false }, - "LayerVersionProperties": { - "title": "LayerVersionProperties", + "samtranslator__schema__aws_serverless_layerversion__Properties": { + "title": "Properties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2547,7 +2839,7 @@ "type": "string" }, { - "$ref": "#/definitions/LayerVersionContentUri" + "$ref": "#/definitions/ContentUri" } ] }, @@ -2573,47 +2865,102 @@ } }, "required": [ - "ContentUri" - ], - "additionalProperties": false - }, - "AwsServerlessLayerVersion": { - "title": "AwsServerlessLayerVersion", - "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", - "type": "object", - "properties": { - "Type": { - "title": "Type", - "enum": [ - "AWS::Serverless::LayerVersion" - ], - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/LayerVersionProperties" - }, - "Condition": { - "title": "Condition" - }, - "DeletionPolicy": { - "title": "Deletionpolicy" - } - }, - "required": [ - "Type", - "Properties" + "ContentUri" + ], + "additionalProperties": false + }, + "samtranslator__schema__aws_serverless_layerversion__Resource": { + "title": "Resource", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "Type": { + "title": "Type", + "enum": [ + "AWS::Serverless::LayerVersion" + ], + "type": "string" + }, + "Properties": { + "$ref": "#/definitions/samtranslator__schema__aws_serverless_layerversion__Properties" + }, + "Condition": { + "title": "Condition" + }, + "DeletionPolicy": { + "title": "Deletionpolicy" + } + }, + "required": [ + "Type", + "Properties" + ], + "additionalProperties": false + }, + "CognitoAuthorizerIdentity": { + "title": "CognitoAuthorizerIdentity", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "Header": { + "title": "Header", + "type": "string" + }, + "ReauthorizeEvery": { + "title": "Reauthorizeevery", + "anyOf": [ + { + "type": "integer" + }, + { + "type": "object" + } + ] + }, + "ValidationExpression": { + "title": "Validationexpression", + "type": "string" + } + }, + "additionalProperties": false + }, + "CognitoAuthorizer": { + "title": "CognitoAuthorizer", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "AuthorizationScopes": { + "title": "Authorizationscopes", + "type": "array", + "items": { + "type": "string" + } + }, + "Identity": { + "$ref": "#/definitions/CognitoAuthorizerIdentity" + }, + "UserPoolArn": { + "title": "Userpoolarn", + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "required": [ + "UserPoolArn" ], "additionalProperties": false }, - "ApiAuthCognitoAuthorizationIdentity": { - "title": "ApiAuthCognitoAuthorizationIdentity", + "LambdaTokenAuthorizerIdentity": { + "title": "LambdaTokenAuthorizerIdentity", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { - "Header": { - "title": "Header", - "type": "string" - }, "ReauthorizeEvery": { "title": "Reauthorizeevery", "anyOf": [ @@ -2628,12 +2975,16 @@ "ValidationExpression": { "title": "Validationexpression", "type": "string" + }, + "Header": { + "title": "Header", + "type": "string" } }, "additionalProperties": false }, - "ApiAuthCognitoAuthorizer": { - "title": "ApiAuthCognitoAuthorizer", + "LambdaTokenAuthorizer": { + "title": "LambdaTokenAuthorizer", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2644,11 +2995,8 @@ "type": "string" } }, - "Identity": { - "$ref": "#/definitions/ApiAuthCognitoAuthorizationIdentity" - }, - "UserPoolArn": { - "title": "Userpoolarn", + "FunctionArn": { + "title": "Functionarn", "anyOf": [ { "type": "string" @@ -2657,15 +3005,30 @@ "type": "object" } ] + }, + "FunctionInvokeRole": { + "title": "Functioninvokerole", + "type": "string" + }, + "FunctionPayloadType": { + "title": "Functionpayloadtype", + "enum": [ + "REQUEST", + "TOKEN" + ], + "type": "string" + }, + "Identity": { + "$ref": "#/definitions/LambdaTokenAuthorizerIdentity" } }, "required": [ - "UserPoolArn" + "FunctionArn" ], "additionalProperties": false }, - "ApiAuthLambdaRequestAuthorizationIdentity": { - "title": "ApiAuthLambdaRequestAuthorizationIdentity", + "LambdaRequestAuthorizerIdentity": { + "title": "LambdaRequestAuthorizerIdentity", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2711,35 +3074,8 @@ }, "additionalProperties": false }, - "ApiAuthLambdaTokenAuthorizationIdentity": { - "title": "ApiAuthLambdaTokenAuthorizationIdentity", - "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", - "type": "object", - "properties": { - "Header": { - "title": "Header", - "type": "string" - }, - "ReauthorizeEvery": { - "title": "Reauthorizeevery", - "anyOf": [ - { - "type": "integer" - }, - { - "type": "object" - } - ] - }, - "ValidationExpression": { - "title": "Validationexpression", - "type": "string" - } - }, - "additionalProperties": false - }, - "ApiAuthLambdaAuthorizer": { - "title": "ApiAuthLambdaAuthorizer", + "LambdaRequestAuthorizer": { + "title": "LambdaRequestAuthorizer", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2774,15 +3110,7 @@ "type": "string" }, "Identity": { - "title": "Identity", - "anyOf": [ - { - "$ref": "#/definitions/ApiAuthLambdaRequestAuthorizationIdentity" - }, - { - "$ref": "#/definitions/ApiAuthLambdaTokenAuthorizationIdentity" - } - ] + "$ref": "#/definitions/LambdaRequestAuthorizerIdentity" } }, "required": [ @@ -2790,8 +3118,170 @@ ], "additionalProperties": false }, - "ApiAuthUsagePlan": { - "title": "ApiAuthUsagePlan", + "samtranslator__schema__aws_serverless_api__ResourcePolicy": { + "title": "ResourcePolicy", + "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", + "type": "object", + "properties": { + "AwsAccountBlacklist": { + "title": "Awsaccountblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "AwsAccountWhitelist": { + "title": "Awsaccountwhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "CustomStatements": { + "title": "Customstatements", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IntrinsicVpcBlacklist": { + "title": "Intrinsicvpcblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IntrinsicVpcWhitelist": { + "title": "Intrinsicvpcwhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IntrinsicVpceBlacklist": { + "title": "Intrinsicvpceblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IntrinsicVpceWhitelist": { + "title": "Intrinsicvpcewhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IpRangeBlacklist": { + "title": "Iprangeblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "IpRangeWhitelist": { + "title": "Iprangewhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "SourceVpcBlacklist": { + "title": "Sourcevpcblacklist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "SourceVpcWhitelist": { + "title": "Sourcevpcwhitelist", + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + } + }, + "additionalProperties": false + }, + "UsagePlan": { + "title": "UsagePlan", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2825,8 +3315,8 @@ ], "additionalProperties": false }, - "ApiAuthProperties": { - "title": "ApiAuthProperties", + "samtranslator__schema__aws_serverless_api__Auth": { + "title": "Auth", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2844,10 +3334,13 @@ "additionalProperties": { "anyOf": [ { - "$ref": "#/definitions/ApiAuthCognitoAuthorizer" + "$ref": "#/definitions/CognitoAuthorizer" + }, + { + "$ref": "#/definitions/LambdaTokenAuthorizer" }, { - "$ref": "#/definitions/ApiAuthLambdaAuthorizer" + "$ref": "#/definitions/LambdaRequestAuthorizer" } ] } @@ -2861,16 +3354,16 @@ "type": "string" }, "ResourcePolicy": { - "$ref": "#/definitions/ResourcePolicy" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_api__ResourcePolicy" }, "UsagePlan": { - "$ref": "#/definitions/ApiAuthUsagePlan" + "$ref": "#/definitions/UsagePlan" } }, "additionalProperties": false }, - "ApiCorsConfiguration": { - "title": "ApiCorsConfiguration", + "Cors": { + "title": "Cors", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2900,8 +3393,8 @@ ], "additionalProperties": false }, - "ApiDomainRoute53Configuration": { - "title": "ApiDomainRoute53Configuration", + "samtranslator__schema__aws_serverless_api__Route53": { + "title": "Route53", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2924,8 +3417,8 @@ }, "additionalProperties": false }, - "ApiDomainConfiguration": { - "title": "ApiDomainConfiguration", + "samtranslator__schema__aws_serverless_api__Domain": { + "title": "Domain", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2960,7 +3453,7 @@ "title": "Ownershipverificationcertificatearn" }, "Route53": { - "$ref": "#/definitions/ApiDomainRoute53Configuration" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_api__Route53" }, "SecurityPolicy": { "title": "Securitypolicy" @@ -2968,8 +3461,8 @@ }, "additionalProperties": false }, - "ApiProperties": { - "title": "ApiProperties", + "samtranslator__schema__aws_serverless_api__Properties": { + "title": "Properties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -2980,7 +3473,7 @@ "title": "Apikeysourcetype" }, "Auth": { - "$ref": "#/definitions/ApiAuthProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_api__Auth" }, "BinaryMediaTypes": { "title": "Binarymediatypes" @@ -3001,7 +3494,7 @@ "type": "string" }, { - "$ref": "#/definitions/ApiCorsConfiguration" + "$ref": "#/definitions/Cors" } ] }, @@ -3018,7 +3511,7 @@ "title": "Disableexecuteapiendpoint" }, "Domain": { - "$ref": "#/definitions/ApiDomainConfiguration" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_api__Domain" }, "EndpointConfiguration": { "title": "Endpointconfiguration" @@ -3083,8 +3576,8 @@ ], "additionalProperties": false }, - "AwsServerlessApi": { - "title": "AwsServerlessApi", + "samtranslator__schema__aws_serverless_api__Resource": { + "title": "Resource", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3096,7 +3589,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/ApiProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_api__Properties" }, "Condition": { "title": "Condition" @@ -3123,8 +3616,8 @@ ], "additionalProperties": false }, - "HttpApiAuthOAuth2Authorizer": { - "title": "HttpApiAuthOAuth2Authorizer", + "OAuth2Authorizer": { + "title": "OAuth2Authorizer", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3145,8 +3638,8 @@ }, "additionalProperties": false }, - "HttpApiAuthLambdaAuthorizerIdentity": { - "title": "HttpApiAuthLambdaAuthorizerIdentity", + "LambdaAuthorizerIdentity": { + "title": "LambdaAuthorizerIdentity", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3185,8 +3678,8 @@ }, "additionalProperties": false }, - "HttpApiAuthLambdaAuthorizer": { - "title": "HttpApiAuthLambdaAuthorizer", + "LambdaAuthorizer": { + "title": "LambdaAuthorizer", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3225,7 +3718,7 @@ ] }, "Identity": { - "$ref": "#/definitions/HttpApiAuthLambdaAuthorizerIdentity" + "$ref": "#/definitions/LambdaAuthorizerIdentity" } }, "required": [ @@ -3234,8 +3727,8 @@ ], "additionalProperties": false }, - "HttpApiAuth": { - "title": "HttpApiAuth", + "samtranslator__schema__aws_serverless_httpapi__Auth": { + "title": "Auth", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3245,10 +3738,10 @@ "additionalProperties": { "anyOf": [ { - "$ref": "#/definitions/HttpApiAuthOAuth2Authorizer" + "$ref": "#/definitions/OAuth2Authorizer" }, { - "$ref": "#/definitions/HttpApiAuthLambdaAuthorizer" + "$ref": "#/definitions/LambdaAuthorizer" } ] } @@ -3264,8 +3757,8 @@ }, "additionalProperties": false }, - "HttpApiCorsConfiguration": { - "title": "HttpApiCorsConfiguration", + "CorsConfiguration": { + "title": "CorsConfiguration", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3308,8 +3801,8 @@ }, "additionalProperties": false }, - "HttpApiDefinitionUri": { - "title": "HttpApiDefinitionUri", + "DefinitionUri": { + "title": "DefinitionUri", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3332,8 +3825,8 @@ ], "additionalProperties": false }, - "HttpApiDomainRoute53": { - "title": "HttpApiDomainRoute53", + "samtranslator__schema__aws_serverless_httpapi__Route53": { + "title": "Route53", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3356,8 +3849,8 @@ }, "additionalProperties": false }, - "HttpApiDomain": { - "title": "HttpApiDomain", + "samtranslator__schema__aws_serverless_httpapi__Domain": { + "title": "Domain", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3395,7 +3888,7 @@ "title": "Ownershipverificationcertificatearn" }, "Route53": { - "$ref": "#/definitions/HttpApiDomainRoute53" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_httpapi__Route53" }, "SecurityPolicy": { "title": "Securitypolicy" @@ -3403,8 +3896,8 @@ }, "additionalProperties": false }, - "HttpApiProperties": { - "title": "HttpApiProperties", + "samtranslator__schema__aws_serverless_httpapi__Properties": { + "title": "Properties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3412,7 +3905,7 @@ "title": "Accesslogsettings" }, "Auth": { - "$ref": "#/definitions/HttpApiAuth" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_httpapi__Auth" }, "CorsConfiguration": { "title": "Corsconfiguration", @@ -3421,7 +3914,7 @@ "type": "object" }, { - "$ref": "#/definitions/HttpApiCorsConfiguration" + "$ref": "#/definitions/CorsConfiguration" } ] }, @@ -3439,7 +3932,7 @@ "type": "string" }, { - "$ref": "#/definitions/HttpApiDefinitionUri" + "$ref": "#/definitions/DefinitionUri" } ] }, @@ -3451,7 +3944,7 @@ "title": "Disableexecuteapiendpoint" }, "Domain": { - "$ref": "#/definitions/HttpApiDomain" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_httpapi__Domain" }, "FailOnWarnings": { "title": "Failonwarnings" @@ -3475,8 +3968,8 @@ }, "additionalProperties": false }, - "AwsServerlessHttpApi": { - "title": "AwsServerlessHttpApi", + "samtranslator__schema__aws_serverless_httpapi__Resource": { + "title": "Resource", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3488,7 +3981,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/HttpApiProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_httpapi__Properties" }, "Metadata": { "title": "Metadata" @@ -3502,8 +3995,8 @@ ], "additionalProperties": false }, - "ApplicationLocation": { - "title": "ApplicationLocation", + "Location": { + "title": "Location", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3536,8 +4029,8 @@ ], "additionalProperties": false }, - "ApplicationProperties": { - "title": "ApplicationProperties", + "samtranslator__schema__aws_serverless_application__Properties": { + "title": "Properties", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3548,7 +4041,7 @@ "type": "string" }, { - "$ref": "#/definitions/ApplicationLocation" + "$ref": "#/definitions/Location" } ] }, @@ -3571,8 +4064,8 @@ ], "additionalProperties": false }, - "AwsServerlessApplication": { - "title": "AwsServerlessApplication", + "samtranslator__schema__aws_serverless_application__Resource": { + "title": "Resource", "description": "By default strict\nhttps://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally", "type": "object", "properties": { @@ -3584,7 +4077,7 @@ "type": "string" }, "Properties": { - "$ref": "#/definitions/ApplicationProperties" + "$ref": "#/definitions/samtranslator__schema__aws_serverless_application__Properties" }, "Condition": { "title": "Condition" @@ -3596,8 +4089,8 @@ ], "additionalProperties": false }, - "AnyNonServerlessResource": { - "title": "AnyNonServerlessResource", + "samtranslator__schema__any_cfn_resource__Resource": { + "title": "Resource", "type": "object", "properties": { "Type": { diff --git a/samtranslator/schema/schema.py b/samtranslator/schema/schema.py index ea70eacd8..602838ece 100644 --- a/samtranslator/schema/schema.py +++ b/samtranslator/schema/schema.py @@ -1,928 +1,43 @@ from __future__ import annotations -from typing_extensions import Literal -from typing import Any, Dict, List, Optional, Union +from typing import Dict, Optional, Union -import pydantic -from pydantic import Extra -# TODO: Get rid of this in favor of proper types -Unknown = Optional[Any] - -# Value passed directly to CloudFormation; not used by SAM -PassThrough = Any # TODO: Make it behave like typescript's unknown - -# Intrinsic resolvable by the SAM transform -SamIntrinsic = Dict[str, Any] - -_LenientBaseModel = pydantic.BaseModel -constr = pydantic.constr - - -class BaseModel(_LenientBaseModel): - """ - By default strict - https://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally - """ - - class Config: - extra = Extra.forbid - - -class ResourceReference(BaseModel): - Id: Optional[str] - Arn: Optional[PassThrough] - Name: Optional[PassThrough] - Qualifier: Optional[PassThrough] - QueueUrl: Optional[PassThrough] - ResourceId: Optional[PassThrough] - RoleName: Optional[PassThrough] - Type: Optional[str] - - -class ConnectorProperties(BaseModel): - Source: ResourceReference - Destination: ResourceReference - Permissions: List[Literal["Read", "Write"]] - - -class AwsServerlessConnector(BaseModel): - Type: Literal["AWS::Serverless::Connector"] - Properties: ConnectorProperties - - -class EventsDeadLetterConfig(BaseModel): - Arn: Optional[PassThrough] - QueueLogicalId: Optional[str] - Type: Optional[Literal["SQS"]] - - -class EventsScheduleProperties(BaseModel): - DeadLetterConfig: Optional[EventsDeadLetterConfig] - Description: Optional[PassThrough] - Enabled: Optional[bool] - Input: Optional[PassThrough] - Name: Optional[PassThrough] - RetryPolicy: Optional[PassThrough] - Schedule: Optional[PassThrough] - State: Optional[PassThrough] - - -class EventsSchedule(BaseModel): - Type: Literal["Schedule"] - Properties: EventsScheduleProperties - - -class EventsScheduleV2Properties(BaseModel): - DeadLetterConfig: Optional[EventsDeadLetterConfig] - Description: Optional[PassThrough] - EndDate: Optional[PassThrough] - FlexibleTimeWindow: Optional[PassThrough] - GroupName: Optional[PassThrough] - Input: Optional[PassThrough] - KmsKeyArn: Optional[PassThrough] - Name: Optional[PassThrough] - PermissionsBoundary: Optional[PassThrough] - RetryPolicy: Optional[PassThrough] - RoleArn: Optional[PassThrough] # TODO: Add to docs - ScheduleExpression: Optional[PassThrough] - ScheduleExpressionTimezone: Optional[PassThrough] - StartDate: Optional[PassThrough] - State: Optional[PassThrough] - - -class EventsScheduleV2(BaseModel): - Type: Literal["ScheduleV2"] - Properties: EventsScheduleV2Properties - - -class ResourcePolicy(BaseModel): - AwsAccountBlacklist: Optional[List[Union[str, Dict[str, Any]]]] - AwsAccountWhitelist: Optional[List[Union[str, Dict[str, Any]]]] - CustomStatements: Optional[List[Union[str, Dict[str, Any]]]] - IntrinsicVpcBlacklist: Optional[List[Union[str, Dict[str, Any]]]] - IntrinsicVpcWhitelist: Optional[List[Union[str, Dict[str, Any]]]] - IntrinsicVpceBlacklist: Optional[List[Union[str, Dict[str, Any]]]] - IntrinsicVpceWhitelist: Optional[List[Union[str, Dict[str, Any]]]] - IpRangeBlacklist: Optional[List[Union[str, Dict[str, Any]]]] - IpRangeWhitelist: Optional[List[Union[str, Dict[str, Any]]]] - SourceVpcBlacklist: Optional[List[Union[str, Dict[str, Any]]]] - SourceVpcWhitelist: Optional[List[Union[str, Dict[str, Any]]]] - - -class FunctionCodeUri(BaseModel): - Bucket: Union[str, SamIntrinsic] - Key: Union[str, SamIntrinsic] - Version: Optional[Union[str, SamIntrinsic]] - - -class FunctionDeploymentPreferenceHooks(BaseModel): - PostTraffic: Optional[Union[str, SamIntrinsic]] - PreTraffic: Optional[Union[str, SamIntrinsic]] - - -class FunctionDeploymentPreference(BaseModel): - Alarms: Optional[Union[List[SamIntrinsic], SamIntrinsic]] - Enabled: Optional[Union[bool, SamIntrinsic]] - Hooks: Optional[FunctionDeploymentPreferenceHooks] - PassthroughCondition: Optional[Union[bool, SamIntrinsic]] - Role: Optional[Union[str, SamIntrinsic]] - TriggerConfigurations: Optional[PassThrough] - Type: Optional[ - Union[str, SamIntrinsic] - ] # TODO: Should investigate whether this is a required field. This is a required field on documentation. However, we don't seem to use this field. - - -class FunctionDeadLetterQueue(BaseModel): - TargetArn: str - Type: Literal["SNS", "SQS"] - - -class FunctionEventInvokeConfig(BaseModel): - DestinationConfig: Optional[PassThrough] - MaximumEventAgeInSeconds: Optional[int] - MaximumRetryAttempts: Optional[int] - - -class FunctionS3Properties(BaseModel): - Bucket: Union[str, SamIntrinsic] - Events: PassThrough - Filter: Optional[PassThrough] - - -class FunctionS3Event(BaseModel): - Properties: FunctionS3Properties - Type: Literal["S3"] - - -class SqsSubscription(BaseModel): - BatchSize: Optional[Union[str, SamIntrinsic]] - Enabled: Optional[bool] - QueueArn: Union[str, SamIntrinsic] - QueuePolicyLogicalId: Optional[str] - QueueUrl: Union[str, SamIntrinsic] - - -class FunctionSNSProperties(BaseModel): - FilterPolicy: Optional[PassThrough] - Region: Optional[PassThrough] - SqsSubscription: Optional[Union[bool, SqsSubscription]] - Topic: PassThrough - - -class FunctionSNSEvent(BaseModel): - Properties: FunctionSNSProperties - Type: Literal["SNS"] - - -class FunctionUrlConfig(BaseModel): - AuthType: Union[str, SamIntrinsic] - Cors: Optional[PassThrough] - - -class FunctionKinesisProperties(BaseModel): - BatchSize: Optional[PassThrough] - BisectBatchOnFunctionError: Optional[PassThrough] - DestinationConfig: Optional[PassThrough] - Enabled: Optional[PassThrough] - FilterCriteria: Optional[PassThrough] - FunctionResponseTypes: Optional[PassThrough] - MaximumBatchingWindowInSeconds: Optional[PassThrough] - MaximumRecordAgeInSeconds: Optional[PassThrough] - MaximumRetryAttempts: Optional[PassThrough] - ParallelizationFactor: Optional[PassThrough] - StartingPosition: PassThrough - Stream: PassThrough - TumblingWindowInSeconds: Optional[PassThrough] - - -class FunctionKinesisEvent(BaseModel): - Type: Literal["Kinesis"] - Properties: FunctionKinesisProperties - - -class FunctionDynamoDBProperties(BaseModel): - BatchSize: Optional[PassThrough] - BisectBatchOnFunctionError: Optional[PassThrough] - DestinationConfig: Optional[PassThrough] - Enabled: Optional[PassThrough] - FilterCriteria: Optional[PassThrough] - FunctionResponseTypes: Optional[PassThrough] - MaximumBatchingWindowInSeconds: Optional[PassThrough] - MaximumRecordAgeInSeconds: Optional[PassThrough] - MaximumRetryAttempts: Optional[PassThrough] - ParallelizationFactor: Optional[PassThrough] - StartingPosition: PassThrough - Stream: PassThrough - TumblingWindowInSeconds: Optional[PassThrough] - - -class FunctionDynamoDBEvent(BaseModel): - Type: Literal["DynamoDB"] - Properties: FunctionDynamoDBProperties - - -class FunctionSqsProperties(BaseModel): - BatchSize: Optional[PassThrough] - Enabled: Optional[PassThrough] - FilterCriteria: Optional[PassThrough] - MaximumBatchingWindowInSeconds: Optional[PassThrough] - Queue: PassThrough - - -class FunctionSqsEvent(BaseModel): - Type: Literal["SQS"] - Properties: FunctionSqsProperties - - -class FunctionApiFunctionAuth(BaseModel): - ApiKeyRequired: Optional[bool] - AuthorizationScopes: Optional[List[str]] - Authorizer: Optional[str] - InvokeRole: Optional[Union[str, SamIntrinsic]] - ResourcePolicy: Optional[ResourcePolicy] - - -class FunctionRequestModel(BaseModel): - Model: str - Required: Optional[bool] - ValidateBody: Optional[bool] - ValidateParameters: Optional[bool] - - -class FunctionRequestParameter(BaseModel): - Caching: Optional[bool] - Required: Optional[bool] - - -class FunctionApiProperties(BaseModel): - Auth: Optional[FunctionApiFunctionAuth] - Method: str - Path: str - RequestModel: Optional[FunctionRequestModel] - RequestParameters: Optional[Union[str, FunctionRequestParameter]] - RestApiId: Optional[Union[str, SamIntrinsic]] - - -class FunctionApiEvent(BaseModel): - Type: Literal["Api"] - Properties: FunctionApiProperties - - -class FunctionCloudWatchProperties(BaseModel): - Enabled: Optional[bool] - EventBusName: Optional[PassThrough] - Input: Optional[PassThrough] - InputPath: Optional[PassThrough] - Pattern: Optional[PassThrough] - State: Optional[PassThrough] - - -class FunctionCloudWatchEvent(BaseModel): - Type: Literal["CloudWatchEvent"] - Properties: FunctionCloudWatchProperties - - -class FunctionEventBridgeRuleProperties(BaseModel): - DeadLetterConfig: Optional[EventsDeadLetterConfig] - EventBusName: Optional[PassThrough] - Input: Optional[PassThrough] - InputPath: Optional[PassThrough] - Pattern: PassThrough - RetryPolicy: Optional[PassThrough] - Target: Optional[PassThrough] - - -class FunctionEventBridgeRuleEvent(BaseModel): - Type: Literal["EventBridgeRule"] - Properties: FunctionEventBridgeRuleProperties - - -class FunctionCloudWatchLogsProperties(BaseModel): - FilterPattern: PassThrough - LogGroupName: PassThrough - - -class FunctionCloudWatchLogsEvent(BaseModel): - Type: Literal["CloudWatchLogs"] - Properties: FunctionCloudWatchLogsProperties - - -class FunctionIoTRuleProperties(BaseModel): - AwsIotSqlVersion: Optional[PassThrough] - Sql: PassThrough - - -class FunctionIoTRuleEvent(BaseModel): - Type: Literal["IoTRule"] - Properties: FunctionIoTRuleProperties - - -class FunctionAlexaSkillProperties(BaseModel): - SkillId: Optional[str] - - -class FunctionAlexaSkillEvent(BaseModel): - Type: Literal["AlexaSkill"] - Properties: Optional[FunctionAlexaSkillProperties] - - -class FunctionCognitoProperties(BaseModel): - Trigger: PassThrough - UserPool: Union[str, SamIntrinsic] - - -class FunctionCognitoEvent(BaseModel): - Type: Literal["Cognito"] - Properties: FunctionCognitoProperties - - -class FunctionHttpApiAuth(BaseModel): - AuthorizationScopes: Optional[List[str]] - Authorizer: Optional[str] - - -class FunctionHttpApiProperties(BaseModel): - ApiId: Optional[Union[str, SamIntrinsic]] - Auth: Optional[FunctionHttpApiAuth] - Method: Optional[str] - Path: Optional[str] - PayloadFormatVersion: Optional[Union[str, SamIntrinsic]] - RouteSettings: Optional[PassThrough] - TimeoutInMillis: Optional[Union[int, SamIntrinsic]] - - -class FunctionHttpApiEvent(BaseModel): - Type: Literal["HttpApi"] - Properties: Optional[FunctionHttpApiProperties] - - -class FunctionMSKProperties(BaseModel): - ConsumerGroupId: Optional[PassThrough] - FilterCriteria: Optional[PassThrough] - MaximumBatchingWindowInSeconds: Optional[PassThrough] - StartingPosition: PassThrough - Stream: PassThrough - Topics: PassThrough - - -class FunctionMSKEvent(BaseModel): - Type: Literal["MSK"] - Properties: FunctionMSKProperties - - -class FunctionMQProperties(BaseModel): - BatchSize: Optional[PassThrough] - Broker: PassThrough - Enabled: Optional[PassThrough] - FilterCriteria: Optional[PassThrough] - MaximumBatchingWindowInSeconds: Optional[PassThrough] - Queues: PassThrough - SecretsManagerKmsKeyId: Optional[str] - SourceAccessConfigurations: PassThrough - - -class FunctionMQEvent(BaseModel): - Type: Literal["MQ"] - Properties: FunctionMQProperties - - -class FunctionSelfManagedKafkaProperties(BaseModel): - BatchSize: Optional[PassThrough] - ConsumerGroupId: Optional[PassThrough] - Enabled: Optional[PassThrough] - FilterCriteria: Optional[PassThrough] - KafkaBootstrapServers: Optional[List[Union[str, SamIntrinsic]]] - SourceAccessConfigurations: PassThrough - Topics: PassThrough - - -class FunctionSelfManagedKafkaEvent(BaseModel): - Type: Literal["SelfManagedKafka"] - Properties: FunctionSelfManagedKafkaProperties - - -class FunctionProperties(BaseModel): - Architectures: Optional[PassThrough] - AssumeRolePolicyDocument: Optional[Dict[str, Any]] - AutoPublishAlias: Optional[Union[str, SamIntrinsic]] - AutoPublishCodeSha256: Optional[Union[str, SamIntrinsic]] - CodeSigningConfigArn: Optional[Union[str, SamIntrinsic]] - CodeUri: Optional[Union[str, FunctionCodeUri]] - DeadLetterQueue: Optional[Union[SamIntrinsic, FunctionDeadLetterQueue]] - DeploymentPreference: Optional[FunctionDeploymentPreference] - Description: Optional[PassThrough] - Environment: Optional[PassThrough] - EphemeralStorage: Optional[PassThrough] - EventInvokeConfig: Optional[FunctionEventInvokeConfig] - Events: Optional[ - Dict[ - str, - Union[ - FunctionS3Event, - FunctionSNSEvent, - FunctionKinesisEvent, - FunctionDynamoDBEvent, - FunctionSqsEvent, - FunctionApiEvent, - EventsSchedule, - EventsScheduleV2, - FunctionCloudWatchEvent, - FunctionEventBridgeRuleEvent, - FunctionCloudWatchLogsEvent, - FunctionIoTRuleEvent, - FunctionAlexaSkillEvent, - FunctionCognitoEvent, - FunctionHttpApiEvent, - FunctionMSKEvent, - FunctionMQEvent, - FunctionSelfManagedKafkaEvent, - ], - ] - ] - FileSystemConfigs: Optional[PassThrough] - FunctionName: Optional[PassThrough] - FunctionUrlConfig: Optional[FunctionUrlConfig] - Handler: Optional[PassThrough] - ImageConfig: Optional[PassThrough] - ImageUri: Optional[PassThrough] - InlineCode: Optional[PassThrough] - KmsKeyArn: Optional[PassThrough] - Layers: Optional[PassThrough] - MemorySize: Optional[PassThrough] - PackageType: Optional[PassThrough] - PermissionsBoundary: Optional[PassThrough] - Policies: Optional[Union[str, List[Union[str, SamIntrinsic]], SamIntrinsic]] - ProvisionedConcurrencyConfig: Optional[PassThrough] - ReservedConcurrentExecutions: Optional[PassThrough] - Role: Optional[Union[str, SamIntrinsic]] - Runtime: Optional[PassThrough] - Tags: Optional[Dict[str, Any]] - Timeout: Optional[PassThrough] - Tracing: Optional[Union[str, SamIntrinsic]] - VersionDescription: Optional[PassThrough] - VpcConfig: Optional[PassThrough] - - -class AwsServerlessFunction(BaseModel): - Type: Literal["AWS::Serverless::Function"] - Properties: Optional[FunctionProperties] - DeletionPolicy: Optional[PassThrough] - UpdateReplacePolicy: Optional[PassThrough] - Condition: Optional[PassThrough] - DependsOn: Optional[PassThrough] - Metadata: Optional[PassThrough] - - -class SimpleTablePrimaryKey(BaseModel): - Name: PassThrough - Type: PassThrough - - -class SimpleTableProperties(BaseModel): - PrimaryKey: Optional[SimpleTablePrimaryKey] - ProvisionedThroughput: Optional[PassThrough] - SSESpecification: Optional[PassThrough] - TableName: Optional[PassThrough] - Tags: Optional[Dict[str, Any]] - - -class AwsServerlessSimpleTable(BaseModel): - Type: Literal["AWS::Serverless::SimpleTable"] - Properties: Optional[SimpleTableProperties] - - -class StateMachineEventsCloudWatchEventProperties(BaseModel): - EventBusName: Optional[PassThrough] - Input: Optional[PassThrough] - InputPath: Optional[PassThrough] - Pattern: Optional[PassThrough] - - -class StateMachineEventsCloudWatchEvent(BaseModel): - Type: Literal["CloudWatchEvent"] - Properties: StateMachineEventsCloudWatchEventProperties - - -class StateMachineEventsEventBridgeRuleDeadLetterConfig(BaseModel): - Arn: Optional[PassThrough] - QueueLogicalId: Optional[str] - Type: Optional[Literal["SQS"]] - - -class StateMachineEventsEventBridgeRuleProperties(BaseModel): - DeadLetterConfig: Optional[StateMachineEventsEventBridgeRuleDeadLetterConfig] - EventBusName: Optional[PassThrough] - Input: Optional[PassThrough] - InputPath: Optional[PassThrough] - Pattern: Optional[PassThrough] - RetryPolicy: Optional[PassThrough] - - -class StateMachineEventsEventBridgeRule(BaseModel): - Type: Literal["EventBridgeRule"] - Properties: StateMachineEventsEventBridgeRuleProperties - - -class StateMachineEventsApiAuth(BaseModel): - ApiKeyRequired: Optional[bool] - AuthorizationScopes: Optional[List[str]] - Authorizer: Optional[str] - ResourcePolicy: Optional[ResourcePolicy] - - -class StateMachineEventsApiProperties(BaseModel): - Auth: Optional[StateMachineEventsApiAuth] - Method: str - Path: str - RestApiId: Optional[SamIntrinsic] - UnescapeMappingTemplate: Optional[bool] # TODO: Add to docs - - -class StateMachineEventsApi(BaseModel): - Type: Literal["Api"] - Properties: StateMachineEventsApiProperties - - -class StateMachineProperties(BaseModel): - Definition: Optional[Dict[str, Any]] - DefinitionSubstitutions: Optional[Dict[str, Any]] - DefinitionUri: Optional[Union[str, PassThrough]] - Events: Optional[ - Dict[ - str, - Union[ - EventsSchedule, - EventsScheduleV2, - StateMachineEventsCloudWatchEvent, - StateMachineEventsEventBridgeRule, - StateMachineEventsApi, - ], - ] - ] - Logging: Optional[PassThrough] - Name: Optional[PassThrough] - PermissionsBoundary: Optional[PassThrough] - Policies: Optional[Union[str, List[str], Dict[str, Any], List[Dict[str, Any]]]] - Role: Optional[PassThrough] - Tags: Optional[Dict[str, Any]] - Tracing: Optional[PassThrough] - Type: Optional[PassThrough] - - -class AwsServerlessStateMachine(BaseModel): - Type: Literal["AWS::Serverless::StateMachine"] - Properties: StateMachineProperties - Condition: Optional[PassThrough] - - -class LayerVersionContentUri(BaseModel): - Bucket: PassThrough - Key: PassThrough - Version: Optional[PassThrough] - - -class LayerVersionProperties(BaseModel): - CompatibleArchitectures: Optional[PassThrough] - CompatibleRuntimes: Optional[PassThrough] - ContentUri: Union[str, LayerVersionContentUri] - Description: Optional[PassThrough] - LayerName: Optional[PassThrough] - LicenseInfo: Optional[PassThrough] - RetentionPolicy: Optional[Union[str, SamIntrinsic]] - - -class AwsServerlessLayerVersion(BaseModel): - Type: Literal["AWS::Serverless::LayerVersion"] - Properties: LayerVersionProperties - Condition: Optional[PassThrough] - DeletionPolicy: Optional[PassThrough] - - -class ApiAuthCognitoAuthorizationIdentity(BaseModel): - Header: Optional[str] - ReauthorizeEvery: Optional[Union[int, SamIntrinsic]] - ValidationExpression: Optional[str] - - -class ApiAuthCognitoAuthorizer(BaseModel): - AuthorizationScopes: Optional[List[str]] - Identity: Optional[ApiAuthCognitoAuthorizationIdentity] - UserPoolArn: Union[str, SamIntrinsic] - - -class ApiAuthLambdaTokenAuthorizationIdentity(BaseModel): - Header: Optional[str] - ReauthorizeEvery: Optional[Union[int, SamIntrinsic]] - ValidationExpression: Optional[str] - - -class ApiAuthLambdaRequestAuthorizationIdentity(BaseModel): - Context: Optional[List[str]] - Headers: Optional[List[str]] - QueryStrings: Optional[List[str]] - ReauthorizeEvery: Optional[Union[int, SamIntrinsic]] - StageVariables: Optional[List[str]] - - -class ApiAuthLambdaAuthorizer(BaseModel): - AuthorizationScopes: Optional[List[str]] - FunctionArn: Union[str, SamIntrinsic] - FunctionInvokeRole: Optional[str] - FunctionPayloadType: Optional[Literal["REQUEST", "TOKEN"]] - Identity: Optional[Union[ApiAuthLambdaRequestAuthorizationIdentity, ApiAuthLambdaTokenAuthorizationIdentity]] - - -class ApiAuthUsagePlan(BaseModel): - CreateUsagePlan: Literal["PER_API", "SHARED", "NONE"] - Description: Optional[PassThrough] - Quota: Optional[PassThrough] - Tags: Optional[PassThrough] - Throttle: Optional[PassThrough] - UsagePlanName: Optional[PassThrough] - - -class ApiAuthProperties(BaseModel): - AddDefaultAuthorizerToCorsPreflight: Optional[bool] - ApiKeyRequired: Optional[bool] - Authorizers: Optional[Dict[str, Union[ApiAuthCognitoAuthorizer, ApiAuthLambdaAuthorizer]]] - DefaultAuthorizer: Optional[str] - InvokeRole: Optional[str] - ResourcePolicy: Optional[ResourcePolicy] - UsagePlan: Optional[ApiAuthUsagePlan] - - -class ApiCorsConfiguration(BaseModel): - AllowCredentials: Optional[bool] - AllowHeaders: Optional[str] - AllowMethods: Optional[str] - AllowOrigin: str - MaxAge: Optional[str] - - -class ApiDomainRoute53Configuration(BaseModel): - DistributionDomainName: Optional[PassThrough] - EvaluateTargetHealth: Optional[PassThrough] - HostedZoneId: Optional[PassThrough] - HostedZoneName: Optional[PassThrough] - IpV6: Optional[bool] - - -class ApiDomainConfiguration(BaseModel): - BasePath: Optional[PassThrough] - CertificateArn: PassThrough - DomainName: PassThrough - EndpointConfiguration: Optional[Union[Literal["REGIONAL", "EDGE"], SamIntrinsic]] - MutualTlsAuthentication: Optional[PassThrough] - OwnershipVerificationCertificateArn: Optional[PassThrough] - Route53: Optional[ApiDomainRoute53Configuration] - SecurityPolicy: Optional[PassThrough] - - -class ApiProperties(BaseModel): - AccessLogSetting: Optional[PassThrough] - ApiKeySourceType: Optional[PassThrough] - Auth: Optional[ApiAuthProperties] - BinaryMediaTypes: Optional[PassThrough] - CacheClusterEnabled: Optional[PassThrough] - CacheClusterSize: Optional[PassThrough] - CanarySetting: Optional[PassThrough] - Cors: Optional[Union[str, ApiCorsConfiguration]] - DefinitionBody: Optional[PassThrough] - DefinitionUri: Optional[PassThrough] - Description: Optional[PassThrough] - DisableExecuteApiEndpoint: Optional[PassThrough] - Domain: Optional[ApiDomainConfiguration] - EndpointConfiguration: Optional[PassThrough] - FailOnWarnings: Optional[PassThrough] - GatewayResponses: Optional[SamIntrinsic] - MethodSettings: Optional[PassThrough] - MinimumCompressionSize: Optional[PassThrough] - Mode: Optional[PassThrough] - Models: Optional[SamIntrinsic] - Name: Optional[PassThrough] - OpenApiVersion: Optional[Union[float, str]] # TODO: float doesn't exist in documentation - StageName: Union[str, SamIntrinsic] - Tags: Optional[PassThrough] - TracingEnabled: Optional[PassThrough] - Variables: Optional[PassThrough] - - -class AwsServerlessApi(BaseModel): - Type: Literal["AWS::Serverless::Api"] - Properties: ApiProperties - Condition: Optional[PassThrough] - DeletionPolicy: Optional[PassThrough] - UpdatePolicy: Optional[PassThrough] - UpdateReplacePolicy: Optional[PassThrough] - DependsOn: Optional[PassThrough] - Metadata: Optional[PassThrough] - - -class HttpApiAuthOAuth2Authorizer(BaseModel): - AuthorizationScopes: Optional[List[str]] - IdentitySource: Optional[str] - JwtConfiguration: Optional[PassThrough] - - -class HttpApiAuthLambdaAuthorizerIdentity(BaseModel): - Context: Optional[List[str]] - Headers: Optional[List[str]] - QueryStrings: Optional[List[str]] - ReauthorizeEvery: Optional[int] - StageVariables: Optional[List[str]] - - -class HttpApiAuthLambdaAuthorizer(BaseModel): - # TODO: Many tests use floats for the version string; docs only mention string - AuthorizerPayloadFormatVersion: Union[Literal["1.0", "2.0"], float] - EnableSimpleResponses: Optional[bool] - FunctionArn: SamIntrinsic - FunctionInvokeRole: Optional[Union[str, SamIntrinsic]] - Identity: Optional[HttpApiAuthLambdaAuthorizerIdentity] - - -class HttpApiAuth(BaseModel): - # TODO: Docs doesn't say it's a map - Authorizers: Optional[ - Dict[ - str, - Union[ - HttpApiAuthOAuth2Authorizer, - HttpApiAuthLambdaAuthorizer, - ], - ] - ] - DefaultAuthorizer: Optional[str] - EnableIamAuthorizer: Optional[bool] - - -class HttpApiCorsConfiguration(BaseModel): - AllowCredentials: Optional[bool] - AllowHeaders: Optional[List[str]] - AllowMethods: Optional[List[str]] - AllowOrigins: Optional[List[str]] - ExposeHeaders: Optional[List[str]] - MaxAge: Optional[int] - - -class HttpApiDefinitionUri(BaseModel): - Bucket: str - Key: str - Version: Optional[str] - - -class HttpApiDomainRoute53(BaseModel): - DistributionDomainName: Optional[PassThrough] - EvaluateTargetHealth: Optional[PassThrough] - HostedZoneId: Optional[PassThrough] - HostedZoneName: Optional[PassThrough] - IpV6: Optional[bool] - - -class HttpApiDomain(BaseModel): - BasePath: Optional[List[str]] - CertificateArn: PassThrough - DomainName: PassThrough - EndpointConfiguration: Optional[Union[Literal["REGIONAL"], SamIntrinsic]] - MutualTlsAuthentication: Optional[PassThrough] - OwnershipVerificationCertificateArn: Optional[PassThrough] - Route53: Optional[HttpApiDomainRoute53] - SecurityPolicy: Optional[PassThrough] - - -class HttpApiProperties(BaseModel): - AccessLogSettings: Optional[PassThrough] - Auth: Optional[HttpApiAuth] - # TODO: Also string like in the docs? - CorsConfiguration: Optional[Union[SamIntrinsic, HttpApiCorsConfiguration]] - DefaultRouteSettings: Optional[PassThrough] - DefinitionBody: Optional[Dict[str, Any]] - DefinitionUri: Optional[Union[str, HttpApiDefinitionUri]] - Description: Optional[str] - DisableExecuteApiEndpoint: Optional[PassThrough] - Domain: Optional[HttpApiDomain] - FailOnWarnings: Optional[PassThrough] - RouteSettings: Optional[PassThrough] - StageName: Optional[PassThrough] - StageVariables: Optional[PassThrough] - Tags: Optional[Dict[str, Any]] - Name: Optional[PassThrough] # TODO: Add to docs - - -class AwsServerlessHttpApi(BaseModel): - Type: Literal["AWS::Serverless::HttpApi"] - Properties: Optional[HttpApiProperties] - Metadata: Optional[PassThrough] - Condition: Optional[PassThrough] - - -class ApplicationLocation(BaseModel): - ApplicationId: Union[str, SamIntrinsic] - SemanticVersion: Union[str, SamIntrinsic] - - -class ApplicationProperties(BaseModel): - Location: Union[str, ApplicationLocation] - NotificationARNs: Optional[PassThrough] - Parameters: Optional[PassThrough] - Tags: Optional[Dict[str, Any]] - TimeoutInMinutes: Optional[PassThrough] - - -class AwsServerlessApplication(BaseModel): - Type: Literal["AWS::Serverless::Application"] - Properties: ApplicationProperties - Condition: Optional[PassThrough] - - -# Match anything not containing Serverless -class AnyNonServerlessResource(_LenientBaseModel): - Type: constr(regex=r"^((?!::Serverless::).)*$") # type: ignore - - -class GlobalsFunction(BaseModel): - Handler: Unknown - Runtime: Unknown - CodeUri: Unknown - DeadLetterQueue: Unknown - Description: Unknown - MemorySize: Unknown - Timeout: Unknown - VpcConfig: Unknown - Environment: Unknown - Tags: Unknown - Tracing: Unknown - KmsKeyArn: Unknown - Layers: Unknown - AutoPublishAlias: Unknown - DeploymentPreference: Unknown - PermissionsBoundary: Unknown - ReservedConcurrentExecutions: Unknown - ProvisionedConcurrencyConfig: Unknown - AssumeRolePolicyDocument: Unknown - EventInvokeConfig: Unknown - Architectures: Unknown - EphemeralStorage: Unknown - - -class GlobalsApi(BaseModel): - Auth: Unknown - Name: Unknown - DefinitionUri: Unknown - CacheClusterEnabled: Unknown - CacheClusterSize: Unknown - Variables: Unknown - EndpointConfiguration: Unknown - MethodSettings: Unknown - BinaryMediaTypes: Unknown - MinimumCompressionSize: Unknown - Cors: Unknown - GatewayResponses: Unknown - AccessLogSetting: Unknown - CanarySetting: Unknown - TracingEnabled: Unknown - OpenApiVersion: Unknown - Domain: Unknown - - -class GlobalsHttpApi(BaseModel): - Auth: Unknown - AccessLogSettings: Unknown - StageVariables: Unknown - Tags: Unknown - RouteSettings: Unknown - FailOnWarnings: Unknown - Domain: Unknown - CorsConfiguration: Unknown - DefaultRouteSettings: Unknown - - -class GlobalsSimpleTable(BaseModel): - SSESpecification: Unknown +from samtranslator.schema.common import BaseModel, LenientBaseModel +from samtranslator.schema import ( + aws_serverless_simpletable, + aws_serverless_application, + aws_serverless_connector, + aws_serverless_function, + aws_serverless_statemachine, + aws_serverless_layerversion, + aws_serverless_api, + aws_serverless_httpapi, + any_cfn_resource, +) class Globals(BaseModel): - Function: Optional[GlobalsFunction] - Api: Optional[GlobalsApi] - HttpApi: Optional[GlobalsHttpApi] - SimpleTable: Optional[GlobalsSimpleTable] + Function: Optional[aws_serverless_function.Globals] + Api: Optional[aws_serverless_api.Globals] + HttpApi: Optional[aws_serverless_httpapi.Globals] + SimpleTable: Optional[aws_serverless_simpletable.Globals] -class Model(_LenientBaseModel): +class Model(LenientBaseModel): Globals: Optional[Globals] Resources: Dict[ str, Union[ - AwsServerlessConnector, - AwsServerlessFunction, - AwsServerlessSimpleTable, - AwsServerlessStateMachine, - AwsServerlessLayerVersion, - AwsServerlessApi, - AwsServerlessHttpApi, - AwsServerlessApplication, - AnyNonServerlessResource, + aws_serverless_connector.Resource, + aws_serverless_function.Resource, + aws_serverless_simpletable.Resource, + aws_serverless_statemachine.Resource, + aws_serverless_layerversion.Resource, + aws_serverless_api.Resource, + aws_serverless_httpapi.Resource, + aws_serverless_application.Resource, + any_cfn_resource.Resource, ], ]