Example usage for com.amazonaws.services.redshift.model ClusterNotFoundException ClusterNotFoundException

List of usage examples for com.amazonaws.services.redshift.model ClusterNotFoundException ClusterNotFoundException

Introduction

In this page you can find the example usage for com.amazonaws.services.redshift.model ClusterNotFoundException ClusterNotFoundException.

Prototype

public ClusterNotFoundException(String message) 

Source Link

Document

Constructs a new ClusterNotFoundException with the specified error message.

Usage

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);

}