def format_summary_messages()

in Onboarding/AWS/Utils.py [0:0]


def format_summary_messages(failed_clusters_map: Dict[str, List[str]], successful_clusters_map: Dict[str, List[str]], is_all_clusters: bool, with_color: bool) -> str:
    if not failed_clusters_map and not successful_clusters_map:
        message = "You didn't have any EKS clusters in all regions, exiting..." if is_all_clusters else \
            "The EKS clusters you requested to onboard doesn't exist in all requested regions. Make sure you don't have spelling mistakes"
        return add_color(message, RED, with_color)

    if successful_clusters_map and not failed_clusters_map:
        return add_color("Successfully granted MDC permission to all requested EKS clusters", GREEN, with_color)

    summary_messages = []
    if successful_clusters_map:
        summary_messages += format_successful_clusters(successful_clusters_map, with_color)
    else:
        summary_messages.append(add_color("Failed to grant MDC permissions to all EKS clusters", RED, with_color))

    if failed_clusters_map:
        summary_messages += format_failed_clusters(failed_clusters_map, with_color)

    return "\n".join(summary_messages)