File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -536,7 +536,7 @@ def get_ecr_image_uri_prefix(account, region):
536
536
Returns:
537
537
(str): URI prefix of ECR image
538
538
"""
539
- domain = "c2s.ic.gov" if region == "us-iso-east-1" else "amazonaws.com"
539
+ domain = _domain_for_region ( region )
540
540
return "{}.dkr.ecr.{}.{}" .format (account , region , domain )
541
541
542
542
@@ -555,7 +555,20 @@ def sts_regional_endpoint(region):
555
555
Returns:
556
556
str: AWS STS regional endpoint
557
557
"""
558
- return "https://sts.{}.amazonaws.com" .format (region )
558
+ domain = _domain_for_region (region )
559
+ return "https://sts.{}.{}" .format (region , domain )
560
+
561
+
562
+ def _domain_for_region (region ):
563
+ """Get the DNS suffix for the given region.
564
+
565
+ Args:
566
+ region (str): AWS region name
567
+
568
+ Returns:
569
+ str: the DNS suffix
570
+ """
571
+ return "c2s.ic.gov" if region == "us-iso-east-1" else "amazonaws.com"
559
572
560
573
561
574
class DeferredError (object ):
Original file line number Diff line number Diff line change @@ -570,3 +570,7 @@ def test_sts_regional_endpoint():
570
570
endpoint = sagemaker .utils .sts_regional_endpoint ("us-west-2" )
571
571
assert endpoint == "https://sts.us-west-2.amazonaws.com"
572
572
assert botocore .utils .is_valid_endpoint_url (endpoint )
573
+
574
+ endpoint = sagemaker .utils .sts_regional_endpoint ("us-iso-east-1" )
575
+ assert endpoint == "https://sts.us-iso-east-1.c2s.ic.gov"
576
+ assert botocore .utils .is_valid_endpoint_url (endpoint )
You can’t perform that action at this time.
0 commit comments