// constructors /// <summary> /// Initializes a new instance of the <see cref="ClientEncryptionOptions"/> class. /// </summary> /// <param name="keyVaultClient">The key vault client.</param> /// <param name="keyVaultNamespace">The key vault namespace.</param> /// <param name="kmsProviders">The KMS providers.</param> public ClientEncryptionOptions( IMongoClient keyVaultClient, CollectionNamespace keyVaultNamespace, IReadOnlyDictionary <string, IReadOnlyDictionary <string, object> > kmsProviders) { _keyVaultClient = Ensure.IsNotNull(keyVaultClient, nameof(keyVaultClient)); _keyVaultNamespace = Ensure.IsNotNull(keyVaultNamespace, nameof(keyVaultNamespace)); _kmsProviders = Ensure.IsNotNull(kmsProviders, nameof(kmsProviders)); KmsProvidersHelper.EnsureKmsProvidersAreValid(_kmsProviders); }
// constructors /// <summary> /// Initializes a new instance of the <see cref="ClientEncryptionOptions"/> class. /// </summary> /// <param name="keyVaultClient">The key vault client.</param> /// <param name="keyVaultNamespace">The key vault namespace.</param> /// <param name="kmsProviders">The KMS providers.</param> /// <param name="tlsOptions">The tls options.</param> public ClientEncryptionOptions( IMongoClient keyVaultClient, CollectionNamespace keyVaultNamespace, IReadOnlyDictionary <string, IReadOnlyDictionary <string, object> > kmsProviders, Optional <IReadOnlyDictionary <string, SslSettings> > tlsOptions = default) { _keyVaultClient = Ensure.IsNotNull(keyVaultClient, nameof(keyVaultClient)); _keyVaultNamespace = Ensure.IsNotNull(keyVaultNamespace, nameof(keyVaultNamespace)); _kmsProviders = Ensure.IsNotNull(kmsProviders, nameof(kmsProviders)); _tlsOptions = tlsOptions.WithDefault(new Dictionary <string, SslSettings>()); KmsProvidersHelper.EnsureKmsProvidersAreValid(_kmsProviders); KmsProvidersHelper.EnsureKmsProvidersTlsSettingsAreValid(_tlsOptions); }
/// <inheritdoc /> public override bool Equals(object obj) { if (object.ReferenceEquals(obj, null) || GetType() != obj.GetType()) { return(false); } var rhs = (AutoEncryptionOptions)obj; return (_bypassAutoEncryption.Equals(rhs._bypassAutoEncryption) && ExtraOptionsEquals(_extraOptions, rhs._extraOptions) && object.ReferenceEquals(_keyVaultClient, rhs._keyVaultClient) && _keyVaultNamespace.Equals(rhs._keyVaultNamespace) && KmsProvidersHelper.Equals(_kmsProviders, rhs._kmsProviders) && _schemaMap.IsEquivalentTo(rhs._schemaMap, object.Equals)); }
// constructors /// <summary> /// [Beta] Initializes a new instance of the <see cref="AutoEncryptionOptions"/> class. /// </summary> /// <param name="keyVaultNamespace">The keyVault namespace.</param> /// <param name="kmsProviders">The kms providers.</param> /// <param name="bypassAutoEncryption">The bypass auto encryption flag.</param> /// <param name="extraOptions">The extra options.</param> /// <param name="keyVaultClient">The keyVault client.</param> /// <param name="schemaMap">The schema map.</param> public AutoEncryptionOptions( CollectionNamespace keyVaultNamespace, IReadOnlyDictionary <string, IReadOnlyDictionary <string, object> > kmsProviders, Optional <bool> bypassAutoEncryption = default, Optional <IReadOnlyDictionary <string, object> > extraOptions = default, Optional <IMongoClient> keyVaultClient = default, Optional <IReadOnlyDictionary <string, BsonDocument> > schemaMap = default) { _keyVaultNamespace = Ensure.IsNotNull(keyVaultNamespace, nameof(keyVaultNamespace)); _kmsProviders = Ensure.IsNotNull(kmsProviders, nameof(kmsProviders)); _bypassAutoEncryption = bypassAutoEncryption.WithDefault(false); _extraOptions = extraOptions.WithDefault(null); _keyVaultClient = keyVaultClient.WithDefault(null); _schemaMap = schemaMap.WithDefault(null); EncryptionExtraOptionsValidator.EnsureThatExtraOptionsAreValid(_extraOptions); KmsProvidersHelper.EnsureKmsProvidersAreValid(_kmsProviders); }