public <T> T build(final AwsClientBuilder builder, final Class<T> clientType) {
        val cfg = new ClientConfiguration();
        try {
            val localAddress = getSetting("localAddress");
            if (StringUtils.isNotBlank(localAddress)) {
                cfg.setLocalAddress(InetAddress.getByName(localAddress));
            }
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        builder.withClientConfiguration(cfg);

        val key = getSetting("credentialAccessKey");
        val secret = getSetting("credentialSecretKey");
        val credentials = ChainingAWSCredentialsProvider.getInstance(key, secret);
        builder.withCredentials(credentials);

        var region = getSetting("region");
        val currentRegion = Regions.getCurrentRegion();
        if (currentRegion != null && StringUtils.isBlank(region)) {
            region = currentRegion.getName();
        }
        var regionOverride = getSetting("regionOverride");
        if (currentRegion != null && StringUtils.isNotBlank(regionOverride)) {
            regionOverride = currentRegion.getName();
        }
        val finalRegion = StringUtils.defaultIfBlank(regionOverride, region);
        if (StringUtils.isNotBlank(finalRegion)) {
            builder.withRegion(finalRegion);
        }

        val endpoint = getSetting("endpoint");
        if (StringUtils.isNotBlank(endpoint)) {
            builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, finalRegion));
        }

        val result = builder.build();
        return clientType.cast(result);
    }
public < T > T build ( final AwsClientBuilder builder , final Class < T > clientType ) { val cfg = new ClientConfiguration ( ) ; try { val localAddress = getSetting ( "localAddress" ) ; if ( StringUtils . isNotBlank ( localAddress ) ) { cfg . setLocalAddress ( InetAddress . getByName ( localAddress ) ) ; } } catch ( final Exception e ) { LOGGER . error ( e . getMessage ( ) , e ) ; } builder . withClientConfiguration ( cfg ) ; val key = getSetting ( "credentialAccessKey" ) ; val secret = getSetting ( "credentialSecretKey" ) ; val credentials = ChainingAWSCredentialsProvider . getInstance ( key , secret ) ; builder . withCredentials ( credentials ) ; var region = getSetting ( "region" ) ; val currentRegion = Regions . getCurrentRegion ( ) ; if ( currentRegion != null && StringUtils . isBlank ( region ) ) { region = currentRegion . getName ( ) ; } var regionOverride = getSetting ( "regionOverride" ) ; if ( currentRegion != null && StringUtils . isNotBlank ( regionOverride ) ) { regionOverride = currentRegion . getName ( ) ; } val finalRegion = StringUtils . defaultIfBlank ( regionOverride , region ) ; if ( StringUtils . isNotBlank ( finalRegion ) ) { builder . withRegion ( finalRegion ) ; } val endpoint = getSetting ( "endpoint" ) ; if ( StringUtils . isNotBlank ( endpoint ) ) { builder . withEndpointConfiguration ( new AwsClientBuilder . EndpointConfiguration ( endpoint , finalRegion ) ) ; } val result = builder . build ( ) ; return clientType . cast ( result ) ; }
Build the client.

@param <T>        the type parameter
@param builder    the builder
@param clientType the client type
@return the client instance