@@ -66,7 +66,9 @@ def get_api_key() -> str:
6666
6767 REGION = os .environ .get ("AWS_REGION" , "" )
6868 is_gov_region = REGION .startswith ("us-gov-" )
69- use_non_fips_endpoints = os .environ .get ("DD_AWS_USE_NON_FIPS_ENDPOINTS" , "" ).lower () == "true"
69+ use_non_fips_endpoints = (
70+ os .environ .get ("DD_AWS_USE_NON_FIPS_ENDPOINTS" , "" ).lower () == "true"
71+ )
7072
7173 if DD_API_KEY_SECRET_ARN :
7274 if is_gov_region and not use_non_fips_endpoints :
@@ -75,8 +77,7 @@ def get_api_key() -> str:
7577 else :
7678 fips_endpoint = None
7779 secrets_manager_client = boto3 .client (
78- "secretsmanager" ,
79- endpoint_url = fips_endpoint
80+ "secretsmanager" , endpoint_url = fips_endpoint
8081 )
8182 api_key = secrets_manager_client .get_secret_value (
8283 SecretId = DD_API_KEY_SECRET_ARN
@@ -87,10 +88,7 @@ def get_api_key() -> str:
8788 fips_endpoint = f"https://ssm-fips.{ REGION } .amazonaws.com"
8889 else :
8990 fips_endpoint = None
90- ssm_client = boto3 .client (
91- "ssm" ,
92- endpoint_url = fips_endpoint
93- )
91+ ssm_client = boto3 .client ("ssm" , endpoint_url = fips_endpoint )
9492 api_key = ssm_client .get_parameter (
9593 Name = DD_API_KEY_SSM_NAME , WithDecryption = True
9694 )["Parameter" ]["Value" ]
@@ -100,10 +98,7 @@ def get_api_key() -> str:
10098 fips_endpoint = f"https://kms-fips.{ REGION } .amazonaws.com"
10199 else :
102100 fips_endpoint = None
103- kms_client = boto3 .client (
104- "kms" ,
105- endpoint_url = fips_endpoint
106- )
101+ kms_client = boto3 .client ("kms" , endpoint_url = fips_endpoint )
107102 api_key = decrypt_kms_api_key (kms_client , DD_KMS_API_KEY )
108103 else :
109104 api_key = DD_API_KEY
0 commit comments