We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Cognito User Pool SMS configuration problem
**Description:**
When trying to create a Cognito user pool using SAM templates, SAM throws the error

> Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [CognitoUserPool] is invalid. Type of property 'SmsConfiguration' is invalid.

when specifying [SmsConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsconfiguration) property.
In the template, there is also a Lambda trigger that has Cognito configured as an event source.
After looking through the project and doing some tests, I believe the error could appear in the samtranslator module:
`'SmsConfiguration': PropertyType(False, list_of(dict)),`
From the CloudFormation docs, [SmsConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsconfiguration) seems to be a simple dict, but in the code snippet above, it is validated as a list of dicts.
Indeed, if I modify the corresponding part of the template from a mapping to a YAML list consisting of a single object, validation passes, but when the stack is created by CloudFormation, it fails with 
> Property validation failure: [Value of property {/SmsConfiguration} does not match type {Object}]

which is consistent with the type of the property specified in the CloudFormation docs.

**Steps to reproduce the issue:**
1. Create a SAM template with a Cognito user pool configured to use SMS MFA and a Lambda trigger associated.
```yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  Example YAML.
Globals:
  Function:
    Timeout: 3
    Handler: lambda_function.lambda_handler
    Runtime: python3.6
    MemorySize: 128
Resources:
  PreSignupValidationLambda:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: src/pre_signup_validation/
      Events:
        CognitoTrigger:
          Type: Cognito
          Properties:
            UserPool: !Ref CognitoUserPool
            Trigger: PreSignUp
  CognitoUserPool:
    Type: 'AWS::Cognito::UserPool'
    Properties:
      AutoVerifiedAttributes:
        - phone_number
      MfaConfiguration: OPTIONAL
      Schema:
        - AttributeDataType: String
          DeveloperOnlyAttribute: false
          Mutable: false
          Name: sub
          Required: true
          StringAttributeConstraints:
            MaxLength: 2048
            MinLength: 0
        - AttributeDataType: String
          DeveloperOnlyAttribute: false
          Mutable: true
          Name: email
          Required: true
          StringAttributeConstraints:
            MaxLength: 2048
            MinLength: 0
        - AttributeDataType: String
          DeveloperOnlyAttribute: false
          Mutable: true
          Name: phone_number
          Required: true
          StringAttributeConstraints:
            MaxLength: 2048
            MinLength: 0
      SmsConfiguration:
        ExternalId: 'xxx-xxx-xxx'
        SnsCallerArn: !GetAtt CognitoSMSRole.Arn
      UsernameAttributes:
        - email
        - phone_number
      UserPoolName: Customers
  CognitoSMSRole:
    Type: 'AWS::IAM::Role'
    Properties:
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: 'cognito-idp.amazonaws.com'
            Action:
              - 'sts:AssumeRole'
            Condition:
              StringEquals:
                'sts:ExternalId': 'xxx-xxx-xxx'
      Policies:
        - PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - 'sns:Publish'
                Resource:
                  - '*'
          PolicyName: CognitoSendSMS
      RoleName: CognitoSMSRole
```
2. Write a basic Lambda function in ```<template_location>/src/pre_signup_validation/lambda_function.py```
```python
def lambda_handler(event: dict, context: dict):
    return event
```
3. Run (Commands from the AWS Toolkit for PyCharm when trying to deploy application)
```bash
sam build --template template.yaml --build-dir build --use-container
```
```bash
sam package --template-file build/template.yaml --output-template-file build/packaged-template.yaml --s3-bucket <your_s3_bucket>
```
```bash
sam deploy --template-file build/packaged-template.yaml --stack-name test --no-execute-changeset
```

**Observed result:**
SAM validates the SmsConfiguration parameter of Cognito user pools as a list of type dict.
**Expected result:**
Validation should be consistent with CloudFormation specification.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `samtranslator/parser/parser.py`
Content:
```
1 import logging
2 
3 from samtranslator.model.exceptions import InvalidDocumentException, InvalidTemplateException, InvalidResourceException
4 from samtranslator.validator.validator import SamTemplateValidator
5 from samtranslator.plugins import LifeCycleEvents
6 from samtranslator.public.sdk.template import SamTemplate
7 
8 LOG = logging.getLogger(__name__)
9 
10 
11 class Parser:
12     def __init__(self):
13         pass
14 
15     def parse(self, sam_template, parameter_values, sam_plugins):
16         self._validate(sam_template, parameter_values)
17         sam_plugins.act(LifeCycleEvents.before_transform_template, sam_template)
18 
19     @staticmethod
20     def validate_datatypes(sam_template):
21         """Validates the datatype within the template """
22         if (
23             "Resources" not in sam_template
24             or not isinstance(sam_template["Resources"], dict)
25             or not sam_template["Resources"]
26         ):
27             raise InvalidDocumentException([InvalidTemplateException("'Resources' section is required")])
28 
29         if not all(isinstance(sam_resource, dict) for sam_resource in sam_template["Resources"].values()):
30             raise InvalidDocumentException(
31                 [
32                     InvalidTemplateException(
33                         "All 'Resources' must be Objects. If you're using YAML, this may be an " "indentation issue."
34                     )
35                 ]
36             )
37 
38         sam_template_instance = SamTemplate(sam_template)
39 
40         for resource_logical_id, sam_resource in sam_template_instance.iterate():
41             # NOTE: Properties isn't required for SimpleTable, so we can't check
42             # `not isinstance(sam_resources.get("Properties"), dict)` as this would be a breaking change.
43             # sam_resource.properties defaults to {} in SamTemplate init
44             if not isinstance(sam_resource.properties, dict):
45                 raise InvalidDocumentException(
46                     [
47                         InvalidResourceException(
48                             resource_logical_id,
49                             "All 'Resources' must be Objects and have a 'Properties' Object. If "
50                             "you're using YAML, this may be an indentation issue.",
51                         )
52                     ]
53                 )
54 
55     # private methods
56     def _validate(self, sam_template, parameter_values):
57         """Validates the template and parameter values and raises exceptions if there's an issue
58 
59         :param dict sam_template: SAM template
60         :param dict parameter_values: Dictionary of parameter values provided by the user
61         """
62         if parameter_values is None:
63             raise ValueError("`parameter_values` argument is required")
64 
65         Parser.validate_datatypes(sam_template)
66 
67         try:
68             validator = SamTemplateValidator()
69             validation_errors = validator.validate(sam_template)
70             if validation_errors:
71                 LOG.warning("Template schema validation reported the following errors: %s", validation_errors)
72         except Exception as e:
73             # Catching any exception and not re-raising to make sure any validation process won't break transform
74             LOG.exception("Exception from SamTemplateValidator: %s", e)
75
```

Path: `samtranslator/model/cognito.py`
Content:
```
1 from samtranslator.model import PropertyType, Resource
2 from samtranslator.model.types import is_type, list_of, is_str
3 from samtranslator.model.intrinsics import fnGetAtt, ref
4 
5 
6 class CognitoUserPool(Resource):
7     resource_type = "AWS::Cognito::UserPool"
8     property_types = {
9         "AccountRecoverySetting": PropertyType(False, is_type(dict)),
10         "AdminCreateUserConfig": PropertyType(False, is_type(dict)),
11         "AliasAttributes": PropertyType(False, list_of(is_str())),
12         "AutoVerifiedAttributes": PropertyType(False, list_of(is_str())),
13         "DeviceConfiguration": PropertyType(False, is_type(dict)),
14         "EmailConfiguration": PropertyType(False, is_type(dict)),
15         "EmailVerificationMessage": PropertyType(False, is_str()),
16         "EmailVerificationSubject": PropertyType(False, is_str()),
17         "EnabledMfas": PropertyType(False, list_of(is_str())),
18         "LambdaConfig": PropertyType(False, is_type(dict)),
19         "MfaConfiguration": PropertyType(False, is_str()),
20         "Policies": PropertyType(False, is_type(dict)),
21         "Schema": PropertyType(False, list_of(dict)),
22         "SmsAuthenticationMessage": PropertyType(False, is_str()),
23         "SmsConfiguration": PropertyType(False, list_of(dict)),
24         "SmsVerificationMessage": PropertyType(False, is_str()),
25         "UsernameAttributes": PropertyType(False, list_of(is_str())),
26         "UsernameConfiguration": PropertyType(False, is_type(dict)),
27         "UserPoolAddOns": PropertyType(False, list_of(dict)),
28         "UserPoolName": PropertyType(False, is_str()),
29         "UserPoolTags": PropertyType(False, is_type(dict)),
30         "VerificationMessageTemplate": PropertyType(False, is_type(dict)),
31     }
32 
33     runtime_attrs = {
34         "name": lambda self: ref(self.logical_id),
35         "arn": lambda self: fnGetAtt(self.logical_id, "Arn"),
36         "provider_name": lambda self: fnGetAtt(self.logical_id, "ProviderName"),
37         "provider_url": lambda self: fnGetAtt(self.logical_id, "ProviderURL"),
38     }
39
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/samtranslator/model/cognito.py b/samtranslator/model/cognito.py
--- a/samtranslator/model/cognito.py
+++ b/samtranslator/model/cognito.py
@@ -20,7 +20,7 @@
         "Policies": PropertyType(False, is_type(dict)),
         "Schema": PropertyType(False, list_of(dict)),
         "SmsAuthenticationMessage": PropertyType(False, is_str()),
-        "SmsConfiguration": PropertyType(False, list_of(dict)),
+        "SmsConfiguration": PropertyType(False, is_type(dict)),
         "SmsVerificationMessage": PropertyType(False, is_str()),
         "UsernameAttributes": PropertyType(False, list_of(is_str())),
         "UsernameConfiguration": PropertyType(False, is_type(dict)),
diff --git a/samtranslator/parser/parser.py b/samtranslator/parser/parser.py
--- a/samtranslator/parser/parser.py
+++ b/samtranslator/parser/parser.py
@@ -18,7 +18,7 @@
 
     @staticmethod
     def validate_datatypes(sam_template):
-        """Validates the datatype within the template """
+        """Validates the datatype within the template"""
         if (
             "Resources" not in sam_template
             or not isinstance(sam_template["Resources"], dict)

{"golden_diff": "diff --git a/samtranslator/model/cognito.py b/samtranslator/model/cognito.py\n--- a/samtranslator/model/cognito.py\n+++ b/samtranslator/model/cognito.py\n@@ -20,7 +20,7 @@\n         \"Policies\": PropertyType(False, is_type(dict)),\n         \"Schema\": PropertyType(False, list_of(dict)),\n         \"SmsAuthenticationMessage\": PropertyType(False, is_str()),\n-        \"SmsConfiguration\": PropertyType(False, list_of(dict)),\n+        \"SmsConfiguration\": PropertyType(False, is_type(dict)),\n         \"SmsVerificationMessage\": PropertyType(False, is_str()),\n         \"UsernameAttributes\": PropertyType(False, list_of(is_str())),\n         \"UsernameConfiguration\": PropertyType(False, is_type(dict)),\ndiff --git a/samtranslator/parser/parser.py b/samtranslator/parser/parser.py\n--- a/samtranslator/parser/parser.py\n+++ b/samtranslator/parser/parser.py\n@@ -18,7 +18,7 @@\n \n     @staticmethod\n     def validate_datatypes(sam_template):\n-        \"\"\"Validates the datatype within the template \"\"\"\n+        \"\"\"Validates the datatype within the template\"\"\"\n         if (\n             \"Resources\" not in sam_template\n             or not isinstance(sam_template[\"Resources\"], dict)\n", "issue": "Cognito User Pool SMS configuration problem\n**Description:**\r\nWhen trying to create a Cognito user pool using SAM templates, SAM throws the error\r\n\r\n> Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [CognitoUserPool] is invalid. Type of property 'SmsConfiguration' is invalid.\r\n\r\nwhen specifying [SmsConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsconfiguration) property.\r\nIn the template, there is also a Lambda trigger that has Cognito configured as an event source.\r\nAfter looking through the project and doing some tests, I believe the error could appear in the samtranslator module:\r\n`'SmsConfiguration': PropertyType(False, list_of(dict)),`\r\nFrom the CloudFormation docs, [SmsConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsconfiguration) seems to be a simple dict, but in the code snippet above, it is validated as a list of dicts.\r\nIndeed, if I modify the corresponding part of the template from a mapping to a YAML list consisting of a single object, validation passes, but when the stack is created by CloudFormation, it fails with \r\n> Property validation failure: [Value of property {/SmsConfiguration} does not match type {Object}]\r\n\r\nwhich is consistent with the type of the property specified in the CloudFormation docs.\r\n\r\n**Steps to reproduce the issue:**\r\n1. Create a SAM template with a Cognito user pool configured to use SMS MFA and a Lambda trigger associated.\r\n```yaml\r\nAWSTemplateFormatVersion: '2010-09-09'\r\nTransform: AWS::Serverless-2016-10-31\r\nDescription: >\r\n  Example YAML.\r\nGlobals:\r\n  Function:\r\n    Timeout: 3\r\n    Handler: lambda_function.lambda_handler\r\n    Runtime: python3.6\r\n    MemorySize: 128\r\nResources:\r\n  PreSignupValidationLambda:\r\n    Type: AWS::Serverless::Function\r\n    Properties:\r\n      CodeUri: src/pre_signup_validation/\r\n      Events:\r\n        CognitoTrigger:\r\n          Type: Cognito\r\n          Properties:\r\n            UserPool: !Ref CognitoUserPool\r\n            Trigger: PreSignUp\r\n  CognitoUserPool:\r\n    Type: 'AWS::Cognito::UserPool'\r\n    Properties:\r\n      AutoVerifiedAttributes:\r\n        - phone_number\r\n      MfaConfiguration: OPTIONAL\r\n      Schema:\r\n        - AttributeDataType: String\r\n          DeveloperOnlyAttribute: false\r\n          Mutable: false\r\n          Name: sub\r\n          Required: true\r\n          StringAttributeConstraints:\r\n            MaxLength: 2048\r\n            MinLength: 0\r\n        - AttributeDataType: String\r\n          DeveloperOnlyAttribute: false\r\n          Mutable: true\r\n          Name: email\r\n          Required: true\r\n          StringAttributeConstraints:\r\n            MaxLength: 2048\r\n            MinLength: 0\r\n        - AttributeDataType: String\r\n          DeveloperOnlyAttribute: false\r\n          Mutable: true\r\n          Name: phone_number\r\n          Required: true\r\n          StringAttributeConstraints:\r\n            MaxLength: 2048\r\n            MinLength: 0\r\n      SmsConfiguration:\r\n        ExternalId: 'xxx-xxx-xxx'\r\n        SnsCallerArn: !GetAtt CognitoSMSRole.Arn\r\n      UsernameAttributes:\r\n        - email\r\n        - phone_number\r\n      UserPoolName: Customers\r\n  CognitoSMSRole:\r\n    Type: 'AWS::IAM::Role'\r\n    Properties:\r\n      AssumeRolePolicyDocument:\r\n        Version: 2012-10-17\r\n        Statement:\r\n          - Effect: Allow\r\n            Principal:\r\n              Service: 'cognito-idp.amazonaws.com'\r\n            Action:\r\n              - 'sts:AssumeRole'\r\n            Condition:\r\n              StringEquals:\r\n                'sts:ExternalId': 'xxx-xxx-xxx'\r\n      Policies:\r\n        - PolicyDocument:\r\n            Version: 2012-10-17\r\n            Statement:\r\n              - Effect: Allow\r\n                Action:\r\n                  - 'sns:Publish'\r\n                Resource:\r\n                  - '*'\r\n          PolicyName: CognitoSendSMS\r\n      RoleName: CognitoSMSRole\r\n```\r\n2. Write a basic Lambda function in ```<template_location>/src/pre_signup_validation/lambda_function.py```\r\n```python\r\ndef lambda_handler(event: dict, context: dict):\r\n    return event\r\n```\r\n3. Run (Commands from the AWS Toolkit for PyCharm when trying to deploy application)\r\n```bash\r\nsam build --template template.yaml --build-dir build --use-container\r\n```\r\n```bash\r\nsam package --template-file build/template.yaml --output-template-file build/packaged-template.yaml --s3-bucket <your_s3_bucket>\r\n```\r\n```bash\r\nsam deploy --template-file build/packaged-template.yaml --stack-name test --no-execute-changeset\r\n```\r\n\r\n**Observed result:**\r\nSAM validates the SmsConfiguration parameter of Cognito user pools as a list of type dict.\r\n**Expected result:**\r\nValidation should be consistent with CloudFormation specification.\n", "before_files": [{"content": "import logging\n\nfrom samtranslator.model.exceptions import InvalidDocumentException, InvalidTemplateException, InvalidResourceException\nfrom samtranslator.validator.validator import SamTemplateValidator\nfrom samtranslator.plugins import LifeCycleEvents\nfrom samtranslator.public.sdk.template import SamTemplate\n\nLOG = logging.getLogger(__name__)\n\n\nclass Parser:\n    def __init__(self):\n        pass\n\n    def parse(self, sam_template, parameter_values, sam_plugins):\n        self._validate(sam_template, parameter_values)\n        sam_plugins.act(LifeCycleEvents.before_transform_template, sam_template)\n\n    @staticmethod\n    def validate_datatypes(sam_template):\n        \"\"\"Validates the datatype within the template \"\"\"\n        if (\n            \"Resources\" not in sam_template\n            or not isinstance(sam_template[\"Resources\"], dict)\n            or not sam_template[\"Resources\"]\n        ):\n            raise InvalidDocumentException([InvalidTemplateException(\"'Resources' section is required\")])\n\n        if not all(isinstance(sam_resource, dict) for sam_resource in sam_template[\"Resources\"].values()):\n            raise InvalidDocumentException(\n                [\n                    InvalidTemplateException(\n                        \"All 'Resources' must be Objects. If you're using YAML, this may be an \" \"indentation issue.\"\n                    )\n                ]\n            )\n\n        sam_template_instance = SamTemplate(sam_template)\n\n        for resource_logical_id, sam_resource in sam_template_instance.iterate():\n            # NOTE: Properties isn't required for SimpleTable, so we can't check\n            # `not isinstance(sam_resources.get(\"Properties\"), dict)` as this would be a breaking change.\n            # sam_resource.properties defaults to {} in SamTemplate init\n            if not isinstance(sam_resource.properties, dict):\n                raise InvalidDocumentException(\n                    [\n                        InvalidResourceException(\n                            resource_logical_id,\n                            \"All 'Resources' must be Objects and have a 'Properties' Object. If \"\n                            \"you're using YAML, this may be an indentation issue.\",\n                        )\n                    ]\n                )\n\n    # private methods\n    def _validate(self, sam_template, parameter_values):\n        \"\"\"Validates the template and parameter values and raises exceptions if there's an issue\n\n        :param dict sam_template: SAM template\n        :param dict parameter_values: Dictionary of parameter values provided by the user\n        \"\"\"\n        if parameter_values is None:\n            raise ValueError(\"`parameter_values` argument is required\")\n\n        Parser.validate_datatypes(sam_template)\n\n        try:\n            validator = SamTemplateValidator()\n            validation_errors = validator.validate(sam_template)\n            if validation_errors:\n                LOG.warning(\"Template schema validation reported the following errors: %s\", validation_errors)\n        except Exception as e:\n            # Catching any exception and not re-raising to make sure any validation process won't break transform\n            LOG.exception(\"Exception from SamTemplateValidator: %s\", e)\n", "path": "samtranslator/parser/parser.py"}, {"content": "from samtranslator.model import PropertyType, Resource\nfrom samtranslator.model.types import is_type, list_of, is_str\nfrom samtranslator.model.intrinsics import fnGetAtt, ref\n\n\nclass CognitoUserPool(Resource):\n    resource_type = \"AWS::Cognito::UserPool\"\n    property_types = {\n        \"AccountRecoverySetting\": PropertyType(False, is_type(dict)),\n        \"AdminCreateUserConfig\": PropertyType(False, is_type(dict)),\n        \"AliasAttributes\": PropertyType(False, list_of(is_str())),\n        \"AutoVerifiedAttributes\": PropertyType(False, list_of(is_str())),\n        \"DeviceConfiguration\": PropertyType(False, is_type(dict)),\n        \"EmailConfiguration\": PropertyType(False, is_type(dict)),\n        \"EmailVerificationMessage\": PropertyType(False, is_str()),\n        \"EmailVerificationSubject\": PropertyType(False, is_str()),\n        \"EnabledMfas\": PropertyType(False, list_of(is_str())),\n        \"LambdaConfig\": PropertyType(False, is_type(dict)),\n        \"MfaConfiguration\": PropertyType(False, is_str()),\n        \"Policies\": PropertyType(False, is_type(dict)),\n        \"Schema\": PropertyType(False, list_of(dict)),\n        \"SmsAuthenticationMessage\": PropertyType(False, is_str()),\n        \"SmsConfiguration\": PropertyType(False, list_of(dict)),\n        \"SmsVerificationMessage\": PropertyType(False, is_str()),\n        \"UsernameAttributes\": PropertyType(False, list_of(is_str())),\n        \"UsernameConfiguration\": PropertyType(False, is_type(dict)),\n        \"UserPoolAddOns\": PropertyType(False, list_of(dict)),\n        \"UserPoolName\": PropertyType(False, is_str()),\n        \"UserPoolTags\": PropertyType(False, is_type(dict)),\n        \"VerificationMessageTemplate\": PropertyType(False, is_type(dict)),\n    }\n\n    runtime_attrs = {\n        \"name\": lambda self: ref(self.logical_id),\n        \"arn\": lambda self: fnGetAtt(self.logical_id, \"Arn\"),\n        \"provider_name\": lambda self: fnGetAtt(self.logical_id, \"ProviderName\"),\n        \"provider_url\": lambda self: fnGetAtt(self.logical_id, \"ProviderURL\"),\n    }\n", "path": "samtranslator/model/cognito.py"}], "after_files": [{"content": "import logging\n\nfrom samtranslator.model.exceptions import InvalidDocumentException, InvalidTemplateException, InvalidResourceException\nfrom samtranslator.validator.validator import SamTemplateValidator\nfrom samtranslator.plugins import LifeCycleEvents\nfrom samtranslator.public.sdk.template import SamTemplate\n\nLOG = logging.getLogger(__name__)\n\n\nclass Parser:\n    def __init__(self):\n        pass\n\n    def parse(self, sam_template, parameter_values, sam_plugins):\n        self._validate(sam_template, parameter_values)\n        sam_plugins.act(LifeCycleEvents.before_transform_template, sam_template)\n\n    @staticmethod\n    def validate_datatypes(sam_template):\n        \"\"\"Validates the datatype within the template\"\"\"\n        if (\n            \"Resources\" not in sam_template\n            or not isinstance(sam_template[\"Resources\"], dict)\n            or not sam_template[\"Resources\"]\n        ):\n            raise InvalidDocumentException([InvalidTemplateException(\"'Resources' section is required\")])\n\n        if not all(isinstance(sam_resource, dict) for sam_resource in sam_template[\"Resources\"].values()):\n            raise InvalidDocumentException(\n                [\n                    InvalidTemplateException(\n                        \"All 'Resources' must be Objects. If you're using YAML, this may be an \" \"indentation issue.\"\n                    )\n                ]\n            )\n\n        sam_template_instance = SamTemplate(sam_template)\n\n        for resource_logical_id, sam_resource in sam_template_instance.iterate():\n            # NOTE: Properties isn't required for SimpleTable, so we can't check\n            # `not isinstance(sam_resources.get(\"Properties\"), dict)` as this would be a breaking change.\n            # sam_resource.properties defaults to {} in SamTemplate init\n            if not isinstance(sam_resource.properties, dict):\n                raise InvalidDocumentException(\n                    [\n                        InvalidResourceException(\n                            resource_logical_id,\n                            \"All 'Resources' must be Objects and have a 'Properties' Object. If \"\n                            \"you're using YAML, this may be an indentation issue.\",\n                        )\n                    ]\n                )\n\n    # private methods\n    def _validate(self, sam_template, parameter_values):\n        \"\"\"Validates the template and parameter values and raises exceptions if there's an issue\n\n        :param dict sam_template: SAM template\n        :param dict parameter_values: Dictionary of parameter values provided by the user\n        \"\"\"\n        if parameter_values is None:\n            raise ValueError(\"`parameter_values` argument is required\")\n\n        Parser.validate_datatypes(sam_template)\n\n        try:\n            validator = SamTemplateValidator()\n            validation_errors = validator.validate(sam_template)\n            if validation_errors:\n                LOG.warning(\"Template schema validation reported the following errors: %s\", validation_errors)\n        except Exception as e:\n            # Catching any exception and not re-raising to make sure any validation process won't break transform\n            LOG.exception(\"Exception from SamTemplateValidator: %s\", e)\n", "path": "samtranslator/parser/parser.py"}, {"content": "from samtranslator.model import PropertyType, Resource\nfrom samtranslator.model.types import is_type, list_of, is_str\nfrom samtranslator.model.intrinsics import fnGetAtt, ref\n\n\nclass CognitoUserPool(Resource):\n    resource_type = \"AWS::Cognito::UserPool\"\n    property_types = {\n        \"AccountRecoverySetting\": PropertyType(False, is_type(dict)),\n        \"AdminCreateUserConfig\": PropertyType(False, is_type(dict)),\n        \"AliasAttributes\": PropertyType(False, list_of(is_str())),\n        \"AutoVerifiedAttributes\": PropertyType(False, list_of(is_str())),\n        \"DeviceConfiguration\": PropertyType(False, is_type(dict)),\n        \"EmailConfiguration\": PropertyType(False, is_type(dict)),\n        \"EmailVerificationMessage\": PropertyType(False, is_str()),\n        \"EmailVerificationSubject\": PropertyType(False, is_str()),\n        \"EnabledMfas\": PropertyType(False, list_of(is_str())),\n        \"LambdaConfig\": PropertyType(False, is_type(dict)),\n        \"MfaConfiguration\": PropertyType(False, is_str()),\n        \"Policies\": PropertyType(False, is_type(dict)),\n        \"Schema\": PropertyType(False, list_of(dict)),\n        \"SmsAuthenticationMessage\": PropertyType(False, is_str()),\n        \"SmsConfiguration\": PropertyType(False, is_type(dict)),\n        \"SmsVerificationMessage\": PropertyType(False, is_str()),\n        \"UsernameAttributes\": PropertyType(False, list_of(is_str())),\n        \"UsernameConfiguration\": PropertyType(False, is_type(dict)),\n        \"UserPoolAddOns\": PropertyType(False, list_of(dict)),\n        \"UserPoolName\": PropertyType(False, is_str()),\n        \"UserPoolTags\": PropertyType(False, is_type(dict)),\n        \"VerificationMessageTemplate\": PropertyType(False, is_type(dict)),\n    }\n\n    runtime_attrs = {\n        \"name\": lambda self: ref(self.logical_id),\n        \"arn\": lambda self: fnGetAtt(self.logical_id, \"Arn\"),\n        \"provider_name\": lambda self: fnGetAtt(self.logical_id, \"ProviderName\"),\n        \"provider_url\": lambda self: fnGetAtt(self.logical_id, \"ProviderURL\"),\n    }\n", "path": "samtranslator/model/cognito.py"}]}