File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 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):
536536 Returns:
537537 (str): URI prefix of ECR image
538538 """
539- domain = "c2s.ic.gov" if region == "us-iso-east-1" else "amazonaws.com"
539+ domain = _domain_for_region ( region )
540540 return "{}.dkr.ecr.{}.{}" .format (account , region , domain )
541541
542542
@@ -555,7 +555,20 @@ def sts_regional_endpoint(region):
555555 Returns:
556556 str: AWS STS regional endpoint
557557 """
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"
559572
560573
561574class DeferredError (object ):
Original file line number Diff line number Diff line change @@ -570,3 +570,7 @@ def test_sts_regional_endpoint():
570570 endpoint = sagemaker .utils .sts_regional_endpoint ("us-west-2" )
571571 assert endpoint == "https://sts.us-west-2.amazonaws.com"
572572 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