Example usage for com.amazonaws.services.rds.model DBSubnetGroupNotFoundException getErrorCode

List of usage examples for com.amazonaws.services.rds.model DBSubnetGroupNotFoundException getErrorCode

Introduction

In this page you can find the example usage for com.amazonaws.services.rds.model DBSubnetGroupNotFoundException getErrorCode.

Prototype

public String getErrorCode() 

Source Link

Document

Returns the AWS error code represented by this exception.

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 {//from  w  w w  . j av a 2  s  .co  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);
        }
    }
}