protected static final class DefaultEc2MetadataClient.Ec2MetadataBuilder extends Object implements Ec2MetadataClient.Builder
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplyMutationpublic DefaultEc2MetadataClient.Ec2MetadataBuilder 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<Ec2MetadataClient.Builder,Ec2MetadataClient>retryPolicy - The retry policy which includes the number of retry attempts for any failed request.public Ec2MetadataClient.Builder 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<Ec2MetadataClient.Builder,Ec2MetadataClient>builderConsumer - the consumerpublic DefaultEc2MetadataClient.Ec2MetadataBuilder 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<Ec2MetadataClient.Builder,Ec2MetadataClient>endpoint - The endpoint of IMDS.public DefaultEc2MetadataClient.Ec2MetadataBuilder tokenTtl(Duration tokenTtl)
Ec2MetadataClientBuildertokenTtl in interface Ec2MetadataClientBuilder<Ec2MetadataClient.Builder,Ec2MetadataClient>tokenTtl - The Time to live (TTL) of the token.public DefaultEc2MetadataClient.Ec2MetadataBuilder 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<Ec2MetadataClient.Builder,Ec2MetadataClient>endpointMode - The endpoint mode of IMDS. Supported values include IPv4 and IPv6.public DefaultEc2MetadataClient.Ec2MetadataBuilder httpClient(SdkHttpClient httpClient)
Ec2MetadataClient.BuilderSdkAutoCloseable.close()
method on it.
If not specified, the IMDS client will look for a SdkHttpClient class included in the classpath of the
application and create 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 Ec2MetadataClient.BuilderhttpClient - the http clientpublic Ec2MetadataClient.Builder httpClient(SdkHttpClient.Builder<?> builder)
Ec2MetadataClient.BuilderSdkHttpClient. 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 Ec2MetadataClient.Builderbuilder - the builder to used to retrieve an instance.public Ec2MetadataRetryPolicy getRetryPolicy()
public URI getEndpoint()
public Duration getTokenTtl()
public EndpointMode getEndpointMode()
public Ec2MetadataClient build()
build in interface Buildablebuild in interface SdkBuilder<Ec2MetadataClientBuilder<Ec2MetadataClient.Builder,Ec2MetadataClient>,Ec2MetadataClient>Copyright © 2023. All rights reserved.