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

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

Introduction

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

Prototype


public String getDBName() 

Source Link

Document

The name of the initial database that was created when the cluster was created.

Usage

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  w  w  w . ja  v  a2 s .com*/
        }
    } else {
        return generateDBServiceInfoStatus(amazonDBService, "resource.dataSource.aws.empty");
    }
    return awsDBInstanceDTOs;
}

From source file:com.optimalbi.AmazonAccount.java

License:Apache License

private void populateRedshift() throws AmazonClientException {
    for (Region region : getRegions()) {
        try {//from  w ww  .  java  2 s.c om
            if (region.isServiceSupported(ServiceAbbreviations.RedShift)) {
                //                    services.addAll(RedshiftService.populateServices(region, getCredentials(), getLogger()));
                AmazonRedshiftClient redshift = new AmazonRedshiftClient(getCredentials().getCredentials());
                redshift.setRegion(region);

                DescribeClustersResult clusterResult;
                List<Cluster> clusters;
                try {
                    clusterResult = redshift.describeClusters();
                    clusters = clusterResult.getClusters();
                } catch (Exception e) {
                    throw new AmazonClientException("Failed to get clusters " + e.getMessage());
                }

                getLogger().info("Redshift, Adding " + clusters.size() + " clusters from " + region.getName());
                for (Cluster cluster : clusters) {
                    getLogger().info("Cluster: " + cluster.getClusterIdentifier());
                    LocalRedshiftService temp = new LocalRedshiftService(cluster.getDBName(), getCredentials(),
                            region, cluster, getLogger());
                    if (servicePricings != null && servicePricings.size() > 0) {
                        temp.attachPricing(servicePricings.get(region).getRedshiftPricing());
                    }
                    services.add(temp);
                }
            } else {
                getLogger().info("Redshift, NOPE from " + region.getName());
            }
        } catch (AmazonClientException e) {
            throw new AmazonClientException(region.getName() + " " + e.getMessage());
        }
        completed.set(completed.get() + 1);
    }
}