prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Invalid Aliases when using SSM dynamic references
  ### CloudFormation Lint Version
  
  0.83.0
  
  ### What operating system are you using?
  
  Mac
  
  ### Describe the bug
  
  When using a dynamic reference to resolve the Alias domain, cfn-lint fails indicating it's an invalid alias. Shouldn't the code check if this is a `REGEX_DYN_REF` in https://github.com/aws-cloudformation/cfn-lint/blob/main/src/cfnlint/rules/resources/cloudfront/Aliases.py and ignore if so?
  
  A workaround would be to use "!Sub" which apparently is ignored already (`FUNCTIONS`). Shouldn't we also ignore when `REGEX_DYN_REF`?
  
  ### Expected behavior
  
  E3013 shouldn't be informed, since there's no way to validate the dynamic-reference value from cfn-lint perspective (?)
  
  ### Reproduction template
  
  ```
  CloudFront:
          Type: AWS::CloudFront::Distribution
          Properties:
              DistributionConfig:
                  Enabled: true
                  Aliases:
                      - "{{resolve:ssm:/env/fqdns/certifier}}"
                  DefaultRootObject: index.html
  ``` 
  
  </issue>
  <code>
  [start of src/cfnlint/rules/resources/cloudfront/Aliases.py]
  1 """
  2 Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3 SPDX-License-Identifier: MIT-0
  4 """
  5 import regex as re
  6 
  7 from cfnlint.helpers import FUNCTIONS
  8 from cfnlint.rules import CloudFormationLintRule, RuleMatch
  9 
  10 
  11 class Aliases(CloudFormationLintRule):
  12     """Check if CloudFront Aliases are valid domain names"""
  13 
  14     id = "E3013"
  15     shortdesc = "CloudFront Aliases"
  16     description = "CloudFront aliases should contain valid domain names"
  17     source_url = "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-aliases"
  18     tags = ["properties", "cloudfront"]
  19 
  20     def match(self, cfn):
  21         """Check cloudfront Resource Parameters"""
  22 
  23         matches = []
  24 
  25         valid_domain = re.compile(
  26             r"^(?:[a-z0-9\*](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
  27         )
  28 
  29         results = cfn.get_resource_properties(
  30             ["AWS::CloudFront::Distribution", "DistributionConfig"]
  31         )
  32         for result in results:
  33             aliases = result["Value"].get("Aliases")
  34             if aliases:
  35                 for alias in aliases:
  36                     if isinstance(alias, str) and alias not in FUNCTIONS:
  37                         wildcard = alias.split(".")
  38                         if "*" in wildcard[1:]:
  39                             path = result["Path"] + ["Aliases"]
  40                             message = f'Invalid use of wildcards: {alias} at {"/".join(result["Path"])}'
  41                             matches.append(RuleMatch(path, message))
  42                         if not re.match(valid_domain, alias):
  43                             path = result["Path"] + ["Aliases"]
  44                             message = f'Invalid alias found: {alias} at {"/".join(result["Path"])}'
  45                             matches.append(RuleMatch(path, message))
  46 
  47         return matches
  48
  [end of src/cfnlint/rules/resources/cloudfront/Aliases.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/cfnlint/rules/resources/cloudfront/Aliases.py b/src/cfnlint/rules/resources/cloudfront/Aliases.py
  --- a/src/cfnlint/rules/resources/cloudfront/Aliases.py
  +++ b/src/cfnlint/rules/resources/cloudfront/Aliases.py
  @@ -4,7 +4,7 @@
   """
   import regex as re
   
  -from cfnlint.helpers import FUNCTIONS
  +from cfnlint.helpers import FUNCTIONS, REGEX_DYN_REF
   from cfnlint.rules import CloudFormationLintRule, RuleMatch
   
   
  @@ -35,6 +35,8 @@
                   for alias in aliases:
                       if isinstance(alias, str) and alias not in FUNCTIONS:
                           wildcard = alias.split(".")
  +                        if re.match(REGEX_DYN_REF, alias):
  +                            continue
                           if "*" in wildcard[1:]:
                               path = result["Path"] + ["Aliases"]
                               message = f'Invalid use of wildcards: {alias} at {"/".join(result["Path"])}'
  
verification_info: {"golden_diff": "diff --git a/src/cfnlint/rules/resources/cloudfront/Aliases.py b/src/cfnlint/rules/resources/cloudfront/Aliases.py\n--- a/src/cfnlint/rules/resources/cloudfront/Aliases.py\n+++ b/src/cfnlint/rules/resources/cloudfront/Aliases.py\n@@ -4,7 +4,7 @@\n \"\"\"\n import regex as re\n \n-from cfnlint.helpers import FUNCTIONS\n+from cfnlint.helpers import FUNCTIONS, REGEX_DYN_REF\n from cfnlint.rules import CloudFormationLintRule, RuleMatch\n \n \n@@ -35,6 +35,8 @@\n                 for alias in aliases:\n                     if isinstance(alias, str) and alias not in FUNCTIONS:\n                         wildcard = alias.split(\".\")\n+                        if re.match(REGEX_DYN_REF, alias):\n+                            continue\n                         if \"*\" in wildcard[1:]:\n                             path = result[\"Path\"] + [\"Aliases\"]\n                             message = f'Invalid use of wildcards: {alias} at {\"/\".join(result[\"Path\"])}'\n", "issue": "Invalid Aliases when using SSM dynamic references\n### CloudFormation Lint Version\r\n\r\n0.83.0\r\n\r\n### What operating system are you using?\r\n\r\nMac\r\n\r\n### Describe the bug\r\n\r\nWhen using a dynamic reference to resolve the Alias domain, cfn-lint fails indicating it's an invalid alias. Shouldn't the code check if this is a `REGEX_DYN_REF` in https://github.com/aws-cloudformation/cfn-lint/blob/main/src/cfnlint/rules/resources/cloudfront/Aliases.py and ignore if so?\r\n\r\nA workaround would be to use \"!Sub\" which apparently is ignored already (`FUNCTIONS`). Shouldn't we also ignore when `REGEX_DYN_REF`?\r\n\r\n### Expected behavior\r\n\r\nE3013 shouldn't be informed, since there's no way to validate the dynamic-reference value from cfn-lint perspective (?)\r\n\r\n### Reproduction template\r\n\r\n```\r\nCloudFront:\r\n        Type: AWS::CloudFront::Distribution\r\n        Properties:\r\n            DistributionConfig:\r\n                Enabled: true\r\n                Aliases:\r\n                    - \"{{resolve:ssm:/env/fqdns/certifier}}\"\r\n                DefaultRootObject: index.html\r\n``` \n", "before_files": [{"content": "\"\"\"\nCopyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\nSPDX-License-Identifier: MIT-0\n\"\"\"\nimport regex as re\n\nfrom cfnlint.helpers import FUNCTIONS\nfrom cfnlint.rules import CloudFormationLintRule, RuleMatch\n\n\nclass Aliases(CloudFormationLintRule):\n    \"\"\"Check if CloudFront Aliases are valid domain names\"\"\"\n\n    id = \"E3013\"\n    shortdesc = \"CloudFront Aliases\"\n    description = \"CloudFront aliases should contain valid domain names\"\n    source_url = \"https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-aliases\"\n    tags = [\"properties\", \"cloudfront\"]\n\n    def match(self, cfn):\n        \"\"\"Check cloudfront Resource Parameters\"\"\"\n\n        matches = []\n\n        valid_domain = re.compile(\n            r\"^(?:[a-z0-9\\*](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$\"\n        )\n\n        results = cfn.get_resource_properties(\n            [\"AWS::CloudFront::Distribution\", \"DistributionConfig\"]\n        )\n        for result in results:\n            aliases = result[\"Value\"].get(\"Aliases\")\n            if aliases:\n                for alias in aliases:\n                    if isinstance(alias, str) and alias not in FUNCTIONS:\n                        wildcard = alias.split(\".\")\n                        if \"*\" in wildcard[1:]:\n                            path = result[\"Path\"] + [\"Aliases\"]\n                            message = f'Invalid use of wildcards: {alias} at {\"/\".join(result[\"Path\"])}'\n                            matches.append(RuleMatch(path, message))\n                        if not re.match(valid_domain, alias):\n                            path = result[\"Path\"] + [\"Aliases\"]\n                            message = f'Invalid alias found: {alias} at {\"/\".join(result[\"Path\"])}'\n                            matches.append(RuleMatch(path, message))\n\n        return matches\n", "path": "src/cfnlint/rules/resources/cloudfront/Aliases.py"}]}