Package com.amazonaws.auth.profile
Class ProfilesConfigFileWriter
- java.lang.Object
-
- com.amazonaws.auth.profile.ProfilesConfigFileWriter
-
public class ProfilesConfigFileWriter extends Object
The class for creating and modifying the credential profiles file.
-
-
Constructor Summary
Constructors Constructor Description ProfilesConfigFileWriter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
deleteProfiles(File destination, String... profileNames)
Remove one or more profiles from the existing credentials file by in-place modification.static void
dumpToFile(File destination, boolean overwrite, com.amazonaws.auth.profile.internal.Profile... profiles)
Write all the credential profiles to a file.static void
modifyOneProfile(File destination, String profileName, com.amazonaws.auth.profile.internal.Profile newProfile)
Modify one profile in the existing credentials file by in-place modification.static void
modifyOrInsertProfiles(File destination, com.amazonaws.auth.profile.internal.Profile... profiles)
Modify or insert new profiles into an existing credentials file by in-place modification.
-
-
-
Method Detail
-
dumpToFile
public static void dumpToFile(File destination, boolean overwrite, com.amazonaws.auth.profile.internal.Profile... profiles)
Write all the credential profiles to a file. Note that this method will clobber the existing content in the destination file if it's in the overwrite mode. UsemodifyOrInsertProfiles(File, Profile...)
instead, if you want to perform in-place modification on your existing credentials file.- Parameters:
destination
- The destination file where the credentials will be written to.overwrite
- If true, this method If false, this method will throw exception if the file already exists.profiles
- All the credential profiles to be written.
-
modifyOrInsertProfiles
public static void modifyOrInsertProfiles(File destination, com.amazonaws.auth.profile.internal.Profile... profiles)
Modify or insert new profiles into an existing credentials file by in-place modification. Only the properties of the affected profiles will be modified; all the unaffected profiles and comment lines will remain the same. This method does not support renaming a profile.- Parameters:
destination
- The destination file to modifyprofiles
- All the credential profiles to be written.
-
modifyOneProfile
public static void modifyOneProfile(File destination, String profileName, com.amazonaws.auth.profile.internal.Profile newProfile)
Modify one profile in the existing credentials file by in-place modification. This method will rename the existing profile if the specified Profile has a different name.- Parameters:
destination
- The destination file to modifyprofileName
- The name of the existing profile to be modifiednewProfile
- The new Profile object.
-
-