Class AutoEncryptionSettings.Builder
- Enclosing class:
- AutoEncryptionSettings
AutoEncryptionSettings
so that AutoEncryptionSettings
can be immutable, and to support easier
construction through chaining.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build an instance ofAutoEncryptionSettings
.bypassAutoEncryption
(boolean bypassAutoEncryption) Sets whether auto-encryption should be bypassed.bypassQueryAnalysis
(boolean bypassQueryAnalysis) Enable or disable automatic analysis of outgoing commands.encryptedFieldsMap
(Map<String, BsonDocument> encryptedFieldsMap) Maps a collection namespace to an encryptedFields.extraOptions
(Map<String, Object> extraOptions) Sets the extra options.keyVaultMongoClientSettings
(MongoClientSettings keyVaultMongoClientSettings) Sets the key vault settings.keyVaultNamespace
(String keyVaultNamespace) Sets the key vault namespaceThis method is similar tokmsProviders(Map)
, but instead of configuring properties for KMS providers, it configuresSupplier
s of properties.Sets the KMS providers map.kmsProviderSslContextMap
(Map<String, SSLContext> kmsProviderSslContextMap) Sets the KMS provider to SSLContext mapschemaMap
(Map<String, BsonDocument> schemaMap) Sets the map from namespace to local schema document
-
Method Details
-
keyVaultMongoClientSettings
public AutoEncryptionSettings.Builder keyVaultMongoClientSettings(MongoClientSettings keyVaultMongoClientSettings) Sets the key vault settings.- Parameters:
keyVaultMongoClientSettings
- the key vault mongo client settings, which may be null.- Returns:
- this
- See Also:
-
keyVaultNamespace
Sets the key vault namespace- Parameters:
keyVaultNamespace
- the key vault namespace, which may not be null- Returns:
- this
- See Also:
-
kmsProviders
Sets the KMS providers map.- Parameters:
kmsProviders
- the KMS providers map, which may not be null- Returns:
- this
- See Also:
-
kmsProviderPropertySuppliers
public AutoEncryptionSettings.Builder kmsProviderPropertySuppliers(Map<String, Supplier<Map<String, Object>>> kmsProviderPropertySuppliers) This method is similar tokmsProviders(Map)
, but instead of configuring properties for KMS providers, it configuresSupplier
s of properties. -
kmsProviderSslContextMap
public AutoEncryptionSettings.Builder kmsProviderSslContextMap(Map<String, SSLContext> kmsProviderSslContextMap) Sets the KMS provider to SSLContext map- Parameters:
kmsProviderSslContextMap
- the KMS provider to SSLContext map, which may not be null- Returns:
- this
- Since:
- 4.4
- See Also:
-
schemaMap
Sets the map from namespace to local schema document- Parameters:
schemaMap
- the map from namespace to local schema document- Returns:
- this
- See Also:
-
extraOptions
Sets the extra options.Note: When setting
cryptSharedLibPath
, the override path must be given as a path to the shared crypt library file itself, and not simply the directory that contains it.- Parameters:
extraOptions
- the extra options, which may not be null- Returns:
- this
- See Also:
-
bypassAutoEncryption
Sets whether auto-encryption should be bypassed.- Parameters:
bypassAutoEncryption
- whether auto-encryption should be bypassed- Returns:
- this
- See Also:
-
encryptedFieldsMap
@Beta(SERVER) public AutoEncryptionSettings.Builder encryptedFieldsMap(Map<String, BsonDocument> encryptedFieldsMap) Maps a collection namespace to an encryptedFields.Note: only applies to queryable encryption. Automatic encryption in queryable encryption is configured with the encryptedFields.
If a collection is present in both the
encryptedFieldsMap
andschemaMap
, the driver will error.If a collection is present on the
encryptedFieldsMap
, the behavior ofcollection.createCollection()
andcollection.drop()
is altered.If a collection is not present on the
encryptedFieldsMap
a server-side collectionencryptedFieldsMap
may be used by the driver.- Parameters:
encryptedFieldsMap
- the mapping of the collection namespace to the encryptedFields- Returns:
- this
- Since:
- 4.7
-
bypassQueryAnalysis
@Beta(SERVER) public AutoEncryptionSettings.Builder bypassQueryAnalysis(boolean bypassQueryAnalysis) Enable or disable automatic analysis of outgoing commands.Set bypassQueryAnalysis to true to use explicit encryption on indexed fields without the MongoDB Enterprise Advanced licensed crypt shared library.
- Parameters:
bypassQueryAnalysis
- whether query analysis should be bypassed- Returns:
- this
- Since:
- 4.7
-
build
Build an instance ofAutoEncryptionSettings
.- Returns:
- the settings from this builder
-