Java Code Examples for com.amazonaws.ClientConfiguration#setProxyUsername()

The following examples show how to use com.amazonaws.ClientConfiguration#setProxyUsername() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LambdaClientConfig.java    From aws-lambda-jenkins-plugin with MIT License 6 votes vote down vote up
private ClientConfiguration getClientConfiguration() {
    /*
    Jenkins instance = Jenkins.getInstance();

    if (instance != null) {
        ProxyConfiguration proxy = instance.proxy;
    */
    ClientConfiguration config = new ClientConfiguration();

    if (proxyConfiguration != null) {
        config.setProxyHost(proxyConfiguration.name);
        config.setProxyPort(proxyConfiguration.port);
        if (proxyConfiguration.getUserName() != null) {
            config.setProxyUsername(proxyConfiguration.getUserName());
            config.setProxyPassword(proxyConfiguration.getPassword());
        }
        if (proxyConfiguration.noProxyHost != null) {
            config.setNonProxyHosts(proxyConfiguration.noProxyHost);
        }
    }

    return config;

}
 
Example 2
Source File: AWSClientFactory.java    From awseb-deployment-plugin with Apache License 2.0 6 votes vote down vote up
private static AWSClientFactory getClientFactory(AWSCredentialsProvider provider,
                                                 String awsRegion) {
    ClientConfiguration clientConfig = new ClientConfiguration();

    Jenkins jenkins = Jenkins.get();

    if (jenkins.proxy != null) {
        ProxyConfiguration proxyConfig = jenkins.proxy;
        clientConfig.setProxyHost(proxyConfig.name);
        clientConfig.setProxyPort(proxyConfig.port);
        if (proxyConfig.getUserName() != null) {
            clientConfig.setProxyUsername(proxyConfig.getUserName());
            clientConfig.setProxyPassword(proxyConfig.getPassword());
        }
    }

    clientConfig.setUserAgentPrefix("ingenieux CloudButler/" + Utils.getVersion());

    return new AWSClientFactory(provider, clientConfig, awsRegion);
}
 
Example 3
Source File: AmazonWebServiceClientUtil.java    From cs-actions with Apache License 2.0 6 votes vote down vote up
public static ClientConfiguration getClientConfiguration(String proxyHost, String proxyPort, String proxyUsername, String proxyPassword, String connectTimeoutMs, String executionTimeoutMs) {
    ClientConfiguration clientConf = new ClientConfiguration()
            .withConnectionTimeout(Integer.parseInt(connectTimeoutMs))
            .withClientExecutionTimeout(Integer.parseInt(executionTimeoutMs));

    if (!StringUtils.isEmpty(proxyHost)) {
        clientConf.setProxyHost(proxyHost);
    }

    if (!StringUtils.isEmpty(proxyPort)) {
        clientConf.setProxyPort(Integer.parseInt(proxyPort));
    }

    if (!StringUtils.isEmpty(proxyUsername)) {
        clientConf.setProxyUsername(proxyUsername);
    }

    if (!StringUtils.isEmpty(proxyPassword)) {
        clientConf.setProxyPassword(proxyPassword);
    }

    return clientConf;
}
 
Example 4
Source File: AmazonAwsClientFactory.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
protected ClientConfiguration createConfiguration() {
    ClientConfiguration configuration = new ClientConfiguration();

    // Proxy設定
    if (proxyHost != null && proxyPort != null) {
        configuration.setProxyHost(proxyHost);
        configuration.setProxyPort(proxyPort);

        if (proxyUser != null && proxyPassword != null) {
            configuration.setProxyUsername(proxyUser);
            configuration.setProxyPassword(proxyPassword);
        }
    }

    // リトライしない
    configuration.setMaxErrorRetry(0);

    return configuration;
}
 
Example 5
Source File: S3Service.java    From crate with Apache License 2.0 6 votes vote down vote up
static ClientConfiguration buildConfiguration(S3ClientSettings clientSettings) {
    final ClientConfiguration clientConfiguration = new ClientConfiguration();
    // the response metadata cache is only there for diagnostics purposes,
    // but can force objects from every response to the old generation.
    clientConfiguration.setResponseMetadataCacheSize(0);
    clientConfiguration.setProtocol(clientSettings.protocol);

    if (Strings.hasText(clientSettings.proxyHost)) {
        // TODO: remove this leniency, these settings should exist together and be validated
        clientConfiguration.setProxyHost(clientSettings.proxyHost);
        clientConfiguration.setProxyPort(clientSettings.proxyPort);
        clientConfiguration.setProxyUsername(clientSettings.proxyUsername);
        clientConfiguration.setProxyPassword(clientSettings.proxyPassword);
    }

    clientConfiguration.setMaxErrorRetry(clientSettings.maxRetries);
    clientConfiguration.setUseThrottleRetries(clientSettings.throttleRetries);
    clientConfiguration.setSocketTimeout(clientSettings.readTimeoutMillis);

    return clientConfiguration;
}
 
Example 6
Source File: S3Accessor.java    From datacollector with Apache License 2.0 6 votes vote down vote up
ClientConfiguration createClientConfiguration() throws StageException {
  ClientConfiguration clientConfig = new ClientConfiguration();

  clientConfig.setConnectionTimeout(connectionConfigs.getConnectionTimeoutMillis());
  clientConfig.setSocketTimeout(connectionConfigs.getSocketTimeoutMillis());
  clientConfig.withMaxErrorRetry(connectionConfigs.getMaxErrorRetry());

  if (connectionConfigs.isProxyEnabled()) {
    clientConfig.setProxyHost(connectionConfigs.getProxyHost());
    clientConfig.setProxyPort(connectionConfigs.getProxyPort());
    if (connectionConfigs.isProxyAuthenticationEnabled()) {
      clientConfig.setProxyUsername(connectionConfigs.getProxyUser().get());
      clientConfig.setProxyPassword(connectionConfigs.getProxyPassword().get());
    }
  }
  return clientConfig;
}
 
Example 7
Source File: AWSUtil.java    From datacollector with Apache License 2.0 6 votes vote down vote up
public static ClientConfiguration getClientConfiguration(ProxyConfig config) throws StageException {
  ClientConfiguration clientConfig = new ClientConfiguration();

  clientConfig.setConnectionTimeout(config.connectionTimeout * MILLIS);
  clientConfig.setSocketTimeout(config.socketTimeout * MILLIS);
  clientConfig.withMaxErrorRetry(config.retryCount);

  // Optional proxy settings
  if (config.useProxy) {
    if (config.proxyHost != null && !config.proxyHost.isEmpty()) {
      clientConfig.setProxyHost(config.proxyHost);
      clientConfig.setProxyPort(config.proxyPort);

      if (config.proxyUser != null && !config.proxyUser.get().isEmpty()) {
        clientConfig.setProxyUsername(config.proxyUser.get());
      }

      if (config.proxyPassword != null) {
        clientConfig.setProxyPassword(config.proxyPassword.get());
      }
    }
  }
  return clientConfig;
}
 
Example 8
Source File: AwsModuleTest.java    From beam with Apache License 2.0 6 votes vote down vote up
@Test
public void testClientConfigurationSerializationDeserialization() throws Exception {
  ClientConfiguration clientConfiguration = new ClientConfiguration();
  clientConfiguration.setProxyHost("localhost");
  clientConfiguration.setProxyPort(1234);
  clientConfiguration.setProxyUsername("username");
  clientConfiguration.setProxyPassword("password");

  final String valueAsJson = objectMapper.writeValueAsString(clientConfiguration);
  final ClientConfiguration valueDes =
      objectMapper.readValue(valueAsJson, ClientConfiguration.class);
  assertEquals("localhost", valueDes.getProxyHost());
  assertEquals(1234, valueDes.getProxyPort());
  assertEquals("username", valueDes.getProxyUsername());
  assertEquals("password", valueDes.getProxyPassword());
}
 
Example 9
Source File: ProxyConfiguration.java    From pipeline-aws-plugin with Apache License 2.0 6 votes vote down vote up
private static void configureProxy(ClientConfiguration config, String env, int defaultPort) {
	Pattern pattern = Pattern.compile(PROXY_PATTERN);
	Matcher matcher = pattern.matcher(env);
	if (matcher.matches()) {
		if (matcher.group(3) != null) {
			config.setProxyUsername(matcher.group(3));
		}
		if (matcher.group(5) != null) {
			config.setProxyPassword(matcher.group(5));
		}
		config.setProxyHost(matcher.group(6));
		if (matcher.group(8) != null) {
			config.setProxyPort(Integer.parseInt(matcher.group(8)));
		} else {
			config.setProxyPort(defaultPort);
		}
	}
}
 
Example 10
Source File: EC2Communication.java    From development with Apache License 2.0 5 votes vote down vote up
/**
 * Return amazon interface
 * 
 * @return AmazonEC2 client ec2
 */

AmazonEC2 getEC2() {
    if (ec2 == null) {
        String endpoint = ENDPOINT_PREFIX + ph.getRegion()
                + ENDPOINT_SUFFIX;
        String proxyHost = System.getProperty(HTTPS_PROXY_HOST);
        String proxyPort = System.getProperty(HTTPS_PROXY_PORT);
        String proxyUser = System.getProperty(HTTPS_PROXY_USER);
        String proxyPassword = System.getProperty(HTTPS_PROXY_PASSWORD);

        int proxyPortInt = 0;
        try {
            proxyPortInt = Integer.parseInt(proxyPort);
        } catch (NumberFormatException e) {
            // ignore
        }
        ClientConfiguration clientConfiguration = new ClientConfiguration();
        if (!isNonProxySet(endpoint)) {
            if (proxyHost != null) {
                clientConfiguration.setProxyHost(proxyHost);
            }
            if (proxyPortInt > 0) {
                clientConfiguration.setProxyPort(proxyPortInt);
            }
            if (proxyUser != null && proxyUser.length() > 0) {
                clientConfiguration.setProxyUsername(proxyUser);
            }
            if (proxyPassword != null && proxyPassword.length() > 0) {
                clientConfiguration.setProxyPassword(proxyPassword);
            }
        }
        ec2 = getEC2(credentialsProvider, clientConfiguration);
        ec2.setEndpoint(endpoint);
    }
    return ec2;
}
 
Example 11
Source File: Aws.java    From digdag with Apache License 2.0 5 votes vote down vote up
static void configureProxy(ClientConfiguration configuration, ProxyConfig proxyConfig)
{
    configuration.setProxyHost(proxyConfig.getHost());
    configuration.setProxyPort(proxyConfig.getPort());
    Optional<String> user = proxyConfig.getUser();
    if (user.isPresent()) {
        configuration.setProxyUsername(user.get());
    }
    Optional<String> password = proxyConfig.getPassword();
    if (password.isPresent()) {
        configuration.setProxyPassword(password.get());
    }
}
 
Example 12
Source File: ClientHelper.java    From jobcacher-plugin with MIT License 5 votes vote down vote up
public static ClientConfiguration getClientConfiguration(ProxyConfiguration proxy) {
    final ClientConfiguration clientConfiguration = new ClientConfiguration();

    if (shouldUseProxy(proxy, "s3.amazonaws.com")) {
        clientConfiguration.setProxyHost(proxy.name);
        clientConfiguration.setProxyPort(proxy.port);
        if (proxy.getUserName() != null) {
            clientConfiguration.setProxyUsername(proxy.getUserName());
            clientConfiguration.setProxyPassword(proxy.getPassword());
        }
    }

    return clientConfiguration;
}
 
Example 13
Source File: ECSService.java    From amazon-ecs-plugin with MIT License 5 votes vote down vote up
public ECSService(String credentialsId, String regionName) {
    this.clientSupplier = () -> {
        ProxyConfiguration proxy = Jenkins.get().proxy;
        ClientConfiguration clientConfiguration = new ClientConfiguration();

        if (proxy != null) {
            clientConfiguration.setProxyHost(proxy.name);
            clientConfiguration.setProxyPort(proxy.port);
            clientConfiguration.setProxyUsername(proxy.getUserName());
            clientConfiguration.setProxyPassword(proxy.getPassword());
        }

        // Default is 3. 10 helps us actually utilize the SDK's backoff strategy
        // The strategy will wait up to 20 seconds per request (after multiple failures)
        clientConfiguration.setMaxErrorRetry(10);

        AmazonECSClientBuilder builder = AmazonECSClientBuilder
                .standard()
                .withClientConfiguration(clientConfiguration)
                .withRegion(regionName);

        AmazonWebServicesCredentials credentials = getCredentials(credentialsId);
        if (credentials != null) {
            if (LOGGER.isLoggable(Level.FINE)) {
                String awsAccessKeyId = credentials.getCredentials().getAWSAccessKeyId();
                String obfuscatedAccessKeyId = StringUtils.left(awsAccessKeyId, 4) + StringUtils.repeat("*", awsAccessKeyId.length() - (2 * 4)) + StringUtils.right(awsAccessKeyId, 4);
                LOGGER.log(Level.FINE, "Connect to Amazon ECS with IAM Access Key {1}", new Object[]{obfuscatedAccessKeyId});
            }
            builder
                    .withCredentials(credentials);
        }
        LOGGER.log(Level.FINE, "Selected Region: {0}", regionName);

        return builder.build();
    };
}
 
Example 14
Source File: AWSUtil.java    From datacollector with Apache License 2.0 5 votes vote down vote up
public static ClientConfiguration getClientConfiguration(ProxyConfig config) throws StageException {
  ClientConfiguration clientConfig = new ClientConfiguration();

  clientConfig.setConnectionTimeout(config.connectionTimeout * MILLIS);
  clientConfig.setSocketTimeout(config.socketTimeout * MILLIS);
  clientConfig.withMaxErrorRetry(config.retryCount);

  // Optional proxy settings
  if (config.useProxy) {
    if (config.proxyHost != null && !config.proxyHost.isEmpty()) {
      clientConfig.setProxyHost(config.proxyHost);
      clientConfig.setProxyPort(config.proxyPort);

      if (config.proxyUser != null && !config.proxyUser.get().isEmpty()) {
        clientConfig.setProxyUsername(config.proxyUser.get());
      }

      if (config.proxyPassword != null && !config.proxyPassword.get().isEmpty()) {
        clientConfig.setProxyPassword(config.proxyPassword.get());
      }

      if (config.proxyDomain != null && !config.proxyDomain.isEmpty()) {
        clientConfig.setProxyDomain(config.proxyDomain);
      }

      if (config.proxyWorkstation != null && !config.proxyWorkstation.isEmpty()) {
        clientConfig.setProxyWorkstation(config.proxyWorkstation);
      }
    }
  }
  return clientConfig;
}
 
Example 15
Source File: DynamoDBClient.java    From emr-dynamodb-connector with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void applyProxyConfiguration(ClientConfiguration clientConfig, Configuration conf) {
  final String proxyHost = conf.get(DynamoDBConstants.PROXY_HOST);
  final int proxyPort = conf.getInt(DynamoDBConstants.PROXY_PORT, 0);
  final String proxyUsername = conf.get(DynamoDBConstants.PROXY_USERNAME);
  final String proxyPassword = conf.get(DynamoDBConstants.PROXY_PASSWORD);
  boolean proxyHostAndPortPresent = false;
  if (!Strings.isNullOrEmpty(proxyHost) && proxyPort > 0) {
    clientConfig.setProxyHost(proxyHost);
    clientConfig.setProxyPort(proxyPort);
    proxyHostAndPortPresent = true;
  } else if (Strings.isNullOrEmpty(proxyHost) ^ proxyPort <= 0) {
    throw new RuntimeException("Only one of proxy host and port are set, when both are required");
  }
  if (!Strings.isNullOrEmpty(proxyUsername) && !Strings.isNullOrEmpty(proxyPassword)) {
    if (!proxyHostAndPortPresent) {
      throw new RuntimeException("Proxy host and port must be supplied if proxy username and "
          + "password are present");
    } else {
      clientConfig.setProxyUsername(proxyUsername);
      clientConfig.setProxyPassword(proxyPassword);
    }
  } else if (Strings.isNullOrEmpty(proxyUsername) ^ Strings.isNullOrEmpty(proxyPassword)) {
    throw new RuntimeException("Only one of proxy username and password are set, when both are "
        + "required");
  }
}
 
Example 16
Source File: HttpUtil.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
public static void setProxyForS3(ClientConfiguration clientConfig)
{
  if (useProxy)
  {
    clientConfig.setProxyHost(proxyHost);
    clientConfig.setProxyPort(proxyPort);
    clientConfig.setNonProxyHosts(nonProxyHosts);
    if (!Strings.isNullOrEmpty(proxyUser) && !Strings.isNullOrEmpty(proxyPassword))
    {
      clientConfig.setProxyUsername(proxyUser);
      clientConfig.setProxyPassword(proxyPassword);
    }
  }
}
 
Example 17
Source File: ServiceCatalogClientBuilder.java    From cs-actions with Apache License 2.0 5 votes vote down vote up
public static AWSServiceCatalog getServiceCatalogClientBuilder(
        String accessKeyId,
        String secretAccessKey,
        String proxyHost,
        Integer proxyPort,
        String proxyUsername,
        String proxyPassword,
        Integer connectTimeoutMs,
        Integer executionTimeoutMs,
        String region,
        boolean async) {

    ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setConnectionTimeout(connectTimeoutMs);
    clientConfiguration.setClientExecutionTimeout(executionTimeoutMs);

    if (!StringUtils.isEmpty(proxyHost)) {
        clientConfiguration.setProxyHost(proxyHost);
        clientConfiguration.setProxyPort(proxyPort);
        if (!StringUtils.isEmpty(proxyUsername)) {
            clientConfiguration.setProxyUsername(proxyUsername);
            clientConfiguration.setProxyPassword(proxyPassword);
        }
    }
    if (!async) {
        return AWSServiceCatalogClientBuilder.standard()
                .withRegion(region)
                .withClientConfiguration(clientConfiguration)
                .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKeyId, secretAccessKey)))
                .build();
    }
    return AWSServiceCatalogAsyncClientBuilder.standard()
            .withRegion(region)
            .withClientConfiguration(clientConfiguration)
            .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKeyId, secretAccessKey)))
            .build();


}
 
Example 18
Source File: AwsEc2ServiceImpl.java    From crate with Apache License 2.0 5 votes vote down vote up
static ClientConfiguration buildConfiguration(Logger logger, Ec2ClientSettings clientSettings) {
    final ClientConfiguration clientConfiguration = new ClientConfiguration();
    // the response metadata cache is only there for diagnostics purposes,
    // but can force objects from every response to the old generation.
    clientConfiguration.setResponseMetadataCacheSize(0);
    clientConfiguration.setProtocol(clientSettings.protocol);
    if (Strings.hasText(clientSettings.proxyHost)) {
        // TODO: remove this leniency, these settings should exist together and be validated
        clientConfiguration.setProxyHost(clientSettings.proxyHost);
        clientConfiguration.setProxyPort(clientSettings.proxyPort);
        clientConfiguration.setProxyUsername(clientSettings.proxyUsername);
        clientConfiguration.setProxyPassword(clientSettings.proxyPassword);
    }
    // Increase the number of retries in case of 5xx API responses
    final Random rand = Randomness.get();
    final RetryPolicy retryPolicy = new RetryPolicy(
        RetryPolicy.RetryCondition.NO_RETRY_CONDITION,
        (originalRequest, exception, retriesAttempted) -> {
            // with 10 retries the max delay time is 320s/320000ms (10 * 2^5 * 1 * 1000)
            logger.warn("EC2 API request failed, retry again. Reason was:", exception);
            return 1000L * (long) (10d * Math.pow(2, retriesAttempted / 2.0d) * (1.0d + rand.nextDouble()));
        },
        10,
        false);
    clientConfiguration.setRetryPolicy(retryPolicy);
    clientConfiguration.setSocketTimeout(clientSettings.readTimeoutMillis);
    return clientConfiguration;
}
 
Example 19
Source File: AbstractAWSProcessor.java    From nifi with Apache License 2.0 4 votes vote down vote up
protected ClientConfiguration createConfiguration(final ProcessContext context) {
    final ClientConfiguration config = new ClientConfiguration();
    config.setMaxConnections(context.getMaxConcurrentTasks());
    config.setMaxErrorRetry(0);
    config.setUserAgent(DEFAULT_USER_AGENT);
    // If this is changed to be a property, ensure other uses are also changed
    config.setProtocol(DEFAULT_PROTOCOL);
    final int commsTimeout = context.getProperty(TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue();
    config.setConnectionTimeout(commsTimeout);
    config.setSocketTimeout(commsTimeout);

    if(this.getSupportedPropertyDescriptors().contains(SSL_CONTEXT_SERVICE)) {
        final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
        if (sslContextService != null) {
            final SSLContext sslContext = sslContextService.createSSLContext(SslContextFactory.ClientAuth.NONE);
            // NIFI-3788: Changed hostnameVerifier from null to DHV (BrowserCompatibleHostnameVerifier is deprecated)
            SdkTLSSocketFactory sdkTLSSocketFactory = new SdkTLSSocketFactory(sslContext, new DefaultHostnameVerifier());
            config.getApacheHttpClientConfig().setSslSocketFactory(sdkTLSSocketFactory);
        }
    }

    final ProxyConfiguration proxyConfig = ProxyConfiguration.getConfiguration(context, () -> {
        if (context.getProperty(PROXY_HOST).isSet()) {
            final ProxyConfiguration componentProxyConfig = new ProxyConfiguration();
            String proxyHost = context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
            Integer proxyPort = context.getProperty(PROXY_HOST_PORT).evaluateAttributeExpressions().asInteger();
            String proxyUsername = context.getProperty(PROXY_USERNAME).evaluateAttributeExpressions().getValue();
            String proxyPassword = context.getProperty(PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
            componentProxyConfig.setProxyType(Proxy.Type.HTTP);
            componentProxyConfig.setProxyServerHost(proxyHost);
            componentProxyConfig.setProxyServerPort(proxyPort);
            componentProxyConfig.setProxyUserName(proxyUsername);
            componentProxyConfig.setProxyUserPassword(proxyPassword);
            return componentProxyConfig;
        }
        return ProxyConfiguration.DIRECT_CONFIGURATION;
    });

    if (Proxy.Type.HTTP.equals(proxyConfig.getProxyType())) {
        config.setProxyHost(proxyConfig.getProxyServerHost());
        config.setProxyPort(proxyConfig.getProxyServerPort());

        if (proxyConfig.hasCredential()) {
            config.setProxyUsername(proxyConfig.getProxyUserName());
            config.setProxyPassword(proxyConfig.getProxyUserPassword());
        }
    }

    return config;
}
 
Example 20
Source File: AwsModule.java    From beam with Apache License 2.0 4 votes vote down vote up
@Override
public ClientConfiguration deserialize(JsonParser jsonParser, DeserializationContext context)
    throws IOException {
  Map<String, Object> map = jsonParser.readValueAs(new TypeReference<Map<String, Object>>() {});

  ClientConfiguration clientConfiguration = new ClientConfiguration();

  if (map.containsKey(PROXY_HOST)) {
    clientConfiguration.setProxyHost((String) map.get(PROXY_HOST));
  }
  if (map.containsKey(PROXY_PORT)) {
    clientConfiguration.setProxyPort((Integer) map.get(PROXY_PORT));
  }
  if (map.containsKey(PROXY_USERNAME)) {
    clientConfiguration.setProxyUsername((String) map.get(PROXY_USERNAME));
  }
  if (map.containsKey(PROXY_PASSWORD)) {
    clientConfiguration.setProxyPassword((String) map.get(PROXY_PASSWORD));
  }
  if (map.containsKey(CLIENT_EXECUTION_TIMEOUT)) {
    clientConfiguration.setClientExecutionTimeout((Integer) map.get(CLIENT_EXECUTION_TIMEOUT));
  }
  if (map.containsKey(CONNECTION_MAX_IDLE_TIME)) {
    clientConfiguration.setConnectionMaxIdleMillis(
        ((Number) map.get(CONNECTION_MAX_IDLE_TIME)).longValue());
  }
  if (map.containsKey(CONNECTION_TIMEOUT)) {
    clientConfiguration.setConnectionTimeout((Integer) map.get(CONNECTION_TIMEOUT));
  }
  if (map.containsKey(CONNECTION_TIME_TO_LIVE)) {
    clientConfiguration.setConnectionTTL(
        ((Number) map.get(CONNECTION_TIME_TO_LIVE)).longValue());
  }
  if (map.containsKey(MAX_CONNECTIONS)) {
    clientConfiguration.setMaxConnections((Integer) map.get(MAX_CONNECTIONS));
  }
  if (map.containsKey(REQUEST_TIMEOUT)) {
    clientConfiguration.setRequestTimeout((Integer) map.get(REQUEST_TIMEOUT));
  }
  if (map.containsKey(SOCKET_TIMEOUT)) {
    clientConfiguration.setSocketTimeout((Integer) map.get(SOCKET_TIMEOUT));
  }
  return clientConfiguration;
}