Class InstanceCredentialsProvider
- java.lang.Object
-
- be.wegenenverkeer.rxhttpclient.aws.InstanceCredentialsProvider
-
- All Implemented Interfaces:
AwsCredentialsProvider
public class InstanceCredentialsProvider extends java.lang.Object implements AwsCredentialsProvider
AnAwsCredentialsProviderthat retrieves (temporary) credentials from the EC2 instance metadata service.The provider will retrieve and cache the credentials. Before each invocation of
InstanceCredentialsProvier#getAwsCredentials(), the service will check whether the credentials need to be refreshed.See the Retrieving Security Credentials from Instance Metadata, and AWS Request Signing documentation.
Created by Karel Maesen, Geovise BVBA on 07/02/17.
-
-
Constructor Summary
Constructors Constructor Description InstanceCredentialsProvider()Constructs an instanceInstanceCredentialsProvider(java.lang.String roleName)Constructs an instance with the security credentials for the specified IAM role
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AwsCredentialsgetAwsCredentials()Returns the AwsCredentials for this provider
-
-
-
Constructor Detail
-
InstanceCredentialsProvider
public InstanceCredentialsProvider(java.lang.String roleName)
Constructs an instance with the security credentials for the specified IAM role- Parameters:
roleName- the name of the IAM role to retrieve
-
InstanceCredentialsProvider
public InstanceCredentialsProvider()
Constructs an instanceWhen constructing this instance the instance metadata services will be queried for available role names and the first role will be selected. This is same behavior as the AWS SDK.
-
-
Method Detail
-
getAwsCredentials
public AwsCredentials getAwsCredentials()
Returns the AwsCredentials for this provider- Specified by:
getAwsCredentialsin interfaceAwsCredentialsProvider- Returns:
- the AwsCredentials
-
-