Table of Contents

Class CredentialProfileStoreChain

Namespace
Amazon.Runtime.CredentialManagement
Assembly
AWSSDK.Core.dll

Class to abstract the combined use of NetSDKCredentialsFile and SharedCredentialsFile where possible.

public class CredentialProfileStoreChain : ICredentialProfileSource
Inheritance
CredentialProfileStoreChain
Implements
Inherited Members

Constructors

CredentialProfileStoreChain()

Construct a CredentialProfileChain.

public CredentialProfileStoreChain()

CredentialProfileStoreChain(string)

Construct a CredentialProfileChain.

public CredentialProfileStoreChain(string profilesLocation)

Parameters

profilesLocation string

The path to the aws credentials file to look at.

Properties

ProfilesLocation

The location of the shared credentials file, or null to use the default location.

public string ProfilesLocation { get; }

Property Value

string

Methods

ListProfiles()

Get a list of available CredentialProfile objects.

If ProfilesLocation is non-null and non-empty include profiles in the shared credentials file at the disk path in the ProfilesLocation property.

If ProfilesLocation is null or empty and the platform supports the .NET SDK credentials file include profiles from the SDK credentials file and from the shared credentials file in the default location.

If ProfilesLocation is null or empty and the platform doesn't support the .NET SDK credentials file include profiles from the shared credentials file in the default location.

public List<CredentialProfile> ListProfiles()

Returns

List<CredentialProfile>

A list of CredentialProfile objects.

RegisterProfile(CredentialProfile)

Register a CredentialProfile

If ProfilesLocation is non-null and non-empty register the profile in the shared credentials file at the disk path in the ProfilesLocation property.

If ProfilesLocation is null or empty and the platform supports the .NET SDK credentials file register the profile in the SDK credentials file.

If ProfilesLocation is null or empty and the platform doesn't support the .NET SDK credentials file register the profile in the shared credentials file in the default location.

public void RegisterProfile(CredentialProfile profile)

Parameters

profile CredentialProfile

The profile to register.

TryGetAWSCredentials(string, out AWSCredentials)

Try to get AWSCredentials from a profile.

If ProfilesLocation is non-null and non-empty search the shared credentials file at the disk path in the ProfilesLocation property.

If ProfilesLocation is null or empty and the platform supports the .NET SDK credentials file search the SDK credentials file. If the profile is not found search the shared credentials file in the default location.

If ProfilesLocation is null or empty and the platform doesn't support the .NET SDK credentials file search the shared credentials file in the default location.

public bool TryGetAWSCredentials(string profileName, out AWSCredentials credentials)

Parameters

profileName string

The name of the profile to get credentials from.

credentials AWSCredentials

The credentials, if the profile is found and credentials can be created.

Returns

bool

True if the profile was found and credentials could be created, false otherwise.

TryGetProfile(string, out CredentialProfile)

Try to get a CredentialProfile

If ProfilesLocation is non-null and non-empty search the shared credentials file at the disk path in the ProfilesLocation property.

If ProfilesLocation is null or empty and the platform supports the .NET SDK credentials file search the SDK credentials file. If the profile is not found search the shared credentials file in the default location.

If ProfilesLocation is null or empty and the platform doesn't support the .NET SDK credentials file search the shared credentials file in the default location.

public bool TryGetProfile(string profileName, out CredentialProfile profile)

Parameters

profileName string

The name of the profile to get.

profile CredentialProfile

The profile, if found

Returns

bool

True if the profile was found, false otherwise.

UnregisterProfile(string)

Unregister a CredentialProfile

If ProfilesLocation is non-null and non-empty unregister the profile from the shared credentials file at the disk path in the ProfilesLocation property.

If ProfilesLocation is null or empty and the platform supports the .NET SDK credentials file search the SDK credentials file. If the profile is found there unregister it. If the profile was not found search the shared credentials file in the default location. If the profile is found in the shared credentials file in the default location unregister it.

If ProfilesLocation is null or empty and the platform doesn't support the .NET SDK credentials file search the shared credentials file in the default location. If the profile is found in the shared credentials file in the default location unregister it.

public void UnregisterProfile(string profileName)

Parameters

profileName string

The name of the profile to unregister.