in src/mount_efs/__init__.py [0:0]
def get_mount_targets_info(efs_client, fs_id):
operation = "DescribeMountTargets"
kwargs = {"FileSystemId": fs_id}
try:
mount_targets_info = efs_describe_mount_targets_helper(efs_client, kwargs)
logging.debug(
"Found these mount targets for file system %s: %s",
fs_id,
mount_targets_info,
)
return mount_targets_info.get("MountTargets")
except ClientError as e:
exception = e.response["Error"]["Code"]
exception_message = e.response["Error"]["Message"]
if exception == "FileSystemNotFound":
fallback_message = "The file system %s is not found" % fs_id
elif exception == "ServiceUnavailableException":
fallback_message = (
"The elasticfilesystem service cannot complete the request, %s"
% exception_message
)
elif exception == "AccessDeniedException":
fallback_message = exception_message
else:
fallback_message = "Unexpected error: %s" % exception_message
except NoCredentialsError as e:
fallback_message = (
"%s when performing operation %s, please confirm your aws credentials are properly configured."
% (e, operation)
)
except EndpointConnectionError as e:
fallback_message = (
"Could not connect to the endpoint when performing operation %s, %s"
% (operation, e)
)
except Exception as e:
fallback_message = "Unknown error when performing operation %s, %s." % (
operation,
e,
)
raise FallbackException(fallback_message)