in global-clusters-automation/failover_and_delete_global_cluster.py [0:0]
def get_secondary_clusters(global_cluster_id):
try:
response = client.describe_global_clusters(
GlobalClusterIdentifier=global_cluster_id
)
global_cluster_members = response['GlobalClusters'][0]['GlobalClusterMembers']
secondary_clusters = []
for each_item in global_cluster_members:
if each_item['IsWriter']:
secondary_clusters = each_item['Readers']
break
# Raise error if no secondary clusters are available
if not secondary_clusters:
print('No secondary clusters found for provided cluster', global_cluster_id,
'.Please check provided input.')
raise RuntimeError
except ClientError as e:
print('ERROR OCCURRED WHILE PROCESSING: ', e)
print('PROCESSING WILL STOP')
raise ClientError
return secondary_clusters