Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mysql replica APIs into spec #3216

Merged
merged 4 commits into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"parameters": {
"serverName": "testmaster",
"resourceGroupName": "TestGroup",
"api-version": "2017-12-01",
"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",
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster",
"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",
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster",
"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",
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster",
"replicaCapacity": 0
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver"
}
}
},
"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",
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver",
"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",
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver",
"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": {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"masterServerId": "",
"replicaCapacity": 5
},
"location": "westus",
"tags": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the API it looks like replicas is a resource type and GET on this resource type is returning a resource of another type. Is there a way to expose this via the GET on /servers and using a filter query parameter to only show the replica servers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replica server is also a server, not a new resource type. Replica - Primary is a relation between two servers. This API is to get all replica servers that belongs to a specified (primary) server, not all replica servers in a resource group.

}
}
},
"x-ms-pageable": {
"nextLinkName": null
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}": {
"put": {
"tags": [
Expand Down Expand Up @@ -1319,6 +1361,20 @@
"storageProfile": {
"$ref": "#/definitions/StorageProfile",
"description": "Storage profile of a server."
},
"replicationRole": {
"type": "string",
"description": "The replication role of the server."
},
"masterServerId": {
"type": "string",
"description": "The master server id of a relica server."
},
"replicaCapacity": {
"type": "integer",
"format": "int32",
"minimum": 0,
"description": "The maximum number of replicas that a master server can have."
}
},
"description": "The properties of a server."
Expand Down Expand Up @@ -1373,7 +1429,8 @@
"enum": [
"Default",
"PointInTimeRestore",
"GeoRestore"
"GeoRestore",
"Replica"
],
"x-ms-enum": {
"name": "CreateMode",
Expand Down Expand Up @@ -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 master server id to create replica from."
}
},
"required": [
"sourceServerId"
],
"description": "The properties to create a new replica."
},
"Sku": {
"properties": {
"name": {
Expand Down Expand Up @@ -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,
Expand Down