-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from tulumvinh/3.x
1. Fetch metadata for running instance 2. Provide token, start, and completed time for snapshot backup status
- Loading branch information
Showing
11 changed files
with
186 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...tity/config/AwsInstanceDataRetriever.java → ...nfig/AwsClassicInstanceDataRetriever.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
priam/src/main/java/com/netflix/priam/identity/config/InstanceDataRetrieverBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.netflix.priam.identity.config; | ||
|
||
import org.codehaus.jettison.json.JSONException; | ||
import org.codehaus.jettison.json.JSONObject; | ||
|
||
import com.netflix.priam.utils.SystemUtils; | ||
|
||
public class InstanceDataRetrieverBase { | ||
protected JSONObject identityDocument = null; | ||
|
||
/* | ||
* @return the id (e.g. 12345) of the AWS account of running instance, could be null /empty. | ||
*/ | ||
public String getAWSAccountId() throws JSONException { | ||
if (this.identityDocument == null ) { | ||
String jsonStr = SystemUtils.getDataFromUrl("http://169.254.169.254/latest/dynamic/instance-identity/document"); | ||
synchronized(this) { | ||
if (this.identityDocument == null) { | ||
this.identityDocument = new JSONObject(jsonStr); | ||
} | ||
} | ||
} | ||
|
||
return this.identityDocument.getString("accountId"); | ||
} | ||
|
||
/* | ||
* @return the region (e.g. us-east-1) of the AWS account of running instance, could be null /empty. | ||
*/ | ||
public String getRegion() throws JSONException { | ||
if (this.identityDocument == null ) { | ||
String jsonStr = SystemUtils.getDataFromUrl("http://169.254.169.254/latest/dynamic/instance-identity/document"); | ||
synchronized(this.identityDocument) { | ||
if (this.identityDocument == null) { | ||
this.identityDocument = new JSONObject(jsonStr); | ||
} | ||
} | ||
} | ||
|
||
return this.identityDocument.getString("region"); | ||
} | ||
|
||
/* | ||
* @return e.g.. us-east-1c | ||
*/ | ||
public String getAvailabilityZone() throws JSONException { | ||
if (this.identityDocument == null ) { | ||
String jsonStr = SystemUtils.getDataFromUrl("http://169.254.169.254/latest/dynamic/instance-identity/document"); | ||
synchronized(this.identityDocument) { | ||
if (this.identityDocument == null) { | ||
this.identityDocument = new JSONObject(jsonStr); | ||
} | ||
} | ||
} | ||
|
||
return this.identityDocument.getString("availabilityZone"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters