@Singleton @Requires(env="gcp") public class GoogleComputeInstanceMetadataResolver extends Object implements ComputeInstanceMetadataResolver
ComputeInstanceMetadata for Google Cloud Platform.| Modifier and Type | Field and Description |
|---|---|
static String |
HEADER_METADATA_FLAVOR
Constant for Metadata flavor.
|
| Constructor and Description |
|---|
GoogleComputeInstanceMetadataResolver()
Construct with default settings.
|
GoogleComputeInstanceMetadataResolver(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
GoogleComputeMetadataConfiguration configuration) |
| Modifier and Type | Method and Description |
|---|---|
protected com.fasterxml.jackson.databind.JsonNode |
readGcMetadataUrl(URL url,
int connectionTimeoutMs,
int readTimeoutMs)
|
Optional<ComputeInstanceMetadata> |
resolve(Environment environment)
Resolves
ComputeInstanceMetadata for the current environment if possible. |
public static final String HEADER_METADATA_FLAVOR
@Inject public GoogleComputeInstanceMetadataResolver(com.fasterxml.jackson.databind.ObjectMapper objectMapper, GoogleComputeMetadataConfiguration configuration)
objectMapper - To read and write JSONconfiguration - The configuration for computing Google Metadatapublic GoogleComputeInstanceMetadataResolver()
public Optional<ComputeInstanceMetadata> resolve(Environment environment)
ComputeInstanceMetadataResolverComputeInstanceMetadata for the current environment if possible.resolve in interface ComputeInstanceMetadataResolverenvironment - The environmentComputeInstanceMetadata@Deprecated protected com.fasterxml.jackson.databind.JsonNode readGcMetadataUrl(URL url, int connectionTimeoutMs, int readTimeoutMs) throws IOException
ComputeInstanceMetadataResolverUtils.readMetadataUrl(URL, int, int, ObjectMapper, Map)url - The metadata URLconnectionTimeoutMs - connection timeout in millisreadTimeoutMs - read timeout in millisIOException - Failed or interrupted I/O operations while reading from input stream.