diff --git a/sdk/storage/arm-storage/src/models/blobContainersMappers.ts b/sdk/storage/arm-storage/src/models/blobContainersMappers.ts index 9364fcab12cf..af27e1f36103 100644 --- a/sdk/storage/arm-storage/src/models/blobContainersMappers.ts +++ b/sdk/storage/arm-storage/src/models/blobContainersMappers.ts @@ -17,6 +17,9 @@ export { BlobContainersExtendImmutabilityPolicyHeaders, BlobContainersGetImmutabilityPolicyHeaders, BlobContainersLockImmutabilityPolicyHeaders, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, BlobServiceProperties, ChangeFeed, CloudError, @@ -60,6 +63,7 @@ export { PrivateLinkServiceConnectionState, ProxyResource, Resource, + RestorePolicyProperties, RoutingPreference, Sku, StorageAccount, diff --git a/sdk/storage/arm-storage/src/models/blobServicesMappers.ts b/sdk/storage/arm-storage/src/models/blobServicesMappers.ts index aad16630283f..0e76fcb14e87 100644 --- a/sdk/storage/arm-storage/src/models/blobServicesMappers.ts +++ b/sdk/storage/arm-storage/src/models/blobServicesMappers.ts @@ -12,6 +12,9 @@ export { AzureFilesIdentityBasedAuthentication, BaseResource, BlobContainer, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, BlobServiceItems, BlobServiceProperties, ChangeFeed, @@ -52,6 +55,7 @@ export { PrivateLinkServiceConnectionState, ProxyResource, Resource, + RestorePolicyProperties, RoutingPreference, Sku, StorageAccount, diff --git a/sdk/storage/arm-storage/src/models/fileServicesMappers.ts b/sdk/storage/arm-storage/src/models/fileServicesMappers.ts index 164085c75a5b..cae6862a0f6f 100644 --- a/sdk/storage/arm-storage/src/models/fileServicesMappers.ts +++ b/sdk/storage/arm-storage/src/models/fileServicesMappers.ts @@ -12,6 +12,9 @@ export { AzureFilesIdentityBasedAuthentication, BaseResource, BlobContainer, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, BlobServiceProperties, ChangeFeed, CloudError, @@ -52,6 +55,7 @@ export { PrivateLinkServiceConnectionState, ProxyResource, Resource, + RestorePolicyProperties, RoutingPreference, Sku, StorageAccount, diff --git a/sdk/storage/arm-storage/src/models/fileSharesMappers.ts b/sdk/storage/arm-storage/src/models/fileSharesMappers.ts index bdbc5da3fa8e..55e072ceb4fd 100644 --- a/sdk/storage/arm-storage/src/models/fileSharesMappers.ts +++ b/sdk/storage/arm-storage/src/models/fileSharesMappers.ts @@ -12,6 +12,9 @@ export { AzureFilesIdentityBasedAuthentication, BaseResource, BlobContainer, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, BlobServiceProperties, ChangeFeed, CloudError, @@ -52,6 +55,7 @@ export { PrivateLinkServiceConnectionState, ProxyResource, Resource, + RestorePolicyProperties, RoutingPreference, Sku, StorageAccount, diff --git a/sdk/storage/arm-storage/src/models/index.ts b/sdk/storage/arm-storage/src/models/index.ts index af2b943406ae..a0849f3a2e69 100644 --- a/sdk/storage/arm-storage/src/models/index.ts +++ b/sdk/storage/arm-storage/src/models/index.ts @@ -705,6 +705,63 @@ export interface GeoReplicationStats { readonly canFailover?: boolean; } +/** + * Blob range + */ +export interface BlobRestoreRange { + /** + * Blob start range. Empty means account start. + */ + startRange: string; + /** + * Blob end range. Empty means account end. + */ + endRange: string; +} + +/** + * Blob restore parameters + */ +export interface BlobRestoreParameters { + /** + * Restore blob to the specified time. + */ + timeToRestore: Date; + /** + * Blob ranges to restore. + */ + blobRanges: BlobRestoreRange[]; +} + +/** + * Blob restore status. + */ +export interface BlobRestoreStatus { + /** + * 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. Possible values include: 'InProgress', + * 'Complete', 'Failed' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly status?: BlobRestoreProgressStatus; + /** + * Failure reason when blob restore is failed. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly failureReason?: string; + /** + * Id for tracking blob restore request. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly restoreId?: string; + /** + * Blob restore request parameters. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly parameters?: BlobRestoreParameters; +} + /** * The Private Endpoint resource. */ @@ -924,6 +981,11 @@ export interface StorageAccount extends TrackedResource { * Maintains information about the network routing choice opted by the user for data transfer */ routingPreference?: RoutingPreference; + /** + * Blob restore status + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly blobRestoreStatus?: BlobRestoreStatus; } /** @@ -1765,6 +1827,21 @@ export interface ChangeFeed { enabled?: boolean; } +/** + * The blob service properties for blob restore policy + */ +export interface RestorePolicyProperties { + /** + * Blob restore is enabled if set to true. + */ + enabled: boolean; + /** + * how long this blob can be restored. It should be great than zero and less than + * DeleteRetentionPolicy.days. + */ + days?: number; +} + /** * The properties of a storage account’s Blob service. */ @@ -1793,6 +1870,10 @@ export interface BlobServiceProperties extends Resource { * The blob service properties for change feed events. */ changeFeed?: ChangeFeed; + /** + * The blob service properties for blob restore policy. + */ + restorePolicy?: RestorePolicyProperties; /** * Sku name and tier. * **NOTE: This property will not be serialized. It can only be populated by the server.** @@ -1922,8 +2003,8 @@ export interface FileShareItem extends AzureEntityResource { export interface StorageAccountsGetPropertiesOptionalParams extends msRest.RequestOptionsBase { /** * 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. Possible - * values include: 'geoReplicationStats' + * included when fetching properties. Currently we only support geoReplicationStats and + * blobRestoreStatus. Possible values include: 'geoReplicationStats', 'blobRestoreStatus' */ expand?: StorageAccountExpand; } @@ -2352,6 +2433,14 @@ export type RoutingChoice = 'MicrosoftRouting' | 'InternetRouting'; */ export type GeoReplicationStatus = 'Live' | 'Bootstrap' | 'Unavailable'; +/** + * Defines values for BlobRestoreProgressStatus. + * Possible values include: 'InProgress', 'Complete', 'Failed' + * @readonly + * @enum {string} + */ +export type BlobRestoreProgressStatus = 'InProgress' | 'Complete' | 'Failed'; + /** * Defines values for ProvisioningState. * Possible values include: 'Creating', 'ResolvingDNS', 'Succeeded' @@ -2491,11 +2580,11 @@ export type ImmutabilityPolicyUpdateType = 'put' | 'lock' | 'extend'; /** * Defines values for StorageAccountExpand. - * Possible values include: 'geoReplicationStats' + * Possible values include: 'geoReplicationStats', 'blobRestoreStatus' * @readonly * @enum {string} */ -export type StorageAccountExpand = 'geoReplicationStats'; +export type StorageAccountExpand = 'geoReplicationStats' | 'blobRestoreStatus'; /** * Defines values for ListKeyExpand. @@ -2753,6 +2842,26 @@ export type StorageAccountsListServiceSASResponse = ListServiceSasResponse & { }; }; +/** + * Contains response data for the restoreBlobRanges operation. + */ +export type StorageAccountsRestoreBlobRangesResponse = BlobRestoreStatus & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: BlobRestoreStatus; + }; +}; + /** * Contains response data for the beginCreate operation. */ @@ -2773,6 +2882,26 @@ export type StorageAccountsBeginCreateResponse = StorageAccount & { }; }; +/** + * Contains response data for the beginRestoreBlobRanges operation. + */ +export type StorageAccountsBeginRestoreBlobRangesResponse = BlobRestoreStatus & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: BlobRestoreStatus; + }; +}; + /** * Contains response data for the listNext operation. */ diff --git a/sdk/storage/arm-storage/src/models/managementPoliciesMappers.ts b/sdk/storage/arm-storage/src/models/managementPoliciesMappers.ts index b9001e154d1a..feeef14a9f3f 100644 --- a/sdk/storage/arm-storage/src/models/managementPoliciesMappers.ts +++ b/sdk/storage/arm-storage/src/models/managementPoliciesMappers.ts @@ -12,6 +12,9 @@ export { AzureFilesIdentityBasedAuthentication, BaseResource, BlobContainer, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, BlobServiceProperties, ChangeFeed, CloudError, @@ -51,6 +54,7 @@ export { PrivateLinkServiceConnectionState, ProxyResource, Resource, + RestorePolicyProperties, RoutingPreference, Sku, StorageAccount, diff --git a/sdk/storage/arm-storage/src/models/mappers.ts b/sdk/storage/arm-storage/src/models/mappers.ts index bb98e818705c..c3278603633f 100644 --- a/sdk/storage/arm-storage/src/models/mappers.ts +++ b/sdk/storage/arm-storage/src/models/mappers.ts @@ -1128,6 +1128,99 @@ export const GeoReplicationStats: msRest.CompositeMapper = { } }; +export const BlobRestoreRange: msRest.CompositeMapper = { + serializedName: "BlobRestoreRange", + type: { + name: "Composite", + className: "BlobRestoreRange", + modelProperties: { + startRange: { + required: true, + serializedName: "startRange", + type: { + name: "String" + } + }, + endRange: { + required: true, + serializedName: "endRange", + type: { + name: "String" + } + } + } + } +}; + +export const BlobRestoreParameters: msRest.CompositeMapper = { + serializedName: "BlobRestoreParameters", + type: { + name: "Composite", + className: "BlobRestoreParameters", + modelProperties: { + timeToRestore: { + required: true, + serializedName: "timeToRestore", + type: { + name: "DateTime" + } + }, + blobRanges: { + required: true, + serializedName: "blobRanges", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BlobRestoreRange" + } + } + } + } + } + } +}; + +export const BlobRestoreStatus: msRest.CompositeMapper = { + serializedName: "BlobRestoreStatus", + type: { + name: "Composite", + className: "BlobRestoreStatus", + modelProperties: { + status: { + readOnly: true, + serializedName: "status", + type: { + name: "String" + } + }, + failureReason: { + readOnly: true, + serializedName: "failureReason", + type: { + name: "String" + } + }, + restoreId: { + readOnly: true, + serializedName: "restoreId", + type: { + name: "String" + } + }, + parameters: { + readOnly: true, + serializedName: "parameters", + type: { + name: "Composite", + className: "BlobRestoreParameters" + } + } + } + } +}; + export const PrivateEndpoint: msRest.CompositeMapper = { serializedName: "PrivateEndpoint", type: { @@ -1466,6 +1559,14 @@ export const StorageAccount: msRest.CompositeMapper = { name: "Composite", className: "RoutingPreference" } + }, + blobRestoreStatus: { + readOnly: true, + serializedName: "properties.blobRestoreStatus", + type: { + name: "Composite", + className: "BlobRestoreStatus" + } } } } @@ -2851,6 +2952,33 @@ export const ChangeFeed: msRest.CompositeMapper = { } }; +export const RestorePolicyProperties: msRest.CompositeMapper = { + serializedName: "RestorePolicyProperties", + type: { + name: "Composite", + className: "RestorePolicyProperties", + modelProperties: { + enabled: { + required: true, + serializedName: "enabled", + type: { + name: "Boolean" + } + }, + days: { + serializedName: "days", + constraints: { + InclusiveMaximum: 365, + InclusiveMinimum: 1 + }, + type: { + name: "Number" + } + } + } + } +}; + export const BlobServiceProperties: msRest.CompositeMapper = { serializedName: "BlobServiceProperties", type: { @@ -2891,6 +3019,13 @@ export const BlobServiceProperties: msRest.CompositeMapper = { className: "ChangeFeed" } }, + restorePolicy: { + serializedName: "properties.restorePolicy", + type: { + name: "Composite", + className: "RestorePolicyProperties" + } + }, sku: { readOnly: true, serializedName: "sku", diff --git a/sdk/storage/arm-storage/src/models/parameters.ts b/sdk/storage/arm-storage/src/models/parameters.ts index d16ed554255d..9c3be020aa02 100644 --- a/sdk/storage/arm-storage/src/models/parameters.ts +++ b/sdk/storage/arm-storage/src/models/parameters.ts @@ -83,7 +83,8 @@ export const expand0: msRest.OperationQueryParameter = { type: { name: "Enum", allowedValues: [ - "geoReplicationStats" + "geoReplicationStats", + "blobRestoreStatus" ] } } diff --git a/sdk/storage/arm-storage/src/models/privateEndpointConnectionsMappers.ts b/sdk/storage/arm-storage/src/models/privateEndpointConnectionsMappers.ts index 5b724ff3a3b2..f6681b66306c 100644 --- a/sdk/storage/arm-storage/src/models/privateEndpointConnectionsMappers.ts +++ b/sdk/storage/arm-storage/src/models/privateEndpointConnectionsMappers.ts @@ -12,6 +12,9 @@ export { AzureFilesIdentityBasedAuthentication, BaseResource, BlobContainer, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, BlobServiceProperties, ChangeFeed, CorsRule, @@ -51,6 +54,7 @@ export { PrivateLinkServiceConnectionState, ProxyResource, Resource, + RestorePolicyProperties, RoutingPreference, Sku, StorageAccount, diff --git a/sdk/storage/arm-storage/src/models/privateLinkResourcesMappers.ts b/sdk/storage/arm-storage/src/models/privateLinkResourcesMappers.ts index d64dc7080742..a60ad13c720b 100644 --- a/sdk/storage/arm-storage/src/models/privateLinkResourcesMappers.ts +++ b/sdk/storage/arm-storage/src/models/privateLinkResourcesMappers.ts @@ -12,6 +12,9 @@ export { AzureFilesIdentityBasedAuthentication, BaseResource, BlobContainer, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, BlobServiceProperties, ChangeFeed, CloudError, @@ -52,6 +55,7 @@ export { PrivateLinkServiceConnectionState, ProxyResource, Resource, + RestorePolicyProperties, RoutingPreference, Sku, StorageAccount, diff --git a/sdk/storage/arm-storage/src/models/storageAccountsMappers.ts b/sdk/storage/arm-storage/src/models/storageAccountsMappers.ts index e762214b2382..00878042fa32 100644 --- a/sdk/storage/arm-storage/src/models/storageAccountsMappers.ts +++ b/sdk/storage/arm-storage/src/models/storageAccountsMappers.ts @@ -13,6 +13,9 @@ export { AzureFilesIdentityBasedAuthentication, BaseResource, BlobContainer, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, BlobServiceProperties, ChangeFeed, CheckNameAvailabilityResult, @@ -55,6 +58,7 @@ export { PrivateLinkServiceConnectionState, ProxyResource, Resource, + RestorePolicyProperties, RoutingPreference, ServiceSasParameters, Sku, diff --git a/sdk/storage/arm-storage/src/operations/storageAccounts.ts b/sdk/storage/arm-storage/src/operations/storageAccounts.ts index d58b46a84772..7200d8a7ca03 100644 --- a/sdk/storage/arm-storage/src/operations/storageAccounts.ts +++ b/sdk/storage/arm-storage/src/operations/storageAccounts.ts @@ -464,6 +464,23 @@ export class StorageAccounts { .then(lroPoller => lroPoller.pollUntilFinished()); } + /** + * Restore blobs in the specified blob ranges + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case + * letters only. + * @param timeToRestore Restore blob to the specified time. + * @param blobRanges Blob ranges to restore. + * @param [options] The optional parameters + * @returns Promise + */ + restoreBlobRanges(resourceGroupName: string, accountName: string, timeToRestore: Date | string, blobRanges: Models.BlobRestoreRange[], options?: msRest.RequestOptionsBase): Promise { + return this.beginRestoreBlobRanges(resourceGroupName,accountName,timeToRestore,blobRanges,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + /** * Revoke user delegation keys. * @param resourceGroupName The name of the resource group within the user's subscription. The name @@ -554,6 +571,31 @@ export class StorageAccounts { options); } + /** + * Restore blobs in the specified blob ranges + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case + * letters only. + * @param timeToRestore Restore blob to the specified time. + * @param blobRanges Blob ranges to restore. + * @param [options] The optional parameters + * @returns Promise + */ + beginRestoreBlobRanges(resourceGroupName: string, accountName: string, timeToRestore: Date | string, blobRanges: Models.BlobRestoreRange[], options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + accountName, + timeToRestore, + blobRanges, + options + }, + beginRestoreBlobRangesOperationSpec, + options); + } + /** * Lists all the storage accounts available under the subscription. Note that storage keys are not * returned; use the ListKeys operation for this. @@ -951,6 +993,44 @@ const beginFailoverOperationSpec: msRest.OperationSpec = { serializer }; +const beginRestoreBlobRangesOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: { + timeToRestore: "timeToRestore", + blobRanges: "blobRanges" + }, + mapper: { + ...Mappers.BlobRestoreParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.BlobRestoreStatus + }, + 202: { + bodyMapper: Mappers.BlobRestoreStatus + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + const listNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", baseUrl: "https://management.azure.com",