diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index ff5cbc35691d..c50602a53618 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -4818,7 +4818,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.2.0-dev.20230804 + typescript: 5.2.0-dev.20230806 dev: false /duplexer3/0.1.5: @@ -10326,8 +10326,8 @@ packages: hasBin: true dev: false - /typescript/5.2.0-dev.20230804: - resolution: {integrity: sha512-4g7zcF85Th+zpaMgR7CHzM1MqjJ0Fv3+2PUxzCUMW8tc7aRYGPtQBfnAyN0+yXChZaV6lVejmrh7hle1DMAEcw==} + /typescript/5.2.0-dev.20230806: + resolution: {integrity: sha512-YQFa8UzjncWuVozkTh+XxPySrW053wUDWVofVi6fwqipHsGtZzi3SYpXv4H3OpViICbej9bCwEL17lo8WhMq+w==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -16899,7 +16899,7 @@ packages: dev: false file:projects/arm-storage.tgz: - resolution: {integrity: sha512-dS/jZZWnVSNazDj3sm24wYG+3bnwDUL5n7kc2qh3OCCauscraVxiQldmVfZ3y8+iQNkoZCc2wuCsgdD7DZMxVg==, tarball: file:projects/arm-storage.tgz} + resolution: {integrity: sha512-FZUs++QPu716IeRFCizGr9D9MHS+aruafJNnz24u2cX8cXkNXel7Ts8lqdYtNuRGepUwDYli2PEscbplkTwXTw==, tarball: file:projects/arm-storage.tgz} name: '@rush-temp/arm-storage' version: 0.0.0 dependencies: @@ -16913,7 +16913,8 @@ packages: '@types/node': 14.18.54 chai: 4.3.7 cross-env: 7.0.3 - mkdirp: 1.0.4 + dotenv: 16.3.1 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 @@ -19300,7 +19301,7 @@ packages: dev: false file:projects/identity-cache-persistence.tgz: - resolution: {integrity: sha512-suRodhlNh4+HKHblrqtOmgcd0v93ubPFRNq17B5XYbNYKyI2Od9n8dyx888Ncq111F0AkZ18ZuHtfOlGGj2kMA==, tarball: file:projects/identity-cache-persistence.tgz} + resolution: {integrity: sha512-m0hoOpafOAY1QGvzbcWmZ09OVvF0vr9h1IJXZPPBm7k9Z6PY7YnbcVSmGhNDTM7uYh+dviEKRh4+iw1ZDeZkDw==, tarball: file:projects/identity-cache-persistence.tgz} name: '@rush-temp/identity-cache-persistence' version: 0.0.0 dependencies: @@ -20254,7 +20255,7 @@ packages: dev: false file:projects/notification-hubs.tgz: - resolution: {integrity: sha512-9MFu1tfnxzzD0yi+/vt2r/ZCUZ79/cMut8DlmlKrYaA4vJo/CicjvfUAWMHz6lkhbJLpYuHy73X0IPIbve11fg==, tarball: file:projects/notification-hubs.tgz} + resolution: {integrity: sha512-DGgM6ZJxfKnVK8axRpJQXEKY+mhOliJQc1QU5q/cyzia188SP9xzz4UX73KmCYNchJuY8AhUoRMShUy+p4ztlg==, tarball: file:projects/notification-hubs.tgz} name: '@rush-temp/notification-hubs' version: 0.0.0 dependencies: diff --git a/sdk/storage/arm-storage/CHANGELOG.md b/sdk/storage/arm-storage/CHANGELOG.md index 94bbdce0b6c6..f3dcdf89846c 100644 --- a/sdk/storage/arm-storage/CHANGELOG.md +++ b/sdk/storage/arm-storage/CHANGELOG.md @@ -1,15 +1,53 @@ # Release History + +## 19.0.0 (2023-08-07) + +**Features** -## 18.1.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation StorageAccounts.beginCustomerInitiatedMigration + - Added operation StorageAccounts.beginCustomerInitiatedMigrationAndWait + - Added operation StorageAccounts.getCustomerInitiatedMigration + - Added Interface BlobInventoryCreationTime + - Added Interface ErrorAdditionalInfo + - Added Interface ErrorDetail + - Added Interface ErrorResponseAutoGenerated + - Added Interface StorageAccountMigration + - Added Interface StorageAccountsCustomerInitiatedMigrationHeaders + - Added Interface StorageAccountsCustomerInitiatedMigrationOptionalParams + - Added Interface StorageAccountsGetCustomerInitiatedMigrationOptionalParams + - Added Type Alias MigrationName + - Added Type Alias MigrationStatus + - Added Type Alias PostFailoverRedundancy + - Added Type Alias PostPlannedFailoverRedundancy + - Added Type Alias StorageAccountsGetCustomerInitiatedMigrationResponse + - Interface BlobInventoryPolicyFilter has a new optional parameter creationTime + - Interface GeoReplicationStats has a new optional parameter canPlannedFailover + - Interface GeoReplicationStats has a new optional parameter postFailoverRedundancy + - Interface GeoReplicationStats has a new optional parameter postPlannedFailoverRedundancy + - Interface StorageAccount has a new optional parameter accountMigrationInProgress + - Interface StorageAccount has a new optional parameter isSkuConversionBlocked + - Added Enum KnownMigrationName + - Added Enum KnownMigrationStatus + - Added Enum KnownPostFailoverRedundancy + - Added Enum KnownPostPlannedFailoverRedundancy + - Enum KnownAllowedMethods has a new value Connect + - Enum KnownAllowedMethods has a new value Trace -### Other Changes +**Breaking Changes** + - Interface BlobContainersListNextOptionalParams no longer has parameter filter + - Interface BlobContainersListNextOptionalParams no longer has parameter include + - Interface BlobContainersListNextOptionalParams no longer has parameter maxpagesize + - Interface EncryptionScopesListNextOptionalParams no longer has parameter filter + - Interface EncryptionScopesListNextOptionalParams no longer has parameter include + - Interface EncryptionScopesListNextOptionalParams no longer has parameter maxpagesize + - Interface FileSharesListNextOptionalParams no longer has parameter expand + - Interface FileSharesListNextOptionalParams no longer has parameter filter + - Interface FileSharesListNextOptionalParams no longer has parameter maxpagesize + - Interface QueueListNextOptionalParams no longer has parameter filter + - Interface QueueListNextOptionalParams no longer has parameter maxpagesize + + ## 18.1.0 (2022-11-24) **Features** diff --git a/sdk/storage/arm-storage/LICENSE b/sdk/storage/arm-storage/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/storage/arm-storage/LICENSE +++ b/sdk/storage/arm-storage/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/storage/arm-storage/_meta.json b/sdk/storage/arm-storage/_meta.json index b14aceb18f6b..e4ce21e42e62 100644 --- a/sdk/storage/arm-storage/_meta.json +++ b/sdk/storage/arm-storage/_meta.json @@ -1,8 +1,8 @@ { - "commit": "c583b05741fadfdca116be3b9ccb1c4be8a73258", + "commit": "a85aa1f7e967976348b11cff9124fd6df40ec3fc", "readme": "specification/storage/resource-manager/readme.md", - "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\storage\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.3.20221108.1 --generate-sample=true", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/storage/resource-manager/readme.md --use=@autorest/typescript@^6.0.4", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", - "use": "@autorest/typescript@6.0.0-rc.3.20221108.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.1", + "use": "@autorest/typescript@^6.0.4" } \ No newline at end of file diff --git a/sdk/storage/arm-storage/package.json b/sdk/storage/arm-storage/package.json index ccd890e24874..29b175181e5c 100644 --- a/sdk/storage/arm-storage/package.json +++ b/sdk/storage/arm-storage/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for StorageManagementClient.", - "version": "18.1.1", + "version": "19.0.0", "engines": { "node": ">=14.0.0" }, "dependencies": { - "@azure/core-lro": "^2.2.0", + "@azure/core-lro": "^2.5.4", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -33,12 +33,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~5.0.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -49,7 +50,6 @@ "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/arm-storage", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -111,12 +111,5 @@ ] }, "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-storage?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/arm-storage" +} \ No newline at end of file diff --git a/sdk/storage/arm-storage/review/arm-storage.api.md b/sdk/storage/arm-storage/review/arm-storage.api.md index b2e86a0236f5..64174d98740e 100644 --- a/sdk/storage/arm-storage/review/arm-storage.api.md +++ b/sdk/storage/arm-storage/review/arm-storage.api.md @@ -6,9 +6,9 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { PollOperationState } from '@azure/core-lro'; +import { SimplePollerLike } from '@azure/core-lro'; // @public (undocumented) export interface AccessPolicy { @@ -105,7 +105,7 @@ export interface BlobContainer extends AzureEntityResource { // @public export interface BlobContainers { - beginObjectLevelWorm(resourceGroupName: string, accountName: string, containerName: string, options?: BlobContainersObjectLevelWormOptionalParams): Promise, void>>; + beginObjectLevelWorm(resourceGroupName: string, accountName: string, containerName: string, options?: BlobContainersObjectLevelWormOptionalParams): Promise, void>>; beginObjectLevelWormAndWait(resourceGroupName: string, accountName: string, containerName: string, options?: BlobContainersObjectLevelWormOptionalParams): Promise; clearLegalHold(resourceGroupName: string, accountName: string, containerName: string, legalHold: LegalHold, options?: BlobContainersClearLegalHoldOptionalParams): Promise; create(resourceGroupName: string, accountName: string, containerName: string, blobContainer: BlobContainer, options?: BlobContainersCreateOptionalParams): Promise; @@ -209,9 +209,6 @@ export type BlobContainersLeaseResponse = LeaseContainerResponse; // @public export interface BlobContainersListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - include?: ListContainersInclude; - maxpagesize?: string; } // @public @@ -259,6 +256,11 @@ export interface BlobContainersUpdateOptionalParams extends coreClient.Operation // @public export type BlobContainersUpdateResponse = BlobContainer; +// @public +export interface BlobInventoryCreationTime { + lastNDays?: number; +} + // @public export interface BlobInventoryPolicies { createOrUpdate(resourceGroupName: string, accountName: string, blobInventoryPolicyName: BlobInventoryPolicyName, properties: BlobInventoryPolicy, options?: BlobInventoryPoliciesCreateOrUpdateOptionalParams): Promise; @@ -311,6 +313,7 @@ export interface BlobInventoryPolicyDefinition { // @public export interface BlobInventoryPolicyFilter { blobTypes?: string[]; + creationTime?: BlobInventoryCreationTime; excludePrefix?: string[]; includeBlobVersions?: boolean; includeDeleted?: boolean; @@ -604,9 +607,6 @@ export type EncryptionScopesGetResponse = EncryptionScope; // @public export interface EncryptionScopesListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - include?: ListEncryptionScopesInclude; - maxpagesize?: number; } // @public @@ -669,11 +669,31 @@ export interface Endpoints { readonly web?: string; } +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + // @public export interface ErrorResponse { error?: ErrorResponseBody; } +// @public +export interface ErrorResponseAutoGenerated { + error?: ErrorDetail; +} + // @public export interface ErrorResponseBody { code?: string; @@ -837,9 +857,6 @@ export type FileSharesLeaseResponse = FileSharesLeaseHeaders & LeaseShareRespons // @public export interface FileSharesListNextOptionalParams extends coreClient.OperationOptions { - expand?: string; - filter?: string; - maxpagesize?: string; } // @public @@ -872,7 +889,10 @@ export type Format = string; // @public export interface GeoReplicationStats { readonly canFailover?: boolean; + readonly canPlannedFailover?: boolean; readonly lastSyncTime?: Date; + readonly postFailoverRedundancy?: PostFailoverRedundancy; + readonly postPlannedFailoverRedundancy?: PostPlannedFailoverRedundancy; readonly status?: GeoReplicationStatus; } @@ -1001,6 +1021,7 @@ export enum KnownAllowedCopyScope { // @public export enum KnownAllowedMethods { + Connect = "CONNECT", Delete = "DELETE", GET = "GET", Head = "HEAD", @@ -1008,7 +1029,8 @@ export enum KnownAllowedMethods { Options = "OPTIONS", Patch = "PATCH", Post = "POST", - PUT = "PUT" + PUT = "PUT", + Trace = "TRACE" } // @public @@ -1211,12 +1233,26 @@ export enum KnownManagementPolicyName { Default = "default" } +// @public +export enum KnownMigrationName { + Default = "default" +} + // @public export enum KnownMigrationState { Completed = "Completed", InProgress = "InProgress" } +// @public +export enum KnownMigrationStatus { + Complete = "Complete", + Failed = "Failed", + InProgress = "InProgress", + Invalid = "Invalid", + SubmittedForConversion = "SubmittedForConversion" +} + // @public export enum KnownMinimumTlsVersion { TLS10 = "TLS1_0", @@ -1255,6 +1291,20 @@ export enum KnownPermissions { W = "w" } +// @public +export enum KnownPostFailoverRedundancy { + StandardLRS = "Standard_LRS", + StandardZRS = "Standard_ZRS" +} + +// @public +export enum KnownPostPlannedFailoverRedundancy { + StandardGRS = "Standard_GRS", + StandardGzrs = "Standard_GZRS", + StandardRagrs = "Standard_RAGRS", + StandardRagzrs = "Standard_RAGZRS" +} + // @public export enum KnownPrivateEndpointConnectionProvisioningState { Creating = "Creating", @@ -1712,9 +1762,15 @@ export interface MetricSpecification { unit?: string; } +// @public +export type MigrationName = string; + // @public export type MigrationState = string; +// @public +export type MigrationStatus = string; + // @public export type MinimumTlsVersion = string; @@ -1843,6 +1899,12 @@ export interface PermissionScope { service: string; } +// @public +export type PostFailoverRedundancy = string; + +// @public +export type PostPlannedFailoverRedundancy = string; + // @public export interface PrivateEndpoint { readonly id?: string; @@ -1983,8 +2045,6 @@ export type QueueGetResponse = StorageQueue; // @public export interface QueueListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - maxpagesize?: string; } // @public @@ -2208,6 +2268,7 @@ export type State = string; // @public export interface StorageAccount extends TrackedResource { readonly accessTier?: AccessTier; + readonly accountMigrationInProgress?: boolean; allowBlobPublicAccess?: boolean; allowCrossTenantReplication?: boolean; allowedCopyScope?: AllowedCopyScope; @@ -2229,6 +2290,7 @@ export interface StorageAccount extends TrackedResource { isHnsEnabled?: boolean; isLocalUserEnabled?: boolean; isSftpEnabled?: boolean; + readonly isSkuConversionBlocked?: boolean; readonly keyCreationTime?: KeyCreationTime; readonly keyPolicy?: KeyPolicy; readonly kind?: Kind; @@ -2332,6 +2394,17 @@ export interface StorageAccountMicrosoftEndpoints { readonly web?: string; } +// @public +export interface StorageAccountMigration { + readonly id?: string; + readonly migrationFailedDetailedReason?: string; + readonly migrationFailedReason?: string; + readonly migrationStatus?: MigrationStatus; + name?: string; + targetSkuName: SkuName; + type?: string; +} + // @public export interface StorageAccountRegenerateKeyParameters { keyName: string; @@ -2339,18 +2412,21 @@ export interface StorageAccountRegenerateKeyParameters { // @public export interface StorageAccounts { - beginAbortHierarchicalNamespaceMigration(resourceGroupName: string, accountName: string, options?: StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParams): Promise, void>>; + beginAbortHierarchicalNamespaceMigration(resourceGroupName: string, accountName: string, options?: StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParams): Promise, void>>; beginAbortHierarchicalNamespaceMigrationAndWait(resourceGroupName: string, accountName: string, options?: StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParams): Promise; - beginCreate(resourceGroupName: string, accountName: string, parameters: StorageAccountCreateParameters, options?: StorageAccountsCreateOptionalParams): Promise, StorageAccountsCreateResponse>>; + beginCreate(resourceGroupName: string, accountName: string, parameters: StorageAccountCreateParameters, options?: StorageAccountsCreateOptionalParams): Promise, StorageAccountsCreateResponse>>; beginCreateAndWait(resourceGroupName: string, accountName: string, parameters: StorageAccountCreateParameters, options?: StorageAccountsCreateOptionalParams): Promise; - beginFailover(resourceGroupName: string, accountName: string, options?: StorageAccountsFailoverOptionalParams): Promise, void>>; + beginCustomerInitiatedMigration(resourceGroupName: string, accountName: string, parameters: StorageAccountMigration, options?: StorageAccountsCustomerInitiatedMigrationOptionalParams): Promise, void>>; + beginCustomerInitiatedMigrationAndWait(resourceGroupName: string, accountName: string, parameters: StorageAccountMigration, options?: StorageAccountsCustomerInitiatedMigrationOptionalParams): Promise; + beginFailover(resourceGroupName: string, accountName: string, options?: StorageAccountsFailoverOptionalParams): Promise, void>>; beginFailoverAndWait(resourceGroupName: string, accountName: string, options?: StorageAccountsFailoverOptionalParams): Promise; - beginHierarchicalNamespaceMigration(resourceGroupName: string, accountName: string, requestType: string, options?: StorageAccountsHierarchicalNamespaceMigrationOptionalParams): Promise, void>>; + beginHierarchicalNamespaceMigration(resourceGroupName: string, accountName: string, requestType: string, options?: StorageAccountsHierarchicalNamespaceMigrationOptionalParams): Promise, void>>; beginHierarchicalNamespaceMigrationAndWait(resourceGroupName: string, accountName: string, requestType: string, options?: StorageAccountsHierarchicalNamespaceMigrationOptionalParams): Promise; - beginRestoreBlobRanges(resourceGroupName: string, accountName: string, parameters: BlobRestoreParameters, options?: StorageAccountsRestoreBlobRangesOptionalParams): Promise, StorageAccountsRestoreBlobRangesResponse>>; + beginRestoreBlobRanges(resourceGroupName: string, accountName: string, parameters: BlobRestoreParameters, options?: StorageAccountsRestoreBlobRangesOptionalParams): Promise, StorageAccountsRestoreBlobRangesResponse>>; beginRestoreBlobRangesAndWait(resourceGroupName: string, accountName: string, parameters: BlobRestoreParameters, options?: StorageAccountsRestoreBlobRangesOptionalParams): Promise; checkNameAvailability(accountName: StorageAccountCheckNameAvailabilityParameters, options?: StorageAccountsCheckNameAvailabilityOptionalParams): Promise; delete(resourceGroupName: string, accountName: string, options?: StorageAccountsDeleteOptionalParams): Promise; + getCustomerInitiatedMigration(resourceGroupName: string, accountName: string, migrationName: MigrationName, options?: StorageAccountsGetCustomerInitiatedMigrationOptionalParams): Promise; getProperties(resourceGroupName: string, accountName: string, options?: StorageAccountsGetPropertiesOptionalParams): Promise; list(options?: StorageAccountsListOptionalParams): PagedAsyncIterableIterator; listAccountSAS(resourceGroupName: string, accountName: string, parameters: AccountSasParameters, options?: StorageAccountsListAccountSASOptionalParams): Promise; @@ -2384,6 +2460,18 @@ export interface StorageAccountsCreateOptionalParams extends coreClient.Operatio // @public export type StorageAccountsCreateResponse = StorageAccount; +// @public +export interface StorageAccountsCustomerInitiatedMigrationHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface StorageAccountsCustomerInitiatedMigrationOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + // @public export interface StorageAccountsDeleteOptionalParams extends coreClient.OperationOptions { } @@ -2394,6 +2482,13 @@ export interface StorageAccountsFailoverOptionalParams extends coreClient.Operat updateIntervalInMs?: number; } +// @public +export interface StorageAccountsGetCustomerInitiatedMigrationOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageAccountsGetCustomerInitiatedMigrationResponse = StorageAccountMigration; + // @public export interface StorageAccountsGetPropertiesOptionalParams extends coreClient.OperationOptions { expand?: StorageAccountExpand; diff --git a/sdk/storage/arm-storage/src/lroImpl.ts b/sdk/storage/arm-storage/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/storage/arm-storage/src/lroImpl.ts +++ b/sdk/storage/arm-storage/src/lroImpl.ts @@ -6,29 +6,37 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; import { LongRunningOperation, LroResponse } from "@azure/core-lro"; -export class LroImpl implements LongRunningOperation { - constructor( - private sendOperationFn: (args: any, spec: any) => Promise>, - private args: Record, - private spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record, - public requestPath: string = spec.path!, - public requestMethod: string = spec.httpMethod - ) {} - public async sendInitialRequest(): Promise> { - return this.sendOperationFn(this.args, this.spec); - } - public async sendPollRequest(path: string): Promise> { - const { requestBody, ...restSpec } = this.spec; - return this.sendOperationFn(this.args, { - ...restSpec, - path, - httpMethod: "GET" - }); - } +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; } diff --git a/sdk/storage/arm-storage/src/models/index.ts b/sdk/storage/arm-storage/src/models/index.ts index a744442d9d61..b7b26df19a6c 100644 --- a/sdk/storage/arm-storage/src/models/index.ts +++ b/sdk/storage/arm-storage/src/models/index.ts @@ -217,7 +217,7 @@ export interface StorageAccountCreateParameters { largeFileSharesState?: LargeFileSharesState; /** Maintains information about the network routing choice opted by the user for data transfer */ routingPreference?: RoutingPreference; - /** Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. */ + /** Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false for this property. */ allowBlobPublicAccess?: boolean; /** Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. */ minimumTlsVersion?: MinimumTlsVersion; @@ -225,7 +225,7 @@ export interface StorageAccountCreateParameters { allowSharedKeyAccess?: boolean; /** NFS 3.0 protocol support enabled if set to true. */ enableNfsV3?: boolean; - /** Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. */ + /** Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object replication policies will involve storage accounts in different AAD tenants. The default interpretation is false for new accounts to follow best security practices by default. */ allowCrossTenantReplication?: boolean; /** A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. */ defaultToOAuthAuthentication?: boolean; @@ -597,6 +597,21 @@ export interface GeoReplicationStats { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly canFailover?: boolean; + /** + * A boolean flag which indicates whether or not planned account failover is supported for the account. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly canPlannedFailover?: boolean; + /** + * The redundancy type of the account after an account failover is performed. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly postFailoverRedundancy?: PostFailoverRedundancy; + /** + * The redundancy type of the account after a planned account failover is performed. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly postPlannedFailoverRedundancy?: PostPlannedFailoverRedundancy; } /** The Private Endpoint resource. */ @@ -732,13 +747,13 @@ export interface StorageAccountUpdateParameters { largeFileSharesState?: LargeFileSharesState; /** Maintains information about the network routing choice opted by the user for data transfer */ routingPreference?: RoutingPreference; - /** Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. */ + /** Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false for this property. */ allowBlobPublicAccess?: boolean; /** Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. */ minimumTlsVersion?: MinimumTlsVersion; /** Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. */ allowSharedKeyAccess?: boolean; - /** Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. */ + /** Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object replication policies will involve storage accounts in different AAD tenants. The default interpretation is false for new accounts to follow best security practices by default. */ allowCrossTenantReplication?: boolean; /** A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. */ defaultToOAuthAuthentication?: boolean; @@ -955,6 +970,85 @@ export interface ListServiceSasResponse { readonly serviceSasToken?: string; } +/** The parameters or status associated with an ongoing or enqueued storage account migration in order to update its current SKU or region. */ +export interface StorageAccountMigration { + /** + * Migration Resource Id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** current value is 'default' for customer initiated migration */ + name?: string; + /** SrpAccountMigrationType in ARM contract which is 'accountMigrations' */ + type?: string; + /** Target sku name for the account */ + targetSkuName: SkuName; + /** + * Current status of migration + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly migrationStatus?: MigrationStatus; + /** + * Error code for migration failure + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly migrationFailedReason?: string; + /** + * Reason for migration failure + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly migrationFailedDetailedReason?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponseAutoGenerated { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + /** The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. */ export interface ManagementPolicySchema { /** The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. */ @@ -1130,6 +1224,14 @@ export interface BlobInventoryPolicyFilter { includeSnapshots?: boolean; /** For 'Container' definition.objectType the definition.schemaFields must include 'Deleted, Version, DeletedTime and RemainingRetentionDays'. For 'Blob' definition.objectType and HNS enabled storage accounts the definition.schemaFields must include 'DeletionId, Deleted, DeletedTime and RemainingRetentionDays' and for Hns disabled accounts the definition.schemaFields must include 'Deleted and RemainingRetentionDays', else it must be excluded. */ includeDeleted?: boolean; + /** This property is used to filter objects based on the object creation time */ + creationTime?: BlobInventoryCreationTime; +} + +/** This property defines the creation time based filtering condition. Blob Inventory schema parameter 'Creation-Time' is mandatory with this filter. */ +export interface BlobInventoryCreationTime { + /** When set the policy filters the objects that are created in the last N days. Where N is an integer value between 1 to 36500. */ + lastNDays?: number; } /** Metadata pertaining to creation and last modification of the resource. */ @@ -2052,7 +2154,7 @@ export interface StorageAccount extends TrackedResource { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly blobRestoreStatus?: BlobRestoreStatus; - /** Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. */ + /** Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false for this property. */ allowBlobPublicAccess?: boolean; /** Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. */ minimumTlsVersion?: MinimumTlsVersion; @@ -2060,7 +2162,7 @@ export interface StorageAccount extends TrackedResource { allowSharedKeyAccess?: boolean; /** NFS 3.0 protocol support enabled if set to true. */ enableNfsV3?: boolean; - /** Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. */ + /** Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object replication policies will involve storage accounts in different AAD tenants. The default interpretation is false for new accounts to follow best security practices by default. */ allowCrossTenantReplication?: boolean; /** A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. */ defaultToOAuthAuthentication?: boolean; @@ -2074,6 +2176,16 @@ export interface StorageAccount extends TrackedResource { storageAccountSkuConversionStatus?: StorageAccountSkuConversionStatus; /** Allows you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of accounts in a single subscription, which creates accounts in an Azure DNS Zone and the endpoint URL will have an alphanumeric DNS Zone identifier. */ dnsEndpointType?: DnsEndpointType; + /** + * This property will be set to true or false on an event of ongoing migration. Default value is null. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isSkuConversionBlocked?: boolean; + /** + * If customer initiated account migration is in progress, the value will be true else it will be null. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly accountMigrationInProgress?: boolean; } /** Deleted storage account */ @@ -2428,6 +2540,11 @@ export interface FileShare extends AzureEntityResource { readonly snapshotTime?: Date; } +/** Defines headers for StorageAccounts_customerInitiatedMigration operation. */ +export interface StorageAccountsCustomerInitiatedMigrationHeaders { + location?: string; +} + /** Defines headers for BlobContainers_createOrUpdateImmutabilityPolicy operation. */ export interface BlobContainersCreateOrUpdateImmutabilityPolicyHeaders { /** The ETag HTTP response header. This is an opaque string. You can use it to detect whether the resource has changed between requests. In particular, you can pass the ETag to one of the If-Match or If-None-Match headers. */ @@ -2905,6 +3022,48 @@ export enum KnownGeoReplicationStatus { */ export type GeoReplicationStatus = string; +/** Known values of {@link PostFailoverRedundancy} that the service accepts. */ +export enum KnownPostFailoverRedundancy { + /** StandardLRS */ + StandardLRS = "Standard_LRS", + /** StandardZRS */ + StandardZRS = "Standard_ZRS" +} + +/** + * Defines values for PostFailoverRedundancy. \ + * {@link KnownPostFailoverRedundancy} can be used interchangeably with PostFailoverRedundancy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Standard_LRS** \ + * **Standard_ZRS** + */ +export type PostFailoverRedundancy = string; + +/** Known values of {@link PostPlannedFailoverRedundancy} that the service accepts. */ +export enum KnownPostPlannedFailoverRedundancy { + /** StandardGRS */ + StandardGRS = "Standard_GRS", + /** StandardGzrs */ + StandardGzrs = "Standard_GZRS", + /** StandardRagrs */ + StandardRagrs = "Standard_RAGRS", + /** StandardRagzrs */ + StandardRagzrs = "Standard_RAGZRS" +} + +/** + * Defines values for PostPlannedFailoverRedundancy. \ + * {@link KnownPostPlannedFailoverRedundancy} can be used interchangeably with PostPlannedFailoverRedundancy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Standard_GRS** \ + * **Standard_GZRS** \ + * **Standard_RAGRS** \ + * **Standard_RAGZRS** + */ +export type PostPlannedFailoverRedundancy = string; + /** Known values of {@link PrivateEndpointServiceConnectionStatus} that the service accepts. */ export enum KnownPrivateEndpointServiceConnectionStatus { /** Pending */ @@ -3097,6 +3256,48 @@ export enum KnownSignedResource { */ export type SignedResource = string; +/** Known values of {@link MigrationStatus} that the service accepts. */ +export enum KnownMigrationStatus { + /** Invalid */ + Invalid = "Invalid", + /** SubmittedForConversion */ + SubmittedForConversion = "SubmittedForConversion", + /** InProgress */ + InProgress = "InProgress", + /** Complete */ + Complete = "Complete", + /** Failed */ + Failed = "Failed" +} + +/** + * Defines values for MigrationStatus. \ + * {@link KnownMigrationStatus} can be used interchangeably with MigrationStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **SubmittedForConversion** \ + * **InProgress** \ + * **Complete** \ + * **Failed** + */ +export type MigrationStatus = string; + +/** Known values of {@link MigrationName} that the service accepts. */ +export enum KnownMigrationName { + /** Default */ + Default = "default" +} + +/** + * Defines values for MigrationName. \ + * {@link KnownMigrationName} can be used interchangeably with MigrationName, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **default** + */ +export type MigrationName = string; + /** Known values of {@link ManagementPolicyName} that the service accepts. */ export enum KnownManagementPolicyName { /** Default */ @@ -3309,7 +3510,11 @@ export enum KnownAllowedMethods { /** PUT */ PUT = "PUT", /** Patch */ - Patch = "PATCH" + Patch = "PATCH", + /** Connect */ + Connect = "CONNECT", + /** Trace */ + Trace = "TRACE" } /** @@ -3324,7 +3529,9 @@ export enum KnownAllowedMethods { * **POST** \ * **OPTIONS** \ * **PUT** \ - * **PATCH** + * **PATCH** \ + * **CONNECT** \ + * **TRACE** */ export type AllowedMethods = string; @@ -3745,6 +3952,22 @@ export interface StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParam resumeFrom?: string; } +/** Optional parameters. */ +export interface StorageAccountsCustomerInitiatedMigrationOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageAccountsGetCustomerInitiatedMigrationOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getCustomerInitiatedMigration operation. */ +export type StorageAccountsGetCustomerInitiatedMigrationResponse = StorageAccountMigration; + /** Optional parameters. */ export interface StorageAccountsRestoreBlobRangesOptionalParams extends coreClient.OperationOptions { @@ -3979,14 +4202,7 @@ export type EncryptionScopesListResponse = EncryptionScopeListResult; /** Optional parameters. */ export interface EncryptionScopesListNextOptionalParams - extends coreClient.OperationOptions { - /** Optional, specifies the maximum number of encryption scopes that will be included in the list response. */ - maxpagesize?: number; - /** Optional. When specified, only encryption scope names starting with the filter will be listed. */ - filter?: string; - /** Optional, when specified, will list encryption scopes with the specific state. Defaults to All */ - include?: ListEncryptionScopesInclude; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type EncryptionScopesListNextResponse = EncryptionScopeListResult; @@ -4137,14 +4353,7 @@ export interface BlobContainersObjectLevelWormOptionalParams /** Optional parameters. */ export interface BlobContainersListNextOptionalParams - extends coreClient.OperationOptions { - /** Optional. When specified, only container names starting with the filter will be listed. */ - filter?: string; - /** Optional. Specified maximum number of containers that can be included in the list. */ - maxpagesize?: string; - /** Optional, used to include the properties for soft deleted blob containers. */ - include?: ListContainersInclude; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type BlobContainersListNextResponse = ListContainerItems; @@ -4241,14 +4450,7 @@ export type FileSharesLeaseResponse = FileSharesLeaseHeaders & /** Optional parameters. */ export interface FileSharesListNextOptionalParams - extends coreClient.OperationOptions { - /** Optional. When specified, only share names starting with the filter will be listed. */ - filter?: string; - /** Optional. Specified maximum number of shares that can be included in the list. */ - maxpagesize?: string; - /** Optional, used to expand the properties within share's properties. Valid values are: deleted, snapshots. Should be passed as a string with delimiter ',' */ - expand?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type FileSharesListNextResponse = FileShareItems; @@ -4311,12 +4513,7 @@ export type QueueListResponse = ListQueueResource; /** Optional parameters. */ export interface QueueListNextOptionalParams - extends coreClient.OperationOptions { - /** Optional, When specified, only the queues with a name starting with the given filter will be listed. */ - filter?: string; - /** Optional, a maximum number of queues that should be included in a list queue response */ - maxpagesize?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type QueueListNextResponse = ListQueueResource; diff --git a/sdk/storage/arm-storage/src/models/mappers.ts b/sdk/storage/arm-storage/src/models/mappers.ts index d6b222ac1a81..11b3adf8a81c 100644 --- a/sdk/storage/arm-storage/src/models/mappers.ts +++ b/sdk/storage/arm-storage/src/models/mappers.ts @@ -1464,6 +1464,27 @@ export const GeoReplicationStats: coreClient.CompositeMapper = { type: { name: "Boolean" } + }, + canPlannedFailover: { + serializedName: "canPlannedFailover", + readOnly: true, + type: { + name: "Boolean" + } + }, + postFailoverRedundancy: { + serializedName: "postFailoverRedundancy", + readOnly: true, + type: { + name: "String" + } + }, + postPlannedFailoverRedundancy: { + serializedName: "postPlannedFailoverRedundancy", + readOnly: true, + type: { + name: "String" + } } } } @@ -2314,6 +2335,158 @@ export const ListServiceSasResponse: coreClient.CompositeMapper = { } }; +export const StorageAccountMigration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageAccountMigration", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + targetSkuName: { + serializedName: "properties.targetSkuName", + required: true, + type: { + name: "String" + } + }, + migrationStatus: { + serializedName: "properties.migrationStatus", + readOnly: true, + type: { + name: "String" + } + }, + migrationFailedReason: { + serializedName: "properties.migrationFailedReason", + readOnly: true, + type: { + name: "String" + } + }, + migrationFailedDetailedReason: { + serializedName: "properties.migrationFailedDetailedReason", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponseAutoGenerated: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponseAutoGenerated", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + export const ManagementPolicySchema: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2907,6 +3080,32 @@ export const BlobInventoryPolicyFilter: coreClient.CompositeMapper = { type: { name: "Boolean" } + }, + creationTime: { + serializedName: "creationTime", + type: { + name: "Composite", + className: "BlobInventoryCreationTime" + } + } + } + } +}; + +export const BlobInventoryCreationTime: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BlobInventoryCreationTime", + modelProperties: { + lastNDays: { + constraints: { + InclusiveMaximum: 36500, + InclusiveMinimum: 1 + }, + serializedName: "lastNDays", + type: { + name: "Number" + } } } } @@ -5218,6 +5417,20 @@ export const StorageAccount: coreClient.CompositeMapper = { type: { name: "String" } + }, + isSkuConversionBlocked: { + serializedName: "properties.isSkuConversionBlocked", + readOnly: true, + type: { + name: "Boolean" + } + }, + accountMigrationInProgress: { + serializedName: "properties.accountMigrationInProgress", + readOnly: true, + type: { + name: "Boolean" + } } } } @@ -5863,6 +6076,21 @@ export const FileShare: coreClient.CompositeMapper = { } }; +export const StorageAccountsCustomerInitiatedMigrationHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageAccountsCustomerInitiatedMigrationHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + export const BlobContainersCreateOrUpdateImmutabilityPolicyHeaders: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/storage/arm-storage/src/models/parameters.ts b/sdk/storage/arm-storage/src/models/parameters.ts index 24bb129810b2..d1e8b846fe88 100644 --- a/sdk/storage/arm-storage/src/models/parameters.ts +++ b/sdk/storage/arm-storage/src/models/parameters.ts @@ -18,6 +18,7 @@ import { StorageAccountRegenerateKeyParameters as StorageAccountRegenerateKeyParametersMapper, AccountSasParameters as AccountSasParametersMapper, ServiceSasParameters as ServiceSasParametersMapper, + StorageAccountMigration as StorageAccountMigrationMapper, BlobRestoreParameters as BlobRestoreParametersMapper, ManagementPolicy as ManagementPolicyMapper, BlobInventoryPolicy as BlobInventoryPolicyMapper, @@ -67,7 +68,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-09-01", + defaultValue: "2023-01-01", isConstant: true, serializedName: "api-version", type: { @@ -131,6 +132,7 @@ export const accountName1: OperationURLParameter = { parameterPath: "accountName", mapper: { constraints: { + Pattern: new RegExp("^[a-z0-9]+$"), MaxLength: 24, MinLength: 3 }, @@ -209,10 +211,41 @@ export const requestType: OperationQueryParameter = { }; export const parameters4: OperationParameter = { + parameterPath: "parameters", + mapper: StorageAccountMigrationMapper +}; + +export const migrationName: OperationURLParameter = { + parameterPath: "migrationName", + mapper: { + serializedName: "migrationName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters5: OperationParameter = { parameterPath: "parameters", mapper: BlobRestoreParametersMapper }; +export const accountName2: OperationURLParameter = { + parameterPath: "accountName", + mapper: { + constraints: { + MaxLength: 24, + MinLength: 3 + }, + serializedName: "accountName", + required: true, + type: { + name: "String" + } + } +}; + export const nextLink: OperationURLParameter = { parameterPath: "nextLink", mapper: { @@ -392,7 +425,7 @@ export const include: OperationQueryParameter = { } }; -export const parameters5: OperationParameter = { +export const parameters6: OperationParameter = { parameterPath: "parameters", mapper: BlobServicePropertiesMapper }; @@ -454,7 +487,7 @@ export const legalHold: OperationParameter = { mapper: LegalHoldMapper }; -export const parameters6: OperationParameter = { +export const parameters7: OperationParameter = { parameterPath: ["options", "parameters"], mapper: ImmutabilityPolicyMapper }; @@ -492,12 +525,12 @@ export const ifMatch1: OperationParameter = { } }; -export const parameters7: OperationParameter = { +export const parameters8: OperationParameter = { parameterPath: ["options", "parameters"], mapper: LeaseContainerRequestMapper }; -export const parameters8: OperationParameter = { +export const parameters9: OperationParameter = { parameterPath: "parameters", mapper: FileServicePropertiesMapper }; @@ -569,12 +602,12 @@ export const deletedShare: OperationParameter = { mapper: DeletedShareMapper }; -export const parameters9: OperationParameter = { +export const parameters10: OperationParameter = { parameterPath: ["options", "parameters"], mapper: LeaseShareRequestMapper }; -export const parameters10: OperationParameter = { +export const parameters11: OperationParameter = { parameterPath: "parameters", mapper: QueueServicePropertiesMapper }; @@ -612,7 +645,7 @@ export const queueName: OperationURLParameter = { } }; -export const parameters11: OperationParameter = { +export const parameters12: OperationParameter = { parameterPath: "parameters", mapper: TableServicePropertiesMapper }; @@ -629,7 +662,7 @@ export const tableServiceName: OperationURLParameter = { } }; -export const parameters12: OperationParameter = { +export const parameters13: OperationParameter = { parameterPath: ["options", "parameters"], mapper: TableMapper }; diff --git a/sdk/storage/arm-storage/src/operations/blobContainers.ts b/sdk/storage/arm-storage/src/operations/blobContainers.ts index e8ef1dfc145c..c7dacc715684 100644 --- a/sdk/storage/arm-storage/src/operations/blobContainers.ts +++ b/sdk/storage/arm-storage/src/operations/blobContainers.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { StorageManagementClient } from "../storageManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { ListContainerItem, BlobContainersListNextOptionalParams, @@ -517,14 +521,14 @@ export class BlobContainersImpl implements BlobContainers { accountName: string, containerName: string, options?: BlobContainersObjectLevelWormOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -557,15 +561,15 @@ export class BlobContainersImpl implements BlobContainers { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, accountName, containerName, options }, - objectLevelWormOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, accountName, containerName, options }, + spec: objectLevelWormOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -788,7 +792,7 @@ const createOrUpdateImmutabilityPolicyOperationSpec: coreClient.OperationSpec = Mappers.BlobContainersCreateOrUpdateImmutabilityPolicyHeaders } }, - requestBody: Parameters.parameters6, + requestBody: Parameters.parameters7, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -881,7 +885,7 @@ const extendImmutabilityPolicyOperationSpec: coreClient.OperationSpec = { headersMapper: Mappers.BlobContainersExtendImmutabilityPolicyHeaders } }, - requestBody: Parameters.parameters6, + requestBody: Parameters.parameters7, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -907,7 +911,7 @@ const leaseOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.LeaseContainerResponse } }, - requestBody: Parameters.parameters7, + requestBody: Parameters.parameters8, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -952,12 +956,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ListContainerItems } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.maxpagesize1, - Parameters.include1 - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/storage/arm-storage/src/operations/blobServices.ts b/sdk/storage/arm-storage/src/operations/blobServices.ts index 482b078e5bf8..9e8e8659dfe9 100644 --- a/sdk/storage/arm-storage/src/operations/blobServices.ts +++ b/sdk/storage/arm-storage/src/operations/blobServices.ts @@ -192,7 +192,7 @@ const setServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.BlobServiceProperties } }, - requestBody: Parameters.parameters5, + requestBody: Parameters.parameters6, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/storage/arm-storage/src/operations/deletedAccounts.ts b/sdk/storage/arm-storage/src/operations/deletedAccounts.ts index cc672064ec95..1d39e7c8067e 100644 --- a/sdk/storage/arm-storage/src/operations/deletedAccounts.ts +++ b/sdk/storage/arm-storage/src/operations/deletedAccounts.ts @@ -185,7 +185,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/storage/arm-storage/src/operations/encryptionScopes.ts b/sdk/storage/arm-storage/src/operations/encryptionScopes.ts index 8d9740beba69..5e7089a8aff0 100644 --- a/sdk/storage/arm-storage/src/operations/encryptionScopes.ts +++ b/sdk/storage/arm-storage/src/operations/encryptionScopes.ts @@ -366,12 +366,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.EncryptionScopeListResult } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.maxpagesize, - Parameters.filter, - Parameters.include - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/storage/arm-storage/src/operations/fileServices.ts b/sdk/storage/arm-storage/src/operations/fileServices.ts index 433b6962190f..d4b21e5a56db 100644 --- a/sdk/storage/arm-storage/src/operations/fileServices.ts +++ b/sdk/storage/arm-storage/src/operations/fileServices.ts @@ -135,7 +135,7 @@ const setServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters8, + requestBody: Parameters.parameters9, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/storage/arm-storage/src/operations/fileShares.ts b/sdk/storage/arm-storage/src/operations/fileShares.ts index 7229805d8865..5bf645fa8539 100644 --- a/sdk/storage/arm-storage/src/operations/fileShares.ts +++ b/sdk/storage/arm-storage/src/operations/fileShares.ts @@ -485,7 +485,7 @@ const leaseOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters9, + requestBody: Parameters.parameters10, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -513,12 +513,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.maxpagesize1, - Parameters.expand2 - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/storage/arm-storage/src/operations/queue.ts b/sdk/storage/arm-storage/src/operations/queue.ts index ca40bc8a38e3..aca8ed2f4613 100644 --- a/sdk/storage/arm-storage/src/operations/queue.ts +++ b/sdk/storage/arm-storage/src/operations/queue.ts @@ -397,11 +397,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.maxpagesize1 - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/storage/arm-storage/src/operations/queueServices.ts b/sdk/storage/arm-storage/src/operations/queueServices.ts index 21fad00fbc79..11baa7b80181 100644 --- a/sdk/storage/arm-storage/src/operations/queueServices.ts +++ b/sdk/storage/arm-storage/src/operations/queueServices.ts @@ -135,7 +135,7 @@ const setServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters10, + requestBody: Parameters.parameters11, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/storage/arm-storage/src/operations/storageAccounts.ts b/sdk/storage/arm-storage/src/operations/storageAccounts.ts index d475e2741da1..339b1e33c980 100644 --- a/sdk/storage/arm-storage/src/operations/storageAccounts.ts +++ b/sdk/storage/arm-storage/src/operations/storageAccounts.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { StorageManagementClient } from "../storageManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { StorageAccount, StorageAccountsListNextOptionalParams, @@ -49,6 +53,11 @@ import { StorageAccountsFailoverOptionalParams, StorageAccountsHierarchicalNamespaceMigrationOptionalParams, StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParams, + StorageAccountMigration, + StorageAccountsCustomerInitiatedMigrationOptionalParams, + MigrationName, + StorageAccountsGetCustomerInitiatedMigrationOptionalParams, + StorageAccountsGetCustomerInitiatedMigrationResponse, BlobRestoreParameters, StorageAccountsRestoreBlobRangesOptionalParams, StorageAccountsRestoreBlobRangesResponse, @@ -232,8 +241,8 @@ export class StorageAccountsImpl implements StorageAccounts { parameters: StorageAccountCreateParameters, options?: StorageAccountsCreateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, StorageAccountsCreateResponse > > { @@ -243,7 +252,7 @@ export class StorageAccountsImpl implements StorageAccounts { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -276,13 +285,16 @@ export class StorageAccountsImpl implements StorageAccounts { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, accountName, parameters, options }, - createOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, accountName, parameters, options }, + spec: createOperationSpec + }); + const poller = await createHttpPoller< + StorageAccountsCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -512,7 +524,7 @@ export class StorageAccountsImpl implements StorageAccounts { * primary and secondary endpoints are available. The primary use case of a Planned Failover is * disaster recovery testing drills. This type of failover is invoked by setting FailoverType parameter * to 'Planned'. Learn more about the failover options here- - * https://learn.microsoft.com/azure/storage/common/storage-disaster-recovery-guidance + * https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance * @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 @@ -524,14 +536,14 @@ export class StorageAccountsImpl implements StorageAccounts { resourceGroupName: string, accountName: string, options?: StorageAccountsFailoverOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -564,15 +576,15 @@ export class StorageAccountsImpl implements StorageAccounts { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, accountName, options }, - failoverOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, accountName, options }, + spec: failoverOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -588,7 +600,7 @@ export class StorageAccountsImpl implements StorageAccounts { * primary and secondary endpoints are available. The primary use case of a Planned Failover is * disaster recovery testing drills. This type of failover is invoked by setting FailoverType parameter * to 'Planned'. Learn more about the failover options here- - * https://learn.microsoft.com/azure/storage/common/storage-disaster-recovery-guidance + * https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance * @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 @@ -627,14 +639,14 @@ export class StorageAccountsImpl implements StorageAccounts { accountName: string, requestType: string, options?: StorageAccountsHierarchicalNamespaceMigrationOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -667,15 +679,15 @@ export class StorageAccountsImpl implements StorageAccounts { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, accountName, requestType, options }, - hierarchicalNamespaceMigrationOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, accountName, requestType, options }, + spec: hierarchicalNamespaceMigrationOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -722,14 +734,14 @@ export class StorageAccountsImpl implements StorageAccounts { resourceGroupName: string, accountName: string, options?: StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -762,15 +774,15 @@ export class StorageAccountsImpl implements StorageAccounts { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, accountName, options }, - abortHierarchicalNamespaceMigrationOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, accountName, options }, + spec: abortHierarchicalNamespaceMigrationOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -798,6 +810,128 @@ export class StorageAccountsImpl implements StorageAccounts { return poller.pollUntilDone(); } + /** + * Account Migration request can be triggered for a storage account to change its redundancy level. The + * migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa + * in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your + * storage account synchronously across three Azure availability zones in the primary region. + * @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 parameters The request parameters required to perform storage account migration. + * @param options The options parameters. + */ + async beginCustomerInitiatedMigration( + resourceGroupName: string, + accountName: string, + parameters: StorageAccountMigration, + options?: StorageAccountsCustomerInitiatedMigrationOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, accountName, parameters, options }, + spec: customerInitiatedMigrationOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Account Migration request can be triggered for a storage account to change its redundancy level. The + * migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa + * in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your + * storage account synchronously across three Azure availability zones in the primary region. + * @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 parameters The request parameters required to perform storage account migration. + * @param options The options parameters. + */ + async beginCustomerInitiatedMigrationAndWait( + resourceGroupName: string, + accountName: string, + parameters: StorageAccountMigration, + options?: StorageAccountsCustomerInitiatedMigrationOptionalParams + ): Promise { + const poller = await this.beginCustomerInitiatedMigration( + resourceGroupName, + accountName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets the status of the ongoing migration for the specified storage account. + * @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 migrationName The name of the Storage Account Migration. It should always be 'default' + * @param options The options parameters. + */ + getCustomerInitiatedMigration( + resourceGroupName: string, + accountName: string, + migrationName: MigrationName, + options?: StorageAccountsGetCustomerInitiatedMigrationOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, migrationName, options }, + getCustomerInitiatedMigrationOperationSpec + ); + } + /** * Restore blobs in the specified blob ranges * @param resourceGroupName The name of the resource group within the user's subscription. The name is @@ -814,8 +948,8 @@ export class StorageAccountsImpl implements StorageAccounts { parameters: BlobRestoreParameters, options?: StorageAccountsRestoreBlobRangesOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, StorageAccountsRestoreBlobRangesResponse > > { @@ -825,7 +959,7 @@ export class StorageAccountsImpl implements StorageAccounts { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -858,15 +992,18 @@ export class StorageAccountsImpl implements StorageAccounts { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, accountName, parameters, options }, - restoreBlobRangesOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, accountName, parameters, options }, + spec: restoreBlobRangesOperationSpec + }); + const poller = await createHttpPoller< + StorageAccountsRestoreBlobRangesResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "location" + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -1227,6 +1364,54 @@ const abortHierarchicalNamespaceMigrationOperationSpec: coreClient.OperationSpec headerParameters: [Parameters.accept], serializer }; +const customerInitiatedMigrationOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/startAccountMigration", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponseAutoGenerated + } + }, + requestBody: Parameters.parameters4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName1 + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getCustomerInitiatedMigrationOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/accountMigrations/{migrationName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageAccountMigration + }, + default: { + bodyMapper: Mappers.ErrorResponseAutoGenerated + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName1, + Parameters.migrationName + ], + headerParameters: [Parameters.accept], + serializer +}; const restoreBlobRangesOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges", @@ -1245,7 +1430,7 @@ const restoreBlobRangesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.BlobRestoreStatus } }, - requestBody: Parameters.parameters4, + requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -1267,7 +1452,7 @@ const revokeUserDelegationKeysOperationSpec: coreClient.OperationSpec = { Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.accountName1 + Parameters.accountName2 ], serializer }; @@ -1279,7 +1464,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.StorageAccountListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1296,7 +1480,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.StorageAccountListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/storage/arm-storage/src/operations/tableOperations.ts b/sdk/storage/arm-storage/src/operations/tableOperations.ts index 25b857d927af..8c39a101c729 100644 --- a/sdk/storage/arm-storage/src/operations/tableOperations.ts +++ b/sdk/storage/arm-storage/src/operations/tableOperations.ts @@ -273,7 +273,7 @@ const createOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters12, + requestBody: Parameters.parameters13, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -298,7 +298,7 @@ const updateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters12, + requestBody: Parameters.parameters13, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -388,7 +388,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/storage/arm-storage/src/operations/tableServices.ts b/sdk/storage/arm-storage/src/operations/tableServices.ts index 3e78fb7ff246..488318926e88 100644 --- a/sdk/storage/arm-storage/src/operations/tableServices.ts +++ b/sdk/storage/arm-storage/src/operations/tableServices.ts @@ -135,7 +135,7 @@ const setServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters11, + requestBody: Parameters.parameters12, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/storage/arm-storage/src/operationsInterfaces/blobContainers.ts b/sdk/storage/arm-storage/src/operationsInterfaces/blobContainers.ts index df47d10afd85..e7f757b5498a 100644 --- a/sdk/storage/arm-storage/src/operationsInterfaces/blobContainers.ts +++ b/sdk/storage/arm-storage/src/operationsInterfaces/blobContainers.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { ListContainerItem, BlobContainersListOptionalParams, @@ -339,7 +339,7 @@ export interface BlobContainers { accountName: string, containerName: string, options?: BlobContainersObjectLevelWormOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * This operation migrates a blob container from container level WORM to object level immutability * enabled container. Prerequisites require a container level immutability policy either in locked or diff --git a/sdk/storage/arm-storage/src/operationsInterfaces/storageAccounts.ts b/sdk/storage/arm-storage/src/operationsInterfaces/storageAccounts.ts index 60effd45b3ae..249561e313a1 100644 --- a/sdk/storage/arm-storage/src/operationsInterfaces/storageAccounts.ts +++ b/sdk/storage/arm-storage/src/operationsInterfaces/storageAccounts.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { StorageAccount, StorageAccountsListOptionalParams, @@ -38,6 +38,11 @@ import { StorageAccountsFailoverOptionalParams, StorageAccountsHierarchicalNamespaceMigrationOptionalParams, StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParams, + StorageAccountMigration, + StorageAccountsCustomerInitiatedMigrationOptionalParams, + MigrationName, + StorageAccountsGetCustomerInitiatedMigrationOptionalParams, + StorageAccountsGetCustomerInitiatedMigrationResponse, BlobRestoreParameters, StorageAccountsRestoreBlobRangesOptionalParams, StorageAccountsRestoreBlobRangesResponse, @@ -96,8 +101,8 @@ export interface StorageAccounts { parameters: StorageAccountCreateParameters, options?: StorageAccountsCreateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, StorageAccountsCreateResponse > >; @@ -245,7 +250,7 @@ export interface StorageAccounts { * primary and secondary endpoints are available. The primary use case of a Planned Failover is * disaster recovery testing drills. This type of failover is invoked by setting FailoverType parameter * to 'Planned'. Learn more about the failover options here- - * https://learn.microsoft.com/azure/storage/common/storage-disaster-recovery-guidanceS + * https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance * @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 @@ -257,7 +262,7 @@ export interface StorageAccounts { resourceGroupName: string, accountName: string, options?: StorageAccountsFailoverOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * A failover request can be triggered for a storage account in the event a primary endpoint becomes * unavailable for any reason. The failover occurs from the storage account's primary cluster to the @@ -268,7 +273,7 @@ export interface StorageAccounts { * primary and secondary endpoints are available. The primary use case of a Planned Failover is * disaster recovery testing drills. This type of failover is invoked by setting FailoverType parameter * to 'Planned'. Learn more about the failover options here- - * https://learn.microsoft.com/azure/storage/common/storage-disaster-recovery-guidance + * https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance * @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 @@ -299,7 +304,7 @@ export interface StorageAccounts { accountName: string, requestType: string, options?: StorageAccountsHierarchicalNamespaceMigrationOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Live Migration of storage account to enable Hns * @param resourceGroupName The name of the resource group within the user's subscription. The name is @@ -332,7 +337,7 @@ export interface StorageAccounts { resourceGroupName: string, accountName: string, options?: StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Abort live Migration of storage account to enable Hns * @param resourceGroupName The name of the resource group within the user's subscription. The name is @@ -347,6 +352,60 @@ export interface StorageAccounts { accountName: string, options?: StorageAccountsAbortHierarchicalNamespaceMigrationOptionalParams ): Promise; + /** + * Account Migration request can be triggered for a storage account to change its redundancy level. The + * migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa + * in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your + * storage account synchronously across three Azure availability zones in the primary region. + * @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 parameters The request parameters required to perform storage account migration. + * @param options The options parameters. + */ + beginCustomerInitiatedMigration( + resourceGroupName: string, + accountName: string, + parameters: StorageAccountMigration, + options?: StorageAccountsCustomerInitiatedMigrationOptionalParams + ): Promise, void>>; + /** + * Account Migration request can be triggered for a storage account to change its redundancy level. The + * migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa + * in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your + * storage account synchronously across three Azure availability zones in the primary region. + * @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 parameters The request parameters required to perform storage account migration. + * @param options The options parameters. + */ + beginCustomerInitiatedMigrationAndWait( + resourceGroupName: string, + accountName: string, + parameters: StorageAccountMigration, + options?: StorageAccountsCustomerInitiatedMigrationOptionalParams + ): Promise; + /** + * Gets the status of the ongoing migration for the specified storage account. + * @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 migrationName The name of the Storage Account Migration. It should always be 'default' + * @param options The options parameters. + */ + getCustomerInitiatedMigration( + resourceGroupName: string, + accountName: string, + migrationName: MigrationName, + options?: StorageAccountsGetCustomerInitiatedMigrationOptionalParams + ): Promise; /** * Restore blobs in the specified blob ranges * @param resourceGroupName The name of the resource group within the user's subscription. The name is @@ -363,8 +422,8 @@ export interface StorageAccounts { parameters: BlobRestoreParameters, options?: StorageAccountsRestoreBlobRangesOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, StorageAccountsRestoreBlobRangesResponse > >; diff --git a/sdk/storage/arm-storage/src/pagingHelper.ts b/sdk/storage/arm-storage/src/pagingHelper.ts index d85fc13bce1e..269a2b9814b5 100644 --- a/sdk/storage/arm-storage/src/pagingHelper.ts +++ b/sdk/storage/arm-storage/src/pagingHelper.ts @@ -13,11 +13,11 @@ export interface PageInfo { const pageMap = new WeakMap(); /** - * Given a result page from a pageable operation, returns a - * continuation token that can be used to begin paging from + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from * that point later. - * @param page A result object from calling .byPage() on a paged operation. - * @returns The continuation token that can be passed into byPage(). + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. */ export function getContinuationToken(page: unknown): string | undefined { if (typeof page !== "object" || page === null) { diff --git a/sdk/storage/arm-storage/src/storageManagementClient.ts b/sdk/storage/arm-storage/src/storageManagementClient.ts index 68fd46e81f7c..78d9e3d178ec 100644 --- a/sdk/storage/arm-storage/src/storageManagementClient.ts +++ b/sdk/storage/arm-storage/src/storageManagementClient.ts @@ -92,7 +92,7 @@ export class StorageManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-storage/18.1.1`; + const packageDetails = `azsdk-js-arm-storage/19.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -145,7 +145,7 @@ export class StorageManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-09-01"; + this.apiVersion = options.apiVersion || "2023-01-01"; this.operations = new OperationsImpl(this); this.skus = new SkusImpl(this); this.storageAccounts = new StorageAccountsImpl(this); diff --git a/sdk/storage/arm-storage/test/sampleTest.ts b/sdk/storage/arm-storage/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/storage/arm-storage/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/storage/arm-storage/tsconfig.json b/sdk/storage/arm-storage/tsconfig.json index 2792c048bc1f..3e6ae96443f3 100644 --- a/sdk/storage/arm-storage/tsconfig.json +++ b/sdk/storage/arm-storage/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-storage": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"