Skip to content

Commit

Permalink
Merge pull request #248 from eduardoraupp/master
Browse files Browse the repository at this point in the history
Enum AwsPropertyKeys inserted instead of Constants
  • Loading branch information
dmuino committed May 21, 2014
2 parents 9f3a246 + c11a512 commit 424eb2f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ atlassian-ide-plugin.xml

# NetBeans specific files/directories
.nbattrs
/bin
24 changes: 19 additions & 5 deletions servo-aws/src/main/java/com/netflix/servo/aws/AwsPropertyKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@
package com.netflix.servo.aws;

/**
* Constant key values for setting aws related properties.
* Enum key values for setting aws related properties.
*/
public class AwsPropertyKeys {
public enum AwsPropertyKeys {

AWS_CREDENTIALS_FILE("com.netflix.servo.aws.credentialsFile"),
AWS_AUTO_SCALING_END_POINT("com.netflix.servo.aws.endpoint.autoscaling"),
AWS_CLOUD_WATCH_END_POINT("com.netflix.servo.aws.endpoint.cloudwatch");

public static final String awsCredentialsFile = "com.netflix.servo.aws.credentialsFile";
public static final String awsAutoScalingEndpoint = "com.netflix.servo.aws.endpoint.autoscaling";
public static final String awsCloudWatchEndpoint = "com.netflix.servo.aws.endpoint.cloudwatch";
private String bundle;

/**
* Constructor responsible to instantiate the type of bundle
*/
private AwsPropertyKeys(String bundle) {
this.bundle = bundle;
}

public String getBundle() {
return bundle;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AwsServiceClients {
*/
public static AmazonCloudWatch cloudWatch(AWSCredentialsProvider credentials ) {
AmazonCloudWatch client = new AmazonCloudWatchClient(credentials);
client.setEndpoint( System.getProperty( AwsPropertyKeys.awsCloudWatchEndpoint, "monitoring.amazonaws.com" ) );
client.setEndpoint( System.getProperty( AwsPropertyKeys.AWS_CLOUD_WATCH_END_POINT.getBundle(), "monitoring.amazonaws.com" ) );
return client;
}

Expand All @@ -41,7 +41,7 @@ public static AmazonCloudWatch cloudWatch(AWSCredentialsProvider credentials ) {
*/
public static AmazonAutoScaling autoScaling(AWSCredentials credentials) {
AmazonAutoScaling client = new AmazonAutoScalingClient(credentials);
client.setEndpoint( System.getProperty( AwsPropertyKeys.awsAutoScalingEndpoint, "autoscaling.amazonaws.com" ) );
client.setEndpoint( System.getProperty( AwsPropertyKeys.AWS_AUTO_SCALING_END_POINT.getBundle(), "autoscaling.amazonaws.com" ) );
return client;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public String tagString() {

static String getAutoScaleGroup() {
try {
String credFileProperty = System.getProperties().getProperty(AwsPropertyKeys.awsCredentialsFile);
String credFileProperty = System.getProperties().getProperty(AwsPropertyKeys.AWS_CREDENTIALS_FILE.getBundle());
AWSCredentials credentials;

if (credFileProperty != null) {
Expand Down

0 comments on commit 424eb2f

Please sign in to comment.