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
5 changes: 4 additions & 1 deletion moto/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ def gzip_compress(body: bytes) -> bytes:
"isoe": "cloud.adc-e.uk",
"isof": "csp.hci.ic.gov",
}
ALT_DOMAIN_SUFFIXES = list(ISO_REGION_DOMAINS.values()) + ["amazonaws.com.cn"]
ALT_DOMAIN_SUFFIXES = list(ISO_REGION_DOMAINS.values()) + [
"amazonaws.com.cn",
"amazonaws.eu",
]


def get_equivalent_url_in_aws_domain(url: str) -> tuple[ParseResult, bool]:
Expand Down
4 changes: 3 additions & 1 deletion moto/glue/glue_schema_registry_constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import re

from moto.utilities.utils import ARN_PARTITION_REGEX

# This file contains the constants required for Glue Schema Registry APIs.

# common used constants
Expand All @@ -10,7 +12,7 @@
DESCRIPTION_PATTERN = re.compile(
r"[\\u0020-\\uD7FF\\uE000-\\uFFFD\\uD800\\uDC00-\\uDBFF\\uDFFF\\r\\n\\t]*"
)
ARN_PATTERN = re.compile(r"^arn:(aws|aws-us-gov|aws-cn):glue:.*$")
ARN_PATTERN = re.compile(rf"{ARN_PARTITION_REGEX}:glue:.*$")
AVAILABLE_STATUS = "AVAILABLE"
DELETING_STATUS = "DELETING"

Expand Down
2 changes: 1 addition & 1 deletion moto/rds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def find_cluster(cluster_arn: str) -> DBCluster:


KMS_ARN_PATTERN = re.compile(
r"^arn:(aws|aws-us-gov|aws-cn):kms:(?P<region>\w+(?:-\w+)+):(?P<account_id>\d{12}):key\/(?P<key>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)+)$"
rf"{ARN_PARTITION_REGEX}:kms:(?P<region>\w+(?:-\w+)+):(?P<account_id>\d{{12}}):key\/(?P<key>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)+)$"
)


Expand Down
1 change: 1 addition & 0 deletions moto/utilities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"us-gov-": "aws-us-gov",
"us-iso-": "aws-iso",
"us-isob-": "aws-iso-b",
"eusc-": "aws-eusc",
}
PARTITION_NAMES = list(REGION_PREFIX_TO_PARTITION.values()) + [DEFAULT_PARTITION]
ARN_PARTITION_REGEX = r"^arn:(" + "|".join(sorted(PARTITION_NAMES)) + ")"
Expand Down
7 changes: 6 additions & 1 deletion tests/test_acmpca/test_acmpca.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@

@mock_aws
@pytest.mark.parametrize(
"region,partition", [("eu-west-1", "aws"), ("us-gov-east-1", "aws-us-gov")]
"region,partition",
[
("eu-west-1", "aws"),
("us-gov-east-1", "aws-us-gov"),
("eusc-de-east-1", "aws-eusc"),
],
)
def test_create_certificate_authority(region, partition):
client = boto3.client("acm-pca", region_name=region)
Expand Down
1 change: 1 addition & 0 deletions tests/test_eks/test_eks_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def region_matches_partition(region, partition):
("us-gov-", "aws-us-gov"),
("us-gov-iso-", "aws-iso"),
("us-gov-iso-b-", "aws-iso-b"),
("eusc-", "aws-eusc"),
]

for prefix, expected_partition in valid_matches:
Expand Down
7 changes: 6 additions & 1 deletion tests/test_wafv2/test_wafv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
@mock_aws
@pytest.mark.parametrize(
"region,partition",
[("us-east-1", "aws"), ("cn-north-1", "aws-cn"), ("us-gov-east-1", "aws-us-gov")],
[
("us-east-1", "aws"),
("cn-north-1", "aws-cn"),
("us-gov-east-1", "aws-us-gov"),
("eusc-de-east-1", "aws-eusc"),
],
)
def test_create_web_acl(region, partition):
conn = boto3.client("wafv2", region_name=region)
Expand Down
Loading