public class VmMetadataCache extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_META_DATA_SERVER
The meta-data server's URL prefix.
|
static String |
META_DATA_PATTERN |
| Constructor and Description |
|---|
VmMetadataCache() |
| Modifier and Type | Method and Description |
|---|---|
String |
getMetadata(String path)
Returns the value of the VM's meta-data attribute, or null if retrieval has failed.
|
protected String |
getMetadataFromServer(String path)
Retrieves the specified path from the VM's meta-data server.
|
protected HttpURLConnection |
openConnection(String path)
Returns an HTTP URL connection to read the value of the specified attribute.
|
public static final String DEFAULT_META_DATA_SERVER
public static final String META_DATA_PATTERN
public String getMetadata(String path)
path - the meta-data attribute to be retrieved (e.g. "image", "attributes/sshKeys").protected HttpURLConnection openConnection(String path) throws IOException
path - the meta-data attribute to be retrieved (e.g. "image", "attributes/sshKeys").IOException - if the connection could not be opened.protected String getMetadataFromServer(String path) throws IOException
path - a path in the meta-data server (e.g. "image").IOException - if the connection to the meta-data server fails, or refused.Copyright © 2014. All Rights Reserved.