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
     
  • Method Summary

    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProfilesConfigFileWriter

      public ProfilesConfigFileWriter()
  • Method Details

    • 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. Use modifyOrInsertProfiles(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 modify
      profiles - 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 modify
      profileName - The name of the existing profile to be modified
      newProfile - The new Profile object.
    • deleteProfiles

      public static void deleteProfiles(File destination, String... profileNames)
      Remove one or more profiles from the existing credentials file by in-place modification.
      Parameters:
      destination - The destination file to modify
      profileNames - The names of all the profiles to be deleted.