global-clusters-automation/add_secondarycluster.py [125:154]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        )

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


def get_instance_status(instance_id, client):
    response_instance = client.describe_db_instances(
        DBInstanceIdentifier=instance_id
    )
    return response_instance['DBInstances'][0]['DBInstanceStatus']


def get_cluster_status(cluster_arn):
    cluster_id = cluster_arn.split(":")[-1]
    region = cluster_arn.split(":")[3]
    client = session.client('docdb', region_name=region)
    response = client.describe_db_clusters(
        DBClusterIdentifier=cluster_id
    )
    cluster_members = response['DBClusters'][0]['DBClusterMembers']
    for each_instance in cluster_members:
        instance_id = each_instance['DBInstanceIdentifier']
        instance_status = ''
        while instance_status != 'available':
            instance_status = get_instance_status(instance_id, client)
            time.sleep(1)
    return response['DBClusters'][0]['Status']
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



global-clusters-automation/failover_and_delete_global_cluster.py [112:141]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        )
    except ClientError as e:
        print('ERROR OCCURRED WHILE PROCESSING: ', e)
        print('PROCESSING WILL STOP')
        raise ClientError


def get_instance_status(instance_id, client):
    response_instance = client.describe_db_instances(
        DBInstanceIdentifier=instance_id
    )
    return response_instance['DBInstances'][0]['DBInstanceStatus']


def get_cluster_status(cluster_arn):
    cluster_id = cluster_arn.split(":")[-1]
    region = cluster_arn.split(":")[3]
    client = session.client('docdb', region_name=region)
    response = client.describe_db_clusters(
        DBClusterIdentifier=cluster_id
    )
    cluster_members = response['DBClusters'][0]['DBClusterMembers']
    for each_instance in cluster_members:
        instance_id = each_instance['DBInstanceIdentifier']
        instance_status = ''
        while instance_status != 'available':
            instance_status = get_instance_status(instance_id, client)
            time.sleep(1)

    return response['DBClusters'][0]['Status']
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



