1717using System . Collections . Generic ;
1818using System . Linq ;
1919using System . Net ;
20+ using MongoDB . Bson ;
2021using MongoDB . Driver . Core . Clusters ;
2122using MongoDB . Driver . Core . Clusters . ServerSelectors ;
2223using MongoDB . Driver . Core . Misc ;
@@ -36,8 +37,10 @@ public class ClusterSettings
3637 // fields
3738 private readonly ClusterConnectionMode _connectionMode ;
3839 private readonly IReadOnlyList < EndPoint > _endPoints ;
40+ private readonly IReadOnlyDictionary < string , IReadOnlyDictionary < string , object > > _kmsProviders ;
3941 private readonly int _maxServerSelectionWaitQueueSize ;
4042 private readonly string _replicaSetName ;
43+ private readonly IReadOnlyDictionary < string , BsonDocument > _schemaMap ;
4144 private readonly ConnectionStringScheme _scheme ;
4245 private readonly TimeSpan _serverSelectionTimeout ;
4346 private readonly IServerSelector _preServerSelector ;
@@ -49,30 +52,36 @@ public class ClusterSettings
4952 /// </summary>
5053 /// <param name="connectionMode">The connection mode.</param>
5154 /// <param name="endPoints">The end points.</param>
55+ /// <param name="kmsProviders">The kms providers.</param>
5256 /// <param name="maxServerSelectionWaitQueueSize">Maximum size of the server selection wait queue.</param>
5357 /// <param name="replicaSetName">Name of the replica set.</param>
5458 /// <param name="serverSelectionTimeout">The server selection timeout.</param>
5559 /// <param name="preServerSelector">The pre server selector.</param>
5660 /// <param name="postServerSelector">The post server selector.</param>
61+ /// <param name="schemaMap">The schema map.</param>
5762 /// <param name="scheme">The connection string scheme.</param>
5863 public ClusterSettings (
5964 Optional < ClusterConnectionMode > connectionMode = default ( Optional < ClusterConnectionMode > ) ,
6065 Optional < IEnumerable < EndPoint > > endPoints = default ( Optional < IEnumerable < EndPoint > > ) ,
66+ Optional < IReadOnlyDictionary < string , IReadOnlyDictionary < string , object > > > kmsProviders = default ( Optional < IReadOnlyDictionary < string , IReadOnlyDictionary < string , object > > > ) ,
6167 Optional < int > maxServerSelectionWaitQueueSize = default ( Optional < int > ) ,
6268 Optional < string > replicaSetName = default ( Optional < string > ) ,
6369 Optional < TimeSpan > serverSelectionTimeout = default ( Optional < TimeSpan > ) ,
6470 Optional < IServerSelector > preServerSelector = default ( Optional < IServerSelector > ) ,
6571 Optional < IServerSelector > postServerSelector = default ( Optional < IServerSelector > ) ,
72+ Optional < IReadOnlyDictionary < string , BsonDocument > > schemaMap = default ( Optional < IReadOnlyDictionary < string , BsonDocument > > ) ,
6673 Optional < ConnectionStringScheme > scheme = default ( Optional < ConnectionStringScheme > ) )
6774 {
6875 _connectionMode = connectionMode . WithDefault ( ClusterConnectionMode . Automatic ) ;
6976 _endPoints = Ensure . IsNotNull ( endPoints . WithDefault ( __defaultEndPoints ) , "endPoints" ) . ToList ( ) ;
77+ _kmsProviders = kmsProviders . WithDefault ( null ) ;
7078 _maxServerSelectionWaitQueueSize = Ensure . IsGreaterThanOrEqualToZero ( maxServerSelectionWaitQueueSize . WithDefault ( 500 ) , "maxServerSelectionWaitQueueSize" ) ;
7179 _replicaSetName = replicaSetName . WithDefault ( null ) ;
7280 _serverSelectionTimeout = Ensure . IsGreaterThanOrEqualToZero ( serverSelectionTimeout . WithDefault ( TimeSpan . FromSeconds ( 30 ) ) , "serverSelectionTimeout" ) ;
7381 _preServerSelector = preServerSelector . WithDefault ( null ) ;
7482 _postServerSelector = postServerSelector . WithDefault ( null ) ;
7583 _scheme = scheme . WithDefault ( ConnectionStringScheme . MongoDB ) ;
84+ _schemaMap = schemaMap . WithDefault ( null ) ;
7685 }
7786
7887 // properties
@@ -98,6 +107,17 @@ public IReadOnlyList<EndPoint> EndPoints
98107 get { return _endPoints ; }
99108 }
100109
110+ /// <summary>
111+ /// Gets the kms providers.
112+ /// </summary>
113+ /// <value>
114+ /// The kms providers.
115+ /// </value>
116+ public IReadOnlyDictionary < string , IReadOnlyDictionary < string , object > > KmsProviders
117+ {
118+ get { return _kmsProviders ; }
119+ }
120+
101121 /// <summary>
102122 /// Gets the maximum size of the server selection wait queue.
103123 /// </summary>
@@ -120,6 +140,17 @@ public string ReplicaSetName
120140 get { return _replicaSetName ; }
121141 }
122142
143+ /// <summary>
144+ /// Gets the schema map.
145+ /// </summary>
146+ /// <value>
147+ /// The schema map.
148+ /// </value>
149+ public IReadOnlyDictionary < string , BsonDocument > SchemaMap
150+ {
151+ get { return _schemaMap ; }
152+ }
153+
123154 /// <summary>
124155 /// Gets the connection string scheme.
125156 /// </summary>
@@ -170,31 +201,37 @@ public IServerSelector PostServerSelector
170201 /// </summary>
171202 /// <param name="connectionMode">The connection mode.</param>
172203 /// <param name="endPoints">The end points.</param>
204+ /// <param name="kmsProviders">The kms providers.</param>
173205 /// <param name="maxServerSelectionWaitQueueSize">Maximum size of the server selection wait queue.</param>
174206 /// <param name="replicaSetName">Name of the replica set.</param>
175207 /// <param name="serverSelectionTimeout">The server selection timeout.</param>
176208 /// <param name="preServerSelector">The pre server selector.</param>
177209 /// <param name="postServerSelector">The post server selector.</param>
210+ /// <param name="schemaMap">The schema map.</param>
178211 /// <param name="scheme">The connection string scheme.</param>
179212 /// <returns>A new ClusterSettings instance.</returns>
180213 public ClusterSettings With (
181214 Optional < ClusterConnectionMode > connectionMode = default ( Optional < ClusterConnectionMode > ) ,
182215 Optional < IEnumerable < EndPoint > > endPoints = default ( Optional < IEnumerable < EndPoint > > ) ,
216+ Optional < IReadOnlyDictionary < string , IReadOnlyDictionary < string , object > > > kmsProviders = default ( Optional < IReadOnlyDictionary < string , IReadOnlyDictionary < string , object > > > ) ,
183217 Optional < int > maxServerSelectionWaitQueueSize = default ( Optional < int > ) ,
184218 Optional < string > replicaSetName = default ( Optional < string > ) ,
185219 Optional < TimeSpan > serverSelectionTimeout = default ( Optional < TimeSpan > ) ,
186220 Optional < IServerSelector > preServerSelector = default ( Optional < IServerSelector > ) ,
187221 Optional < IServerSelector > postServerSelector = default ( Optional < IServerSelector > ) ,
222+ Optional < IReadOnlyDictionary < string , BsonDocument > > schemaMap = default ( Optional < IReadOnlyDictionary < string , BsonDocument > > ) ,
188223 Optional < ConnectionStringScheme > scheme = default ( Optional < ConnectionStringScheme > ) )
189224 {
190225 return new ClusterSettings (
191226 connectionMode : connectionMode . WithDefault ( _connectionMode ) ,
192227 endPoints : Optional . Enumerable ( endPoints . WithDefault ( _endPoints ) ) ,
228+ kmsProviders : Optional . Create ( kmsProviders . WithDefault ( _kmsProviders ) ) ,
193229 maxServerSelectionWaitQueueSize : maxServerSelectionWaitQueueSize . WithDefault ( _maxServerSelectionWaitQueueSize ) ,
194230 replicaSetName : replicaSetName . WithDefault ( _replicaSetName ) ,
195231 serverSelectionTimeout : serverSelectionTimeout . WithDefault ( _serverSelectionTimeout ) ,
196232 preServerSelector : Optional . Create ( preServerSelector . WithDefault ( _preServerSelector ) ) ,
197233 postServerSelector : Optional . Create ( postServerSelector . WithDefault ( _postServerSelector ) ) ,
234+ schemaMap : Optional . Create ( schemaMap . WithDefault ( _schemaMap ) ) ,
198235 scheme : scheme . WithDefault ( _scheme ) ) ;
199236 }
200237 }
0 commit comments