Class Ec2MetadataResponse
java.lang.Object
software.amazon.awssdk.imds.Ec2MetadataResponse
This class is used for response handling and parsing the metadata fetched by the get call in the
Ec2MetadataClient
interface. 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
Modifier and TypeMethodDescriptionParses the response String into aDocumenttype.asList()Splits the Metadata response body on new line character and returns it as a list.asString()static Ec2MetadataResponseCreate aEc2MetadataResponsewith the given body as its content.booleaninthashCode()toString()
-
Method Details
-
create
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
- Returns:
- String Representation of the Metadata Response Body.
-
asList
-
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.
-
equals
-
hashCode
-
toString
-