@Singleton @Requires(env="ec2") public class AmazonComputeInstanceMetadataResolver extends Object implements ComputeInstanceMetadataResolver
ComputeInstanceMetadata
for Amazon EC2.Constructor and Description |
---|
AmazonComputeInstanceMetadataResolver()
Create a new instance to resolve
ComputeInstanceMetadata for Amazon EC2 with default configurations. |
AmazonComputeInstanceMetadataResolver(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
AmazonMetadataConfiguration configuration)
Create a new instance to resolve
ComputeInstanceMetadata for Amazon EC2. |
Modifier and Type | Method and Description |
---|---|
protected com.fasterxml.jackson.databind.JsonNode |
readEc2MetadataJson(URL url,
int connectionTimeoutMs,
int readTimeoutMs)
|
Optional<ComputeInstanceMetadata> |
resolve(Environment environment)
Resolves
ComputeInstanceMetadata for the current environment if possible. |
@Inject public AmazonComputeInstanceMetadataResolver(com.fasterxml.jackson.databind.ObjectMapper objectMapper, AmazonMetadataConfiguration configuration)
ComputeInstanceMetadata
for Amazon EC2.objectMapper
- To convert AWS EC2 metadata information into Mapconfiguration
- AWS Metadata configurationpublic AmazonComputeInstanceMetadataResolver()
ComputeInstanceMetadata
for Amazon EC2 with default configurations.public Optional<ComputeInstanceMetadata> resolve(Environment environment)
ComputeInstanceMetadataResolver
ComputeInstanceMetadata
for the current environment if possible.resolve
in interface ComputeInstanceMetadataResolver
environment
- The environmentComputeInstanceMetadata
@Deprecated protected com.fasterxml.jackson.databind.JsonNode readEc2MetadataJson(URL url, int connectionTimeoutMs, int readTimeoutMs) throws IOException
ComputeInstanceMetadataResolverUtils.readMetadataUrl(URL, int, int, ObjectMapper, Map)
url
- URL to fetch AWS EC2 metadata informationconnectionTimeoutMs
- connection timeout in millisreadTimeoutMs
- read timeout in millisIOException
- Signals that an I/O exception of some sort has occurred