Skip to content

Commit

Permalink
chore: update properties in schema with new docs (#3026)
Browse files Browse the repository at this point in the history
Co-authored-by: _sam <3804518+aahung@users.noreply.github.com>
  • Loading branch information
aaythapa and aahung committed Mar 14, 2023
1 parent c666efa commit 90d7119
Show file tree
Hide file tree
Showing 8 changed files with 421 additions and 98 deletions.
4 changes: 2 additions & 2 deletions samtranslator/internal/schema_source/aws_serverless_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class LambdaTokenAuthorizer(BaseModel):
FunctionInvokeRole: Optional[str] = lambdatokenauthorizer("FunctionInvokeRole")
FunctionPayloadType: Optional[Literal["TOKEN"]] = lambdatokenauthorizer("FunctionPayloadType")
Identity: Optional[LambdaTokenAuthorizerIdentity] = lambdatokenauthorizer("Identity")
DisableFunctionDefaultPermissions: Optional[bool] # TODO Add docs
DisableFunctionDefaultPermissions: Optional[bool] = lambdatokenauthorizer("DisableFunctionDefaultPermissions")


class LambdaRequestAuthorizer(BaseModel):
Expand All @@ -86,7 +86,7 @@ class LambdaRequestAuthorizer(BaseModel):
FunctionInvokeRole: Optional[str] = lambdarequestauthorizer("FunctionInvokeRole")
FunctionPayloadType: Optional[Literal["REQUEST"]] = lambdarequestauthorizer("FunctionPayloadType")
Identity: Optional[LambdaRequestAuthorizerIdentity] = lambdarequestauthorizer("Identity")
DisableFunctionDefaultPermissions: Optional[bool] # TODO Add docs
DisableFunctionDefaultPermissions: Optional[bool] = lambdarequestauthorizer("DisableFunctionDefaultPermissions")


class UsagePlan(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

resourcereference = get_prop("sam-property-connector-resourcereference")
properties = get_prop("sam-resource-connector")
sourcereference = get_prop("sam-property-connector-sourcereference")

PermissionsType = List[Literal["Read", "Write"]]

Expand All @@ -32,12 +33,12 @@ class Resource(ResourceAttributes):
Properties: Properties


class SourceReference(BaseModel):
Qualifier: Optional[PassThroughProp] = resourcereference("Qualifier")
class SourceReferenceProperties(BaseModel):
Qualifier: Optional[PassThroughProp] = sourcereference("Qualifier")


class EmbeddedConnectorProperties(BaseModel):
SourceReference: Optional[SourceReference] # TODO: add docs for SourceReference
SourceReference: Optional[SourceReferenceProperties] = properties("SourceReference")
Destination: Union[ResourceReference, List[ResourceReference]] = properties("Destination")
Permissions: PermissionsType = properties("Permissions")

Expand Down
35 changes: 19 additions & 16 deletions samtranslator/internal/schema_source/aws_serverless_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
deadletterconfig = get_prop("sam-property-function-deadletterconfig")
deploymentpreference = get_prop("sam-property-function-deploymentpreference")
dlq = get_prop("sam-property-function-deadletterqueue")
documentdbeventproperties = get_prop("sam-property-function-documentdb")
dynamodbeventproperties = get_prop("sam-property-function-dynamodb")
event = get_prop("sam-property-function-eventsource")
eventbridgeruleeventproperties = get_prop("sam-property-function-eventbridgerule")
Expand Down Expand Up @@ -201,18 +202,20 @@ class DynamoDBEvent(BaseModel):


class DocumentDBEventProperties(BaseModel):
BatchSize: Optional[PassThroughProp] # TODO: add documentation
Cluster: PassThroughProp # TODO: add documentation
CollectionName: Optional[PassThroughProp] # TODO: add documentation
DatabaseName: PassThroughProp # TODO: add documentation
Enabled: Optional[PassThroughProp] # TODO: add documentation
FilterCriteria: Optional[PassThroughProp] # TODO: add documentation
FullDocument: Optional[PassThroughProp] # TODO: add documentation
MaximumBatchingWindowInSeconds: Optional[PassThroughProp] # TODO: add documentation
SecretsManagerKmsKeyId: Optional[str] # TODO: add documentation
SourceAccessConfigurations: PassThroughProp # TODO: add documentation
StartingPosition: Optional[PassThroughProp] # TODO: add documentation
StartingPositionTimestamp: Optional[PassThroughProp] # TODO: add documentation
BatchSize: Optional[PassThroughProp] = documentdbeventproperties("BatchSize")
Cluster: PassThroughProp = documentdbeventproperties("Cluster")
CollectionName: Optional[PassThroughProp] = documentdbeventproperties("CollectionName")
DatabaseName: PassThroughProp = documentdbeventproperties("DatabaseName")
Enabled: Optional[PassThroughProp] = documentdbeventproperties("Enabled")
FilterCriteria: Optional[PassThroughProp] = documentdbeventproperties("FilterCriteria")
FullDocument: Optional[PassThroughProp] = documentdbeventproperties("FullDocument")
MaximumBatchingWindowInSeconds: Optional[PassThroughProp] = documentdbeventproperties(
"MaximumBatchingWindowInSeconds"
)
SecretsManagerKmsKeyId: Optional[str] = documentdbeventproperties("SecretsManagerKmsKeyId")
SourceAccessConfigurations: PassThroughProp = documentdbeventproperties("SourceAccessConfigurations")
StartingPosition: Optional[PassThroughProp] = documentdbeventproperties("StartingPosition")
StartingPositionTimestamp: Optional[PassThroughProp] = documentdbeventproperties("StartingPositionTimestamp")


class DocumentDBEvent(BaseModel):
Expand Down Expand Up @@ -395,7 +398,7 @@ class MSKEventProperties(BaseModel):
StartingPositionTimestamp: Optional[PassThroughProp] = mskeventproperties("StartingPositionTimestamp")
Stream: PassThroughProp = mskeventproperties("Stream")
Topics: PassThroughProp = mskeventproperties("Topics")
SourceAccessConfigurations: Optional[PassThroughProp] # TODO: update docs when live
SourceAccessConfigurations: Optional[PassThroughProp] = mskeventproperties("SourceAccessConfigurations")


class MSKEvent(BaseModel):
Expand Down Expand Up @@ -491,7 +494,7 @@ class Properties(BaseModel):
Architectures: Optional[Architectures] = prop("Architectures")
AssumeRolePolicyDocument: Optional[AssumeRolePolicyDocument] = prop("AssumeRolePolicyDocument")
AutoPublishAlias: Optional[AutoPublishAlias] = prop("AutoPublishAlias")
AutoPublishAliasAllProperties: Optional[AutoPublishAliasAllProperties] # TODO: add docs
AutoPublishAliasAllProperties: Optional[AutoPublishAliasAllProperties] = prop("AutoPublishAliasAllProperties")
AutoPublishCodeSha256: Optional[SamIntrinsicable[str]] = prop("AutoPublishCodeSha256")
CodeSigningConfigArn: Optional[SamIntrinsicable[str]] = prop("CodeSigningConfigArn")
CodeUri: Optional[CodeUriType] = prop("CodeUri")
Expand Down Expand Up @@ -546,7 +549,7 @@ class Properties(BaseModel):
Role: Optional[SamIntrinsicable[str]] = prop("Role")
Runtime: Optional[Runtime] = prop("Runtime")
SnapStart: Optional[SnapStart] = prop("SnapStart")
RuntimeManagementConfig: Optional[RuntimeManagementConfig] # TODO: add prop and types
RuntimeManagementConfig: Optional[RuntimeManagementConfig] = prop("RuntimeManagementConfig")
Tags: Optional[Tags] = prop("Tags")
Timeout: Optional[Timeout] = prop("Timeout")
Tracing: Optional[Tracing] = prop("Tracing")
Expand Down Expand Up @@ -579,7 +582,7 @@ class Globals(BaseModel):
Architectures: Optional[Architectures] = prop("Architectures")
EphemeralStorage: Optional[EphemeralStorage] = prop("EphemeralStorage")
SnapStart: Optional[SnapStart] = prop("SnapStart")
RuntimeManagementConfig: Optional[RuntimeManagementConfig] # TODO: add prop
RuntimeManagementConfig: Optional[RuntimeManagementConfig] = prop("RuntimeManagementConfig")


class Resource(ResourceAttributes):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Properties(BaseModel):
StageName: Optional[PassThroughProp] = properties("StageName")
StageVariables: Optional[StageVariables] = properties("StageVariables")
Tags: Optional[Tags] = properties("Tags")
Name: Optional[PassThroughProp] # TODO: Add to docs
Name: Optional[PassThroughProp] = properties("Name")


class Globals(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
apieventproperties = get_prop("sam-property-statemachine-statemachineapi")
apiauth = get_prop("sam-property-statemachine-apistatemachineauth")
event = get_prop("sam-property-statemachine-statemachineeventsource")
scheduletarget = get_prop("sam-property-statemachine-statemachinescheduletarget")
eventtarget = get_prop("sam-property-statemachine-statemachinetarget")


class DeadLetterConfig(BaseModel):
Expand All @@ -34,7 +36,7 @@ class DeadLetterConfig(BaseModel):


class ScheduleTarget(BaseModel):
Id: PassThroughProp # TODO: Add docs
Id: PassThroughProp = scheduletarget("Id")


class ScheduleEventProperties(BaseModel):
Expand All @@ -46,7 +48,7 @@ class ScheduleEventProperties(BaseModel):
RetryPolicy: Optional[PassThroughProp] = scheduleeventproperties("RetryPolicy")
Schedule: Optional[PassThroughProp] = scheduleeventproperties("Schedule")
State: Optional[PassThroughProp] = scheduleeventproperties("State")
Target: Optional[ScheduleTarget] # TODO: Add docs
Target: Optional[ScheduleTarget] = scheduleeventproperties("Target")


class ScheduleEvent(BaseModel):
Expand Down Expand Up @@ -104,7 +106,7 @@ class CloudWatchEvent(BaseModel):


class EventBridgeRuleTarget(BaseModel):
Id: PassThroughProp # TODO: Add docs
Id: PassThroughProp = eventtarget("Id")


class EventBridgeRuleEventProperties(BaseModel):
Expand All @@ -114,7 +116,7 @@ class EventBridgeRuleEventProperties(BaseModel):
InputPath: Optional[PassThroughProp] = eventbridgeruleeventproperties("InputPath")
Pattern: Optional[PassThroughProp] = eventbridgeruleeventproperties("Pattern")
RetryPolicy: Optional[PassThroughProp] = eventbridgeruleeventproperties("RetryPolicy")
Target: Optional[EventBridgeRuleTarget] # TODO: Add docs
Target: Optional[EventBridgeRuleTarget] = eventbridgeruleeventproperties("Target")


class EventBridgeRuleEvent(BaseModel):
Expand All @@ -134,7 +136,7 @@ class ApiEventProperties(BaseModel):
Method: str = apieventproperties("Method")
Path: str = apieventproperties("Path")
RestApiId: Optional[SamIntrinsicable[str]] = apieventproperties("RestApiId")
UnescapeMappingTemplate: Optional[bool] # TODO: Add to docs
UnescapeMappingTemplate: Optional[bool] = apieventproperties("UnescapeMappingTemplate")


class ApiEvent(BaseModel):
Expand Down Expand Up @@ -163,7 +165,7 @@ class Properties(BaseModel):
PermissionsBoundary: Optional[PassThroughProp] = properties("PermissionsBoundary")
Policies: Optional[Union[str, DictStrAny, List[Union[str, DictStrAny]]]] = properties("Policies")
Role: Optional[PassThroughProp] = properties("Role")
RolePath: Optional[PassThroughProp] # TODO: Add docs
RolePath: Optional[PassThroughProp] = properties("RolePath")
Tags: Optional[DictStrAny] = properties("Tags")
Tracing: Optional[PassThroughProp] = properties("Tracing")
Type: Optional[PassThroughProp] = properties("Type")
Expand Down
Loading

0 comments on commit 90d7119

Please sign in to comment.