in src/mount_efs/__init__.py [0:0]
def get_botocore_client(config, service, options):
if not BOTOCORE_PRESENT:
logging.error("Failed to import botocore, please install botocore first.")
return None
botocore_config = None
if get_fips_config(config):
botocore_config = botocore.config.Config(use_fips_endpoint=True)
session = botocore.session.get_session()
region = get_target_region(config, options)
if options and options.get("awsprofile"):
profile = options.get("awsprofile")
session.set_config_variable("profile", profile)
try:
return session.create_client(
service, region_name=region, config=botocore_config
)
except ProfileNotFound as e:
fatal_error(
"%s, please add the [profile %s] section in the aws config file following %s and %s."
% (e, profile, NAMED_PROFILE_HELP_URL, CONFIG_FILE_SETTINGS_HELP_URL)
)
return session.create_client(service, region_name=region, config=botocore_config)