Java Code Examples for software.amazon.awssdk.utils.AttributeMap#builder()

The following examples show how to use software.amazon.awssdk.utils.AttributeMap#builder() . 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: ApacheHttpClientWireMockTest.java    From aws-sdk-java-v2 with Apache License 2.0 6 votes vote down vote up
@Override
protected SdkHttpClient createSdkHttpClient(SdkHttpClientOptions options) {
    ApacheHttpClient.Builder builder = ApacheHttpClient.builder();

    AttributeMap.Builder attributeMap = AttributeMap.builder();

    if (options.tlsTrustManagersProvider() != null) {
        builder.tlsTrustManagersProvider(options.tlsTrustManagersProvider());
    }

    if (options.trustAll()) {
        attributeMap.put(TRUST_ALL_CERTIFICATES, options.trustAll());
    }

    return builder.buildWithDefaults(attributeMap.build());
}
 
Example 2
Source File: UrlConnectionHttpClientWireMockTest.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
@Override
protected SdkHttpClient createSdkHttpClient(SdkHttpClientOptions options) {
    UrlConnectionHttpClient.Builder builder = UrlConnectionHttpClient.builder();
    AttributeMap.Builder attributeMap = AttributeMap.builder();

    if (options.tlsTrustManagersProvider() != null) {
        builder.tlsTrustManagersProvider(options.tlsTrustManagersProvider());
    }

    if (options.trustAll()) {
        attributeMap.put(TRUST_ALL_CERTIFICATES, options.trustAll());
    }

    return builder.buildWithDefaults(attributeMap.build());
}
 
Example 3
Source File: AwsModule.java    From beam with Apache License 2.0 5 votes vote down vote up
@Override
public AttributeMap deserialize(JsonParser jsonParser, DeserializationContext context)
    throws IOException {
  Map<String, String> map = jsonParser.readValueAs(new TypeReference<Map<String, String>>() {});

  // Add new attributes below.
  final AttributeMap.Builder attributeMapBuilder = AttributeMap.builder();
  if (map.containsKey(CONNECTION_ACQUIRE_TIMEOUT)) {
    attributeMapBuilder.put(
        SdkHttpConfigurationOption.CONNECTION_ACQUIRE_TIMEOUT,
        Duration.parse(map.get(CONNECTION_ACQUIRE_TIMEOUT)));
  }
  if (map.containsKey(CONNECTION_MAX_IDLE_TIMEOUT)) {
    attributeMapBuilder.put(
        SdkHttpConfigurationOption.CONNECTION_MAX_IDLE_TIMEOUT,
        Duration.parse(map.get(CONNECTION_MAX_IDLE_TIMEOUT)));
  }
  if (map.containsKey(CONNECTION_TIMEOUT)) {
    attributeMapBuilder.put(
        SdkHttpConfigurationOption.CONNECTION_TIMEOUT,
        Duration.parse(map.get(CONNECTION_TIMEOUT)));
  }
  if (map.containsKey(CONNECTION_TIME_TO_LIVE)) {
    attributeMapBuilder.put(
        SdkHttpConfigurationOption.CONNECTION_TIME_TO_LIVE,
        Duration.parse(map.get(CONNECTION_TIME_TO_LIVE)));
  }
  if (map.containsKey(MAX_CONNECTIONS)) {
    attributeMapBuilder.put(
        SdkHttpConfigurationOption.MAX_CONNECTIONS, Integer.parseInt(map.get(MAX_CONNECTIONS)));
  }
  if (map.containsKey(READ_TIMEOUT)) {
    attributeMapBuilder.put(
        SdkHttpConfigurationOption.READ_TIMEOUT, Duration.parse(map.get(READ_TIMEOUT)));
  }
  return attributeMapBuilder.build();
}
 
Example 4
Source File: SdkClientConfiguration.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
/**
 * Create a builder for a {@link SdkClientConfiguration}.
 */
public static SdkClientConfiguration.Builder builder() {
    return new Builder(AttributeMap.builder());
}