Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating URL constant variable #1462

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
public class AmazonInfo implements DataCenterInfo, UniqueIdentifier {

private static final String AWS_API_VERSION = "latest";
private static final String AWS_METADATA_URL = "http://169.254.169.254/" + AWS_API_VERSION + "/meta-data/";
private static final String AWS_HTTP_ADDRESS = "http://169.254.169.254/";
private static final String AWS_METADATA_URL = AWS_HTTP_ADDRESS + AWS_API_VERSION + "/meta-data/";

public enum MetaDataKey {
instanceId("instance-id"), // always have this first as we use it as a fail fast mechanism
Expand All @@ -78,7 +79,7 @@ public URL getURL(String prepend, String mac) throws MalformedURLException {

@Override
public URL getURL(String prepend, String append) throws MalformedURLException {
return new URL("http://169.254.169.254/" + AWS_API_VERSION + "/dynamic/instance-identity/document");
return new URL(AWS_HTTP_ADDRESS + AWS_API_VERSION + "/dynamic/instance-identity/document");
}

// no need to use a json deserializer, do a custom regex parse
Expand Down