Package software.amazon.awssdk.imds
Class Ec2MetadataResponse
- java.lang.Object
-
- software.amazon.awssdk.imds.Ec2MetadataResponse
-
public final class Ec2MetadataResponse extends Object
This class is used for response handling and parsing the metadata fetched by the get call in theEc2MetadataClientinterface. It provides convenience methods to the users to parse the metadata as a String and List. Also provides ways to parse the metadata as Document type if it is in the json format.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentasDocument()Parses the response String into aDocumenttype.List<String>asList()Splits the Metadata response body on new line character and returns it as a list.StringasString()static Ec2MetadataResponsecreate(String body)Create aEc2MetadataResponsewith the given body as its content.booleanequals(Object o)inthashCode()StringtoString()
-
-
-
Method Detail
-
create
public static Ec2MetadataResponse create(String body)
Create aEc2MetadataResponsewith the given body as its content.- Parameters:
body- the content of the response- Returns:
- a
Ec2MetadataResponsewith the given body as its content.
-
asString
public String asString()
- Returns:
- String Representation of the Metadata Response Body.
-
asList
public List<String> asList()
Splits the Metadata response body on new line character and returns it as a list.- Returns:
- The Metadata response split on each line.
-
asDocument
public Document asDocument()
Parses the response String into aDocumenttype. This method can be used for parsing the metadata in a String Json Format.- Returns:
- Document Representation, as json, of the Metadata Response Body.
- Throws:
UncheckedIOException- (wrapping aJsonParseExceptionif the Response body is not of JSON format.
-
-