@Internal public class ComputeInstanceMetadataResolverUtils extends Object
ComputeInstanceMetadataResolver
's.Constructor and Description |
---|
ComputeInstanceMetadataResolverUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
populateMetadata(AbstractComputeInstanceMetadata instanceMetadata,
JsonNode metadata)
Populates the instance instance metadata's
AbstractComputeInstanceMetadata.setMetadata(Map) property. |
static void |
populateMetadata(AbstractComputeInstanceMetadata instanceMetadata,
Map<?,?> metadata)
Populates the instance instance metadata's
AbstractComputeInstanceMetadata.setMetadata(Map) property. |
static JsonNode |
readMetadataUrl(URL url,
int connectionTimeoutMs,
int readTimeoutMs,
JsonMapper jsonMapper,
Map<String,String> requestProperties)
Reads the result of a URL and parses it using the given
JsonMapper . |
static JsonNode |
readMetadataUrl(URL url,
int connectionTimeoutMs,
int readTimeoutMs,
JsonNodeTreeCodec treeCodec,
com.fasterxml.jackson.core.JsonFactory jsonFactory,
Map<String,String> requestProperties)
Reads the result of a URL and parses it using the given
JsonFactory . |
static com.fasterxml.jackson.databind.JsonNode |
readMetadataUrl(URL url,
int connectionTimeoutMs,
int readTimeoutMs,
com.fasterxml.jackson.databind.ObjectMapper objectMapper,
Map<String,String> requestProperties)
Reads the result of a URL and parses it using the given
ObjectMapper . |
static Optional<String> |
stringValue(com.fasterxml.jackson.databind.JsonNode json,
String key)
Resolve a value as a string from the metadata json.
|
public ComputeInstanceMetadataResolverUtils()
public static com.fasterxml.jackson.databind.JsonNode readMetadataUrl(URL url, int connectionTimeoutMs, int readTimeoutMs, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Map<String,String> requestProperties) throws IOException
ObjectMapper
.url
- the URL to readconnectionTimeoutMs
- connection timeout, in millisecondsreadTimeoutMs
- read timeout, in millisecondsobjectMapper
- Jackson's ObjectMapper
requestProperties
- any request properties to passJsonNode
instanceIOException
- if any I/O error occurspublic static JsonNode readMetadataUrl(URL url, int connectionTimeoutMs, int readTimeoutMs, JsonNodeTreeCodec treeCodec, com.fasterxml.jackson.core.JsonFactory jsonFactory, Map<String,String> requestProperties) throws IOException
JsonFactory
.url
- the URL to readconnectionTimeoutMs
- connection timeout, in millisecondsreadTimeoutMs
- read timeout, in millisecondstreeCodec
- Tree codec to use (contains deserialization config)jsonFactory
- Jackson's JsonFactory
requestProperties
- any request properties to passJsonNode
instanceIOException
- if any I/O error occurspublic static JsonNode readMetadataUrl(URL url, int connectionTimeoutMs, int readTimeoutMs, JsonMapper jsonMapper, Map<String,String> requestProperties) throws IOException
JsonMapper
.url
- the URL to readconnectionTimeoutMs
- connection timeout, in millisecondsreadTimeoutMs
- read timeout, in millisecondsjsonMapper
- JSON mapper to use for parsingrequestProperties
- any request properties to passJsonNode
instanceIOException
- if any I/O error occurspublic static void populateMetadata(AbstractComputeInstanceMetadata instanceMetadata, JsonNode metadata)
AbstractComputeInstanceMetadata.setMetadata(Map)
property.instanceMetadata
- The instance metadatametadata
- A json object of metadatapublic static Optional<String> stringValue(com.fasterxml.jackson.databind.JsonNode json, String key)
json
- The jsonkey
- The keypublic static void populateMetadata(AbstractComputeInstanceMetadata instanceMetadata, Map<?,?> metadata)
AbstractComputeInstanceMetadata.setMetadata(Map)
property.instanceMetadata
- The instance metadatametadata
- A map of metadata