def is_request_processed()

in global-clusters-automation/convert_to_global_lambda_function.py [0:0]


def is_request_processed(event):
    try:
        record_value = get_item(event['global_cluster_id'], event['primary_cluster_arn'])
        secondary_clusters = event['secondary_clusters']
        is_processed = False
        if "Item" in record_value and "secondary_clusters" in record_value['Item']:
            for each_item in record_value['Item']['secondary_clusters']:
                region_ddb = each_item['region']
                secondary_cluster_id = each_item['secondary_cluster_id']
                for clusters in secondary_clusters:
                    if clusters['region'] == region_ddb and clusters['secondary_cluster_id'] == secondary_cluster_id:
                        is_processed = True
                        break
        else:
            is_processed = False

        return is_processed

    except ClientError as e:
        print('ERROR OCCURRED WHILE PROCESSING: ', e)
        print('PROCESSING WILL STOP')
        raise RuntimeError