From a8f9f05ab116569cc8aa1c42ffe51895e7943c55 Mon Sep 17 00:00:00 2001 From: Yao Gao Date: Wed, 15 Jan 2020 11:46:27 +0800 Subject: [PATCH 1/2] Add RestoreBlobRanges API in Microsoft.Storage specification --- .../stable/2019-06-01/blob.json | 22 ++- .../examples/BlobRangesRestore.json | 61 ++++++++ .../stable/2019-06-01/storage.json | 132 +++++++++++++++++- 3 files changed, 212 insertions(+), 3 deletions(-) create mode 100644 specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/examples/BlobRangesRestore.json diff --git a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json index cb824822a92b..250bc693cb68 100644 --- a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json +++ b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json @@ -1142,7 +1142,11 @@ "changeFeed": { "$ref": "#/definitions/ChangeFeed", "description": "The blob service properties for change feed events." - } + }, + "restorePolicy": { + "$ref": "#/definitions/RestorePolicyProperties", + "description": "The blob service properties for blob restore policy." + } }, "x-ms-client-flatten": true, "x-ms-client-name": "BlobServiceProperties", @@ -1182,6 +1186,22 @@ }, "description": "The blob service properties for change feed events." }, + "RestorePolicyProperties": { + "properties": { + "enabled": { + "type": "boolean", + "description": "Blob restore is enabled if set to true." + }, + "days": { + "type": "integer", + "minimum": 1, + "maximum": 365, + "description": "how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days." + } + }, + "required": ["enabled"], + "description": "The blob service properties for blob restore policy" + }, "LeaseContainerRequest": { "properties": { "action": { diff --git a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/examples/BlobRangesRestore.json b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/examples/BlobRangesRestore.json new file mode 100644 index 000000000000..4ea6ff6b0787 --- /dev/null +++ b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/examples/BlobRangesRestore.json @@ -0,0 +1,61 @@ +{ + "parameters": { + "subscriptionId": "{subscription-id}", + "resourceGroupName": "res9101", + "accountName": "sto4445", + "api-version": "2019-06-01", + "parameters": { + "timeToRestore": "2019-04-20T15:30:00.0000000Z", + "blobRanges": [ + { + "startRange": "container/blobpath1", + "endRange": "container/blobpath2" + }, + { + "startRange": "container2/blobpath3", + "endRange": "" + } + ] + } + }, + "responses": { + "200": { + "body": { + "status": "Complete", + "restoreId": "{restore_id}", + "parameters": { + "timeToRestore": "2019-04-20T15:30:00.0000000Z", + "blobRanges": [ + { + "startRange": "container/blobpath1", + "endRange": "container/blobpath2" + }, + { + "startRange": "container2/blobpath3", + "endRange": "" + } + ] + } + } + }, + "202": { + "body": { + "status": "InProgress", + "restoreId": "{restore_id}", + "parameters": { + "timeToRestore": "2019-04-20T15:30:00.0000000Z", + "blobRanges": [ + { + "startRange": "container/blobpath1", + "endRange": "container/blobpath2" + }, + { + "startRange": "container2/blobpath3", + "endRange": "" + } + ] + } + } + } + } +} diff --git a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json index 1dcbff2a61b0..a23b12d80693 100644 --- a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json +++ b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json @@ -226,12 +226,13 @@ }, { "name": "$expand", - "description": "May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats.", + "description": "May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus.", "in": "query", "required": false, "type": "string", "enum": [ - "geoReplicationStats" + "geoReplicationStats", + "blobRestoreStatus" ], "x-ms-enum": { "name": "StorageAccountExpand", @@ -631,6 +632,61 @@ } } }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges": { + "post": { + "tags": [ + "StorageAccounts" + ], + "operationId": "StorageAccounts_RestoreBlobRanges", + "description": "Restore blobs in the specified blob ranges", + "x-ms-examples": { + "BlobRangesRestore": { + "$ref": "./examples/BlobRangesRestore.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/StorageAccountName" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/BlobRestoreParameters" + }, + "description": "The parameters to provide for restore blob ranges." + } + ], + "responses": { + "200": { + "description": "OK -- returned when blob ranges are restored completely with the same properties specified in the request body.", + "schema": { + "$ref": "#/definitions/BlobRestoreStatus" + } + }, + "202": { + "description": "Accepted -- Blob restore request accepted; operation will complete asynchronously.", + "schema": { + "$ref": "#/definitions/BlobRestoreStatus" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}": { "get": { "tags": [ @@ -1863,6 +1919,40 @@ }, "description": "Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing" }, + "BlobRestoreStatus": { + "properties": { + "status": { + "readOnly": true, + "type": "string", + "description": "The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed.", + "enum": [ + "InProgress", + "Complete", + "Failed" + ], + "x-ms-enum": { + "name": "BlobRestoreProgressStatus", + "modelAsString": true + } + }, + "failureReason": { + "readOnly": true, + "type": "string", + "description": "Failure reason when blob restore is failed." + }, + "restoreId": { + "readOnly": true, + "type": "string", + "description": "Id for tracking blob restore request." + }, + "parameters": { + "readOnly": true, + "$ref": "#/definitions/BlobRestoreParameters", + "description": "Blob restore request parameters." + } + }, + "description": "Blob restore status." + }, "StorageAccountProperties": { "properties": { "provisioningState": { @@ -2016,6 +2106,12 @@ "$ref": "#/definitions/RoutingPreference", "x-ms-client-name": "RoutingPreference", "description": "Maintains information about the network routing choice opted by the user for data transfer" + }, + "blobRestoreStatus": { + "$ref": "#/definitions/BlobRestoreStatus", + "x-ms-client-name": "BlobRestoreStatus", + "description": "Blob restore status", + "readOnly": true } }, "description": "Properties of the storage account." @@ -2227,6 +2323,38 @@ }, "description": "The parameters that can be provided when updating the storage account properties." }, + "BlobRestoreParameters": { + "properties": { + "timeToRestore": { + "type": "string", + "format": "date-time", + "description": "Restore blob to the specified time." + }, + "blobRanges": { + "type": "array", + "items": { + "$ref": "#/definitions/BlobRestoreRange" + }, + "description": "Blob ranges to restore." + } + }, + "required": [ "timeToRestore", "blobRanges"], + "description": "Blob restore parameters" + }, + "BlobRestoreRange": { + "properties": { + "startRange": { + "type": "string", + "description": "Blob start range. Empty means account start." + }, + "endRange": { + "type": "string", + "description": "Blob end range. Empty means account end." + } + }, + "required": [ "startRange", "endRange"], + "description": "Blob range" + }, "UsageName": { "properties": { "value": { From 0469c826da18dcc7bd25716418bac47fdbe2c93e Mon Sep 17 00:00:00 2001 From: Yao Gao Date: Wed, 15 Jan 2020 16:32:21 +0800 Subject: [PATCH 2/2] Fix Prettier Check --- .../Microsoft.Storage/stable/2019-06-01/blob.json | 6 ++++-- .../stable/2019-06-01/storage.json | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json index 250bc693cb68..71c810643fc4 100644 --- a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json +++ b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/blob.json @@ -1146,7 +1146,7 @@ "restorePolicy": { "$ref": "#/definitions/RestorePolicyProperties", "description": "The blob service properties for blob restore policy." - } + } }, "x-ms-client-flatten": true, "x-ms-client-name": "BlobServiceProperties", @@ -1199,7 +1199,9 @@ "description": "how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days." } }, - "required": ["enabled"], + "required": [ + "enabled" + ], "description": "The blob service properties for blob restore policy" }, "LeaseContainerRequest": { diff --git a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json index a23b12d80693..a1e8a86c9731 100644 --- a/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json +++ b/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json @@ -1364,7 +1364,10 @@ "name": "KeyType", "modelAsString": true }, - "x-ms-mutability": ["create","read"] + "x-ms-mutability": [ + "create", + "read" + ] } }, "description": "A service that allows server-side encryption to be used." @@ -2338,7 +2341,10 @@ "description": "Blob ranges to restore." } }, - "required": [ "timeToRestore", "blobRanges"], + "required": [ + "timeToRestore", + "blobRanges" + ], "description": "Blob restore parameters" }, "BlobRestoreRange": { @@ -2352,7 +2358,10 @@ "description": "Blob end range. Empty means account end." } }, - "required": [ "startRange", "endRange"], + "required": [ + "startRange", + "endRange" + ], "description": "Blob range" }, "UsageName": {