Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 37 additions & 20 deletions samtranslator/internal/schema_source/aws_serverless_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
ROUTE53_STEM = "sam-property-api-route53configuration"
ENDPOINT_CONFIGURATION_STEM = "sam-property-api-endpointconfiguration"
DEFINITION_URI_STEM = "sam-property-api-apidefinition"
ACCESS_ASSOCIATION_STEM = "sam-property-api-domainaccessassociation"

resourcepolicy = get_prop("sam-property-api-resourcepolicystatement")
cognitoauthorizeridentity = get_prop("sam-property-api-cognitoauthorizationidentity")
Expand Down Expand Up @@ -103,7 +104,7 @@ class UsagePlan(BaseModel):

class Auth(BaseModel):
AddDefaultAuthorizerToCorsPreflight: Optional[bool] = auth("AddDefaultAuthorizerToCorsPreflight")
AddApiKeyRequiredToCorsPreflight: Optional[bool] # TODO Add Docs
AddApiKeyRequiredToCorsPreflight: Optional[bool] = auth("AddApiKeyRequiredToCorsPreflight")
ApiKeyRequired: Optional[bool] = auth("ApiKeyRequired")
Authorizers: Optional[
Dict[
Expand Down Expand Up @@ -151,15 +152,35 @@ class Route53(BaseModel):
["AWS::Route53::RecordSetGroup.RecordSet", "HostedZoneName"],
)
IpV6: Optional[bool] = route53("IpV6")
SetIdentifier: Optional[PassThroughProp] # TODO: add docs
Region: Optional[PassThroughProp] # TODO: add docs
SeparateRecordSetGroup: Optional[bool] # TODO: add docs
VpcEndpointDomainName: Optional[PassThroughProp] # TODO: add docs
VpcEndpointHostedZoneId: Optional[PassThroughProp] # TODO: add docs
SetIdentifier: Optional[PassThroughProp] = passthrough_prop(
ROUTE53_STEM,
"SetIdentifier",
["AWS::Route53::RecordSetGroup.RecordSet", "SetIdentifier"],
)
Region: Optional[PassThroughProp] = passthrough_prop(
ROUTE53_STEM,
"Region",
["AWS::Route53::RecordSetGroup.RecordSet", "Region"],
)
SeparateRecordSetGroup: Optional[bool] # SAM-specific property - not yet documented in sam-docs.json
VpcEndpointDomainName: Optional[PassThroughProp] = passthrough_prop(
ROUTE53_STEM,
"VpcEndpointDomainName",
["AWS::Route53::RecordSet.AliasTarget", "DNSName"],
)
VpcEndpointHostedZoneId: Optional[PassThroughProp] = passthrough_prop(
ROUTE53_STEM,
"VpcEndpointHostedZoneId",
["AWS::Route53::RecordSet.AliasTarget", "HostedZoneId"],
)


class AccessAssociation(BaseModel):
VpcEndpointId: PassThroughProp # TODO: add docs
VpcEndpointId: PassThroughProp = passthrough_prop(
ACCESS_ASSOCIATION_STEM,
"VpcEndpointId",
["AWS::ApiGateway::DomainNameAccessAssociation", "Properties", "AccessAssociationSource"],
)


class Domain(BaseModel):
Expand All @@ -175,11 +196,7 @@ class Domain(BaseModel):
EndpointConfiguration: Optional[SamIntrinsicable[Literal["REGIONAL", "EDGE", "PRIVATE"]]] = domain(
"EndpointConfiguration"
)
IpAddressType: Optional[PassThroughProp] = passthrough_prop(
DOMAIN_STEM,
"IpAddressType",
["AWS::ApiGateway::DomainName.EndpointConfiguration", "IpAddressType"],
)
IpAddressType: Optional[PassThroughProp] # TODO: add documentation; currently unavailable
MutualTlsAuthentication: Optional[PassThroughProp] = passthrough_prop(
DOMAIN_STEM,
"MutualTlsAuthentication",
Expand Down Expand Up @@ -228,11 +245,7 @@ class EndpointConfiguration(BaseModel):
"VPCEndpointIds",
["AWS::ApiGateway::RestApi.EndpointConfiguration", "VpcEndpointIds"],
)
IpAddressType: Optional[PassThroughProp] = passthrough_prop(
Comment thread
vicheey marked this conversation as resolved.
ENDPOINT_CONFIGURATION_STEM,
"IpAddressType",
["AWS::ApiGateway::RestApi.EndpointConfiguration", "IpAddressType"],
)
IpAddressType: Optional[PassThroughProp] # TODO: add documentation; currently unavailable


Name = Optional[PassThroughProp]
Expand Down Expand Up @@ -324,8 +337,12 @@ class Properties(BaseModel):
OpenApiVersion: Optional[OpenApiVersion] = properties("OpenApiVersion")
StageName: SamIntrinsicable[str] = properties("StageName")
Tags: Optional[DictStrAny] = properties("Tags")
Policy: Optional[PassThroughProp] # TODO: add docs
PropagateTags: Optional[bool] # TODO: add docs
Policy: Optional[PassThroughProp] = passthrough_prop(
PROPERTIES_STEM,
"Policy",
["AWS::ApiGateway::RestApi", "Properties", "Policy"],
)
PropagateTags: Optional[bool] = properties("PropagateTags")
SecurityPolicy: Optional[PassThroughProp] = passthrough_prop(
PROPERTIES_STEM,
"SecurityPolicy",
Expand Down Expand Up @@ -396,7 +413,7 @@ class Globals(BaseModel):
OpenApiVersion: Optional[OpenApiVersion] = properties("OpenApiVersion")
Domain: Optional[Domain] = properties("Domain")
AlwaysDeploy: Optional[AlwaysDeploy] = properties("AlwaysDeploy")
PropagateTags: Optional[bool] # TODO: add docs
PropagateTags: Optional[bool] = properties("PropagateTags")
SecurityPolicy: Optional[PassThroughProp] = passthrough_prop(
PROPERTIES_STEM,
"SecurityPolicy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ResourceAttributes,
SamIntrinsicable,
get_prop,
passthrough_prop,
)

PROPERTIES_STEM = "sam-resource-capacityprovider"
Expand Down Expand Up @@ -52,15 +53,11 @@ class ScalingConfig(BaseModel):


class Properties(BaseModel):
# TODO: Change back to passthrough_prop after CloudFormation schema is updated with AWS::Lambda::CapacityProvider
# Optional capacity provider name - passes through directly to CFN AWS::Lambda::CapacityProvider
# Uses PassThroughProp because it's a direct 1:1 mapping with no SAM transformation
# CapacityProviderName: Optional[PassThroughProp] = passthrough_prop(
# PROPERTIES_STEM,
# "CapacityProviderName",
# ["AWS::Lambda::CapacityProvider", "Properties", "CapacityProviderName"],
# )
CapacityProviderName: Optional[PassThroughProp] # TODO: add documentation
CapacityProviderName: Optional[PassThroughProp] = passthrough_prop(
PROPERTIES_STEM,
"CapacityProviderName",
["AWS::Lambda::CapacityProvider", "Properties", "CapacityProviderName"],
)

# Required VPC configuration - preserves CFN structure, required for EC2 instance networking
# Uses custom VpcConfig class to validate required SubnetIds while maintaining passthrough behavior
Expand All @@ -85,15 +82,11 @@ class Properties(BaseModel):
# Uses custom ScalingConfig class because SAM renames construct (CapacityProviderScalingConfig→ScalingConfig)
ScalingConfig: Optional[ScalingConfig] = properties("ScalingConfig")

# TODO: Change back to passthrough_prop after CloudFormation schema is updated with AWS::Lambda::CapacityProvider
# Optional KMS key ARN - passes through directly to CFN for encryption configuration
# Uses PassThroughProp because it's a direct 1:1 mapping with no SAM transformation
# KmsKeyArn: Optional[PassThroughProp] = passthrough_prop(
# PROPERTIES_STEM,
# "KmsKeyArn",
# ["AWS::Lambda::CapacityProvider", "Properties", "KmsKeyArn"],
# )
KmsKeyArn: Optional[PassThroughProp] # TODO: add documentation
KmsKeyArn: Optional[PassThroughProp] = passthrough_prop(
PROPERTIES_STEM,
"KmsKeyArn",
["AWS::Lambda::CapacityProvider", "Properties", "KmsKeyArn"],
)


class Globals(BaseModel):
Expand All @@ -120,7 +113,11 @@ class Globals(BaseModel):
# Uses custom ScalingConfig class because SAM renames construct (CapacityProviderScalingConfig→ScalingConfig)
ScalingConfig: Optional[ScalingConfig] = properties("ScalingConfig")

KmsKeyArn: Optional[PassThroughProp] # TODO: add documentation
KmsKeyArn: Optional[PassThroughProp] = passthrough_prop(
PROPERTIES_STEM,
"KmsKeyArn",
["AWS::Lambda::CapacityProvider", "Properties", "KmsKeyArn"],
)


class Resource(ResourceAttributes):
Expand Down
Loading
Loading