Package software.amazon.awssdk.profiles
Class ProfileFile
- java.lang.Object
-
- software.amazon.awssdk.profiles.ProfileFile
-
@SdkPublicApi public final class ProfileFile extends Object
Provides programmatic access to the contents of an AWS configuration profile file. AWS configuration 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 configuration profiles, see: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
A profile file can be created with
builder()and merged with other profiles files withaggregator(). By default, the SDK will use thedefaultProfileFile()when that behavior hasn't been explicitly overridden.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProfileFile.AggregatorA mechanism for merging multipleProfileFiles together into a single file.static interfaceProfileFile.BuilderA builder for aProfileFile.static classProfileFile.TypeThe supported types of profile files.
-
Field Summary
Fields Modifier and Type Field Description static StringPROFILES_SECTION_TITLE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProfileFile.Aggregatoraggregator()Create a builder that can merge multipleProfileFiles together.static ProfileFile.Builderbuilder()Create a builder for aProfileFile.static ProfileFiledefaultProfileFile()Get the default profile file, using the credentials file from "~/.aws/credentials", the config file from "~/.aws/config" and the "default" profile.booleanequals(Object o)Optional<Profile>getSection(String sectionName, String sectionTitle)inthashCode()Optional<Profile>profile(String profileName)Retrieve the profile from this file with the given name.Map<String,Profile>profiles()Retrieve an unmodifiable collection including all of the profiles in this file.StringtoString()
-
-
-
Field Detail
-
PROFILES_SECTION_TITLE
public static final String PROFILES_SECTION_TITLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static ProfileFile.Builder builder()
Create a builder for aProfileFile.
-
aggregator
public static ProfileFile.Aggregator aggregator()
Create a builder that can merge multipleProfileFiles together.
-
defaultProfileFile
public static ProfileFile defaultProfileFile()
Get the default profile file, using the credentials file from "~/.aws/credentials", the config file from "~/.aws/config" and the "default" profile. This default behavior can be customized using theProfileFileSystemSetting.AWS_SHARED_CREDENTIALS_FILE,ProfileFileSystemSetting.AWS_CONFIG_FILEandProfileFileSystemSetting.AWS_PROFILEsettings or by specifying a different profile file and profile name.The file is read each time this method is invoked.
-
profile
public Optional<Profile> profile(String profileName)
Retrieve the profile from this file with the given name.- Parameters:
profileName- The name of the profile that should be retrieved from this file.- Returns:
- The profile, if available.
-
profiles
public Map<String,Profile> profiles()
Retrieve an unmodifiable collection including all of the profiles in this file.- Returns:
- An unmodifiable collection of the profiles in this file, keyed by profile name.
-
-