@InterfaceAudience.LimitedPrivate(value="extensions") @InterfaceStability.Evolving public final class AWSCredentialProviderList extends Object implements software.amazon.awssdk.auth.credentials.AwsCredentialsProvider, AutoCloseable
AWSCredentialsProviderChain
,
except that:
SdkException
, that is rethrown, rather than
swallowed.SdkException
raised is
rethrown; exceptions other than 'no credentials' have priority.AnonymousCredentialsProvider
.Modifier and Type | Field and Description |
---|---|
static String |
NO_AWS_CREDENTIAL_PROVIDERS |
Constructor and Description |
---|
AWSCredentialProviderList()
Empty instance.
|
AWSCredentialProviderList(Collection<software.amazon.awssdk.auth.credentials.AwsCredentialsProvider> providers)
Create with an initial list of providers.
|
AWSCredentialProviderList(String name,
software.amazon.awssdk.auth.credentials.AwsCredentialsProvider... providerArgs)
Create with an initial list of SDK V2 credential providers.
|
Modifier and Type | Method and Description |
---|---|
void |
add(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider provider)
Add a new SDK V2 provider.
|
void |
addAll(AWSCredentialProviderList other)
Add all providers from another list to this one.
|
void |
checkNotEmpty()
Verify that the provider list is not empty.
|
void |
close()
Close routine will close all providers in the list which implement
Closeable . |
List<software.amazon.awssdk.auth.credentials.AwsCredentialsProvider> |
getProviders()
Returns the underlying list of providers.
|
int |
getRefCount()
Get the current reference count.
|
boolean |
isClosed()
Get the closed flag.
|
String |
listProviderNames()
List all the providers' names.
|
static IOException |
maybeTranslateCredentialException(String path,
Throwable throwable)
Translate an exception if it or its inner exception is an
CredentialInitializationException . |
void |
refresh()
Deprecated.
|
software.amazon.awssdk.auth.credentials.AwsCredentials |
resolveCredentials()
Iterate through the list of providers, to find one with credentials.
|
void |
setName(String name)
Set the name; adds a ": " if needed.
|
AWSCredentialProviderList |
share()
Get a reference to this object with an updated reference count.
|
int |
size()
Get the size of this list.
|
String |
toString()
The string value is this class name and the string values of nested
providers.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final String NO_AWS_CREDENTIAL_PROVIDERS
public AWSCredentialProviderList()
public AWSCredentialProviderList(Collection<software.amazon.awssdk.auth.credentials.AwsCredentialsProvider> providers)
providers
- provider list.public AWSCredentialProviderList(String name, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider... providerArgs)
name
- name for error messages, may be ""providerArgs
- provider list.public void setName(String name)
name
- name to add, or "" for no name.public void add(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider provider)
provider
- providerpublic void addAll(AWSCredentialProviderList other)
other
- the other list.@Deprecated public void refresh()
public software.amazon.awssdk.auth.credentials.AwsCredentials resolveCredentials()
reuseLastProvider
is true, then it is re-used.resolveCredentials
in interface software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
public List<software.amazon.awssdk.auth.credentials.AwsCredentialsProvider> getProviders()
public void checkNotEmpty()
software.amazon.awssdk.core.exception.SdkException
- if there are no providers.public String listProviderNames()
public String toString()
public AWSCredentialProviderList share()
@VisibleForTesting public int getRefCount()
@VisibleForTesting public boolean isClosed()
public void close()
Closeable
.
This matters because some providers start a background thread to
refresh their secrets.close
in interface AutoCloseable
public int size()
public static IOException maybeTranslateCredentialException(String path, Throwable throwable)
CredentialInitializationException
.
If this condition is not met, null is returned.path
- path of operation.throwable
- exceptionCopyright © 2008–2024 Apache Software Foundation. All rights reserved.