in src/watchdog/__init__.py [0:0]
def get_aws_security_credentials(config, credentials_source, region):
"""
Lookup AWS security credentials (access key ID and secret access key). Adapted credentials provider chain from:
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html and
https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html
"""
method, value = credentials_source.split(":", 1)
if method == "credentials":
return get_aws_security_credentials_from_file("credentials", value)
elif method == "named_profile":
return get_aws_security_credentials_from_assumed_profile(value)
elif method == "config":
return get_aws_security_credentials_from_file("config", value)
elif method == "ecs":
return get_aws_security_credentials_from_ecs(config, value)
elif method == "podidentity":
return get_aws_security_credentials_from_pod_identity(config, value)
elif method == "webidentity":
return get_aws_security_credentials_from_webidentity(
config, *(value.split(",")), region=region
)
elif method == "metadata":
return get_aws_security_credentials_from_instance_metadata(config)
else:
logging.error(
'Improper credentials source string "%s" found from mount state file',
credentials_source,
)
return None