Package com.amazonaws.encryptionsdk.kms
Class KmsMasterKeyProvider.Builder
- java.lang.Object
-
- com.amazonaws.encryptionsdk.kms.KmsMasterKeyProvider.Builder
-
- All Implemented Interfaces:
Cloneable
- Enclosing class:
- KmsMasterKeyProvider
public static class KmsMasterKeyProvider.Builder extends Object implements Cloneable
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KmsMasterKeyProvider
build()
Builds the master key provider.KmsMasterKeyProvider.Builder
clone()
protected void
snoopClientCache(ConcurrentHashMap<String,com.amazonaws.services.kms.AWSKMS> map)
KmsMasterKeyProvider.Builder
withClientBuilder(com.amazonaws.services.kms.AWSKMSClientBuilder builder)
Configures theKmsMasterKeyProvider
to use settings from thisAWSKMSClientBuilder
to configure KMS clients.KmsMasterKeyProvider.Builder
withCredentials(com.amazonaws.auth.AWSCredentials credentials)
Configures theKmsMasterKeyProvider
to use specific credentials.KmsMasterKeyProvider.Builder
withCredentials(com.amazonaws.auth.AWSCredentialsProvider credentialsProvider)
Configures theKmsMasterKeyProvider
to use specific credentials.KmsMasterKeyProvider.Builder
withCustomClientFactory(KmsMasterKeyProvider.RegionalClientSupplier regionalClientSupplier)
Provides a custom factory function that will vend KMS clients.KmsMasterKeyProvider.Builder
withDefaultRegion(String defaultRegion)
Sets the default region.KmsMasterKeyProvider.Builder
withKeysForEncryption(String... keyIds)
Adds key ID(s) to the list of keys to use on encryption.KmsMasterKeyProvider.Builder
withKeysForEncryption(List<String> keyIds)
Adds key ID(s) to the list of keys to use on encryption.
-
-
-
Method Detail
-
clone
public KmsMasterKeyProvider.Builder clone()
-
withKeysForEncryption
public KmsMasterKeyProvider.Builder withKeysForEncryption(String... keyIds)
Adds key ID(s) to the list of keys to use on encryption.- Parameters:
keyIds
-- Returns:
-
withKeysForEncryption
public KmsMasterKeyProvider.Builder withKeysForEncryption(List<String> keyIds)
Adds key ID(s) to the list of keys to use on encryption.- Parameters:
keyIds
-- Returns:
-
withDefaultRegion
public KmsMasterKeyProvider.Builder withDefaultRegion(String defaultRegion)
Sets the default region. This region will be used when specifying key IDs for encryption or inMasterKeyProvider.getMasterKey(String)
that are not full ARNs, but are instead bare key IDs or aliases. If the default region is not specified, only full key ARNs will be usable.- Parameters:
defaultRegion
- The default region to use.- Returns:
-
withCustomClientFactory
public KmsMasterKeyProvider.Builder withCustomClientFactory(KmsMasterKeyProvider.RegionalClientSupplier regionalClientSupplier)
Provides a custom factory function that will vend KMS clients. This is provided for advanced use cases which require complete control over the client construction process. Because the regional client supplier fully controls the client construction process, it is not possible to configure the client through methods such aswithCredentials(AWSCredentialsProvider)
orwithClientBuilder(AWSKMSClientBuilder)
; if you try to use these in combination, anIllegalStateException
will be thrown.- Parameters:
regionalClientSupplier
-- Returns:
-
withCredentials
public KmsMasterKeyProvider.Builder withCredentials(com.amazonaws.auth.AWSCredentialsProvider credentialsProvider)
Configures theKmsMasterKeyProvider
to use specific credentials. If a builder was previously set, this will override whatever credentials it set.- Parameters:
credentialsProvider
-- Returns:
-
withCredentials
public KmsMasterKeyProvider.Builder withCredentials(com.amazonaws.auth.AWSCredentials credentials)
Configures theKmsMasterKeyProvider
to use specific credentials. If a builder was previously set, this will override whatever credentials it set.- Parameters:
credentials
-- Returns:
-
withClientBuilder
public KmsMasterKeyProvider.Builder withClientBuilder(com.amazonaws.services.kms.AWSKMSClientBuilder builder)
Configures theKmsMasterKeyProvider
to use settings from thisAWSKMSClientBuilder
to configure KMS clients. Note that the region set on this builder will be ignored, but all other settings will be propagated into the regional clients. This method will overwrite any credentials set usingwithCredentials(AWSCredentialsProvider)
.- Parameters:
builder
-- Returns:
-
build
public KmsMasterKeyProvider build()
Builds the master key provider.- Returns:
-
snoopClientCache
protected void snoopClientCache(ConcurrentHashMap<String,com.amazonaws.services.kms.AWSKMS> map)
-
-