@Internal public class ComputeInstanceMetadataResolverUtils extends Object
ComputeInstanceMetadataResolver's.| Constructor and Description |
|---|
ComputeInstanceMetadataResolverUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
populateMetadata(AbstractComputeInstanceMetadata instanceMetadata,
Map<?,?> metadata)
Populates the instance instance metadata's
AbstractComputeInstanceMetadata.setMetadata(Map) property. |
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 ObjectMapperrequestProperties - any request properties to passJsonNode instanceIOException - if any I/O error occurspublic 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