Skip to content

Commit 64adedb

Browse files
Flexible MySQL: Adding apis for BackupAndExport/LTR Backup (Azure#20675)
* Flexible MySQL: Adding apis for BackupAndExport/LTR Backup * Fixing model validation errors * Fixing lint errors * Fixing swagger api version * Prettier fix * Fixing lint check * Adding existing apis in readme for new tag * Changing prebackup response parameter and adding base class for storage details. * changes after PR comments 1. change name from "PreBackup" to "ValidateBackup" 2. add tag in backupFormat "INTERNAL - DO NOT USE" 3. change the order of securitydefinitions , title, paths * updated description for "CollatedFormat" do not use. just added description for "CollatedFormat" to not use. Co-authored-by: sumitkumams <107923889+sumitkumams@users.noreply.github.com>
1 parent 0f161c7 commit 64adedb

File tree

4 files changed

+412
-0
lines changed

4 files changed

+412
-0
lines changed
Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
{
2+
"swagger": "2.0",
3+
"consumes": [
4+
"application/json"
5+
],
6+
"host": "management.azure.com",
7+
"info": {
8+
"title": "MySQLManagementClient",
9+
"description": "The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules and configurations.",
10+
"version": "2022-08-01-privatepreview"
11+
},
12+
"securityDefinitions": {
13+
"azure_auth": {
14+
"type": "oauth2",
15+
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
16+
"flow": "implicit",
17+
"description": "Azure Active Directory OAuth2 Flow",
18+
"scopes": {
19+
"user_impersonation": "impersonate your user account"
20+
}
21+
}
22+
},
23+
"parameters": {
24+
"ServerNameParameter": {
25+
"name": "serverName",
26+
"in": "path",
27+
"required": true,
28+
"type": "string",
29+
"description": "The name of the server.",
30+
"x-ms-parameter-location": "method"
31+
}
32+
},
33+
"paths": {
34+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backupAndExport": {
35+
"post": {
36+
"tags": [
37+
"Servers"
38+
],
39+
"operationId": "Servers_BackupAndExport",
40+
"x-ms-examples": {
41+
"Create and Export Backup": {
42+
"$ref": "./examples/BackupAndExport.json"
43+
}
44+
},
45+
"description": "Exports the backup of the given server by creating a backup if not existing.",
46+
"parameters": [
47+
{
48+
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
49+
},
50+
{
51+
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
52+
},
53+
{
54+
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
55+
},
56+
{
57+
"$ref": "#/parameters/ServerNameParameter"
58+
},
59+
{
60+
"name": "parameters",
61+
"in": "body",
62+
"required": true,
63+
"schema": {
64+
"$ref": "#/definitions/BackupAndExportRequest"
65+
},
66+
"description": "The required parameters for creating and exporting backup of the given server."
67+
}
68+
],
69+
"responses": {
70+
"200": {
71+
"description": "OK",
72+
"schema": {
73+
"$ref": "#/definitions/BackupAndExportResponse"
74+
}
75+
},
76+
"202": {
77+
"description": "Accepted"
78+
},
79+
"default": {
80+
"description": "Error response describing why the operation failed.",
81+
"schema": {
82+
"$ref": "#/definitions/CloudError"
83+
}
84+
}
85+
},
86+
"x-ms-long-running-operation": true,
87+
"x-ms-long-running-operation-options": {
88+
"final-state-via": "azure-async-operation"
89+
}
90+
}
91+
},
92+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/validateBackup": {
93+
"post": {
94+
"tags": [
95+
"Servers"
96+
],
97+
"operationId": "Servers_ValidateBackup",
98+
"x-ms-examples": {
99+
"Validate Backup": {
100+
"$ref": "./examples/ValidateBackup.json"
101+
}
102+
},
103+
"description": "Validates if backup can be performed for given server.",
104+
"parameters": [
105+
{
106+
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter"
107+
},
108+
{
109+
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
110+
},
111+
{
112+
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
113+
},
114+
{
115+
"$ref": "#/parameters/ServerNameParameter"
116+
},
117+
{
118+
"name": "parameters",
119+
"in": "body",
120+
"required": true,
121+
"schema": {
122+
"$ref": "#/definitions/ValidateBackupRequest"
123+
},
124+
"description": "The required parameters for validating if backup can be performed for given server."
125+
}
126+
],
127+
"responses": {
128+
"200": {
129+
"description": "OK",
130+
"schema": {
131+
"$ref": "#/definitions/ValidateBackupResponse"
132+
}
133+
},
134+
"default": {
135+
"description": "Error response describing why the operation failed.",
136+
"schema": {
137+
"$ref": "#/definitions/CloudError"
138+
}
139+
}
140+
}
141+
}
142+
}
143+
},
144+
"definitions": {
145+
"BackupRequestBase": {
146+
"description": "BackupRequestBase is the base for all backup request.",
147+
"required": [
148+
"backupSettings"
149+
],
150+
"type": "object",
151+
"properties": {
152+
"backupSettings": {
153+
"$ref": "#/definitions/BackupSettings",
154+
"description": "Backup Settings"
155+
}
156+
}
157+
},
158+
"BackupAndExportRequest": {
159+
"description": "BackupAndExport API Request",
160+
"type": "object",
161+
"allOf": [
162+
{
163+
"$ref": "#/definitions/BackupRequestBase"
164+
}
165+
],
166+
"required": [
167+
"backupSettings",
168+
"targetDetails"
169+
],
170+
"properties": {
171+
"targetDetails": {
172+
"$ref": "#/definitions/BackupStoreDetails",
173+
"description": "Backup Target Store Details"
174+
}
175+
}
176+
},
177+
"ValidateBackupRequest": {
178+
"description": "ValidateBackup API Request.",
179+
"type": "object",
180+
"allOf": [
181+
{
182+
"$ref": "#/definitions/BackupRequestBase"
183+
}
184+
]
185+
},
186+
"BackupStoreDetails": {
187+
"description": "Details about the target where the backup content will be stored.",
188+
"required": [
189+
"objectType"
190+
],
191+
"type": "object",
192+
"properties": {
193+
"objectType": {
194+
"description": "Type of the specific object - used for deserializing",
195+
"type": "string",
196+
"readOnly": false
197+
}
198+
},
199+
"discriminator": "objectType"
200+
},
201+
"FullBackupStoreDetails": {
202+
"description": "FullBackupStoreDetails is used for scenarios where backup data is streamed/copied over to a storage destination.",
203+
"type": "object",
204+
"required": [
205+
"sasUriList"
206+
],
207+
"allOf": [
208+
{
209+
"$ref": "#/definitions/BackupStoreDetails"
210+
}
211+
],
212+
"properties": {
213+
"sasUriList": {
214+
"description": "SASUriList of storage containers where backup data is to be streamed/copied.",
215+
"type": "array",
216+
"items": {
217+
"type": "string"
218+
}
219+
}
220+
}
221+
},
222+
"BackupSettings": {
223+
"description": "Backup Settings",
224+
"type": "object",
225+
"required": [
226+
"backupName"
227+
],
228+
"properties": {
229+
"backupName": {
230+
"type": "string",
231+
"description": "Backup Name for the current backup"
232+
},
233+
"backupFormat": {
234+
"description": "Backup Format for the current backup. (CollatedFormat is INTERNAL – DO NOT USE)",
235+
"enum": [
236+
"None",
237+
"CollatedFormat"
238+
],
239+
"type": "string",
240+
"x-ms-enum": {
241+
"name": "BackupFormat",
242+
"modelAsString": true
243+
}
244+
}
245+
}
246+
},
247+
"ValidateBackupResponseProperties": {
248+
"description": "ValidateBackup Response Properties",
249+
"type": "object",
250+
"required": [
251+
"numberOfContainers"
252+
],
253+
"properties": {
254+
"numberOfContainers": {
255+
"format": "int32",
256+
"description": "Estimated no of storage containers required for resource data to be backed up.",
257+
"type": "integer"
258+
}
259+
}
260+
},
261+
"BackupAndExportResponseProperties": {
262+
"description": "BackupAndExport Response Properties",
263+
"type": "object",
264+
"required": [
265+
"datasourceSizeInBytes",
266+
"dataTransferredInBytes",
267+
"backupMetadata"
268+
],
269+
"properties": {
270+
"datasourceSizeInBytes": {
271+
"format": "int64",
272+
"description": "Size of datasource in bytes",
273+
"type": "integer"
274+
},
275+
"dataTransferredInBytes": {
276+
"format": "int64",
277+
"description": "Data transferred in bytes",
278+
"type": "integer"
279+
},
280+
"backupMetadata": {
281+
"description": "Metadata related to backup to be stored for restoring resource in key-value pairs.",
282+
"type": "string"
283+
}
284+
}
285+
},
286+
"BackupAndExportResponse": {
287+
"type": "object",
288+
"properties": {
289+
"properties": {
290+
"$ref": "#/definitions/BackupAndExportResponseProperties",
291+
"x-ms-client-flatten": true,
292+
"description": "The response properties of an backup and export operation."
293+
}
294+
},
295+
"allOf": [
296+
{
297+
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ProxyResource"
298+
}
299+
],
300+
"description": "Represents BackupAndExport API Response"
301+
},
302+
"ValidateBackupResponse": {
303+
"type": "object",
304+
"properties": {
305+
"properties": {
306+
"$ref": "#/definitions/ValidateBackupResponseProperties",
307+
"x-ms-client-flatten": true,
308+
"description": "The response properties of an pre backup operation."
309+
}
310+
},
311+
"description": "Represents ValidateBackup API Response"
312+
},
313+
"CloudError": {
314+
"type": "object",
315+
"x-ms-external": true,
316+
"properties": {
317+
"error": {
318+
"$ref": "../../../../../common-types/resource-management/v1/types.json#/definitions/ErrorResponse",
319+
"description": "The resource management error response."
320+
}
321+
},
322+
"description": "An error response from the Batch service."
323+
}
324+
},
325+
"produces": [
326+
"application/json"
327+
],
328+
"schemes": [
329+
"https"
330+
],
331+
"security": [
332+
{
333+
"azure_auth": [
334+
"user_impersonation"
335+
]
336+
}
337+
]
338+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"parameters": {
3+
"api-version": "2022-08-01-privatepreview",
4+
"serverName": "mysqltestserver",
5+
"resourceGroupName": "TestGroup",
6+
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff",
7+
"parameters": {
8+
"targetDetails": {
9+
"objectType": "FullBackupStoreDetails",
10+
"sasUriList": [
11+
"sasuri1",
12+
"sasuri2"
13+
]
14+
},
15+
"backupSettings": {
16+
"backupName": "customer-backup-name"
17+
}
18+
}
19+
},
20+
"responses": {
21+
"200": {
22+
"body": {
23+
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/customer-backup-name",
24+
"name": "customer-backup-name",
25+
"type": "Microsoft.DBforMySQL/flexibleServers/backups",
26+
"properties": {
27+
"datasourceSizeInBytes": 1024,
28+
"dataTransferredInBytes": 1024,
29+
"backupMetadata": "{\"key1\":\"value1\",\"key2\":\"value2\"}"
30+
}
31+
}
32+
},
33+
"202": {}
34+
}
35+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"parameters": {
3+
"api-version": "2022-08-01-privatepreview",
4+
"serverName": "mysqltestserver",
5+
"resourceGroupName": "TestGroup",
6+
"subscriptionId": "ffffffff-ffff-ffff-ffff-ffffffffffff",
7+
"parameters": {
8+
"backupSettings": {
9+
"backupName": "customer-backup-name"
10+
}
11+
}
12+
},
13+
"responses": {
14+
"200": {
15+
"body": {
16+
"properties": {
17+
"numberOfContainers": 1
18+
}
19+
}
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)