com.amazonaws.services.redshift.model.DescribeClustersRequest Java Examples
The following examples show how to use
com.amazonaws.services.redshift.model.DescribeClustersRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedshiftInstanceUtil.java From obevo with Apache License 2.0 | 6 votes |
private void describe(String dbInstanceIdentifier) throws Exception { while (true) { DescribeDBInstancesRequest request = new DescribeDBInstancesRequest() .withDBInstanceIdentifier(dbInstanceIdentifier); DescribeClustersResult response = client.describeClusters(new DescribeClustersRequest() .withClusterIdentifier(INSTANCE_ID) ); Cluster dbInstance = response.getClusters().get(0); if (!dbInstance.getClusterStatus().equalsIgnoreCase("creating")) { System.out.println("Done! " + response); System.out.println(dbInstance.getEndpoint().getAddress()); System.out.println(dbInstance.getEndpoint().getPort()); break; } System.out.println("Not done - will wait 10s: " + response); Thread.sleep(10000L); } }
Example #2
Source File: PublicAccessAutoFix.java From pacbot with Apache License 2.0 | 5 votes |
/** * Gets the cluster for redhift resource. * * @param clientMap the client map * @param resourceId the resource id * @return the cluster for redhift resource * @throws Exception the exception */ public static List<Cluster> getClusterForRedhiftResource(Map<String,Object> clientMap,String resourceId) throws Exception { AmazonRedshift amazonRedshift = (AmazonRedshift) clientMap.get("client"); DescribeClustersRequest describeClustersRequest = new DescribeClustersRequest(); describeClustersRequest.setClusterIdentifier(resourceId); DescribeClustersResult clustersResult = amazonRedshift.describeClusters(describeClustersRequest); return clustersResult.getClusters(); }
Example #3
Source File: RedshiftUtils.java From amazon-kinesis-connectors with Apache License 2.0 | 5 votes |
/** * Gets the JDBC URL associated with an active Amazon Redshift cluster. * * @param client * The {@link AmazonRedshiftClient} with read permissions * @param clusterIdentifier * The unique Amazon Redshift cluster identifier * @return JDBC URL for the Amazon 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; }
Example #4
Source File: RedshiftUtils.java From amazon-kinesis-connectors with Apache License 2.0 | 5 votes |
/** * Helper method to determine if an Amazon Redshift cluster exists * * @param client * The {@link AmazonRedshiftClient} with read permissions * @param clusterIdentifier * The Amazon Redshift cluster to check * @return true if the Amazon 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; } }
Example #5
Source File: RedshiftUtils.java From amazon-kinesis-connectors with Apache License 2.0 | 5 votes |
/** * Helper method to determine the Amazon Redshift cluster state * * @param client * The {@link AmazonRedshiftClient} with read permissions * @param clusterIdentifier * The Amazon Redshift cluster to get the state of * @return The String representation of the Amazon 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); }