Example usage for com.amazonaws.services.rds AmazonRDSClient describeDBSubnetGroups

List of usage examples for com.amazonaws.services.rds AmazonRDSClient describeDBSubnetGroups

Introduction

In this page you can find the example usage for com.amazonaws.services.rds AmazonRDSClient describeDBSubnetGroups.

Prototype

@Override
public DescribeDBSubnetGroupsResult describeDBSubnetGroups(DescribeDBSubnetGroupsRequest request) 

Source Link

Document

Returns a list of DBSubnetGroup descriptions.

Usage

From source file:com.cloudera.director.aws.rds.RDSInstanceTemplateConfigurationValidator.java

License:Apache License

@VisibleForTesting
void checkDBSubnetGroupName(AmazonRDSClient client, Configured configuration,
        PluginExceptionConditionAccumulator accumulator, LocalizationContext localizationContext) {

    String dbSubnetGroupName = configuration.getConfigurationValue(DB_SUBNET_GROUP_NAME, localizationContext);

    DescribeDBSubnetGroupsRequest request = new DescribeDBSubnetGroupsRequest()
            .withDBSubnetGroupName(dbSubnetGroupName);
    try {/*  www.j  a  v a  2  s . c o m*/
        client.describeDBSubnetGroups(request);
    } catch (DBSubnetGroupNotFoundException e) {
        addError(accumulator, DB_SUBNET_GROUP_NAME, localizationContext, null, DB_SUBNET_GROUP_NOT_FOUND,
                dbSubnetGroupName);
    } catch (AmazonServiceException e) {
        if (e.getErrorCode().equals(INVALID_PARAMETER_VALUE)) {
            addError(accumulator, DB_SUBNET_GROUP_NAME, localizationContext, null, INVALID_DB_SUBNET_GROUP,
                    dbSubnetGroupName);
        } else {
            throw Throwables.propagate(e);
        }
    }
}