def update_aws_auth_for_all_regions()

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


def update_aws_auth_for_all_regions(session: boto3.Session, args: argparse.Namespace) -> Tuple[Dict[str, List[str]], Dict[str, List[str]]]:
    print(f"Attempting to grant MDC access to {' '.join(args.regions)} regions")
    successful_clusters_map = dict()
    failed_clusters_map = dict()

    for region in args.regions:
        clusters_to_onboard = get_clusters_to_onboard(session, region, args.clusters, args.all_clusters)
        if not clusters_to_onboard:
            continue

        left_clusters = update_aws_auth_for_region(session, clusters_to_onboard, region, args.roles, args.role_arn)

        successful_clusters = list(set(clusters_to_onboard) - set(left_clusters))
        if successful_clusters:
            successful_clusters_map[region] = successful_clusters
        if left_clusters:
            failed_clusters_map[region] = left_clusters

        print_region_summary_message(region, clusters_to_onboard, left_clusters)
    return failed_clusters_map, successful_clusters_map