From 3cbacc0b20de216b0df23c0e64bc30dae83ebaad Mon Sep 17 00:00:00 2001 From: edinstance Date: Mon, 12 May 2025 23:45:16 +0100 Subject: [PATCH 1/2] feat: updated the cognito properties based on cloudformation properties --- samtranslator/model/cognito.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samtranslator/model/cognito.py b/samtranslator/model/cognito.py index 9dc6772751..bb655b8577 100644 --- a/samtranslator/model/cognito.py +++ b/samtranslator/model/cognito.py @@ -11,6 +11,8 @@ class CognitoUserPool(Resource): "AutoVerifiedAttributes": GeneratedProperty(), "DeletionProtection": GeneratedProperty(), "DeviceConfiguration": GeneratedProperty(), + "EmailAuthenticationMessage": GeneratedProperty(), + "EmailAuthenticationSubject": GeneratedProperty(), "EmailConfiguration": GeneratedProperty(), "EmailVerificationMessage": GeneratedProperty(), "EmailVerificationSubject": GeneratedProperty(), @@ -28,7 +30,10 @@ class CognitoUserPool(Resource): "UserPoolAddOns": GeneratedProperty(), "UserPoolName": GeneratedProperty(), "UserPoolTags": GeneratedProperty(), + "UserPoolTier": GeneratedProperty(), "VerificationMessageTemplate": GeneratedProperty(), + "WebAuthnRelyingPartyID": GeneratedProperty(), + "WebAuthnUserVerification": GeneratedProperty(), } runtime_attrs = { From 9ba4395ea0002e034ff402c718903091cf1fbaa9 Mon Sep 17 00:00:00 2001 From: edinstance Date: Tue, 13 May 2025 00:01:27 +0100 Subject: [PATCH 2/2] feat: added translator tests for the new properties --- .../cognito_template_with_new_properties.yaml | 11 +++++++++++ .../cognito_template_with_new_properties.json | 15 +++++++++++++++ .../cognito_template_with_new_properties.json | 15 +++++++++++++++ .../cognito_template_with_new_properties.json | 15 +++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 tests/translator/input/cognito_template_with_new_properties.yaml create mode 100644 tests/translator/output/aws-cn/cognito_template_with_new_properties.json create mode 100644 tests/translator/output/aws-us-gov/cognito_template_with_new_properties.json create mode 100644 tests/translator/output/cognito_template_with_new_properties.json diff --git a/tests/translator/input/cognito_template_with_new_properties.yaml b/tests/translator/input/cognito_template_with_new_properties.yaml new file mode 100644 index 0000000000..cdfb89112b --- /dev/null +++ b/tests/translator/input/cognito_template_with_new_properties.yaml @@ -0,0 +1,11 @@ +Transform: AWS::Serverless-2016-10-31 +Resources: + MyUserPool: + Type: AWS::Cognito::UserPool + Properties: + UserPoolTier: PLUS + UserPoolName: MyUserPool + EmailAuthenticationMessage: Your verification code is {####} + EmailAuthenticationSubject: Your verification code + WebAuthnRelyingPartyID: id + WebAuthnUserVerification: required diff --git a/tests/translator/output/aws-cn/cognito_template_with_new_properties.json b/tests/translator/output/aws-cn/cognito_template_with_new_properties.json new file mode 100644 index 0000000000..7869a8eda5 --- /dev/null +++ b/tests/translator/output/aws-cn/cognito_template_with_new_properties.json @@ -0,0 +1,15 @@ +{ + "Resources": { + "MyUserPool": { + "Properties": { + "EmailAuthenticationMessage": "Your verification code is {####}", + "EmailAuthenticationSubject": "Your verification code", + "UserPoolName": "MyUserPool", + "UserPoolTier": "PLUS", + "WebAuthnRelyingPartyID": "id", + "WebAuthnUserVerification": "required" + }, + "Type": "AWS::Cognito::UserPool" + } + } +} diff --git a/tests/translator/output/aws-us-gov/cognito_template_with_new_properties.json b/tests/translator/output/aws-us-gov/cognito_template_with_new_properties.json new file mode 100644 index 0000000000..7869a8eda5 --- /dev/null +++ b/tests/translator/output/aws-us-gov/cognito_template_with_new_properties.json @@ -0,0 +1,15 @@ +{ + "Resources": { + "MyUserPool": { + "Properties": { + "EmailAuthenticationMessage": "Your verification code is {####}", + "EmailAuthenticationSubject": "Your verification code", + "UserPoolName": "MyUserPool", + "UserPoolTier": "PLUS", + "WebAuthnRelyingPartyID": "id", + "WebAuthnUserVerification": "required" + }, + "Type": "AWS::Cognito::UserPool" + } + } +} diff --git a/tests/translator/output/cognito_template_with_new_properties.json b/tests/translator/output/cognito_template_with_new_properties.json new file mode 100644 index 0000000000..7869a8eda5 --- /dev/null +++ b/tests/translator/output/cognito_template_with_new_properties.json @@ -0,0 +1,15 @@ +{ + "Resources": { + "MyUserPool": { + "Properties": { + "EmailAuthenticationMessage": "Your verification code is {####}", + "EmailAuthenticationSubject": "Your verification code", + "UserPoolName": "MyUserPool", + "UserPoolTier": "PLUS", + "WebAuthnRelyingPartyID": "id", + "WebAuthnUserVerification": "required" + }, + "Type": "AWS::Cognito::UserPool" + } + } +}