From 0955f0659a29cbb529c0cf2ed3d35201291b5baf Mon Sep 17 00:00:00 2001 From: poetw <45549150+poetw@users.noreply.github.com> Date: Tue, 24 Nov 2020 12:20:45 +0800 Subject: [PATCH] BRP prune backup store API (#11479) * Add backup external store pruning to the API spec * Fix CI --- .../preview/2018-09-01/Backup.json | 3 + .../preview/2018-09-01/BackupLocations.json | 105 ++++++++++++++++++ .../examples/BackupLocations/Prune.json | 22 ++++ 3 files changed, 130 insertions(+) create mode 100644 specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/examples/BackupLocations/Prune.json diff --git a/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/Backup.json b/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/Backup.json index 578460a3f5cd..65c6538d3f6e 100644 --- a/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/Backup.json +++ b/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/Backup.json @@ -39,6 +39,9 @@ "schema": { "$ref": "#/definitions/OperationList" } + }, + "default": { + "description": "Error response." } }, "x-ms-pageable": { diff --git a/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/BackupLocations.json b/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/BackupLocations.json index 2b28908cb974..3ca194698eb6 100644 --- a/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/BackupLocations.json +++ b/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/BackupLocations.json @@ -186,6 +186,55 @@ } } } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Backup.Admin/backupLocations/{location}/pruneExternalStore": { + "post": { + "x-ms-examples": { + "Prune the external backup store": { + "$ref": "./examples/BackupLocations/Prune.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "description": "Prune the external backup store.", + "tags": [ + "BackupLocations" + ], + "operationId": "BackupLocations_PruneExternalStore", + "parameters": [ + { + "$ref": "Backup.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "Backup.json#/parameters/ResourceGroupParameter" + }, + { + "$ref": "#/parameters/BackupLocationParameter" + }, + { + "$ref": "#/parameters/PruneBackupStoreOptionParameter" + }, + { + "$ref": "Backup.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/PruneList" + } + }, + "202": { + "description": "ACCEPTED" + }, + "default": { + "description": "Error response." + } + } + } } }, "definitions": { @@ -288,6 +337,52 @@ "type": "string" } } + }, + "PruneBackupStoreOperationType": { + "description": "Prune backup store operation type.", + "type": "string", + "enum": [ + "Default", + "DryRun" + ], + "x-ms-enum": { + "name": "PruneBackupStoreOperationType", + "modelAsString": false + } + }, + "PruneBackupStoreOperationOptionModel": { + "type": "object", + "description": "Prune backup store operation model.", + "properties": { + "operationType": { + "description": "Operation type.", + "$ref": "#/definitions/PruneBackupStoreOperationType" + } + } + }, + "PruneModel": { + "description": "Properties for a prune list.", + "properties": { + "pathsToDelete": { + "description": "Garbage file list.", + "type": "array", + "items": { + "type": "string" + }, + "x-ms-client-flatten": true + } + } + }, + "PruneList": { + "type": "object", + "description": "List of files to delete.", + "properties": { + "properties": { + "description": "Holds information for a backup.", + "$ref": "#/definitions/PruneModel", + "x-ms-client-flatten": true + } + } } }, "parameters": { @@ -308,6 +403,16 @@ "$ref": "#/definitions/BackupLocation" }, "x-ms-parameter-location": "method" + }, + "PruneBackupStoreOptionParameter": { + "name": "option", + "in": "body", + "description": "Prune operation option.", + "required": false, + "schema": { + "$ref": "#/definitions/PruneBackupStoreOperationOptionModel" + }, + "x-ms-parameter-location": "method" } }, "securityDefinitions": { diff --git a/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/examples/BackupLocations/Prune.json b/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/examples/BackupLocations/Prune.json new file mode 100644 index 000000000000..b36228ea30d7 --- /dev/null +++ b/specification/azsadmin/resource-manager/backup/Microsoft.Backup.Admin/preview/2018-09-01/examples/BackupLocations/Prune.json @@ -0,0 +1,22 @@ +{ + "parameters": { + "subscriptionId": "8742f75d-84ae-4f1b-b22e-0e63dde0d6f4", + "resourceGroupName": "System.redmond", + "location": "redmond", + "api-version": "2018-09-01", + "OperationType": "DryRun" + }, + "responses": { + "200": { + "body": { + "properties": { + "pathsToDelete": [ + "masbackup/progressivebackup/1.2011.0.23/BackupEncryptionCert.cer", + "masbackup/progressivebackup/1.2011.0.23/BackupEncryptionCert.pfx" + ] + } + } + }, + "202": {} + } +}