public class PropertiesCredentials extends Object implements AWSCredentials, AccountIdAware, ProviderNameAware
Constructor and Description |
---|
PropertiesCredentials(File file)
Reads the specified file as a Java properties file and extracts the
AWS access key from the "accessKey" property and AWS secret access
key from the "secretKey" property.
|
PropertiesCredentials(File file,
String providerName)
Reads the specified file as a Java properties file and extracts the
AWS access key from the "accessKey" property and AWS secret access
key from the "secretKey" property.
|
PropertiesCredentials(InputStream inputStream)
Reads the specified input stream as a stream of Java properties file
content and extracts the AWS access key ID and secret access key from the
properties.
|
PropertiesCredentials(InputStream inputStream,
String providerName)
Reads the specified input stream as a stream of Java properties file
content and extracts the AWS access key ID and secret access key from the
properties.
|
Modifier and Type | Method and Description |
---|---|
String |
getAccountId()
Returns the AWS account id associated with this credentials object, if found.
|
String |
getAWSAccessKeyId()
Returns the AWS access key ID for this credentials object.
|
String |
getAWSSecretKey()
Returns the AWS secret access key for this credentials object.
|
String |
getProviderName()
The name of the source that resolved these credentials, normally a credentials provider.
|
public PropertiesCredentials(File file) throws FileNotFoundException, IOException, IllegalArgumentException
file
- The file from which to read the AWS credentials
properties.FileNotFoundException
- If the specified file isn't found.IOException
- If any problems are encountered reading the AWS access
keys from the specified file.IllegalArgumentException
- If the specified properties file does not contain the
required keys.public PropertiesCredentials(File file, String providerName) throws FileNotFoundException, IOException, IllegalArgumentException
file
- The file from which to read the AWS credentials
properties.providerName
- The name of the credentials provider that is creating these credentialsFileNotFoundException
- If the specified file isn't found.IOException
- If any problems are encountered reading the AWS access
keys from the specified file.IllegalArgumentException
- If the specified properties file does not contain the
required keys.public PropertiesCredentials(InputStream inputStream) throws IOException
inputStream
- The input stream containing the AWS credential properties.IOException
- If any problems occur while reading from the input stream.public PropertiesCredentials(InputStream inputStream, String providerName) throws IOException
inputStream
- The input stream containing the AWS credential properties.providerName
- The name of the credentials provider that is creating these credentialsIOException
- If any problems occur while reading from the input stream.public String getAWSAccessKeyId()
AWSCredentials
getAWSAccessKeyId
in interface AWSCredentials
public String getAWSSecretKey()
AWSCredentials
getAWSSecretKey
in interface AWSCredentials
public String getAccountId()
AccountIdAware
getAccountId
in interface AccountIdAware
public String getProviderName()
ProviderNameAware
getProviderName
in interface ProviderNameAware