@@ -66,7 +66,9 @@ def get_api_key() -> str:
66
66
67
67
REGION = os .environ .get ("AWS_REGION" , "" )
68
68
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
+ )
70
72
71
73
if DD_API_KEY_SECRET_ARN :
72
74
if is_gov_region and not use_non_fips_endpoints :
@@ -75,8 +77,7 @@ def get_api_key() -> str:
75
77
else :
76
78
fips_endpoint = None
77
79
secrets_manager_client = boto3 .client (
78
- "secretsmanager" ,
79
- endpoint_url = fips_endpoint
80
+ "secretsmanager" , endpoint_url = fips_endpoint
80
81
)
81
82
api_key = secrets_manager_client .get_secret_value (
82
83
SecretId = DD_API_KEY_SECRET_ARN
@@ -87,10 +88,7 @@ def get_api_key() -> str:
87
88
fips_endpoint = f"https://ssm-fips.{ REGION } .amazonaws.com"
88
89
else :
89
90
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 )
94
92
api_key = ssm_client .get_parameter (
95
93
Name = DD_API_KEY_SSM_NAME , WithDecryption = True
96
94
)["Parameter" ]["Value" ]
@@ -100,10 +98,7 @@ def get_api_key() -> str:
100
98
fips_endpoint = f"https://kms-fips.{ REGION } .amazonaws.com"
101
99
else :
102
100
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 )
107
102
api_key = decrypt_kms_api_key (kms_client , DD_KMS_API_KEY )
108
103
else :
109
104
api_key = DD_API_KEY
0 commit comments