Class DefaultEc2MetadataClient
java.lang.Object
software.amazon.awssdk.imds.internal.BaseEc2MetadataClient
software.amazon.awssdk.imds.internal.DefaultEc2MetadataClient
- All Implemented Interfaces:
AutoCloseable,Ec2MetadataClient,SdkAutoCloseable
@SdkInternalApi
@Immutable
@ThreadSafe
public final class DefaultEc2MetadataClient
extends BaseEc2MetadataClient
implements Ec2MetadataClient
An Implementation of the Ec2Metadata Interface.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classNested classes/interfaces inherited from interface software.amazon.awssdk.imds.Ec2MetadataClient
Ec2MetadataClient.Builder -
Field Summary
Fields inherited from class software.amazon.awssdk.imds.internal.BaseEc2MetadataClient
DEFAULT_TOKEN_TTL, endpoint, requestMarshaller, retryPolicy, tokenTtl -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a default builder forEc2MetadataClient.voidclose()Gets the specified instance metadata value by the given path.toString()Methods inherited from class software.amazon.awssdk.imds.internal.BaseEc2MetadataClient
imdsHttpDefaults, shouldRetry, uncheckedInputStreamToUtf8
-
Method Details
-
toString
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSdkAutoCloseable
-
builder
Description copied from interface:Ec2MetadataClientCreates a default builder forEc2MetadataClient. -
get
Gets the specified instance metadata value by the given path. Will retry base on theretry policyprovided, in the case of an IOException during request. Will not retry on SdkClientException, like 4XX HTTP error.- Specified by:
getin interfaceEc2MetadataClient- Parameters:
path- Input path of the resource to get.- Returns:
- Instance metadata value as part of MetadataResponse Object
- Throws:
SdkClientException- if the request for a token or the request for the Metadata does not have a 2XX SUCCESS response, if the maximum number of retries is reached, or if another IOException is thrown during the request.
-