diff --git a/sdk/storage/arm-storage/src/models/fileSharesMappers.ts b/sdk/storage/arm-storage/src/models/fileSharesMappers.ts index a9627942af8f..cdc3a0d452c9 100644 --- a/sdk/storage/arm-storage/src/models/fileSharesMappers.ts +++ b/sdk/storage/arm-storage/src/models/fileSharesMappers.ts @@ -23,6 +23,7 @@ export { CustomDomain, DateAfterCreation, DateAfterModification, + DeletedShare, DeleteRetentionPolicy, Encryption, EncryptionScope, diff --git a/sdk/storage/arm-storage/src/models/index.ts b/sdk/storage/arm-storage/src/models/index.ts index ee6a494413e9..2429759707d6 100644 --- a/sdk/storage/arm-storage/src/models/index.ts +++ b/sdk/storage/arm-storage/src/models/index.ts @@ -2142,6 +2142,72 @@ export interface FileShare extends AzureEntityResource { * 5TB (5120). For Large File Shares, the maximum size is 102400. */ shareQuota?: number; + /** + * The authentication protocol that is used for the file share. Can only be specified when + * creating a share. Possible values include: 'SMB', 'NFS' + */ + enabledProtocols?: EnabledProtocols; + /** + * The property is for NFS share only. The default is NoRootSquash. Possible values include: + * 'NoRootSquash', 'RootSquash', 'AllSquash' + */ + rootSquash?: RootSquashType; + /** + * The version of the share. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly version?: string; + /** + * Indicates whether the share was deleted. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly deleted?: boolean; + /** + * The deleted time if the share was deleted. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly deletedTime?: Date; + /** + * Remaining retention days for share that was soft deleted. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly remainingRetentionDays?: number; + /** + * Access tier for specific share. GpV2 account can choose between TransactionOptimized + * (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: + * 'TransactionOptimized', 'Hot', 'Cool', 'Premium' + */ + accessTier?: ShareAccessTier; + /** + * Indicates the last modification time for share access tier. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly accessTierChangeTime?: Date; + /** + * Indicates if there is a pending transition for access tier. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly accessTierStatus?: string; + /** + * The approximate size of the data stored on the share. Note that this value may not include all + * recently created or recently resized files. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly shareUsageBytes?: number; +} + +/** + * The deleted share to be restored. + */ +export interface DeletedShare { + /** + * Required. Identify the name of the deleted share that will be restored. + */ + deletedShareName: string; + /** + * Required. Identify the version of the deleted share that will be restored. + */ + deletedShareVersion: string; } /** @@ -2162,6 +2228,58 @@ export interface FileShareItem extends AzureEntityResource { * 5TB (5120). For Large File Shares, the maximum size is 102400. */ shareQuota?: number; + /** + * The authentication protocol that is used for the file share. Can only be specified when + * creating a share. Possible values include: 'SMB', 'NFS' + */ + enabledProtocols?: EnabledProtocols; + /** + * The property is for NFS share only. The default is NoRootSquash. Possible values include: + * 'NoRootSquash', 'RootSquash', 'AllSquash' + */ + rootSquash?: RootSquashType; + /** + * The version of the share. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly version?: string; + /** + * Indicates whether the share was deleted. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly deleted?: boolean; + /** + * The deleted time if the share was deleted. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly deletedTime?: Date; + /** + * Remaining retention days for share that was soft deleted. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly remainingRetentionDays?: number; + /** + * Access tier for specific share. GpV2 account can choose between TransactionOptimized + * (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: + * 'TransactionOptimized', 'Hot', 'Cool', 'Premium' + */ + accessTier?: ShareAccessTier; + /** + * Indicates the last modification time for share access tier. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly accessTierChangeTime?: Date; + /** + * Indicates if there is a pending transition for access tier. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly accessTierStatus?: string; + /** + * The approximate size of the data stored on the share. Note that this value may not include all + * recently created or recently resized files. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly shareUsageBytes?: number; } /** @@ -2291,36 +2409,22 @@ export interface FileSharesListOptionalParams extends msRest.RequestOptionsBase * Optional. When specified, only share names starting with the filter will be listed. */ filter?: string; -} - -/** - * Optional Parameters. - */ -export interface FileSharesCreateOptionalParams extends msRest.RequestOptionsBase { /** - * A name-value pair to associate with the share as metadata. + * Optional, used to expand the properties within share's properties. Possible values include: + * 'deleted' */ - metadata?: { [propertyName: string]: string }; - /** - * The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to - * 5TB (5120). For Large File Shares, the maximum size is 102400. - */ - shareQuota?: number; + expand?: ListSharesExpand; } /** * Optional Parameters. */ -export interface FileSharesUpdateOptionalParams extends msRest.RequestOptionsBase { +export interface FileSharesGetOptionalParams extends msRest.RequestOptionsBase { /** - * A name-value pair to associate with the share as metadata. - */ - metadata?: { [propertyName: string]: string }; - /** - * The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to - * 5TB (5120). For Large File Shares, the maximum size is 102400. + * Optional, used to expand the properties within share's properties. Possible values include: + * 'stats' */ - shareQuota?: number; + expand?: GetShareExpand; } /** @@ -2782,6 +2886,30 @@ export type ImmutabilityPolicyState = 'Locked' | 'Unlocked'; */ export type ImmutabilityPolicyUpdateType = 'put' | 'lock' | 'extend'; +/** + * Defines values for EnabledProtocols. + * Possible values include: 'SMB', 'NFS' + * @readonly + * @enum {string} + */ +export type EnabledProtocols = 'SMB' | 'NFS'; + +/** + * Defines values for RootSquashType. + * Possible values include: 'NoRootSquash', 'RootSquash', 'AllSquash' + * @readonly + * @enum {string} + */ +export type RootSquashType = 'NoRootSquash' | 'RootSquash' | 'AllSquash'; + +/** + * Defines values for ShareAccessTier. + * Possible values include: 'TransactionOptimized', 'Hot', 'Cool', 'Premium' + * @readonly + * @enum {string} + */ +export type ShareAccessTier = 'TransactionOptimized' | 'Hot' | 'Cool' | 'Premium'; + /** * Defines values for StorageAccountExpand. * Possible values include: 'geoReplicationStats', 'blobRestoreStatus' @@ -2798,6 +2926,22 @@ export type StorageAccountExpand = 'geoReplicationStats' | 'blobRestoreStatus'; */ export type ListKeyExpand = 'kerb'; +/** + * Defines values for ListSharesExpand. + * Possible values include: 'deleted' + * @readonly + * @enum {string} + */ +export type ListSharesExpand = 'deleted'; + +/** + * Defines values for GetShareExpand. + * Possible values include: 'stats' + * @readonly + * @enum {string} + */ +export type GetShareExpand = 'stats'; + /** * Defines values for Action1. * Possible values include: 'Acquire', 'Renew', 'Change', 'Release', 'Break' diff --git a/sdk/storage/arm-storage/src/models/mappers.ts b/sdk/storage/arm-storage/src/models/mappers.ts index f400448c6f35..ac507570198c 100644 --- a/sdk/storage/arm-storage/src/models/mappers.ts +++ b/sdk/storage/arm-storage/src/models/mappers.ts @@ -3434,6 +3434,97 @@ export const FileShare: msRest.CompositeMapper = { type: { name: "Number" } + }, + enabledProtocols: { + serializedName: "properties.enabledProtocols", + type: { + name: "String" + } + }, + rootSquash: { + serializedName: "properties.rootSquash", + type: { + name: "String" + } + }, + version: { + readOnly: true, + serializedName: "properties.version", + type: { + name: "String" + } + }, + deleted: { + readOnly: true, + serializedName: "properties.deleted", + type: { + name: "Boolean" + } + }, + deletedTime: { + readOnly: true, + serializedName: "properties.deletedTime", + type: { + name: "DateTime" + } + }, + remainingRetentionDays: { + readOnly: true, + serializedName: "properties.remainingRetentionDays", + type: { + name: "Number" + } + }, + accessTier: { + serializedName: "properties.accessTier", + type: { + name: "String" + } + }, + accessTierChangeTime: { + readOnly: true, + serializedName: "properties.accessTierChangeTime", + type: { + name: "DateTime" + } + }, + accessTierStatus: { + readOnly: true, + serializedName: "properties.accessTierStatus", + type: { + name: "String" + } + }, + shareUsageBytes: { + readOnly: true, + serializedName: "properties.shareUsageBytes", + type: { + name: "Number" + } + } + } + } +}; + +export const DeletedShare: msRest.CompositeMapper = { + serializedName: "DeletedShare", + type: { + name: "Composite", + className: "DeletedShare", + modelProperties: { + deletedShareName: { + required: true, + serializedName: "deletedShareName", + type: { + name: "String" + } + }, + deletedShareVersion: { + required: true, + serializedName: "deletedShareVersion", + type: { + name: "String" + } } } } @@ -3473,6 +3564,73 @@ export const FileShareItem: msRest.CompositeMapper = { type: { name: "Number" } + }, + enabledProtocols: { + serializedName: "properties.enabledProtocols", + type: { + name: "String" + } + }, + rootSquash: { + serializedName: "properties.rootSquash", + type: { + name: "String" + } + }, + version: { + readOnly: true, + serializedName: "properties.version", + type: { + name: "String" + } + }, + deleted: { + readOnly: true, + serializedName: "properties.deleted", + type: { + name: "Boolean" + } + }, + deletedTime: { + readOnly: true, + serializedName: "properties.deletedTime", + type: { + name: "DateTime" + } + }, + remainingRetentionDays: { + readOnly: true, + serializedName: "properties.remainingRetentionDays", + type: { + name: "Number" + } + }, + accessTier: { + serializedName: "properties.accessTier", + type: { + name: "String" + } + }, + accessTierChangeTime: { + readOnly: true, + serializedName: "properties.accessTierChangeTime", + type: { + name: "DateTime" + } + }, + accessTierStatus: { + readOnly: true, + serializedName: "properties.accessTierStatus", + type: { + name: "String" + } + }, + shareUsageBytes: { + readOnly: true, + serializedName: "properties.shareUsageBytes", + type: { + name: "Number" + } } } } diff --git a/sdk/storage/arm-storage/src/models/parameters.ts b/sdk/storage/arm-storage/src/models/parameters.ts index 549f9a6efbf5..38e6d36a2533 100644 --- a/sdk/storage/arm-storage/src/models/parameters.ts +++ b/sdk/storage/arm-storage/src/models/parameters.ts @@ -118,6 +118,36 @@ export const expand1: msRest.OperationQueryParameter = { } } }; +export const expand2: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "expand" + ], + mapper: { + serializedName: "$expand", + type: { + name: "Enum", + allowedValues: [ + "deleted" + ] + } + } +}; +export const expand3: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "expand" + ], + mapper: { + serializedName: "$expand", + type: { + name: "Enum", + allowedValues: [ + "stats" + ] + } + } +}; export const fileServicesName: msRest.OperationURLParameter = { parameterPath: "fileServicesName", mapper: { diff --git a/sdk/storage/arm-storage/src/operations/fileShares.ts b/sdk/storage/arm-storage/src/operations/fileShares.ts index 4aa2b2e10b9a..0b7e466add49 100644 --- a/sdk/storage/arm-storage/src/operations/fileShares.ts +++ b/sdk/storage/arm-storage/src/operations/fileShares.ts @@ -80,10 +80,11 @@ export class FileShares { * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or * number. + * @param fileShare Properties of the file share to create. * @param [options] The optional parameters * @returns Promise */ - create(resourceGroupName: string, accountName: string, shareName: string, options?: Models.FileSharesCreateOptionalParams): Promise; + create(resourceGroupName: string, accountName: string, shareName: string, fileShare: Models.FileShare, options?: msRest.RequestOptionsBase): Promise; /** * @param resourceGroupName The name of the resource group within the user's subscription. The name * is case insensitive. @@ -94,9 +95,10 @@ export class FileShares { * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or * number. + * @param fileShare Properties of the file share to create. * @param callback The callback */ - create(resourceGroupName: string, accountName: string, shareName: string, callback: msRest.ServiceCallback): void; + create(resourceGroupName: string, accountName: string, shareName: string, fileShare: Models.FileShare, callback: msRest.ServiceCallback): void; /** * @param resourceGroupName The name of the resource group within the user's subscription. The name * is case insensitive. @@ -107,16 +109,18 @@ export class FileShares { * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or * number. + * @param fileShare Properties of the file share to create. * @param options The optional parameters * @param callback The callback */ - create(resourceGroupName: string, accountName: string, shareName: string, options: Models.FileSharesCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(resourceGroupName: string, accountName: string, shareName: string, options?: Models.FileSharesCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create(resourceGroupName: string, accountName: string, shareName: string, fileShare: Models.FileShare, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + create(resourceGroupName: string, accountName: string, shareName: string, fileShare: Models.FileShare, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, shareName, + fileShare, options }, createOperationSpec, @@ -135,10 +139,11 @@ export class FileShares { * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or * number. + * @param fileShare Properties to update for the file share. * @param [options] The optional parameters * @returns Promise */ - update(resourceGroupName: string, accountName: string, shareName: string, options?: Models.FileSharesUpdateOptionalParams): Promise; + update(resourceGroupName: string, accountName: string, shareName: string, fileShare: Models.FileShare, options?: msRest.RequestOptionsBase): Promise; /** * @param resourceGroupName The name of the resource group within the user's subscription. The name * is case insensitive. @@ -149,9 +154,10 @@ export class FileShares { * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or * number. + * @param fileShare Properties to update for the file share. * @param callback The callback */ - update(resourceGroupName: string, accountName: string, shareName: string, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, accountName: string, shareName: string, fileShare: Models.FileShare, callback: msRest.ServiceCallback): void; /** * @param resourceGroupName The name of the resource group within the user's subscription. The name * is case insensitive. @@ -162,16 +168,18 @@ export class FileShares { * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or * number. + * @param fileShare Properties to update for the file share. * @param options The optional parameters * @param callback The callback */ - update(resourceGroupName: string, accountName: string, shareName: string, options: Models.FileSharesUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, accountName: string, shareName: string, options?: Models.FileSharesUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update(resourceGroupName: string, accountName: string, shareName: string, fileShare: Models.FileShare, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, accountName: string, shareName: string, fileShare: Models.FileShare, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceGroupName, accountName, shareName, + fileShare, options }, updateOperationSpec, @@ -192,7 +200,7 @@ export class FileShares { * @param [options] The optional parameters * @returns Promise */ - get(resourceGroupName: string, accountName: string, shareName: string, options?: msRest.RequestOptionsBase): Promise; + get(resourceGroupName: string, accountName: string, shareName: string, options?: Models.FileSharesGetOptionalParams): Promise; /** * @param resourceGroupName The name of the resource group within the user's subscription. The name * is case insensitive. @@ -219,8 +227,8 @@ export class FileShares { * @param options The optional parameters * @param callback The callback */ - get(resourceGroupName: string, accountName: string, shareName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, accountName: string, shareName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get(resourceGroupName: string, accountName: string, shareName: string, options: Models.FileSharesGetOptionalParams, callback: msRest.ServiceCallback): void; + get(resourceGroupName: string, accountName: string, shareName: string, options?: Models.FileSharesGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -286,6 +294,71 @@ export class FileShares { callback); } + /** + * Restore a file share within a valid retention days if share soft delete is enabled + * @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 shareName The name of the file share within the specified storage account. File share + * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash + * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or + * number. + * @param deletedShareName Required. Identify the name of the deleted share that will be restored. + * @param deletedShareVersion Required. Identify the version of the deleted share that will be + * restored. + * @param [options] The optional parameters + * @returns Promise + */ + restore(resourceGroupName: string, accountName: string, shareName: string, deletedShareName: string, deletedShareVersion: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @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 shareName The name of the file share within the specified storage account. File share + * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash + * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or + * number. + * @param deletedShareName Required. Identify the name of the deleted share that will be restored. + * @param deletedShareVersion Required. Identify the version of the deleted share that will be + * restored. + * @param callback The callback + */ + restore(resourceGroupName: string, accountName: string, shareName: string, deletedShareName: string, deletedShareVersion: string, callback: msRest.ServiceCallback): void; + /** + * @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 shareName The name of the file share within the specified storage account. File share + * names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash + * (-) only. Every dash (-) character must be immediately preceded and followed by a letter or + * number. + * @param deletedShareName Required. Identify the name of the deleted share that will be restored. + * @param deletedShareVersion Required. Identify the version of the deleted share that will be + * restored. + * @param options The optional parameters + * @param callback The callback + */ + restore(resourceGroupName: string, accountName: string, shareName: string, deletedShareName: string, deletedShareVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + restore(resourceGroupName: string, accountName: string, shareName: string, deletedShareName: string, deletedShareVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + shareName, + deletedShareName, + deletedShareVersion, + options + }, + restoreOperationSpec, + callback); + } + /** * Lists all shares. * @param nextPageLink The NextLink from the previous successful call to List operation. @@ -328,7 +401,8 @@ const listOperationSpec: msRest.OperationSpec = { queryParameters: [ Parameters.apiVersion, Parameters.maxpagesize, - Parameters.filter + Parameters.filter, + Parameters.expand2 ], headerParameters: [ Parameters.acceptLanguage @@ -360,16 +434,7 @@ const createOperationSpec: msRest.OperationSpec = { Parameters.acceptLanguage ], requestBody: { - parameterPath: { - metadata: [ - "options", - "metadata" - ], - shareQuota: [ - "options", - "shareQuota" - ] - }, + parameterPath: "fileShare", mapper: { ...Mappers.FileShare, required: true @@ -405,16 +470,7 @@ const updateOperationSpec: msRest.OperationSpec = { Parameters.acceptLanguage ], requestBody: { - parameterPath: { - metadata: [ - "options", - "metadata" - ], - shareQuota: [ - "options", - "shareQuota" - ] - }, + parameterPath: "fileShare", mapper: { ...Mappers.FileShare, required: true @@ -441,7 +497,8 @@ const getOperationSpec: msRest.OperationSpec = { Parameters.subscriptionId ], queryParameters: [ - Parameters.apiVersion + Parameters.apiVersion, + Parameters.expand3 ], headerParameters: [ Parameters.acceptLanguage @@ -482,6 +539,40 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { serializer }; +const restoreOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.shareName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: { + deletedShareName: "deletedShareName", + deletedShareVersion: "deletedShareVersion" + }, + mapper: { + ...Mappers.DeletedShare, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + const listNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", baseUrl: "https://management.azure.com",