public class AwsCandidateHarvester extends MappingCandidateHarvester
Modifier and Type | Field and Description |
---|---|
private static boolean |
addressChecked
Whether we have already checked and found the mapping addresses.
|
private static String |
EC2_TEST_URL
The URL to use to test whether we are running on Amazon EC2.
|
private static TransportAddress |
face
The addresses that we will be masking
|
private static String |
LOCAL_IP_URL
The URL where one obtains AWS private/local addresses.
|
private static Logger |
logger
The Logger used by the AwsCandidateHarvester
class and its instances for logging output.
|
private static TransportAddress |
mask
The addresses that we will use as a mask
|
private static String |
PUBLIC_IP_URL
The URL where one obtains AWS public addresses.
|
private static Boolean |
RUNNING_ON_EC2
Whether we are running on Amazon EC2.
|
Constructor and Description |
---|
AwsCandidateHarvester()
Creates an AWS harvester.
|
Modifier and Type | Method and Description |
---|---|
private static boolean |
doTestEc2()
Tries to connect to an Amazon EC2-specific URL in order to determine
whether we are running on EC2.
|
private static String |
fetch(String url)
Retrieves the content at the specified url.
|
TransportAddress |
getFace()
Returns the local (face) address, or null.
|
TransportAddress |
getMask()
Returns the public (mask) address, or null.
|
private static void |
obtainEC2Addresses()
Sends HTTP GET queries to
http://169.254.169.254/latest/meta-data/local-ipv4 and
http://169.254.169.254/latest/meta-data/public-ipv4 to learn the
private (face) and public (mask) addresses of this EC2 instance.
|
static boolean |
smellsLikeAnEC2()
Determines if there is a decent chance for the box executing this
application to be an AWS EC2 instance and returns true if so.
|
harvest, toString
getHarvestStatistics, isHostHarvester
private static final Logger logger
private static final String PUBLIC_IP_URL
private static final String LOCAL_IP_URL
private static final String EC2_TEST_URL
private static Boolean RUNNING_ON_EC2
private static TransportAddress mask
private static TransportAddress face
private static boolean addressChecked
public AwsCandidateHarvester()
private static void obtainEC2Addresses()
public TransportAddress getMask()
getMask
in class MappingCandidateHarvester
public TransportAddress getFace()
getFace
in class MappingCandidateHarvester
public static boolean smellsLikeAnEC2()
private static boolean doTestEc2()
Copyright © 2018. All rights reserved.