List of usage examples for com.amazonaws.services.redshift.model ClusterNotFoundException ClusterNotFoundException
public ClusterNotFoundException(String message)
From source file:com.amazon.services.awsrum.utils.RedshiftUtils.java
License:Open Source License
/** * Helper method to determine the Redshift cluster state * /* w w w. j a v a 2 s.c o m*/ * @param client * The {@link AmazonRedshiftClient} with read permissions * @param clusterIdentifier * The Redshift cluster to get the state of * @return The String representation of the Redshift cluster state */ public static String clusterState(AmazonRedshiftClient client, String clusterIdentifier) { DescribeClustersRequest describeClustersRequest = new DescribeClustersRequest(); describeClustersRequest.setClusterIdentifier(clusterIdentifier); List<Cluster> clusters = client.describeClusters(describeClustersRequest).getClusters(); if (clusters.size() == 1) { return clusters.get(0).getClusterStatus(); } throw new ClusterNotFoundException(clusterIdentifier); }