public class ProfilesConfigFile extends Object
AWS_CREDENTIAL_PROFILES_FILE
environment
variable or by specifying an alternate credentials file location through this class' constructor.
The AWS credentials file format allows you to specify multiple profiles, each with their own set of AWS security credentials:
[default] aws_access_key_id=testAccessKey aws_secret_access_key=testSecretKey aws_session_token=testSessionToken [test-user] aws_access_key_id=testAccessKey aws_secret_access_key=testSecretKey aws_session_token=testSessionToken
These credential profiles allow you to share multiple sets of AWS security credentials between different tools such as the AWS SDK for Java and the AWS CLI.
For more information on setting up AWS credential profiles, see: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
ProfileCredentialsProvider
Modifier and Type | Field and Description |
---|---|
static String |
AWS_PROFILE_ENVIRONMENT_VARIABLE
Deprecated.
|
static String |
AWS_PROFILE_SYSTEM_PROPERTY
Deprecated.
|
static String |
DEFAULT_PROFILE_NAME
Deprecated.
|
Constructor and Description |
---|
ProfilesConfigFile()
Loads the AWS credential profiles file from the default location (~/.aws/credentials) or from
an alternate location if
AWS_CREDENTIAL_PROFILES_FILE is set. |
ProfilesConfigFile(File file)
Loads the AWS credential profiles from the file.
|
ProfilesConfigFile(File file,
ProfileCredentialsService credentialsService)
Loads the AWS credential profiles from the file.
|
ProfilesConfigFile(String filePath)
Loads the AWS credential profiles from the file.
|
ProfilesConfigFile(String filePath,
ProfileCredentialsService credentialsService)
Loads the AWS credential profiles from the file.
|
Modifier and Type | Method and Description |
---|---|
Map<String,BasicProfile> |
getAllBasicProfiles() |
Map<String,Profile> |
getAllProfiles()
Deprecated.
|
BasicProfile |
getBasicProfile(String profile) |
AWSCredentials |
getCredentials(String profileName)
Returns the AWS credentials for the specified profile.
|
void |
refresh()
Reread data from disk.
|
@Deprecated public static final String AWS_PROFILE_ENVIRONMENT_VARIABLE
@Deprecated public static final String AWS_PROFILE_SYSTEM_PROPERTY
@Deprecated public static final String DEFAULT_PROFILE_NAME
public ProfilesConfigFile() throws SdkClientException
AWS_CREDENTIAL_PROFILES_FILE
is set.SdkClientException
public ProfilesConfigFile(String filePath)
public ProfilesConfigFile(String filePath, ProfileCredentialsService credentialsService) throws SdkClientException
SdkClientException
public ProfilesConfigFile(File file) throws SdkClientException
SdkClientException
public ProfilesConfigFile(File file, ProfileCredentialsService credentialsService) throws SdkClientException
SdkClientException
public AWSCredentials getCredentials(String profileName)
public void refresh()
public BasicProfile getBasicProfile(String profile)
public Map<String,BasicProfile> getAllBasicProfiles()
@Deprecated public Map<String,Profile> getAllProfiles()
Copyright © 2023. All rights reserved.