Skip to content

Commit d222b8d

Browse files
Suna-MSanuchandy
authored andcommitted
Add mysql replica APIs into spec (#3216)
* Add mysql replica APIs into spec * Fix comment: update api-version in example file * Fix camel case in path * Change 'primary' to 'master' in replication specs
1 parent 35a0cef commit d222b8d

File tree

4 files changed

+280
-5
lines changed

4 files changed

+280
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"parameters": {
3+
"serverName": "testmaster",
4+
"resourceGroupName": "TestGroup",
5+
"api-version": "2017-12-01",
6+
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff"
7+
},
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"value": [
12+
{
13+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver",
14+
"name": "testserver",
15+
"type": "Microsoft.DBforMySQL/servers",
16+
"location": "northeurope",
17+
"tags": {
18+
"elasticServer": "1"
19+
},
20+
"sku": {
21+
"name": "GP_Gen4_2",
22+
"tier": "GeneralPurpose",
23+
"family": "Gen4",
24+
"capacity": 2
25+
},
26+
"properties": {
27+
"storageProfile": {
28+
"storageMB": 256000,
29+
"backupRetentionDays": 35,
30+
"geoRedundantBackup": "Enabled"
31+
},
32+
"administratorLogin": "cloudsa",
33+
"sslEnforcement":"Enabled",
34+
"userVisibleState": "Ready",
35+
"fullyQualifiedDomainName": "testserver.mysql.database.azure.com",
36+
"version": "5.6",
37+
"earliestRestoreDate": "2018-06-11T23:56:54.3+00:00",
38+
"replicationRole": "Replica",
39+
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster",
40+
"replicaCapacity": 0
41+
}
42+
},
43+
{
44+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver1",
45+
"name": "testserver1",
46+
"type": "Microsoft.DBforMySQL/servers",
47+
"location": "northeurope",
48+
"tags": {
49+
"elasticServer": "1"
50+
},
51+
"sku": {
52+
"name": "GP_Gen4_2",
53+
"tier": "GeneralPurpose",
54+
"family": "Gen4",
55+
"capacity": 2
56+
},
57+
"properties": {
58+
"storageProfile": {
59+
"storageMB": 256000,
60+
"backupRetentionDays": 35,
61+
"geoRedundantBackup": "Enabled"
62+
},
63+
"administratorLogin": "cloudsa",
64+
"sslEnforcement":"Enabled",
65+
"userVisibleState": "Ready",
66+
"fullyQualifiedDomainName": "testserver1.mysql.database.azure.com",
67+
"version": "5.6",
68+
"earliestRestoreDate": "2018-06-11T23:56:54.3+00:00",
69+
"replicationRole": "Replica",
70+
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster",
71+
"replicaCapacity": 0
72+
}
73+
},
74+
{
75+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver2",
76+
"name": "testserver2",
77+
"type": "Microsoft.DBforMySQL/servers",
78+
"location": "northeurope",
79+
"tags": {
80+
"elasticServer": "1"
81+
},
82+
"sku": {
83+
"name": "GP_Gen4_2",
84+
"tier": "GeneralPurpose",
85+
"family": "Gen4",
86+
"capacity": 2
87+
},
88+
"properties": {
89+
"storageProfile": {
90+
"storageMB": 256000,
91+
"backupRetentionDays": 35,
92+
"geoRedundantBackup": "Enabled"
93+
},
94+
"administratorLogin": "cloudsa",
95+
"sslEnforcement":"Enabled",
96+
"userVisibleState": "Ready",
97+
"fullyQualifiedDomainName": "testserver2.mysql.database.azure.com",
98+
"version": "5.6",
99+
"earliestRestoreDate": "2018-06-11T23:56:54.3+00:00",
100+
"replicationRole": "Replica",
101+
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster",
102+
"replicaCapacity": 0
103+
}
104+
}
105+
]
106+
}
107+
}
108+
}
109+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"parameters": {
3+
"serverName": "targetserver",
4+
"resourceGroupName": "TargetResourceGroup",
5+
"api-version": "2017-12-01",
6+
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff",
7+
"parameters": {
8+
"location": "westus",
9+
"properties": {
10+
"createMode": "Replica",
11+
"sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver"
12+
}
13+
}
14+
},
15+
"responses": {
16+
"201": {
17+
"body": {
18+
"sku": {
19+
"name": "GP_Gen4_2",
20+
"tier": "GeneralPurpose",
21+
"family": "Gen4",
22+
"capacity": 2
23+
},
24+
"properties": {
25+
"administratorLogin": "cloudsa",
26+
"storageProfile": {
27+
"storageMB": 128000,
28+
"backupRetentionDays": 14,
29+
"geoRedundantBackup": "Enabled"
30+
},
31+
"version": "5.7",
32+
"sslEnforcement": "Enabled",
33+
"userVisibleState": "Ready",
34+
"fullyQualifiedDomainName": "targetserver.mysql.database.azure.com",
35+
"earliestRestoreDate": "2018-03-14T18:02:41.577+00:00",
36+
"replicationRole": "Replica",
37+
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver",
38+
"replicaCapacity": 0
39+
},
40+
"location": "westus",
41+
"tags": {
42+
"ElasticServer": "1"
43+
},
44+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/servers/targetserver",
45+
"name": "targetserver",
46+
"type": "Microsoft.DBforMySQL/servers"
47+
}
48+
},
49+
"200": {
50+
"body": {
51+
"sku": {
52+
"name": "GP_Gen4_2",
53+
"tier": "GeneralPurpose",
54+
"family": "Gen4",
55+
"capacity": 2
56+
},
57+
"properties": {
58+
"administratorLogin": "cloudsa",
59+
"storageProfile": {
60+
"storageMB": 128000,
61+
"backupRetentionDays": 14,
62+
"geoRedundantBackup": "Enabled"
63+
},
64+
"version": "5.7",
65+
"sslEnforcement": "Enabled",
66+
"userVisibleState": "Ready",
67+
"fullyQualifiedDomainName": "targetserver.mysql.database.azure.com",
68+
"earliestRestoreDate": "2018-03-14T18:02:41.577+00:00",
69+
"replicationRole": "Replica",
70+
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver",
71+
"replicaCapacity": 0
72+
},
73+
"location": "westus",
74+
"tags": {
75+
"ElasticServer": "1"
76+
},
77+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/servers/targetserver",
78+
"name": "targetserver",
79+
"type": "Microsoft.DBforMySQL/servers"
80+
}
81+
},
82+
"202": {}
83+
}
84+
}

specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
"sslEnforcement": "Enabled",
2626
"userVisibleState": "Ready",
2727
"fullyQualifiedDomainName": "mysqltestsvc4.mysql.database.azure.com",
28-
"earliestRestoreDate": "2018-03-14T18:02:41.577+00:00"
28+
"earliestRestoreDate": "2018-03-14T18:02:41.577+00:00",
29+
"replicationRole": "None",
30+
"masterServerId": "",
31+
"replicaCapacity": 5
2932
},
3033
"location": "westus",
3134
"tags": {

specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@
4444
"Create a new server": {
4545
"$ref": "./examples/ServerCreate.json"
4646
},
47-
"Create a database as a point in time restore":{
47+
"Create a database as a point in time restore": {
4848
"$ref":"./examples/ServerCreatePointInTimeRestore.json"
4949
},
50-
"Create a server as a geo restore ": {
50+
"Create a server as a geo restore ": {
5151
"$ref": "./examples/ServerCreateGeoRestoreMode.json"
52+
},
53+
"Create a replica server": {
54+
"$ref": "./examples/ServerCreateReplicaMode.json"
5255
}
5356
},
5457
"description": "Creates a new server or updates an existing server. The update action will overwrite the existing server.",
@@ -283,6 +286,45 @@
283286
}
284287
}
285288
},
289+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/replicas": {
290+
"get": {
291+
"tags": [
292+
"Replicas"
293+
],
294+
"operationId": "Replicas_ListByServer",
295+
"x-ms-examples": {
296+
"ReplicasListByServer": {
297+
"$ref": "./examples/ReplicasListByServer.json"
298+
}
299+
},
300+
"description": "List all the replicas for a given server.",
301+
"parameters": [
302+
{
303+
"$ref": "#/parameters/ApiVersionParameter"
304+
},
305+
{
306+
"$ref": "#/parameters/SubscriptionIdParameter"
307+
},
308+
{
309+
"$ref": "#/parameters/ResourceGroupParameter"
310+
},
311+
{
312+
"$ref": "#/parameters/ServerNameParameter"
313+
}
314+
],
315+
"responses": {
316+
"200": {
317+
"description": "OK",
318+
"schema": {
319+
"$ref": "#/definitions/ServerListResult"
320+
}
321+
}
322+
},
323+
"x-ms-pageable": {
324+
"nextLinkName": null
325+
}
326+
}
327+
},
286328
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}": {
287329
"put": {
288330
"tags": [
@@ -1319,6 +1361,20 @@
13191361
"storageProfile": {
13201362
"$ref": "#/definitions/StorageProfile",
13211363
"description": "Storage profile of a server."
1364+
},
1365+
"replicationRole": {
1366+
"type": "string",
1367+
"description": "The replication role of the server."
1368+
},
1369+
"masterServerId": {
1370+
"type": "string",
1371+
"description": "The master server id of a relica server."
1372+
},
1373+
"replicaCapacity": {
1374+
"type": "integer",
1375+
"format": "int32",
1376+
"minimum": 0,
1377+
"description": "The maximum number of replicas that a master server can have."
13221378
}
13231379
},
13241380
"description": "The properties of a server."
@@ -1373,7 +1429,8 @@
13731429
"enum": [
13741430
"Default",
13751431
"PointInTimeRestore",
1376-
"GeoRestore"
1432+
"GeoRestore",
1433+
"Replica"
13771434
],
13781435
"x-ms-enum": {
13791436
"name": "CreateMode",
@@ -1448,7 +1505,25 @@
14481505
"sourceServerId"
14491506
],
14501507
"description": "The properties used to create a new server by restoring to a different region from a geo replicated backup."
1451-
},
1508+
},
1509+
"ServerPropertiesForReplica": {
1510+
"x-ms-discriminator-value": "Replica",
1511+
"allOf": [
1512+
{
1513+
"$ref": "#/definitions/ServerPropertiesForCreate"
1514+
}
1515+
],
1516+
"properties": {
1517+
"sourceServerId": {
1518+
"type": "string",
1519+
"description": "The master server id to create replica from."
1520+
}
1521+
},
1522+
"required": [
1523+
"sourceServerId"
1524+
],
1525+
"description": "The properties to create a new replica."
1526+
},
14521527
"Sku": {
14531528
"properties": {
14541529
"name": {
@@ -1557,6 +1632,10 @@
15571632
"sslEnforcement": {
15581633
"$ref": "#/definitions/SslEnforcement",
15591634
"description": "Enable ssl enforcement or not when connect to server."
1635+
},
1636+
"replicationRole": {
1637+
"type": "string",
1638+
"description": "The replication role of the server."
15601639
}
15611640
},
15621641
"x-ms-client-flatten": true,

0 commit comments

Comments
 (0)