From fb8b03b6998e5ce78abeb4d9f536d0d1480abbb9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 12 Oct 2023 04:10:41 +0000 Subject: [PATCH] CodeGen from PR 26172 in Azure/azure-rest-api-specs Merge 5cace91d5595747a200c202cbff811d24bcf51aa into 43c5786b7d90124e46fe068894694ac899965948 --- common/config/rush/pnpm-lock.yaml | 97 +++++++++++++-- .../arm-recoveryservicesbackup/CHANGELOG.md | 25 ++-- .../arm-recoveryservicesbackup/_meta.json | 6 +- .../arm-recoveryservicesbackup/package.json | 31 ++--- .../review/arm-recoveryservicesbackup.api.md | 8 +- .../src/models/index.ts | 52 +++++--- .../src/models/mappers.ts | 19 +++ .../src/operations/protectionContainers.ts | 112 +++++++++++++++++- .../protectionContainers.ts | 29 ++++- .../src/recoveryServicesBackupClient.ts | 2 +- .../test/sampleTest.ts | 43 +++++++ .../arm-recoveryservicesbackup/tsconfig.json | 10 +- 12 files changed, 358 insertions(+), 76 deletions(-) create mode 100644 sdk/recoveryservicesbackup/arm-recoveryservicesbackup/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 6767c3038392..15e6cd68a40f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1807,6 +1807,16 @@ packages: lodash: 4.17.21 dev: false + /@microsoft/api-extractor-model@7.28.2(@types/node@14.18.63): + resolution: {integrity: sha512-vkojrM2fo3q4n4oPh4uUZdjJ2DxQ2+RnDQL/xhTWSRUNPF6P4QyrvY357HBxbnltKcYu+nNNolVqc6TIGQ73Ig==} + dependencies: + '@microsoft/tsdoc': 0.14.2 + '@microsoft/tsdoc-config': 0.16.2 + '@rushstack/node-core-library': 3.61.0(@types/node@14.18.63) + transitivePeerDependencies: + - '@types/node' + dev: false + /@microsoft/api-extractor-model@7.28.2(@types/node@16.18.55): resolution: {integrity: sha512-vkojrM2fo3q4n4oPh4uUZdjJ2DxQ2+RnDQL/xhTWSRUNPF6P4QyrvY357HBxbnltKcYu+nNNolVqc6TIGQ73Ig==} dependencies: @@ -1817,6 +1827,26 @@ packages: - '@types/node' dev: false + /@microsoft/api-extractor@7.38.0(@types/node@14.18.63): + resolution: {integrity: sha512-e1LhZYnfw+JEebuY2bzhw0imDCl1nwjSThTrQqBXl40hrVo6xm3j/1EpUr89QyzgjqmAwek2ZkIVZbrhaR+cqg==} + hasBin: true + dependencies: + '@microsoft/api-extractor-model': 7.28.2(@types/node@14.18.63) + '@microsoft/tsdoc': 0.14.2 + '@microsoft/tsdoc-config': 0.16.2 + '@rushstack/node-core-library': 3.61.0(@types/node@14.18.63) + '@rushstack/rig-package': 0.5.1 + '@rushstack/ts-command-line': 4.16.1 + colors: 1.2.5 + lodash: 4.17.21 + resolve: 1.22.6 + semver: 7.5.4 + source-map: 0.6.1 + typescript: 5.0.4 + transitivePeerDependencies: + - '@types/node' + dev: false + /@microsoft/api-extractor@7.38.0(@types/node@16.18.55): resolution: {integrity: sha512-e1LhZYnfw+JEebuY2bzhw0imDCl1nwjSThTrQqBXl40hrVo6xm3j/1EpUr89QyzgjqmAwek2ZkIVZbrhaR+cqg==} hasBin: true @@ -2465,6 +2495,24 @@ packages: rollup: 3.29.4 dev: false + /@rushstack/node-core-library@3.61.0(@types/node@14.18.63): + resolution: {integrity: sha512-tdOjdErme+/YOu4gPed3sFS72GhtWCgNV9oDsHDnoLY5oDfwjKUc9Z+JOZZ37uAxcm/OCahDHfuu2ugqrfWAVQ==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + dependencies: + '@types/node': 14.18.63 + colors: 1.2.5 + fs-extra: 7.0.1 + import-lazy: 4.0.0 + jju: 1.4.0 + resolve: 1.22.6 + semver: 7.5.4 + z-schema: 5.0.5 + dev: false + /@rushstack/node-core-library@3.61.0(@types/node@16.18.55): resolution: {integrity: sha512-tdOjdErme+/YOu4gPed3sFS72GhtWCgNV9oDsHDnoLY5oDfwjKUc9Z+JOZZ37uAxcm/OCahDHfuu2ugqrfWAVQ==} peerDependencies: @@ -3997,7 +4045,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug@3.2.7: @@ -8820,6 +8868,37 @@ packages: code-block-writer: 12.0.0 dev: false + /ts-node@10.9.1(@types/node@14.18.63)(typescript@5.0.4): + resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.9 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 14.18.63 + acorn: 8.10.0 + acorn-walk: 8.2.0 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 5.0.4 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: false + /ts-node@10.9.1(@types/node@16.18.55)(typescript@5.0.4): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true @@ -15045,32 +15124,34 @@ packages: dev: false file:projects/arm-recoveryservicesbackup.tgz: - resolution: {integrity: sha512-u8HfvHfMTLPsfWyrcXw+PyIHAtEJ+VEKlTzF3fA27QZ8SGs/wCd/bOo5UsmqChyLD61mFXn5CqeN6RRgfk6lug==, tarball: file:projects/arm-recoveryservicesbackup.tgz} + resolution: {integrity: sha512-bQS11cIEiKvPeIl6nonTn7HvVILU+tYIdOT9R5WsyTtakIPr9rE/rNo2cJ//kn0QE3hlp9W2xpU+CM0iv1L0MQ==, tarball: file:projects/arm-recoveryservicesbackup.tgz} name: '@rush-temp/arm-recoveryservicesbackup' version: 0.0.0 dependencies: - '@microsoft/api-extractor': 7.38.0(@types/node@16.18.55) + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.38.0(@types/node@14.18.63) '@rollup/plugin-commonjs': 24.1.0(rollup@2.79.1) '@rollup/plugin-json': 6.0.0(rollup@2.79.1) '@rollup/plugin-multi-entry': 6.0.0(rollup@2.79.1) '@rollup/plugin-node-resolve': 13.3.0(rollup@2.79.1) '@types/chai': 4.3.6 - '@types/node': 16.18.55 + '@types/node': 14.18.63 chai: 4.3.10 cross-env: 7.0.3 dotenv: 16.3.1 mkdirp: 2.1.6 - mocha: 10.2.0 - rimraf: 3.0.2 + mocha: 7.2.0 + rimraf: 5.0.5 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3(@types/node@16.18.55)(rollup@2.79.1) - ts-node: 10.9.1(@types/node@16.18.55)(typescript@5.0.4) + rollup-plugin-sourcemaps: 0.6.3(@types/node@14.18.63)(rollup@2.79.1) + ts-node: 10.9.1(@types/node@14.18.63)(typescript@5.0.4) tslib: 2.6.2 typescript: 5.0.4 uglify-js: 3.17.4 transitivePeerDependencies: - '@swc/core' - '@swc/wasm' + - supports-color dev: false file:projects/arm-rediscache.tgz: diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/CHANGELOG.md b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/CHANGELOG.md index 4bb7dda0143f..081e9f9c79e4 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/CHANGELOG.md +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/CHANGELOG.md @@ -1,15 +1,22 @@ # Release History + +## 12.0.0 (2023-10-12) + +**Features** -## 11.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation ProtectionContainers.beginRegister + - Added operation ProtectionContainers.beginRegisterAndWait + - Interface BackupStatusResponse has a new optional parameter acquireStorageAccountLock + - Interface BackupStatusResponse has a new optional parameter protectedItemsCount + - Interface IaasVMRecoveryPoint has a new optional parameter extendedLocation + - Interface ProtectionContainersRegisterOptionalParams has a new optional parameter resumeFrom + - Interface ProtectionContainersRegisterOptionalParams has a new optional parameter updateIntervalInMs -### Other Changes +**Breaking Changes** + - Removed operation ProtectionContainers.register + + ## 11.0.0 (2023-09-01) **Features** @@ -323,4 +330,4 @@ To understand the detail of the change, please refer to [Changelog](https://aka. To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). -To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/_meta.json b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/_meta.json index 8440b201b76d..c3657317a9db 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/_meta.json +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/_meta.json @@ -1,8 +1,8 @@ { - "commit": "95c0363e4cae8756c6a33b58add67776db427bbc", + "commit": "76b41213dd26c013e7a7c63aafd72f42a1df9c62", "readme": "specification/recoveryservicesbackup/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --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\\recoveryservicesbackup\\resource-manager\\readme.md --use=@autorest/typescript@6.0.8 --generate-sample=true", + "autorest_command": "autorest --version=3.9.7 --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/recoveryservicesbackup/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.7.2", - "use": "@autorest/typescript@6.0.8" + "use": "@autorest/typescript@^6.0.4" } \ No newline at end of file diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/package.json b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/package.json index a92ad957a883..89106b341c6d 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/package.json +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/package.json @@ -3,9 +3,9 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for RecoveryServicesBackupClient.", - "version": "11.0.1", + "version": "12.0.0", "engines": { - "node": ">=16.0.0" + "node": ">=14.0.0" }, "dependencies": { "@azure/core-lro": "^2.5.4", @@ -38,19 +38,18 @@ "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~5.0.0", "uglify-js": "^3.4.9", - "rimraf": "^3.0.0", + "rimraf": "^5.0.0", "dotenv": "^16.0.0", - "@azure/identity": "^3.3.0", + "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", - "mocha": "^10.0.0", + "mocha": "^7.1.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", - "@types/node": "^16.0.0", - "@azure/dev-tool": "^1.0.0", - "@azure/arm-recoveryservices": "^5.2.0", - "ts-node": "^10.0.0" + "@types/node": "^14.0.0", + "ts-node": "^10.0.0", + "@azure/dev-tool": "^1.0.0" }, "repository": { "type": "git", @@ -85,7 +84,7 @@ "extract-api": "api-extractor run --local", "lint": "echo skipped", "audit": "echo skipped", - "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", "build:browser": "echo skipped", "build:test": "echo skipped", @@ -113,13 +112,5 @@ ] }, "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/recoveryservicesbackup/arm-recoveryservicesbackup", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-recoveryservicesbackup?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/recoveryservicesbackup/arm-recoveryservicesbackup" +} \ No newline at end of file diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/review/arm-recoveryservicesbackup.api.md b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/review/arm-recoveryservicesbackup.api.md index 6ea563464896..ce2e94a891ae 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/review/arm-recoveryservicesbackup.api.md +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/review/arm-recoveryservicesbackup.api.md @@ -1155,12 +1155,14 @@ export interface BackupStatusRequest { // @public export interface BackupStatusResponse { + acquireStorageAccountLock?: AcquireStorageAccountLock; containerName?: string; errorCode?: string; errorMessage?: string; fabricName?: FabricName; policyName?: string; protectedItemName?: string; + protectedItemsCount?: number; protectionStatus?: ProtectionStatus; registrationStatus?: string; vaultId?: string; @@ -1755,6 +1757,7 @@ export type IaaSVMProtectableItemUnion = IaaSVMProtectableItem | AzureIaaSClassi // @public export interface IaasVMRecoveryPoint extends RecoveryPoint { + extendedLocation?: ExtendedLocation; isInstantIlrSessionActive?: boolean; isManagedVirtualMachine?: boolean; isPrivateAccessEnabledOnAnyDisk?: boolean; @@ -3170,10 +3173,11 @@ export interface ProtectionContainerResourceList extends ResourceList { // @public export interface ProtectionContainers { + beginRegister(vaultName: string, resourceGroupName: string, fabricName: string, containerName: string, parameters: ProtectionContainerResource, options?: ProtectionContainersRegisterOptionalParams): Promise, ProtectionContainersRegisterResponse>>; + beginRegisterAndWait(vaultName: string, resourceGroupName: string, fabricName: string, containerName: string, parameters: ProtectionContainerResource, options?: ProtectionContainersRegisterOptionalParams): Promise; get(vaultName: string, resourceGroupName: string, fabricName: string, containerName: string, options?: ProtectionContainersGetOptionalParams): Promise; inquire(vaultName: string, resourceGroupName: string, fabricName: string, containerName: string, options?: ProtectionContainersInquireOptionalParams): Promise; refresh(vaultName: string, resourceGroupName: string, fabricName: string, options?: ProtectionContainersRefreshOptionalParams): Promise; - register(vaultName: string, resourceGroupName: string, fabricName: string, containerName: string, parameters: ProtectionContainerResource, options?: ProtectionContainersRegisterOptionalParams): Promise; unregister(vaultName: string, resourceGroupName: string, fabricName: string, containerName: string, options?: ProtectionContainersUnregisterOptionalParams): Promise; } @@ -3196,6 +3200,8 @@ export interface ProtectionContainersRefreshOptionalParams extends coreClient.Op // @public export interface ProtectionContainersRegisterOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/models/index.ts b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/models/index.ts index 10f305f27b8c..3b0359650428 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/models/index.ts +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/models/index.ts @@ -353,6 +353,10 @@ export interface BackupStatusResponse { policyName?: string; /** Container registration status */ registrationStatus?: string; + /** Number of protected items */ + protectedItemsCount?: number; + /** Specifies whether the storage account lock has been acquired or not */ + acquireStorageAccountLock?: AcquireStorageAccountLock; } /** Base class for feature request */ @@ -2673,6 +2677,11 @@ export interface IaasVMRecoveryPoint extends RecoveryPoint { recoveryPointProperties?: RecoveryPointProperties; /** This flag denotes if any of the disks in the VM are using Private access network setting */ isPrivateAccessEnabledOnAnyDisk?: boolean; + /** + * Extended location of the VM recovery point, + * should be null if VM is in public cloud + */ + extendedLocation?: ExtendedLocation; } /** AzureFileShare Restore Request */ @@ -3977,6 +3986,24 @@ export enum KnownFabricName { */ export type FabricName = string; +/** Known values of {@link AcquireStorageAccountLock} that the service accepts. */ +export enum KnownAcquireStorageAccountLock { + /** Acquire */ + Acquire = "Acquire", + /** NotAcquire */ + NotAcquire = "NotAcquire" +} + +/** + * Defines values for AcquireStorageAccountLock. \ + * {@link KnownAcquireStorageAccountLock} can be used interchangeably with AcquireStorageAccountLock, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Acquire** \ + * **NotAcquire** + */ +export type AcquireStorageAccountLock = string; + /** Known values of {@link SupportStatus} that the service accepts. */ export enum KnownSupportStatus { /** Invalid */ @@ -5180,24 +5207,6 @@ export enum KnownOperationType { */ export type OperationType = string; -/** Known values of {@link AcquireStorageAccountLock} that the service accepts. */ -export enum KnownAcquireStorageAccountLock { - /** Acquire */ - Acquire = "Acquire", - /** NotAcquire */ - NotAcquire = "NotAcquire" -} - -/** - * Defines values for AcquireStorageAccountLock. \ - * {@link KnownAcquireStorageAccountLock} can be used interchangeably with AcquireStorageAccountLock, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Acquire** \ - * **NotAcquire** - */ -export type AcquireStorageAccountLock = string; - /** Known values of {@link InquiryStatus} that the service accepts. */ export enum KnownInquiryStatus { /** Invalid */ @@ -6067,7 +6076,12 @@ export type ProtectionContainersGetResponse = ProtectionContainerResource; /** Optional parameters. */ export interface ProtectionContainersRegisterOptionalParams - extends coreClient.OperationOptions {} + 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; +} /** Contains response data for the register operation. */ export type ProtectionContainersRegisterResponse = ProtectionContainerResource; diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/models/mappers.ts b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/models/mappers.ts index 11e617379f2a..99285e62f795 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/models/mappers.ts +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/models/mappers.ts @@ -361,6 +361,18 @@ export const BackupStatusResponse: coreClient.CompositeMapper = { type: { name: "String" } + }, + protectedItemsCount: { + serializedName: "protectedItemsCount", + type: { + name: "Number" + } + }, + acquireStorageAccountLock: { + serializedName: "acquireStorageAccountLock", + type: { + name: "String" + } } } } @@ -6771,6 +6783,13 @@ export const IaasVMRecoveryPoint: coreClient.CompositeMapper = { type: { name: "Boolean" } + }, + extendedLocation: { + serializedName: "extendedLocation", + type: { + name: "Composite", + className: "ExtendedLocation" + } } } } diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/operations/protectionContainers.ts b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/operations/protectionContainers.ts index 8bb5592fff58..5c89618c4539 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/operations/protectionContainers.ts +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/operations/protectionContainers.ts @@ -11,6 +11,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { RecoveryServicesBackupClient } from "../recoveryServicesBackupClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { ProtectionContainersGetOptionalParams, ProtectionContainersGetResponse, @@ -69,16 +75,61 @@ export class ProtectionContainersImpl implements ProtectionContainers { * @param parameters Request body for operation * @param options The options parameters. */ - register( + async beginRegister( vaultName: string, resourceGroupName: string, fabricName: string, containerName: string, parameters: ProtectionContainerResource, options?: ProtectionContainersRegisterOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { + ): Promise< + SimplePollerLike< + OperationState, + ProtectionContainersRegisterResponse + > + > { + 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: { vaultName, resourceGroupName, fabricName, @@ -86,8 +137,49 @@ export class ProtectionContainersImpl implements ProtectionContainers { parameters, options }, - registerOperationSpec + spec: registerOperationSpec + }); + const poller = await createHttpPoller< + ProtectionContainersRegisterResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Registers the container with Recovery Services vault. + * This is an asynchronous operation. To track the operation status, use location header to call get + * latest status of + * the operation. + * @param vaultName The name of the recovery services vault. + * @param resourceGroupName The name of the resource group where the recovery services vault is + * present. + * @param fabricName Fabric name associated with the container. + * @param containerName Name of the container to be registered. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginRegisterAndWait( + vaultName: string, + resourceGroupName: string, + fabricName: string, + containerName: string, + parameters: ProtectionContainerResource, + options?: ProtectionContainersRegisterOptionalParams + ): Promise { + const poller = await this.beginRegister( + vaultName, + resourceGroupName, + fabricName, + containerName, + parameters, + options ); + return poller.pollUntilDone(); } /** @@ -196,7 +288,15 @@ const registerOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.ProtectionContainerResource }, - 202: {}, + 201: { + bodyMapper: Mappers.ProtectionContainerResource + }, + 202: { + bodyMapper: Mappers.ProtectionContainerResource + }, + 204: { + bodyMapper: Mappers.ProtectionContainerResource + }, default: { bodyMapper: Mappers.CloudError } diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/operationsInterfaces/protectionContainers.ts b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/operationsInterfaces/protectionContainers.ts index d0a76cfb3575..a732a5c7f9f2 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/operationsInterfaces/protectionContainers.ts +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/operationsInterfaces/protectionContainers.ts @@ -6,6 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { ProtectionContainersGetOptionalParams, ProtectionContainersGetResponse, @@ -48,7 +49,33 @@ export interface ProtectionContainers { * @param parameters Request body for operation * @param options The options parameters. */ - register( + beginRegister( + vaultName: string, + resourceGroupName: string, + fabricName: string, + containerName: string, + parameters: ProtectionContainerResource, + options?: ProtectionContainersRegisterOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ProtectionContainersRegisterResponse + > + >; + /** + * Registers the container with Recovery Services vault. + * This is an asynchronous operation. To track the operation status, use location header to call get + * latest status of + * the operation. + * @param vaultName The name of the recovery services vault. + * @param resourceGroupName The name of the resource group where the recovery services vault is + * present. + * @param fabricName Fabric name associated with the container. + * @param containerName Name of the container to be registered. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginRegisterAndWait( vaultName: string, resourceGroupName: string, fabricName: string, diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/recoveryServicesBackupClient.ts b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/recoveryServicesBackupClient.ts index c528c4a10709..9bbb502ea0b5 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/recoveryServicesBackupClient.ts +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/src/recoveryServicesBackupClient.ts @@ -168,7 +168,7 @@ export class RecoveryServicesBackupClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-recoveryservicesbackup/11.0.1`; + const packageDetails = `azsdk-js-arm-recoveryservicesbackup/12.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` diff --git a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/test/sampleTest.ts b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/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/recoveryservicesbackup/arm-recoveryservicesbackup/tsconfig.json b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/tsconfig.json index a7e9eaf1a49b..3e6ae96443f3 100644 --- a/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/tsconfig.json +++ b/sdk/recoveryservicesbackup/arm-recoveryservicesbackup/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-recoveryservicesbackup": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"