From f1d83b06ff7610d37e0edc709ce6106d012b1cb5 Mon Sep 17 00:00:00 2001 From: suna Liu Date: Tue, 12 Jun 2018 14:02:17 +0800 Subject: [PATCH 1/4] Add mysql replica APIs into spec --- .../examples/ReplicasListByServer.json | 109 ++++++++++++++++++ .../examples/ServerCreateReplicaMode.json | 84 ++++++++++++++ .../stable/2017-12-01/examples/ServerGet.json | 5 +- .../stable/2017-12-01/mysql.json | 87 +++++++++++++- 4 files changed, 280 insertions(+), 5 deletions(-) create mode 100644 specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json create mode 100644 specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json new file mode 100644 index 000000000000..2d8024f13d98 --- /dev/null +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json @@ -0,0 +1,109 @@ +{ + "parameters": { + "serverName": "testprimary", + "resourceGroupName": "TestGroup", + "api-version": "2017-12-01-preview", + "subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver", + "name": "testserver", + "type": "Microsoft.DBforMySQL/servers", + "location": "northeurope", + "tags": { + "elasticServer": "1" + }, + "sku": { + "name": "GP_Gen4_2", + "tier": "GeneralPurpose", + "family": "Gen4", + "capacity": 2 + }, + "properties": { + "storageProfile": { + "storageMB": 256000, + "backupRetentionDays": 35, + "geoRedundantBackup": "Enabled" + }, + "administratorLogin": "cloudsa", + "sslEnforcement":"Enabled", + "userVisibleState": "Ready", + "fullyQualifiedDomainName": "testserver.mysql.database.azure.com", + "version": "5.6", + "earliestRestoreDate": "2018-06-11T23:56:54.3+00:00", + "replicationRole": "Replica", + "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testprimary", + "replicaCapacity": 0 + } + }, + { + "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver1", + "name": "testserver1", + "type": "Microsoft.DBforMySQL/servers", + "location": "northeurope", + "tags": { + "elasticServer": "1" + }, + "sku": { + "name": "GP_Gen4_2", + "tier": "GeneralPurpose", + "family": "Gen4", + "capacity": 2 + }, + "properties": { + "storageProfile": { + "storageMB": 256000, + "backupRetentionDays": 35, + "geoRedundantBackup": "Enabled" + }, + "administratorLogin": "cloudsa", + "sslEnforcement":"Enabled", + "userVisibleState": "Ready", + "fullyQualifiedDomainName": "testserver1.mysql.database.azure.com", + "version": "5.6", + "earliestRestoreDate": "2018-06-11T23:56:54.3+00:00", + "replicationRole": "Replica", + "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testprimary", + "replicaCapacity": 0 + } + }, + { + "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver2", + "name": "testserver2", + "type": "Microsoft.DBforMySQL/servers", + "location": "northeurope", + "tags": { + "elasticServer": "1" + }, + "sku": { + "name": "GP_Gen4_2", + "tier": "GeneralPurpose", + "family": "Gen4", + "capacity": 2 + }, + "properties": { + "storageProfile": { + "storageMB": 256000, + "backupRetentionDays": 35, + "geoRedundantBackup": "Enabled" + }, + "administratorLogin": "cloudsa", + "sslEnforcement":"Enabled", + "userVisibleState": "Ready", + "fullyQualifiedDomainName": "testserver2.mysql.database.azure.com", + "version": "5.6", + "earliestRestoreDate": "2018-06-11T23:56:54.3+00:00", + "replicationRole": "Replica", + "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testprimary", + "replicaCapacity": 0 + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json new file mode 100644 index 000000000000..29b45ed52dc7 --- /dev/null +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json @@ -0,0 +1,84 @@ +{ + "parameters": { + "serverName": "targetserver", + "resourceGroupName": "TargetResourceGroup", + "api-version": "2017-12-01", + "subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff", + "parameters": { + "location": "westus", + "properties": { + "createMode": "Replica", + "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/PrimaryResourceGroup/providers/Microsoft.DBforMySQL/servers/primaryserver" + } + } + }, + "responses": { + "201": { + "body": { + "sku": { + "name": "GP_Gen4_2", + "tier": "GeneralPurpose", + "family": "Gen4", + "capacity": 2 + }, + "properties": { + "administratorLogin": "cloudsa", + "storageProfile": { + "storageMB": 128000, + "backupRetentionDays": 14, + "geoRedundantBackup": "Enabled" + }, + "version": "5.7", + "sslEnforcement": "Enabled", + "userVisibleState": "Ready", + "fullyQualifiedDomainName": "targetserver.mysql.database.azure.com", + "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00", + "replicationRole": "Replica", + "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/PrimaryResourceGroup/providers/Microsoft.DBforMySQL/servers/primaryserver", + "replicaCapacity": 0 + }, + "location": "westus", + "tags": { + "ElasticServer": "1" + }, + "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/servers/targetserver", + "name": "targetserver", + "type": "Microsoft.DBforMySQL/servers" + } + }, + "200": { + "body": { + "sku": { + "name": "GP_Gen4_2", + "tier": "GeneralPurpose", + "family": "Gen4", + "capacity": 2 + }, + "properties": { + "administratorLogin": "cloudsa", + "storageProfile": { + "storageMB": 128000, + "backupRetentionDays": 14, + "geoRedundantBackup": "Enabled" + }, + "version": "5.7", + "sslEnforcement": "Enabled", + "userVisibleState": "Ready", + "fullyQualifiedDomainName": "targetserver.mysql.database.azure.com", + "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00", + "replicationRole": "Replica", + "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/PrimaryResourceGroup/providers/Microsoft.DBforMySQL/servers/primaryserver", + "replicaCapacity": 0 + }, + "location": "westus", + "tags": { + "ElasticServer": "1" + }, + "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/servers/targetserver", + "name": "targetserver", + "type": "Microsoft.DBforMySQL/servers" + } + }, + "202": {} + } +} \ No newline at end of file diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json index 87165071f53c..ba4d728b5e99 100644 --- a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json @@ -25,7 +25,10 @@ "sslEnforcement": "Enabled", "userVisibleState": "Ready", "fullyQualifiedDomainName": "mysqltestsvc4.mysql.database.azure.com", - "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00" + "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00", + "replicationRole": "None", + "primaryServerId": "", + "replicaCapacity": 5 }, "location": "westus", "tags": { diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json index 32be2de610b5..014571c5a3c3 100644 --- a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json @@ -44,11 +44,14 @@ "Create a new server": { "$ref": "./examples/ServerCreate.json" }, - "Create a database as a point in time restore":{ + "Create a database as a point in time restore": { "$ref":"./examples/ServerCreatePointInTimeRestore.json" }, - "Create a server as a geo restore ": { + "Create a server as a geo restore ": { "$ref": "./examples/ServerCreateGeoRestoreMode.json" + }, + "Create a replica server": { + "$ref": "./examples/ServerCreateReplicaMode.json" } }, "description": "Creates a new server or updates an existing server. The update action will overwrite the existing server.", @@ -283,6 +286,45 @@ } } }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/Replicas": { + "get": { + "tags": [ + "Replicas" + ], + "operationId": "Replicas_ListByServer", + "x-ms-examples": { + "ReplicasListByServer": { + "$ref": "./examples/ReplicasListByServer.json" + } + }, + "description": "List all the replicas for a given server.", + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/ResourceGroupParameter" + }, + { + "$ref": "#/parameters/ServerNameParameter" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ServerListResult" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}": { "put": { "tags": [ @@ -1319,6 +1361,20 @@ "storageProfile": { "$ref": "#/definitions/StorageProfile", "description": "Storage profile of a server." + }, + "replicationRole": { + "type": "string", + "description": "The replication role of the server." + }, + "primaryServerId": { + "type": "string", + "description": "The primary server id of a relica server." + }, + "replicaCapacity": { + "type": "integer", + "format": "int32", + "minimum": 0, + "description": "The maximum number of replicas that a primary server can have." } }, "description": "The properties of a server." @@ -1373,7 +1429,8 @@ "enum": [ "Default", "PointInTimeRestore", - "GeoRestore" + "GeoRestore", + "Replica" ], "x-ms-enum": { "name": "CreateMode", @@ -1448,7 +1505,25 @@ "sourceServerId" ], "description": "The properties used to create a new server by restoring to a different region from a geo replicated backup." - }, + }, + "ServerPropertiesForReplica": { + "x-ms-discriminator-value": "Replica", + "allOf": [ + { + "$ref": "#/definitions/ServerPropertiesForCreate" + } + ], + "properties": { + "sourceServerId": { + "type": "string", + "description": "The primary server id to create replica from." + } + }, + "required": [ + "sourceServerId" + ], + "description": "The properties to create a new replica." + }, "Sku": { "properties": { "name": { @@ -1557,6 +1632,10 @@ "sslEnforcement": { "$ref": "#/definitions/SslEnforcement", "description": "Enable ssl enforcement or not when connect to server." + }, + "replicationRole": { + "type": "string", + "description": "The replication role of the server." } }, "x-ms-client-flatten": true, From a7c1b90cc925fabee4eb61520efe6d7897333b01 Mon Sep 17 00:00:00 2001 From: suna Liu Date: Thu, 14 Jun 2018 13:19:10 +0800 Subject: [PATCH 2/4] Fix comment: update api-version in example file --- .../stable/2017-12-01/examples/ReplicasListByServer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json index 2d8024f13d98..70f132574f33 100644 --- a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json @@ -2,7 +2,7 @@ "parameters": { "serverName": "testprimary", "resourceGroupName": "TestGroup", - "api-version": "2017-12-01-preview", + "api-version": "2017-12-01", "subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff" }, "responses": { From 886c92121aba83cead8203b4f9435f99c524baab Mon Sep 17 00:00:00 2001 From: suna Liu Date: Thu, 21 Jun 2018 17:17:52 +0800 Subject: [PATCH 3/4] Fix camel case in path --- .../Microsoft.DBforMySQL/stable/2017-12-01/mysql.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json index 014571c5a3c3..7cd2c33921d2 100644 --- a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json @@ -286,7 +286,7 @@ } } }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/Replicas": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/replicas": { "get": { "tags": [ "Replicas" From 76883a32f2c9aa596a7c0ceefb356637708d6ed3 Mon Sep 17 00:00:00 2001 From: suna Liu Date: Mon, 23 Jul 2018 10:31:51 +0800 Subject: [PATCH 4/4] Change 'primary' to 'master' in replication specs --- .../stable/2017-12-01/examples/ReplicasListByServer.json | 8 ++++---- .../2017-12-01/examples/ServerCreateReplicaMode.json | 6 +++--- .../stable/2017-12-01/examples/ServerGet.json | 2 +- .../Microsoft.DBforMySQL/stable/2017-12-01/mysql.json | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json index 70f132574f33..931fd7889be2 100644 --- a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json @@ -1,6 +1,6 @@ { "parameters": { - "serverName": "testprimary", + "serverName": "testmaster", "resourceGroupName": "TestGroup", "api-version": "2017-12-01", "subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff" @@ -36,7 +36,7 @@ "version": "5.6", "earliestRestoreDate": "2018-06-11T23:56:54.3+00:00", "replicationRole": "Replica", - "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testprimary", + "masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster", "replicaCapacity": 0 } }, @@ -67,7 +67,7 @@ "version": "5.6", "earliestRestoreDate": "2018-06-11T23:56:54.3+00:00", "replicationRole": "Replica", - "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testprimary", + "masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster", "replicaCapacity": 0 } }, @@ -98,7 +98,7 @@ "version": "5.6", "earliestRestoreDate": "2018-06-11T23:56:54.3+00:00", "replicationRole": "Replica", - "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testprimary", + "masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster", "replicaCapacity": 0 } } diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json index 29b45ed52dc7..c9857560febb 100644 --- a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json @@ -8,7 +8,7 @@ "location": "westus", "properties": { "createMode": "Replica", - "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/PrimaryResourceGroup/providers/Microsoft.DBforMySQL/servers/primaryserver" + "sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver" } } }, @@ -34,7 +34,7 @@ "fullyQualifiedDomainName": "targetserver.mysql.database.azure.com", "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00", "replicationRole": "Replica", - "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/PrimaryResourceGroup/providers/Microsoft.DBforMySQL/servers/primaryserver", + "masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver", "replicaCapacity": 0 }, "location": "westus", @@ -67,7 +67,7 @@ "fullyQualifiedDomainName": "targetserver.mysql.database.azure.com", "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00", "replicationRole": "Replica", - "primaryServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/PrimaryResourceGroup/providers/Microsoft.DBforMySQL/servers/primaryserver", + "masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver", "replicaCapacity": 0 }, "location": "westus", diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json index ba4d728b5e99..381f09f4870d 100644 --- a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json @@ -27,7 +27,7 @@ "fullyQualifiedDomainName": "mysqltestsvc4.mysql.database.azure.com", "earliestRestoreDate": "2018-03-14T18:02:41.577+00:00", "replicationRole": "None", - "primaryServerId": "", + "masterServerId": "", "replicaCapacity": 5 }, "location": "westus", diff --git a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json index 7cd2c33921d2..3bc599427fd3 100644 --- a/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json +++ b/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/mysql.json @@ -1366,15 +1366,15 @@ "type": "string", "description": "The replication role of the server." }, - "primaryServerId": { + "masterServerId": { "type": "string", - "description": "The primary server id of a relica server." + "description": "The master server id of a relica server." }, "replicaCapacity": { "type": "integer", "format": "int32", "minimum": 0, - "description": "The maximum number of replicas that a primary server can have." + "description": "The maximum number of replicas that a master server can have." } }, "description": "The properties of a server." @@ -1516,7 +1516,7 @@ "properties": { "sourceServerId": { "type": "string", - "description": "The primary server id to create replica from." + "description": "The master server id to create replica from." } }, "required": [