@@ -3,6 +3,7 @@ import "@azure-tools/typespec-client-generator-core";
3
3
using TypeSpec .Http ;
4
4
using TypeSpec .OpenAPI ;
5
5
using TypeSpec .Rest ;
6
+ using TypeSpec .Versioning ;
6
7
using Azure .ResourceManager ;
7
8
using Azure .ResourceManager .Private ;
8
9
using Azure .ClientGenerator .Core ;
@@ -55,8 +56,23 @@ interface MongoClusters {
55
56
/** Check if mongo cluster name is available for use. */
56
57
@ action ("checkMongoClusterNameAvailability" )
57
58
checkNameAvailability is checkLocalNameAvailability ;
59
+ /** Promotes a replica mongo cluster to a primary role. */
60
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
61
+ promote is ArmResourceActionNoResponseContentAsync <
62
+ MongoCluster ,
63
+ PromoteReplicaRequest
64
+ >;
58
65
}
59
66
67
+ /** Identifier for a mongo cluster resource. */
68
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
69
+ scalar MongoClusterResourceId
70
+ extends Azure .Core .armResourceIdentifier <[
71
+ {
72
+ type : "Microsoft.DocumentDB/mongoClusters" ,
73
+ }
74
+ ]>;
75
+
60
76
/** The properties of a mongo cluster. */
61
77
model MongoClusterProperties {
62
78
/** The mode to create a mongo cluster. */
@@ -67,6 +83,11 @@ model MongoClusterProperties {
67
83
@ visibility ("create" )
68
84
restoreParameters ? : MongoClusterRestoreParameters ;
69
85
86
+ /** The parameters to create a replica mongo cluster. */
87
+ @ visibility ("create" )
88
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
89
+ replicaParameters ? : MongoClusterReplicaParameters ;
90
+
70
91
/** The administrator's login for the mongo cluster. */
71
92
@ visibility ("read" , "create" , "update" )
72
93
administratorLogin ? : string ;
@@ -105,6 +126,20 @@ model MongoClusterProperties {
105
126
/** List of private endpoint connections. */
106
127
@ visibility ("read" )
107
128
privateEndpointConnections ? : PrivateEndpointConnection [];
129
+
130
+ /** List of private endpoint connections. */
131
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
132
+ previewFeatures ? : PreviewFeature [];
133
+
134
+ /** The replication properties for the mongo cluster */
135
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
136
+ @ visibility ("read" )
137
+ replica ? : ReplicationProperties ;
138
+
139
+ /** The infrastructure version the cluster is provisioned on. */
140
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
141
+ @ visibility ("read" )
142
+ infrastructureVersion ? : string ;
108
143
}
109
144
110
145
/** The mode that the Mongo Cluster is created with. */
@@ -116,6 +151,14 @@ union CreateMode {
116
151
117
152
/** Create a mongo cluster from a restore point-in-time. */
118
153
"PointInTimeRestore" ,
154
+
155
+ /** Create a replica cluster in distinct geographic region from the source cluster. */
156
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
157
+ "GeoReplica" ,
158
+
159
+ /** Create a replica cluster in the same geographic region as the source cluster. */
160
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
161
+ "Replica" ,
119
162
}
120
163
121
164
/** The kind of the node on the cluster. */
@@ -133,7 +176,8 @@ model MongoClusterRestoreParameters {
133
176
pointInTimeUTC ? : utcDateTime ;
134
177
135
178
/** Resource ID to locate the source cluster to restore */
136
- sourceResourceId ? : string ;
179
+ @ typeChangedFrom (Microsoft .DocumentDB .Versions .v2024_06_01_preview , string )
180
+ sourceResourceId ? : MongoClusterResourceId ;
137
181
}
138
182
139
183
/** Specification for a node group. */
@@ -180,6 +224,7 @@ model ConnectionString {
180
224
}
181
225
182
226
/** The status of the Mongo cluster resource. */
227
+ @ clientName ("MongoClusterStatus" , "go" )
183
228
union MongoClusterStatus {
184
229
string ,
185
230
@@ -215,3 +260,105 @@ union PublicNetworkAccess {
215
260
/** If set, the private endpoints are the exclusive access method. */
216
261
"Disabled" ,
217
262
}
263
+
264
+ /** Preview features that can be enabled on a mongo cluster. */
265
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
266
+ union PreviewFeature {
267
+ string ,
268
+
269
+ /** Enables geo replicas preview feature. The feature must be set at create-time on new cluster to enable linking a geo-replica cluster to it. */
270
+ "GeoReplicas" ,
271
+ }
272
+
273
+ /** Parameters used for replica operations. */
274
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
275
+ model MongoClusterReplicaParameters {
276
+ /** The id of the replication source cluster. */
277
+ sourceResourceId : MongoClusterResourceId ;
278
+
279
+ /** The location of the source cluster */
280
+ sourceLocation : Azure .Core .azureLocation ;
281
+ }
282
+
283
+ /** Promote replica request properties. */
284
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
285
+ model PromoteReplicaRequest {
286
+ /** The promote option to apply to the operation. */
287
+ promoteOption : PromoteOption ;
288
+
289
+ /** The mode to apply to the promote operation. Value is optional and default value is 'Switchover'. */
290
+ mode ? : PromoteMode ;
291
+ }
292
+
293
+ /** The option to apply to a promote operation. */
294
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
295
+ union PromoteOption {
296
+ string ,
297
+
298
+ /** Promote option forces the promotion without waiting for the replica to be caught up to the primary. This can result in data-loss so should only be used during disaster recovery scenarios. */
299
+ "Forced" ,
300
+ }
301
+
302
+ /** The mode to apply to a promote operation. */
303
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
304
+ union PromoteMode {
305
+ string ,
306
+
307
+ /** Promotion will switch the current replica cluster to the primary role and the original primary will be switched to a replica role, maintaining the replication link. */
308
+ "Switchover" ,
309
+ }
310
+
311
+ /** Replica properties of the mongo cluster. */
312
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
313
+ model ReplicationProperties {
314
+ /** The resource id the source cluster for the replica cluster. */
315
+ @ visibility ("read" )
316
+ sourceResourceId ? : MongoClusterResourceId ;
317
+
318
+ /** The replication role of the cluster */
319
+ @ visibility ("read" )
320
+ role ? : ReplicationRole ;
321
+
322
+ /** The replication link state of the replica cluster. */
323
+ @ visibility ("read" )
324
+ replicationState ? : ReplicationState ;
325
+ }
326
+
327
+ /** Replication role of the mongo cluster. */
328
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
329
+ union ReplicationRole {
330
+ string ,
331
+
332
+ /** The cluster is a primary replica. */
333
+ "Primary" ,
334
+
335
+ /** The cluster is a local asynchronous replica. */
336
+ "AsyncReplica" ,
337
+
338
+ /** The cluster is a geo-asynchronous replica. */
339
+ "GeoAsyncReplica" ,
340
+ }
341
+
342
+ /** The state of the replication link between the replica and source cluster. */
343
+ @ added (Microsoft .DocumentDB .Versions .v2024_06_01_preview )
344
+ union ReplicationState {
345
+ string ,
346
+
347
+ /** Replication link is active. */
348
+ "Active" ,
349
+
350
+ /** Replica is catching-up with the primary. This can occur after the replica is created or after a promotion is triggered. */
351
+ "Catchup" ,
352
+
353
+ /** Replica and replication link to the primary is being created. */
354
+ "Provisioning" ,
355
+
356
+ /** Replication link is being updated due to a change on the replica or an upgrade. */
357
+ "Updating" ,
358
+
359
+ /** Replication link is broken and the replica may need to be recreated. */
360
+ "Broken" ,
361
+
362
+ /** Replication link is re-configuring due to a promotion event. */
363
+ "Reconfiguring" ,
364
+ }
0 commit comments