Example usage for com.amazonaws.regions ServiceAbbreviations RDS

List of usage examples for com.amazonaws.regions ServiceAbbreviations RDS

Introduction

In this page you can find the example usage for com.amazonaws.regions ServiceAbbreviations RDS.

Prototype

String RDS

To view the source code for com.amazonaws.regions ServiceAbbreviations RDS.

Click Source Link

Usage

From source file:com.hangum.tadpole.aws.rds.commons.core.utils.AmazonRDSUtsils.java

License:Open Source License

/**
 * list region name/*from  w w w. jav  a 2s.c  om*/
 * 
 * @return
 */
public static List<String> getRDSRegionList() {
    List<String> listRegion = new ArrayList<String>();

    for (Region region : RegionUtils.getRegionsForService(ServiceAbbreviations.RDS)) {
        listRegion.add(region.getName());
    }

    return listRegion;
}

From source file:com.optimalbi.AmazonAccount.java

License:Apache License

private void populateRDS() throws AmazonClientException {
    for (Region region : getRegions()) {
        try {//from  w  ww.j av a 2  s .c  o m
            if (region.isServiceSupported(ServiceAbbreviations.RDS)) {
                AmazonRDSClient rds = new AmazonRDSClient(getCredentials().getCredentials());
                rds.setRegion(region);

                DescribeDBInstancesResult result = rds.describeDBInstances();
                List<DBInstance> instances = result.getDBInstances();

                getLogger().info("RDS, Adding " + instances.size() + " instances from " + region.getName());

                for (DBInstance i : instances) {
                    LocalRDSService temp;
                    if (i.getDBName() != null) {
                        temp = new LocalRDSService(i.getDBName(), getCredentials(), region, i, getLogger());
                    } else {
                        temp = new LocalRDSService(i.getDBInstanceIdentifier(), getCredentials(), region, i,
                                getLogger());
                    }
                    if (servicePricings != null && servicePricings.size() > 0) {
                        if (servicePricings.get(region).getRDSPricing() != null) {
                            temp.attachPricing(servicePricings.get(region).getRDSPricing());
                        }
                    }
                    services.add(temp);
                }
            } else {
                getLogger().info("RDS, NOPE from " + region.getName());
            }
        } catch (AmazonClientException e) {
            throw new AmazonClientException(region.getName() + " " + e.getMessage());
        }
        completed.set(completed.get() + 1);
    }
}

From source file:com.optimalbi.Controller.AmazonAccount.java

License:Apache License

private void populateRDS() throws AmazonClientException {
    for (Region region : getRegions()) {
        try {//from   w  ww  .j a  v  a 2s.  c o  m
            if (region.isServiceSupported(ServiceAbbreviations.RDS)) {
                //                services.addAll(RDSService.populateServices(region, getCredentials(), getLogger()));
                AmazonRDSClient rds = new AmazonRDSClient(getCredentials().getCredentials());
                rds.setRegion(region);

                DescribeDBInstancesResult result = rds.describeDBInstances();
                List<DBInstance> instances = result.getDBInstances();

                getLogger().info("RDS, Adding " + instances.size() + " instances from " + region.getName());
                services.addAll(
                        instances
                                .stream().map(i -> new LocalRDSService(i.getDBInstanceIdentifier(),
                                        getCredentials(), region, i, getLogger()))
                                .collect(Collectors.toList()));
            } else {
                getLogger().info("RDS, NOPE from " + region.getName());
            }
        } catch (AmazonClientException e) {
            throw new AmazonClientException(region.getName() + " " + e.getMessage());
        }
        completed.set(completed.get() + 1);

    }
}