List of usage examples for com.amazonaws.services.redshift.model DescribeClustersRequest setClusterIdentifier
public void setClusterIdentifier(String clusterIdentifier)
The unique identifier of a cluster whose properties you are requesting.
From source file:com.amazon.services.awsrum.utils.RedshiftUtils.java
License:Open Source License
/** * Gets the JDBC URL associated with an active Redshift cluster. * /*from w ww . j a v a2 s . co m*/ * @param client * The {@link AmazonRedshiftClient} with read permissions * @param clusterIdentifier * The unique Redshift cluster identifier * @return JDBC URL for the Redshift cluster */ public static String getClusterURL(AmazonRedshiftClient client, String clusterIdentifier) { DescribeClustersRequest describeClustersRequest = new DescribeClustersRequest(); describeClustersRequest.setClusterIdentifier(clusterIdentifier); DescribeClustersResult describeClustersResult = client.describeClusters(describeClustersRequest); List<Cluster> clusters = describeClustersResult.getClusters(); if (!clusters.isEmpty()) { return toJDBC(clusters.get(0).getEndpoint(), clusters.get(0).getDBName()); } return null; }
From source file:com.amazon.services.awsrum.utils.RedshiftUtils.java
License:Open Source License
/** * Helper method to determine if a Redshift cluster exists * /*from w w w . ja va 2 s . c om*/ * @param client * The {@link AmazonRedshiftClient} with read permissions * @param clusterIdentifier * The Redshift cluster to check * @return true if the Redshift cluster exists, otherwise return false */ private static boolean clusterExists(AmazonRedshiftClient client, String clusterIdentifier) { DescribeClustersRequest describeClustersRequest = new DescribeClustersRequest(); describeClustersRequest.setClusterIdentifier(clusterIdentifier); try { client.describeClusters(describeClustersRequest); return true; } catch (ClusterNotFoundException e) { return false; } }
From source file:com.amazon.services.awsrum.utils.RedshiftUtils.java
License:Open Source License
/** * Helper method to determine the Redshift cluster state * /*from w ww .j a va 2 s . com*/ * @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); }