in src/mount_efs/__init__.py [0:0]
def bootstrap_cloudwatch_logging(config, options, fs_id=None):
if not check_if_cloudwatch_log_enabled(config):
return None
cloudwatchlog_client = get_botocore_client(config, "logs", options)
if not cloudwatchlog_client:
return None
cloudwatchlog_config = get_cloudwatchlog_config(config, fs_id)
log_group_name = cloudwatchlog_config.get("log_group_name")
log_stream_name = cloudwatchlog_config.get("log_stream_name")
retention_days = cloudwatchlog_config.get("retention_days")
group_creation_completed = create_cloudwatch_log_group(
cloudwatchlog_client, log_group_name
)
if not group_creation_completed:
return None
put_retention_policy_completed = put_cloudwatch_log_retention_policy(
cloudwatchlog_client, log_group_name, retention_days
)
if not put_retention_policy_completed:
return None
stream_creation_completed = create_cloudwatch_log_stream(
cloudwatchlog_client, log_group_name, log_stream_name
)
if not stream_creation_completed:
return None
return {
"client": cloudwatchlog_client,
"log_group_name": log_group_name,
"log_stream_name": log_stream_name,
}