Skip to content

Commit 26ef77f

Browse files
rishky1001guptaheenanitishsharma25
authored andcommitted
Swagger changes for reader endpoint (#42930)
* swagger changes for reader endpoint * ran pretty * fix typos * resolving review comments (#42752) * Removing examples other than reader endpoint * Revert "Removing examples other than reader endpoint" This reverts commit 24f552a. --------- Co-authored-by: Heena Gupta <heenagupta@microsoft.com> Co-authored-by: Nitish Sharma <nitishsharma@microsoft.com>
1 parent 9768490 commit 26ef77f

7 files changed

Lines changed: 459 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "@typespec/versioning";
6+
import "./models.tsp";
7+
import "./Server.tsp";
8+
9+
using TypeSpec.Rest;
10+
using Azure.ResourceManager;
11+
using TypeSpec.Versioning;
12+
13+
namespace Microsoft.DBforMySQL;
14+
/**
15+
* A server's Reader Endpoint.
16+
*/
17+
@parentResource(Server)
18+
@added(Versions.v2025_12_01_preview)
19+
model ReaderEndpoint
20+
is Azure.ResourceManager.ProxyResource<ReaderEndpointProperties> {
21+
...ResourceNameParameter<
22+
Resource = ReaderEndpoint,
23+
KeyName = "readerEndpointName",
24+
SegmentName = "readerEndpoint",
25+
NamePattern = "^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*"
26+
>;
27+
}
28+
29+
@added(Versions.v2025_12_01_preview)
30+
@armResourceOperations
31+
interface ReaderEndpoints {
32+
/**
33+
* Get a server's Reader Endpoint
34+
*/
35+
get is ArmResourceRead<ReaderEndpoint>;
36+
37+
/**
38+
* Creates a server's Reader Endpoint.
39+
*/
40+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility"
41+
updatePut is ArmResourceCreateOrReplaceAsync<
42+
ReaderEndpoint,
43+
Response = ArmResourceUpdatedResponse<ReaderEndpoint> | ArmResourceCreatedResponse<ReaderEndpoint> | ArmAcceptedLroResponse
44+
>;
45+
46+
/**
47+
* Delete Reader Endpoint for a given server with specified reader endpoint name.
48+
*/
49+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "For backward compatibility"
50+
delete is ArmResourceDeleteWithoutOkAsync<
51+
ReaderEndpoint,
52+
LroHeaders = ArmAsyncOperationHeader &
53+
Azure.Core.Foundations.RetryAfterHeader
54+
>;
55+
56+
/**
57+
* Gets a list of server's Reader Endpoints.
58+
*/
59+
list is Azure.ResourceManager.Legacy.ArmListSinglePageByParent<
60+
ReaderEndpoint,
61+
Response = ArmResponse<ReaderEndpointList>
62+
>;
63+
}
64+
65+
@@doc(ReaderEndpoint.name, "The name of the Reader Endpoint.");
66+
@@doc(ReaderEndpoint.properties, "Resource properties.");
67+
@@doc(ReaderEndpoints.updatePut::parameters.resource,
68+
"The server's Reader Endpoint body to update."
69+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-12-01-preview",
4+
"parameters": {
5+
"properties": {
6+
"autoAddNewReplicas": true,
7+
"dnsTtl": 20,
8+
"failoverOnPrimary": false,
9+
"permissibleReplicationLag": 60,
10+
"readerEndpointConnections": [
11+
{
12+
"replicaName": "replica1.database.mysql.azure.com"
13+
},
14+
{
15+
"replicaName": "replica2.database.mysql.azure.com"
16+
}
17+
],
18+
"routingMethod": "Rotational"
19+
}
20+
},
21+
"readerEndpointName": "readerEndpoint1",
22+
"resourceGroupName": "testrg",
23+
"serverName": "mysqltestserver",
24+
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff"
25+
},
26+
"responses": {
27+
"200": {
28+
"body": {
29+
"name": "readerEndpoint1",
30+
"type": "Microsoft.DBforMySQL/flexibleServers/readerEndpoints",
31+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/readerEndpoints/readerEndpoint1",
32+
"properties": {
33+
"autoAddNewReplicas": true,
34+
"dnsTtl": 20,
35+
"failoverOnPrimary": false,
36+
"fullyQualifiedDomainName": "readerEndpoint1.reader.mysql.database.azure.com",
37+
"permissibleReplicationLag": 60,
38+
"provisioningState": "Provisioning",
39+
"readerEndpointConnections": [
40+
{
41+
"replicaName": "replica1.database.mysql.azure.com",
42+
"status": "Healthy"
43+
},
44+
{
45+
"replicaName": "replica2.database.mysql.azure.com",
46+
"status": "Healthy"
47+
}
48+
],
49+
"routingMethod": "Rotational"
50+
},
51+
"systemData": {
52+
"createdAt": "2025-07-21T16:41:33.937Z",
53+
"createdBy": "string",
54+
"createdByType": "User",
55+
"lastModifiedAt": "2025-07-21T16:41:33.937Z",
56+
"lastModifiedBy": "string",
57+
"lastModifiedByType": "User"
58+
}
59+
},
60+
"headers": {
61+
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/azureAsyncOperation/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2025-06-01-preview",
62+
"Location": "https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/operationResults/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2025-06-01-preview"
63+
}
64+
},
65+
"201": {
66+
"body": {
67+
"name": "readerEndpoint1",
68+
"type": "Microsoft.DBforMySQL/flexibleServers/readerEndpoints",
69+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/readerEndpoints/readerEndpoint1",
70+
"properties": {
71+
"autoAddNewReplicas": true,
72+
"dnsTtl": 20,
73+
"failoverOnPrimary": false,
74+
"fullyQualifiedDomainName": "readerEndpoint1.reader.mysql.database.azure.com",
75+
"permissibleReplicationLag": 60,
76+
"provisioningState": "Provisioning",
77+
"readerEndpointConnections": [
78+
{
79+
"replicaName": "replica1.database.mysql.azure.com",
80+
"status": "Healthy"
81+
},
82+
{
83+
"replicaName": "replica2.database.mysql.azure.com",
84+
"status": "Healthy"
85+
}
86+
],
87+
"routingMethod": "Rotational"
88+
},
89+
"systemData": {
90+
"createdAt": "2025-07-21T16:41:33.937Z",
91+
"createdBy": "string",
92+
"createdByType": "User",
93+
"lastModifiedAt": "2025-07-21T16:41:33.937Z",
94+
"lastModifiedBy": "string",
95+
"lastModifiedByType": "User"
96+
}
97+
},
98+
"headers": {
99+
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/azureAsyncOperation/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2025-06-01-preview",
100+
"Location": "https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/operationResults/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2025-06-01-preview"
101+
}
102+
}
103+
},
104+
"operationId": "ReaderEndpoints_UpdatePut",
105+
"title": "Create a server's Reader Endpoint"
106+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-12-01-preview",
4+
"readerEndpointName": "readerEndpoint1",
5+
"resourceGroupName": "testrg",
6+
"serverName": "mysqltestserver",
7+
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff"
8+
},
9+
"responses": {
10+
"202": {
11+
"headers": {
12+
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/azureAsyncOperation/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2025-06-01-preview",
13+
"Location": "https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/operationResults/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2025-06-01-preview"
14+
}
15+
},
16+
"204": {}
17+
},
18+
"operationId": "ReaderEndpoints_Delete",
19+
"title": "Deletes a reader endpoint for a server"
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-12-01-preview",
4+
"readerEndpointName": "readerEndpoint1",
5+
"resourceGroupName": "testrg",
6+
"serverName": "mysqltestserver",
7+
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff"
8+
},
9+
"responses": {
10+
"200": {
11+
"body": {
12+
"name": "readerEndpoint1",
13+
"type": "Microsoft.DBforMySQL/flexibleServers/readerEndpoints",
14+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/readerEndpoints/readerEndpoint1",
15+
"properties": {
16+
"autoAddNewReplicas": true,
17+
"dnsTtl": 20,
18+
"failoverOnPrimary": false,
19+
"fullyQualifiedDomainName": "readerEndpoint1.reader.mysql.database.azure.com",
20+
"permissibleReplicationLag": 60,
21+
"provisioningState": "Succeeded",
22+
"readerEndpointConnections": [
23+
{
24+
"replicaName": "replica1.database.mysql.azure.com",
25+
"status": "Healthy"
26+
},
27+
{
28+
"replicaName": "replica2.database.mysql.azure.com",
29+
"status": "Healthy"
30+
}
31+
],
32+
"routingMethod": "Rotational"
33+
},
34+
"systemData": {
35+
"createdAt": "2025-07-21T16:41:33.937Z",
36+
"createdBy": "string",
37+
"createdByType": "User",
38+
"lastModifiedAt": "2025-07-21T16:41:33.937Z",
39+
"lastModifiedBy": "string",
40+
"lastModifiedByType": "User"
41+
}
42+
}
43+
}
44+
},
45+
"operationId": "ReaderEndpoints_Get",
46+
"title": "Get a server's Reader Endpoint."
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"parameters": {
3+
"api-version": "2025-12-01-preview",
4+
"resourceGroupName": "testrg",
5+
"serverName": "mysqltestserver",
6+
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff"
7+
},
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"value": [
12+
{
13+
"name": "readerEndpoint1",
14+
"type": "Microsoft.DBforMySQL/flexibleServers/readerEndpoints",
15+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/readerEndpoints/readerEndpoint1",
16+
"properties": {
17+
"autoAddNewReplicas": true,
18+
"dnsTtl": 20,
19+
"failoverOnPrimary": false,
20+
"fullyQualifiedDomainName": "readerEndpoint1.reader.mysql.database.azure.com",
21+
"permissibleReplicationLag": 60,
22+
"provisioningState": "Succeeded",
23+
"readerEndpointConnections": [
24+
{
25+
"replicaName": "replica1.database.mysql.azure.com",
26+
"status": "Healthy"
27+
},
28+
{
29+
"replicaName": "replica2.database.mysql.azure.com",
30+
"status": "Healthy"
31+
}
32+
],
33+
"routingMethod": "Rotational"
34+
},
35+
"systemData": {
36+
"createdAt": "2025-07-21T16:41:33.937Z",
37+
"createdBy": "string",
38+
"createdByType": "User",
39+
"lastModifiedAt": "2025-07-21T16:41:33.937Z",
40+
"lastModifiedBy": "string",
41+
"lastModifiedByType": "User"
42+
}
43+
},
44+
{
45+
"name": "readerEndpoint2",
46+
"type": "Microsoft.DBforMySQL/flexibleServers/readerEndpoints",
47+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/readerEndpoints/readerEndpoint2",
48+
"properties": {
49+
"autoAddNewReplicas": true,
50+
"dnsTtl": 10,
51+
"failoverOnPrimary": false,
52+
"fullyQualifiedDomainName": "readerEndpoint2.reader.mysql.database.azure.com",
53+
"permissibleReplicationLag": 60,
54+
"provisioningState": "Succeeded",
55+
"readerEndpointConnections": [
56+
{
57+
"replicaName": "replica2.database.mysql.azure.com",
58+
"status": "Healthy"
59+
},
60+
{
61+
"replicaName": "replica3.database.mysql.azure.com",
62+
"status": "Healthy"
63+
}
64+
],
65+
"routingMethod": "Rotational"
66+
},
67+
"systemData": {
68+
"createdAt": "2025-07-22T16:41:33.937Z",
69+
"createdBy": "string",
70+
"createdByType": "User",
71+
"lastModifiedAt": "2025-07-22T16:41:33.937Z",
72+
"lastModifiedBy": "string",
73+
"lastModifiedByType": "User"
74+
}
75+
}
76+
]
77+
}
78+
}
79+
},
80+
"operationId": "ReaderEndpoints_List",
81+
"title": "Get list of server's Reader Endpoints"
82+
}

specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/main.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import "./PrivateEndpointConnection.tsp";
2727
import "./PrivateLinkResource.tsp";
2828
import "./routes.tsp";
2929
import "./FabricMirroringSettings.tsp";
30+
import "./ReaderEndpoint.tsp";
3031

3132
using TypeSpec.Rest;
3233
using TypeSpec.Http;

0 commit comments

Comments
 (0)