C# Class Amazon.Runtime.Internal.Auth.SharedCredentialsFile

Provides access to read and write to the shared credentials INI file. The file is read, parsed, and validated at construction time. Changes can be made using the AddOrUpdateSection() and DeleteSection() methods. Those changes can be persisted to disk using the Persist() method. This class is not threadsafe.
Exibir arquivo Open project: aws/aws-sdk-net Class Usage Examples

Public Methods

Method Description
AddOrUpdateCredentials ( string profileName, string accessKey, string secretAccessKey ) : void

Add credentials for the profile given. If credentials for the profile already exist, update them. Changes are not written to disk until the Persist() method is called.

AddOrUpdateCredentials ( string profileName, string accessKey, string secretAccessKey, string token ) : void

Add credentials for the profile given. If credentials for the profile already exist, update them. Changes are not written to disk until the Persist() method is called.

DeleteProfile ( string profileName ) : void

Deletes the section with the given ProfileName from the SharedCredentialsFile, if one exists. Changes are not written to disk until the Persist() method is called.

GetCredentials ( string profileName ) : ImmutableCredentials

Get credentials for the given profile.

ListProfileNames ( ) : List
Persist ( ) : void

Persist any changes to disk.

SharedCredentialsFile ( string filePath ) : Amazon.Runtime.Internal.Util

Construct a new SharedCredentialsFile.

TryGetCredentials ( string profileName, ImmutableCredentials &credentials ) : bool

Return the credentials for the profile if valid credentials can be found.

Private Methods

Method Description
GetCredentials ( string profileName, bool throwIfInvalid ) : ImmutableCredentials

Method Details

AddOrUpdateCredentials() public method

Add credentials for the profile given. If credentials for the profile already exist, update them. Changes are not written to disk until the Persist() method is called.
public AddOrUpdateCredentials ( string profileName, string accessKey, string secretAccessKey ) : void
profileName string name of profile
accessKey string access key for the credentials
secretAccessKey string secret access key for the credentials
return void

AddOrUpdateCredentials() public method

Add credentials for the profile given. If credentials for the profile already exist, update them. Changes are not written to disk until the Persist() method is called.
public AddOrUpdateCredentials ( string profileName, string accessKey, string secretAccessKey, string token ) : void
profileName string name of profile
accessKey string access key for the credentials
secretAccessKey string secret access key for the credentials
token string token for the credentials
return void

DeleteProfile() public method

Deletes the section with the given ProfileName from the SharedCredentialsFile, if one exists. Changes are not written to disk until the Persist() method is called.
public DeleteProfile ( string profileName ) : void
profileName string ProfileName of section to delete
return void

GetCredentials() public method

Get credentials for the given profile.
public GetCredentials ( string profileName ) : ImmutableCredentials
profileName string name of profile to find credentials for
return ImmutableCredentials

ListProfileNames() public method

public ListProfileNames ( ) : List
return List

Persist() public method

Persist any changes to disk.
public Persist ( ) : void
return void

SharedCredentialsFile() public method

Construct a new SharedCredentialsFile.
public SharedCredentialsFile ( string filePath ) : Amazon.Runtime.Internal.Util
filePath string path of the shared credentials file
return Amazon.Runtime.Internal.Util

TryGetCredentials() public method

Return the credentials for the profile if valid credentials can be found.
public TryGetCredentials ( string profileName, ImmutableCredentials &credentials ) : bool
profileName string name of profile to find credentials for
credentials ImmutableCredentials the credentials for the profile
return bool