Class DefaultEc2MetadataClient
- java.lang.Object
-
- software.amazon.awssdk.imds.internal.BaseEc2MetadataClient
-
- software.amazon.awssdk.imds.internal.DefaultEc2MetadataClient
-
- All Implemented Interfaces:
AutoCloseable,Ec2MetadataClient,SdkAutoCloseable
@Immutable @ThreadSafe public final class DefaultEc2MetadataClient extends BaseEc2MetadataClient implements Ec2MetadataClient
An Implementation of the Ec2Metadata Interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDefaultEc2MetadataClient.Ec2MetadataBuilder-
Nested 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DefaultEc2MetadataClient.Ec2MetadataBuilderbuilder()Creates a default builder forEc2MetadataClient.voidclose()Ec2MetadataResponseget(String path)Gets the specified instance metadata value by the given path.StringtoString()-
Methods inherited from class software.amazon.awssdk.imds.internal.BaseEc2MetadataClient
imdsHttpDefaults, shouldRetry, uncheckedInputStreamToUtf8
-
-
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSdkAutoCloseable
-
builder
public static DefaultEc2MetadataClient.Ec2MetadataBuilder builder()
Description copied from interface:Ec2MetadataClientCreates a default builder forEc2MetadataClient.
-
get
public Ec2MetadataResponse get(String path)
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.
-
-