Example usage for com.amazonaws.services.redshift.model Cluster getEndpoint

List of usage examples for com.amazonaws.services.redshift.model Cluster getEndpoint

Introduction

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

Prototype


public Endpoint getEndpoint() 

Source Link

Document

The connection endpoint.

Usage

From source file:com.gs.obevo.amazon.RedshiftInstanceUtil.java

License:Apache License

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;
        }/*from w  ww. j  ava2  s  .c o  m*/

        System.out.println("Not done - will wait 10s: " + response);
        Thread.sleep(10000L);
    }
}

From source file:com.jaspersoft.jasperserver.war.amazon.client.AwsDataSourceServiceImpl.java

License:Open Source License

private List<AwsDBInstanceDTO> toRedshiftInstancesDTOs(List<Cluster> dbClusters, String amazonDBService) {
    List<AwsDBInstanceDTO> awsDBInstanceDTOs = new ArrayList<AwsDBInstanceDTO>();
    if (dbClusters != null && dbClusters.size() > 0) {
        for (Cluster dbCluster : dbClusters) {
            if (dbCluster.getClusterStatus().toLowerCase().equals(awsDataSourceActiveStatus)) {
                AwsDBInstanceDTO awsDBInstanceDTO = new AwsDBInstanceDTO();
                awsDBInstanceDTO.setdBInstanceIdentifier(dbCluster.getClusterIdentifier());
                awsDBInstanceDTO.setdBName(dbCluster.getDBName());
                awsDBInstanceDTO.setEngine("postgresql");
                awsDBInstanceDTO.setEngineVersion(null);
                awsDBInstanceDTO.setAddress(dbCluster.getEndpoint().getAddress());
                awsDBInstanceDTO.setPort(dbCluster.getEndpoint().getPort());
                awsDBInstanceDTO.setAmazonDbService(amazonDBService.toLowerCase());

                updateWithConnectionUrl(awsDBInstanceDTO);

                awsDBInstanceDTOs.add(awsDBInstanceDTO);
            }//from   ww w  .  j a va2  s.c  o  m
        }
    } else {
        return generateDBServiceInfoStatus(amazonDBService, "resource.dataSource.aws.empty");
    }
    return awsDBInstanceDTOs;
}