Skip to content

Commit c3802d5

Browse files
allenjzhangFrancisco-Gamino
authored andcommitted
[mongocluster] React to breaking changes in TypeSpec 0.56 (Azure#29096)
1 parent 13109f7 commit c3802d5

File tree

6 files changed

+86
-158
lines changed

6 files changed

+86
-158
lines changed
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import "@azure-tools/typespec-azure-core";
2-
import "@azure-tools/typespec-azure-resource-manager";
3-
import "@typespec/rest";
4-
import "./common.tsp";
5-
import "./MongoCluster.tsp";
6-
71
using TypeSpec.Rest;
82
using Azure.ResourceManager;
9-
using Azure.ResourceManager.Foundations;
103
using TypeSpec.Http;
114

125
namespace Microsoft.DocumentDB;
13-
@doc("Represents a mongo cluster firewall rule.")
6+
/** Represents a mongo cluster firewall rule. */
147
@parentResource(MongoCluster)
158
model FirewallRule is ProxyResource<FirewallRuleProperties> {
16-
@doc("The name of the mongo cluster firewall rule.")
9+
/** The name of the mongo cluster firewall rule. */
1710
@maxLength(80)
1811
@minLength(1)
1912
@pattern("^[a-zA-Z0-9][-_.a-zA-Z0-9]*")
@@ -24,30 +17,36 @@ model FirewallRule is ProxyResource<FirewallRuleProperties> {
2417
name: string;
2518
}
2619

27-
@doc("The properties of a mongo cluster firewall rule.")
20+
/** The properties of a mongo cluster firewall rule. */
2821
model FirewallRuleProperties {
29-
@doc("The provisioning state of the firewall rule.")
22+
/** The provisioning state of the firewall rule. */
3023
@visibility("read")
3124
provisioningState?: ProvisioningState;
3225

33-
@doc("The start IP address of the mongo cluster firewall rule. Must be IPv4 format.")
26+
/** The start IP address of the mongo cluster firewall rule. Must be IPv4 format. */
3427
@pattern("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
3528
startIpAddress: string;
3629

37-
@doc("The end IP address of the mongo cluster firewall rule. Must be IPv4 format.")
30+
/** The end IP address of the mongo cluster firewall rule. Must be IPv4 format. */
3831
@pattern("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
3932
endIpAddress: string;
4033
}
4134

4235
@armResourceOperations
4336
interface FirewallRules {
44-
@doc("Gets information about a mongo cluster firewall rule.")
37+
/** Gets information about a mongo cluster firewall rule. */
4538
get is ArmResourceRead<FirewallRule>;
39+
/** Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. */
4640
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "Need to support existing 202 response for PUT operations"
47-
@doc("Creates a new firewall rule or updates an existing firewall rule on a mongo cluster.")
48-
createOrUpdate is Operations.ArmResourceCreateOrUpdateWithAcceptedAsync<FirewallRule>;
49-
@doc("Deletes a mongo cluster firewall rule.")
41+
createOrUpdate is ArmResourceCreateOrReplaceAsync<
42+
FirewallRule,
43+
Response = ArmAcceptedLroResponse<"Resource operation accepted."> | ArmResourceUpdatedResponse<FirewallRule> | ArmResourceCreatedResponse<
44+
FirewallRule,
45+
LroHeaders = {}
46+
>
47+
>;
48+
/** Deletes a mongo cluster firewall rule. */
5049
delete is ArmResourceDeleteWithoutOkAsync<FirewallRule>;
51-
@doc("List all the firewall rules in a given mongo cluster.")
50+
/** List all the firewall rules in a given mongo cluster. */
5251
listByParent is ArmResourceListByParent<FirewallRule>;
5352
}
Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
import "@azure-tools/typespec-azure-core";
2-
import "@azure-tools/typespec-azure-resource-manager";
31
import "@azure-tools/typespec-client-generator-core";
4-
import "@typespec/openapi";
5-
import "@typespec/rest";
6-
import "./common.tsp";
72

83
using TypeSpec.Http;
94
using TypeSpec.OpenAPI;
105
using TypeSpec.Rest;
116
using Azure.ResourceManager;
12-
using Azure.ResourceManager.Foundations;
137
using Azure.ResourceManager.Private;
148
using Azure.ClientGenerator.Core;
159

1610
namespace Microsoft.DocumentDB;
17-
@doc("Represents a mongo cluster resource.")
11+
/** Represents a mongo cluster resource. */
1812
model MongoCluster is TrackedResource<MongoClusterProperties> {
19-
@doc("The name of the mongo cluster.")
13+
/** The name of the mongo cluster. */
2014
@maxLength(40)
2115
@minLength(3)
2216
@pattern("^[a-z0-9]+(-[a-z0-9]+)*")
@@ -29,184 +23,184 @@ model MongoCluster is TrackedResource<MongoClusterProperties> {
2923

3024
@armResourceOperations
3125
interface MongoClusters {
32-
@doc("Gets information about a mongo cluster.")
26+
/** Gets information about a mongo cluster. */
3327
get is ArmResourceRead<MongoCluster>;
34-
@doc("Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH.")
28+
/** Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. */
3529
createOrUpdate is ArmResourceCreateOrUpdateAsync<MongoCluster>;
36-
@doc("Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition.")
30+
/** Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. */
3731
update is ArmResourcePatchAsync<MongoCluster, MongoClusterProperties>;
38-
@doc("Deletes a mongo cluster.")
32+
/** Deletes a mongo cluster. */
3933
delete is ArmResourceDeleteWithoutOkAsync<MongoCluster>;
40-
@doc("List all the mongo clusters in a given resource group.")
34+
/** List all the mongo clusters in a given resource group. */
4135
listByResourceGroup is ArmResourceListByParent<MongoCluster>;
42-
@doc("List all the mongo clusters in a given subscription.")
36+
/** List all the mongo clusters in a given subscription. */
4337
list is ArmListBySubscription<MongoCluster>;
44-
@doc("List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster.")
38+
/** List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. */
4539
listConnectionStrings is ArmResourceActionSync<
4640
MongoCluster,
4741
void,
4842
ListConnectionStringsResult
4943
>;
50-
@doc("Check if mongo cluster name is available for use.")
44+
/** Check if mongo cluster name is available for use. */
5145
@action("checkMongoClusterNameAvailability")
5246
checkNameAvailability is checkLocalNameAvailability;
5347
}
5448

55-
@doc("The properties of a mongo cluster.")
49+
/** The properties of a mongo cluster. */
5650
model MongoClusterProperties {
57-
@doc("The mode to create a mongo cluster.")
51+
/** The mode to create a mongo cluster. */
5852
@visibility("create")
5953
createMode?: CreateMode;
6054

61-
@doc("The parameters to create a point-in-time restore mongo cluster.")
55+
/** The parameters to create a point-in-time restore mongo cluster. */
6256
@visibility("create")
6357
restoreParameters?: MongoClusterRestoreParameters;
6458

65-
@doc("The administrator's login for the mongo cluster.")
59+
/** The administrator's login for the mongo cluster. */
6660
@visibility("read", "create", "update")
6761
administratorLogin?: string;
6862

69-
@doc("The password of the administrator login.")
63+
/** The password of the administrator login. */
7064
@visibility("create", "update")
7165
@secret
7266
administratorLoginPassword?: string;
7367

74-
@doc("The Mongo DB server version. Defaults to the latest available version if not specified.")
68+
/** The Mongo DB server version. Defaults to the latest available version if not specified. */
7569
serverVersion?: string;
7670

77-
@doc("The default mongo connection string for the cluster.")
71+
/** The default mongo connection string for the cluster. */
7872
@visibility("read")
7973
connectionString?: string;
8074

81-
@doc("Earliest restore timestamp in UTC ISO8601 format.")
75+
/** Earliest restore timestamp in UTC ISO8601 format. */
8276
@visibility("read")
8377
earliestRestoreTime?: string;
8478

85-
@doc("The provisioning state of the mongo cluster.")
79+
/** The provisioning state of the mongo cluster. */
8680
@visibility("read")
8781
provisioningState?: ProvisioningState;
8882

89-
@doc("The status of the mongo cluster.")
83+
/** The status of the mongo cluster. */
9084
@visibility("read")
9185
clusterStatus?: MongoClusterStatus;
9286

93-
@doc("Whether or not public endpoint access is allowed for this mongo cluster.")
87+
/** Whether or not public endpoint access is allowed for this mongo cluster. */
9488
publicNetworkAccess?: PublicNetworkAccess;
9589

96-
@doc("The list of node group specs in the cluster.")
90+
/** The list of node group specs in the cluster. */
9791
@extension("x-ms-identifiers", [])
9892
nodeGroupSpecs?: NodeGroupSpec[];
9993

100-
@doc("List of private endpoint connections.")
94+
/** List of private endpoint connections. */
10195
@visibility("read")
10296
privateEndpointConnections?: PrivateEndpointConnection[];
10397
}
10498

105-
@doc("The mode that the Mongo Cluster is created with.")
99+
/** The mode that the Mongo Cluster is created with. */
106100
union CreateMode {
107101
string,
108102

109-
@doc("Create a new mongo cluster.")
103+
/** Create a new mongo cluster. */
110104
"Default",
111105

112-
@doc("Create a mongo cluster from a restore point-in-time.")
106+
/** Create a mongo cluster from a restore point-in-time. */
113107
"PointInTimeRestore",
114108
}
115109

116-
@doc("The kind of the node on the cluster.")
110+
/** The kind of the node on the cluster. */
117111
union NodeKind {
118112
string,
119113

120-
@doc("The node is a shard kind.")
114+
/** The node is a shard kind. */
121115
"Shard",
122116
}
123117

124-
@doc("Parameters used for restore operations")
118+
/** Parameters used for restore operations */
125119
model MongoClusterRestoreParameters {
120+
/** UTC point in time to restore a mongo cluster */
126121
#suppress "@azure-tools/typespec-azure-core/casing-style" "Capitialized acronym in the property name."
127-
@doc("UTC point in time to restore a mongo cluster")
128122
pointInTimeUTC?: utcDateTime;
129123

130-
@doc("Resource ID to locate the source cluster to restore")
124+
/** Resource ID to locate the source cluster to restore */
131125
sourceResourceId?: string;
132126
}
133127

134-
@doc("Specification for a node group.")
128+
/** Specification for a node group. */
135129
model NodeGroupSpec is NodeGroupProperties {
136-
@doc("The node type deployed in the node group.")
130+
/** The node type deployed in the node group. */
137131
kind?: NodeKind;
138132

139-
@doc("The number of nodes in the node group.")
133+
/** The number of nodes in the node group. */
140134
nodeCount?: int32;
141135
}
142136

143-
@doc("The properties of the node group on a cluster.")
137+
/** The properties of the node group on a cluster. */
144138
model NodeGroupProperties {
145-
@doc("The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'.")
139+
/** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */
146140
sku?: string;
147141

142+
/** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */
148143
#suppress "@azure-tools/typespec-azure-core/casing-style" "Capitialized acronym in the property name."
149-
@doc("The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024.")
150144
diskSizeGB?: int64;
151145

152-
@doc("Whether high availability is enabled on the node group.")
146+
/** Whether high availability is enabled on the node group. */
153147
enableHa?: boolean;
154148
}
155149

156-
@doc("The connection strings for the given mongo cluster.")
150+
/** The connection strings for the given mongo cluster. */
157151
model ListConnectionStringsResult {
158-
@doc("An array that contains the connection strings for a mongo cluster.")
152+
/** An array that contains the connection strings for a mongo cluster. */
159153
@visibility("read")
160154
@extension("x-ms-identifiers", [])
161155
connectionStrings?: ConnectionString[];
162156
}
163157

164-
@doc("Connection string for the mongo cluster")
158+
/** Connection string for the mongo cluster */
165159
model ConnectionString {
160+
/** Value of the connection string */
166161
#suppress "@azure-tools/typespec-azure-core/property-name-conflict" "https://github.com/Azure/typespec-azure/issues/417"
167-
@doc("Value of the connection string")
168162
@visibility("read")
169163
@clientName("uri", "csharp")
170164
connectionString?: string;
171165

172-
@doc("Description of the connection string")
166+
/** Description of the connection string */
173167
@visibility("read")
174168
description?: string;
175169
}
176170

177-
@doc("The status of the Mongo cluster resource.")
171+
/** The status of the Mongo cluster resource. */
178172
union MongoClusterStatus {
179173
string,
180174

181-
@doc("The mongo cluster resource is ready for use.")
175+
/** The mongo cluster resource is ready for use. */
182176
"Ready",
183177

184-
@doc("The mongo cluster resource is being provisioned.")
178+
/** The mongo cluster resource is being provisioned. */
185179
"Provisioning",
186180

187-
@doc("The mongo cluster resource is being updated.")
181+
/** The mongo cluster resource is being updated. */
188182
"Updating",
189183

190-
@doc("The mongo cluster resource is being started.")
184+
/** The mongo cluster resource is being started. */
191185
"Starting",
192186

193-
@doc("The mongo cluster resource is being stopped.")
187+
/** The mongo cluster resource is being stopped. */
194188
"Stopping",
195189

196-
@doc("The mongo cluster resource is stopped.")
190+
/** The mongo cluster resource is stopped. */
197191
"Stopped",
198192

199-
@doc("The mongo cluster resource is being dropped.")
193+
/** The mongo cluster resource is being dropped. */
200194
"Dropping",
201195
}
202196

203-
@doc("Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled'")
197+
/** Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled' */
204198
union PublicNetworkAccess {
205199
string,
206200

207-
@doc("If set, mongo cluster can be accessed through private and public methods.")
201+
/** If set, mongo cluster can be accessed through private and public methods. */
208202
"Enabled",
209203

210-
@doc("If set, the private endpoints are the exclusive access method.")
204+
/** If set, the private endpoints are the exclusive access method. */
211205
"Disabled",
212206
}

specification/mongocluster/DocumentDB.MongoCluster.Management/PrivateEndpointConnection.tsp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
import "@typespec/http";
2-
import "@typespec/rest";
3-
import "@azure-tools/typespec-azure-core";
4-
import "@azure-tools/typespec-azure-resource-manager";
5-
import "./common.tsp";
6-
import "./MongoCluster.tsp";
7-
81
using TypeSpec.Http;
92
using TypeSpec.Rest;
103
using Azure.ResourceManager;
@@ -25,7 +18,13 @@ interface PrivateEndpointConnections {
2518
get is ArmResourceRead<PrivateEndpointConnectionResource>;
2619
/** Create a Private endpoint connection */
2720
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "Need to support existing 202 response for PUT operations"
28-
create is Operations.ArmResourceCreateOrUpdateWithAcceptedAsync<PrivateEndpointConnectionResource>;
21+
create is ArmResourceCreateOrReplaceAsync<
22+
PrivateEndpointConnectionResource,
23+
Response = ArmAcceptedLroResponse<"Resource operation accepted."> | ArmResourceUpdatedResponse<PrivateEndpointConnectionResource> | ArmResourceCreatedResponse<
24+
PrivateEndpointConnectionResource,
25+
LroHeaders = {}
26+
>
27+
>;
2928
/** Delete the private endpoint connection */
3029
delete is ArmResourceDeleteWithoutOkAsync<PrivateEndpointConnectionResource>;
3130
}

0 commit comments

Comments
 (0)