protected static final class DefaultEc2MetadataAsyncClient.Ec2MetadataAsyncBuilder extends Object implements Ec2MetadataAsyncClient.Builder
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplyMutationpublic DefaultEc2MetadataAsyncClient.Ec2MetadataAsyncBuilder retryPolicy(Ec2MetadataRetryPolicy retryPolicy)
Ec2MetadataClientBuilder
If not specified, defaults to 3 retry attempts and a BackoffStrategy.defaultStrategy() backoff strategy} that
uses RetryMode.STANDARD. Can be also specified by using the
Ec2MetadataClientBuilder.retryPolicy(Consumer) method. if any of the retryPolicy methods are called multiple times,
only the last invocation will be considered.
retryPolicy in interface Ec2MetadataClientBuilder<Ec2MetadataAsyncClient.Builder,Ec2MetadataAsyncClient>retryPolicy - The retry policy which includes the number of retry attempts for any failed request.public DefaultEc2MetadataAsyncClient.Ec2MetadataAsyncBuilder retryPolicy(Consumer<Ec2MetadataRetryPolicy.Builder> builderConsumer)
Ec2MetadataClientBuilderEc2MetadataClientBuilder.retryPolicy(Ec2MetadataRetryPolicy) to use a "fluent consumer" syntax. User
should not manually build the builder in the consumer.
If not specified, defaults to 3 retry attempts and a BackoffStrategy.defaultStrategy() backoff strategy} that
uses RetryMode.STANDARD. Can be also specified by using the
Ec2MetadataClientBuilder.retryPolicy(Ec2MetadataRetryPolicy) method. if any of the retryPolicy methods are
called multiple times, only the last invocation will be considered.
retryPolicy in interface Ec2MetadataClientBuilder<Ec2MetadataAsyncClient.Builder,Ec2MetadataAsyncClient>builderConsumer - the consumerpublic DefaultEc2MetadataAsyncClient.Ec2MetadataAsyncBuilder endpoint(URI endpoint)
Ec2MetadataClientBuilder
If not specified, the IMDS client will attempt to automatically resolve the endpoint value
based on the logic of Ec2MetadataEndpointProvider.
endpoint in interface Ec2MetadataClientBuilder<Ec2MetadataAsyncClient.Builder,Ec2MetadataAsyncClient>endpoint - The endpoint of IMDS.public DefaultEc2MetadataAsyncClient.Ec2MetadataAsyncBuilder tokenTtl(Duration tokenTtl)
Ec2MetadataClientBuildertokenTtl in interface Ec2MetadataClientBuilder<Ec2MetadataAsyncClient.Builder,Ec2MetadataAsyncClient>tokenTtl - The Time to live (TTL) of the token.public DefaultEc2MetadataAsyncClient.Ec2MetadataAsyncBuilder endpointMode(EndpointMode endpointMode)
Ec2MetadataClientBuilderEc2MetadataClientBuilder.endpoint(URI) is not specified. Only one of both endpoint or endpoint mode
but not both. If both are specified in the Builder, a IllegalArgumentException will be thrown.
If not specified, the IMDS client will attempt to automatically resolve the endpoint mode value
based on the logic of Ec2MetadataEndpointProvider.
endpointMode in interface Ec2MetadataClientBuilder<Ec2MetadataAsyncClient.Builder,Ec2MetadataAsyncClient>endpointMode - The endpoint mode of IMDS. Supported values include IPv4 and IPv6.public DefaultEc2MetadataAsyncClient.Ec2MetadataAsyncBuilder httpClient(SdkAsyncHttpClient httpClient)
Ec2MetadataAsyncClient.BuilderSdkAutoCloseable.close()
method on it.
If not specified, the IMDS client will look for a SdkAsyncHttpClient class included in the classpath of the
application and creates a new instance of that class, managed by the IMDS Client, that will be closed when the IMDS
Client is closed. If no such class can be found, will throw a SdkClientException.
httpClient in interface Ec2MetadataAsyncClient.BuilderhttpClient - the http clientpublic Ec2MetadataAsyncClient.Builder httpClient(SdkAsyncHttpClient.Builder<?> builder)
Ec2MetadataAsyncClient.BuilderSdkAsyncHttpClient. If specified, the Ec2
Metadata Client will use the instance returned by the builder and manage its lifetime by closing the http client
once the Ec2 Client itself is closed.httpClient in interface Ec2MetadataAsyncClient.Builderbuilder - the builder to used to retrieve an instance.public DefaultEc2MetadataAsyncClient.Ec2MetadataAsyncBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
Ec2MetadataAsyncClient.BuilderScheduledExecutorService used to schedule asynchronous retry attempts. If provided, the
Ec2MetadataClient will NOT manage the lifetime if the httpClient and must therefore be
closed explicitly by calling the SdkAutoCloseable.close() method on it.
If not specified, defaults to Executors.newScheduledThreadPool(int) with a default value of 3 thread in the
pool.
scheduledExecutorService in interface Ec2MetadataAsyncClient.BuilderscheduledExecutorService - the ScheduledExecutorService to use for retry attempt.public Ec2MetadataRetryPolicy getRetryPolicy()
public URI getEndpoint()
public Duration getTokenTtl()
public EndpointMode getEndpointMode()
public Ec2MetadataAsyncClient build()
build in interface Buildablebuild in interface SdkBuilder<Ec2MetadataClientBuilder<Ec2MetadataAsyncClient.Builder,Ec2MetadataAsyncClient>,Ec2MetadataAsyncClient>Copyright © 2023. All rights reserved.