Java Code Examples for software.amazon.awssdk.http.SdkHttpClient#Builder

The following examples show how to use software.amazon.awssdk.http.SdkHttpClient#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: AbstractAmazonServiceProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
protected void createClientBuilders(List<AmazonClientTransportsBuildItem> clients,
        BuildProducer<AmazonClientBuilderBuildItem> builderProducer,
        Function<RuntimeValue<SdkHttpClient.Builder>, RuntimeValue<AwsClientBuilder>> syncFunc,
        Function<RuntimeValue<SdkAsyncHttpClient.Builder>, RuntimeValue<AwsClientBuilder>> asyncFunc) {

    for (AmazonClientTransportsBuildItem client : clients) {
        if (configName().equals(client.getAwsClientName())) {
            RuntimeValue<AwsClientBuilder> syncBuilder = null;
            RuntimeValue<AwsClientBuilder> asyncBuilder = null;
            if (client.getSyncClassName().isPresent()) {
                syncBuilder = syncFunc.apply(client.getSyncTransport());
            }
            if (client.getAsyncClassName().isPresent()) {
                asyncBuilder = asyncFunc.apply(client.getAsyncTransport());
            }
            builderProducer.produce(new AmazonClientBuilderBuildItem(client.getAwsClientName(), syncBuilder, asyncBuilder));
        }
    }
}
 
Example 2
Source File: KmsRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public RuntimeValue<AwsClientBuilder> createSyncBuilder(KmsConfig config, RuntimeValue<SdkHttpClient.Builder> transport) {
    KmsClientBuilder builder = KmsClient.builder();
    if (transport != null) {
        builder.httpClientBuilder(transport.getValue());
    }
    return new RuntimeValue<>(builder);
}
 
Example 3
Source File: SesRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public RuntimeValue<AwsClientBuilder> createSyncBuilder(SesConfig config, RuntimeValue<SdkHttpClient.Builder> transport) {
    SesClientBuilder builder = SesClient.builder();
    if (transport != null) {
        builder.httpClientBuilder(transport.getValue());
    }
    return new RuntimeValue<>(builder);
}
 
Example 4
Source File: DynamodbRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public RuntimeValue<AwsClientBuilder> createSyncBuilder(DynamodbConfig config,
        RuntimeValue<SdkHttpClient.Builder> transport) {
    DynamoDbClientBuilder builder = DynamoDbClient.builder();
    builder.endpointDiscoveryEnabled(config.enableEndpointDiscovery);

    if (transport != null) {
        builder.httpClientBuilder(transport.getValue());
    }
    return new RuntimeValue<>(builder);
}
 
Example 5
Source File: ResourceManagementTest.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void httpClientFromBuilderShutdown() {
    SdkHttpClient httpClient = mock(SdkHttpClient.class);
    SdkHttpClient.Builder httpClientBuilder = mock(SdkHttpClient.Builder.class);

    when(httpClientBuilder.buildWithDefaults(any())).thenReturn(httpClient);

    syncClientBuilder().httpClientBuilder(httpClientBuilder).build().close();
    verify(httpClient).close();
}
 
Example 6
Source File: STSCredentialProviderV2.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
public static SdkHttpClient.Builder initConnectionSettings(Configuration conf) {
  final ApacheHttpClient.Builder httpBuilder = ApacheHttpClient.builder();
  httpBuilder.maxConnections(intOption(conf, Constants.MAXIMUM_CONNECTIONS, Constants.DEFAULT_MAXIMUM_CONNECTIONS, 1));
  httpBuilder.connectionTimeout(
    Duration.ofSeconds(intOption(conf, Constants.ESTABLISH_TIMEOUT, Constants.DEFAULT_ESTABLISH_TIMEOUT, 0)));
  httpBuilder.socketTimeout(
    Duration.ofSeconds(intOption(conf, Constants.SOCKET_TIMEOUT, Constants.DEFAULT_SOCKET_TIMEOUT, 0)));
  httpBuilder.proxyConfiguration(initProxySupport(conf));

  return httpBuilder;
}
 
Example 7
Source File: ApacheSdkHttpService.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public SdkHttpClient.Builder createHttpClientBuilder() {
    return ApacheHttpClient.builder();
}
 
Example 8
Source File: UrlConnectionSdkHttpService.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public SdkHttpClient.Builder createHttpClientBuilder() {
    return UrlConnectionHttpClient.builder();
}
 
Example 9
Source File: SdkDefaultClientBuilder.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@SdkTestInternalApi
protected SdkDefaultClientBuilder(SdkHttpClient.Builder defaultHttpClientBuilder,
                                  SdkAsyncHttpClient.Builder defaultAsyncHttpClientBuilder) {
    this.defaultHttpClientBuilder = defaultHttpClientBuilder;
    this.defaultAsyncHttpClientBuilder = defaultAsyncHttpClientBuilder;
}
 
Example 10
Source File: SystemPropertyHttpServiceProviderTest.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public SdkHttpClient.Builder createHttpClientBuilder() {
    return null;
}
 
Example 11
Source File: SystemPropertyHttpServiceProviderTest.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public SdkHttpClient.Builder createHttpClientBuilder() {
    return null;
}
 
Example 12
Source File: AwsDefaultClientBuilder.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@SdkTestInternalApi
AwsDefaultClientBuilder(SdkHttpClient.Builder defaultHttpClientBuilder,
                        SdkAsyncHttpClient.Builder defaultAsyncHttpClientFactory) {
    super(defaultHttpClientBuilder, defaultAsyncHttpClientFactory);
}