This repository has been archived by the owner on Mar 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support customer AWS credential providers (#22)
- Loading branch information
1 parent
2a3ac84
commit 514d448
Showing
7 changed files
with
119 additions
and
2 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
31 changes: 31 additions & 0 deletions
31
...ava/com/amazon/opendistroforelasticsearch/jdbc/config/AwsCredentialsProviderProperty.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,31 @@ | ||
package com.amazon.opendistroforelasticsearch.jdbc.config; | ||
|
||
import com.amazonaws.auth.AWSCredentialsProvider; | ||
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; | ||
|
||
public class AwsCredentialsProviderProperty extends ConnectionProperty<AWSCredentialsProvider> { | ||
|
||
public static final String KEY = "awsCredentialsProvider"; | ||
|
||
public AwsCredentialsProviderProperty() { | ||
super(KEY); | ||
} | ||
|
||
@Override | ||
public AWSCredentialsProvider getDefault() { | ||
return new DefaultAWSCredentialsProviderChain(); | ||
} | ||
|
||
@Override | ||
protected AWSCredentialsProvider parseValue(Object rawValue) throws ConnectionPropertyException { | ||
if (null == rawValue) { | ||
return null; | ||
} else if (rawValue instanceof AWSCredentialsProvider) { | ||
return (AWSCredentialsProvider) rawValue; | ||
} | ||
|
||
throw new ConnectionPropertyException(getKey(), | ||
String.format("Property \"%s\" requires a valid AWSCredentialsProvider instance. " + | ||
"Invalid value of type: %s specified.", getKey(), rawValue.getClass().getName())); | ||
} | ||
} |
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