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

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

Introduction

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

Prototype

@Override
    public DescribeDBSecurityGroupsResult describeDBSecurityGroups() 

Source Link

Usage

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

License:Apache License

/**
 * Configures the specified client./*  w  ww .  j  a  v  a2 s.  c  o  m*/
 *
 * @param configuration               the provider configuration
 * @param accumulator                 the exception accumulator
 * @param client                      the RDS client
 * @param endpoints                   the RDS endpoints
 * @param providerLocalizationContext the resource provider localization context
 * @param verify                      whether to verify the configuration by making an API call
 * @return the configured client
 * @throws InvalidCredentialsException    if the supplied credentials are invalid
 * @throws TransientProviderException     if a transient exception occurs communicating with the
 *                                        provider
 * @throws UnrecoverableProviderException if an unrecoverable exception occurs communicating with
 *                                        the provider
 */
protected static AmazonRDSClient configureClient(Configured configuration,
        PluginExceptionConditionAccumulator accumulator, AmazonRDSClient client, RDSEndpoints endpoints,
        LocalizationContext providerLocalizationContext, boolean verify) {
    checkNotNull(client, "client is null");
    try {
        String regionEndpoint = configuration.getConfigurationValue(REGION_ENDPOINT,
                providerLocalizationContext);
        if (regionEndpoint != null) {
            LOG.info("<< Using configured region endpoint: {}", regionEndpoint);
        } else {
            String region = configuration.getConfigurationValue(REGION, providerLocalizationContext);
            if (region == null) {
                region = configuration.getConfigurationValue(
                        EC2Provider.EC2ProviderConfigurationPropertyToken.REGION, providerLocalizationContext);
            }
            regionEndpoint = getEndpointForRegion(checkNotNull(endpoints, "endpoints is null"), region);
        }
        client.setEndpoint(regionEndpoint);

        if (verify) {
            // Attempt to use client, to validate credentials and connectivity
            client.describeDBSecurityGroups();
        }

    } catch (AmazonClientException e) {
        throw AWSExceptions.propagate(e);
    } catch (IllegalArgumentException e) {
        accumulator.addError(REGION.unwrap().getConfigKey(), e.getMessage());
    }
    return client;
}