diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 9e1d6b32806e..85e1bac9dd5d 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1967,7 +1967,7 @@ packages: rollup: 2.79.1 dev: false - /@rollup/plugin-typescript/10.0.1_bgwi2fgwyi362qsw25gfipc3ca: + /@rollup/plugin-typescript/10.0.1_bhcmvni67fkldpaxrtldxbogce: resolution: {integrity: sha512-wBykxRLlX7EzL8BmUqMqk5zpx2onnmRMSw/l9M1sVfkJvdwfxogZQVNUM9gVMJbjRLDR5H6U0OMOrlDGmIV45A==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1984,7 +1984,7 @@ packages: resolve: 1.22.1 rollup: 2.79.1 tslib: 2.5.0 - typescript: 4.9.4 + typescript: 4.9.5 dev: false /@rollup/plugin-virtual/2.1.0_rollup@2.79.1: @@ -3816,7 +3816,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 4.9.4 + typescript: 4.9.5 dev: false /downlevel-dts/0.8.0: @@ -3825,7 +3825,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 4.9.4 + typescript: 4.9.5 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8311,7 +8311,7 @@ packages: hasBin: true dev: false - /ts-node/10.9.1_gjo33tkf7m2dtuw6tmxt3xwf4q: + /ts-node/10.9.1_7iyetdgfmqiorh7qupktbe7tm4: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8337,12 +8337,12 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.8.4 + typescript: 4.9.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false - /ts-node/10.9.1_hrxs3cimgx563ee773t2eh6j4y: + /ts-node/10.9.1_gjo33tkf7m2dtuw6tmxt3xwf4q: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8368,12 +8368,12 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.2.4 + typescript: 4.8.4 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false - /ts-node/10.9.1_laqv367ntbladgchwutjrnj4ky: + /ts-node/10.9.1_hrxs3cimgx563ee773t2eh6j4y: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8392,19 +8392,19 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 - '@types/node': 17.0.45 + '@types/node': 14.18.36 acorn: 8.8.2 acorn-walk: 8.2.0 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.6.4 + typescript: 4.2.4 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false - /ts-node/10.9.1_ocil65wecyuhsmrrocoajouipe: + /ts-node/10.9.1_laqv367ntbladgchwutjrnj4ky: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8423,14 +8423,14 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 - '@types/node': 14.18.36 + '@types/node': 17.0.45 acorn: 8.8.2 acorn-walk: 8.2.0 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.9.4 + typescript: 4.6.4 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false @@ -8647,8 +8647,8 @@ packages: hasBin: true dev: false - /typescript/4.9.4: - resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==} + /typescript/4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -13177,7 +13177,7 @@ packages: dev: false file:projects/arm-netapp.tgz: - resolution: {integrity: sha512-Be87k+UXyNc0L/9IzjMVNDD0mb37fMSe9oX9/XL3dbr5DKm0t3qCPZaF/rkWK5/PvND9usEHom7dJg8iNeBRbw==, tarball: file:projects/arm-netapp.tgz} + resolution: {integrity: sha512-fyuCOI4D4QqeK2lLRxd86pDi6c79v1fnu3Cq0FtCMEWU7l8R+q0lNgFA0/J1kRoJuBVs2YTfXQf+fViHVAQiMQ==, tarball: file:projects/arm-netapp.tgz} name: '@rush-temp/arm-netapp' version: 0.0.0 dependencies: @@ -13188,18 +13188,18 @@ packages: '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 '@types/chai': 4.3.4 + '@types/node': 14.18.36 chai: 4.3.7 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_p2gydaekoyjvl5wd3ixslt7iq4 tslib: 2.5.0 - typescript: 4.6.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - supports-color dev: false @@ -16460,7 +16460,7 @@ packages: name: '@rush-temp/dev-tool' version: 0.0.0 dependencies: - '@_ts/max': /typescript/4.9.4 + '@_ts/max': /typescript/4.9.5 '@_ts/min': /typescript/4.2.4 '@microsoft/api-extractor': 7.34.0 '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 @@ -17890,7 +17890,7 @@ packages: version: 0.0.0 dependencies: '@microsoft/api-extractor': 7.34.0 - '@rollup/plugin-typescript': 10.0.1_bgwi2fgwyi362qsw25gfipc3ca + '@rollup/plugin-typescript': 10.0.1_bhcmvni67fkldpaxrtldxbogce '@types/chai': 4.3.4 '@types/mocha': 7.0.2 '@types/node': 14.18.36 @@ -17922,9 +17922,9 @@ packages: rollup: 2.79.1 rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.6.3_p2gydaekoyjvl5wd3ixslt7iq4 - ts-node: 10.9.1_ocil65wecyuhsmrrocoajouipe + ts-node: 10.9.1_7iyetdgfmqiorh7qupktbe7tm4 tslib: 2.5.0 - typescript: 4.9.4 + typescript: 4.9.5 util: 0.12.5 uuid: 9.0.0 transitivePeerDependencies: diff --git a/sdk/netapp/arm-netapp/CHANGELOG.md b/sdk/netapp/arm-netapp/CHANGELOG.md index ccfdc28a7515..9edf46f56efc 100644 --- a/sdk/netapp/arm-netapp/CHANGELOG.md +++ b/sdk/netapp/arm-netapp/CHANGELOG.md @@ -1,15 +1,13 @@ # Release History + +## 18.0.0 (2023-01-31) + +**Breaking Changes** -## 17.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Operation NetAppResource.checkNameAvailability has a new signature + - Operation NetAppResource.checkQuotaAvailability has a new signature + + ## 17.0.0 (2022-09-21) **Features** diff --git a/sdk/netapp/arm-netapp/LICENSE b/sdk/netapp/arm-netapp/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/netapp/arm-netapp/LICENSE +++ b/sdk/netapp/arm-netapp/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/netapp/arm-netapp/_meta.json b/sdk/netapp/arm-netapp/_meta.json index 6eda2c4f1b6f..b1dbe17a3345 100644 --- a/sdk/netapp/arm-netapp/_meta.json +++ b/sdk/netapp/arm-netapp/_meta.json @@ -1,8 +1,8 @@ { - "commit": "8ff0e3b8dc12cd793f4f2208d76f9f3a7f51176c", + "commit": "e0f435e4de9eab69629e19a0754962ac6b22b8f4", "readme": "specification/netapp/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\\netapp\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.1.20220727.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/netapp/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.5", "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.1.20220727.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.1", + "use": "@autorest/typescript@6.0.0-rc.5" } \ No newline at end of file diff --git a/sdk/netapp/arm-netapp/package.json b/sdk/netapp/arm-netapp/package.json index ce0fd7d11712..59b854ca4110 100644 --- a/sdk/netapp/arm-netapp/package.json +++ b/sdk/netapp/arm-netapp/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for NetAppManagementClient.", - "version": "17.0.1", + "version": "18.0.0", "engines": { "node": ">=14.0.0" }, @@ -11,7 +11,7 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.5.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -36,7 +36,7 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.6.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", @@ -46,6 +46,7 @@ "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", + "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/netapp/arm-netapp", @@ -109,13 +110,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-netapp?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/netapp/arm-netapp/review/arm-netapp.api.md b/sdk/netapp/arm-netapp/review/arm-netapp.api.md index 93108e795d99..8d0822764354 100644 --- a/sdk/netapp/arm-netapp/review/arm-netapp.api.md +++ b/sdk/netapp/arm-netapp/review/arm-netapp.api.md @@ -517,6 +517,9 @@ export interface FilePathAvailabilityRequest { subnetId: string; } +// @public +export function getContinuationToken(page: unknown): string | undefined; + // @public export interface HourlySchedule { minute?: number; @@ -908,8 +911,8 @@ export interface NetAppManagementClientOptionalParams extends coreClient.Service // @public export interface NetAppResource { checkFilePathAvailability(location: string, name: string, subnetId: string, options?: NetAppResourceCheckFilePathAvailabilityOptionalParams): Promise; - checkNameAvailability(location: string, name: string, resourceGroup: string, typeParam: CheckNameResourceTypes, options?: NetAppResourceCheckNameAvailabilityOptionalParams): Promise; - checkQuotaAvailability(location: string, name: string, resourceGroup: string, typeParam: CheckQuotaNameResourceTypes, options?: NetAppResourceCheckQuotaAvailabilityOptionalParams): Promise; + checkNameAvailability(location: string, name: string, typeParam: CheckNameResourceTypes, resourceGroup: string, options?: NetAppResourceCheckNameAvailabilityOptionalParams): Promise; + checkQuotaAvailability(location: string, name: string, typeParam: CheckQuotaNameResourceTypes, resourceGroup: string, options?: NetAppResourceCheckQuotaAvailabilityOptionalParams): Promise; queryRegionInfo(location: string, options?: NetAppResourceQueryRegionInfoOptionalParams): Promise; } diff --git a/sdk/netapp/arm-netapp/src/index.ts b/sdk/netapp/arm-netapp/src/index.ts index cb8b872ff966..fa78fb4ee94e 100644 --- a/sdk/netapp/arm-netapp/src/index.ts +++ b/sdk/netapp/arm-netapp/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { NetAppManagementClient } from "./netAppManagementClient"; export * from "./operationsInterfaces"; diff --git a/sdk/netapp/arm-netapp/src/models/index.ts b/sdk/netapp/arm-netapp/src/models/index.ts index ef110ad9f350..0a34804eb1a8 100644 --- a/sdk/netapp/arm-netapp/src/models/index.ts +++ b/sdk/netapp/arm-netapp/src/models/index.ts @@ -209,7 +209,7 @@ export interface NetAppAccountList { export interface ActiveDirectory { /** Id of the Active Directory */ activeDirectoryId?: string; - /** Username of Active Directory domain administrator */ + /** A domain user account with permission to create machine accounts */ username?: string; /** Plain text password of Active Directory domain administrator, value is masked in the response */ password?: string; @@ -1235,7 +1235,7 @@ export interface VolumeGroupVolumeProperties { creationToken: string; /** The service level of the file system */ serviceLevel?: ServiceLevel; - /** Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 500 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes. */ + /** Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes. */ usageThreshold: number; /** Set of export policy rules */ exportPolicy?: VolumePropertiesExportPolicy; @@ -1684,7 +1684,7 @@ export interface Volume extends TrackedResource { creationToken: string; /** The service level of the file system */ serviceLevel?: ServiceLevel; - /** Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 500 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes. */ + /** Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes. */ usageThreshold: number; /** Set of export policy rules */ exportPolicy?: VolumePropertiesExportPolicy; diff --git a/sdk/netapp/arm-netapp/src/netAppManagementClient.ts b/sdk/netapp/arm-netapp/src/netAppManagementClient.ts index e5194e64355f..f5efa2cf28d3 100644 --- a/sdk/netapp/arm-netapp/src/netAppManagementClient.ts +++ b/sdk/netapp/arm-netapp/src/netAppManagementClient.ts @@ -83,22 +83,19 @@ export class NetAppManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-netapp/17.0.1`; + const packageDetails = `azsdk-js-arm-netapp/18.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix }, - baseUri: + endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); @@ -124,7 +121,9 @@ export class NetAppManagementClient extends coreClient.ServiceClient { this.pipeline.addPolicy( coreRestPipeline.bearerTokenAuthenticationPolicy({ credential: credentials, - scopes: `${optionsWithDefaults.credentialScopes}`, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, challengeCallbacks: { authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge diff --git a/sdk/netapp/arm-netapp/src/operations/accountBackups.ts b/sdk/netapp/arm-netapp/src/operations/accountBackups.ts index bd8ae9c2418c..0b3b8b0560d9 100644 --- a/sdk/netapp/arm-netapp/src/operations/accountBackups.ts +++ b/sdk/netapp/arm-netapp/src/operations/accountBackups.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { AccountBackups } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -55,8 +55,16 @@ export class AccountBackupsImpl implements AccountBackups { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -64,9 +72,11 @@ export class AccountBackupsImpl implements AccountBackups { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: AccountBackupsListOptionalParams + options?: AccountBackupsListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); + let result: AccountBackupsListResponse; + result = await this._list(resourceGroupName, accountName, options); yield result.value || []; } diff --git a/sdk/netapp/arm-netapp/src/operations/accounts.ts b/sdk/netapp/arm-netapp/src/operations/accounts.ts index 46be208bb5ec..3dd21bbb0cfa 100644 --- a/sdk/netapp/arm-netapp/src/operations/accounts.ts +++ b/sdk/netapp/arm-netapp/src/operations/accounts.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Accounts } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,9 +19,9 @@ import { NetAppAccount, AccountsListBySubscriptionNextOptionalParams, AccountsListBySubscriptionOptionalParams, + AccountsListBySubscriptionResponse, AccountsListNextOptionalParams, AccountsListOptionalParams, - AccountsListBySubscriptionResponse, AccountsListResponse, AccountsGetOptionalParams, AccountsGetResponse, @@ -63,22 +64,34 @@ export class AccountsImpl implements Accounts { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: AccountsListBySubscriptionOptionalParams + options?: AccountsListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AccountsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -107,19 +120,29 @@ export class AccountsImpl implements Accounts { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(resourceGroupName, options, settings); } }; } private async *listPagingPage( resourceGroupName: string, - options?: AccountsListOptionalParams + options?: AccountsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AccountsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -127,7 +150,9 @@ export class AccountsImpl implements Accounts { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -713,6 +738,7 @@ const renewCredentialsOperationSpec: coreClient.OperationSpec = { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials", httpMethod: "POST", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} }, + queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -730,7 +756,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { }, default: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -748,7 +773,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { }, default: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/netapp/arm-netapp/src/operations/backupPolicies.ts b/sdk/netapp/arm-netapp/src/operations/backupPolicies.ts index cb833029ece6..7fe598953915 100644 --- a/sdk/netapp/arm-netapp/src/operations/backupPolicies.ts +++ b/sdk/netapp/arm-netapp/src/operations/backupPolicies.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { BackupPolicies } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -60,8 +60,16 @@ export class BackupPoliciesImpl implements BackupPolicies { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -69,9 +77,11 @@ export class BackupPoliciesImpl implements BackupPolicies { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: BackupPoliciesListOptionalParams + options?: BackupPoliciesListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); + let result: BackupPoliciesListResponse; + result = await this._list(resourceGroupName, accountName, options); yield result.value || []; } diff --git a/sdk/netapp/arm-netapp/src/operations/backups.ts b/sdk/netapp/arm-netapp/src/operations/backups.ts index 433768af36ff..775125b75c94 100644 --- a/sdk/netapp/arm-netapp/src/operations/backups.ts +++ b/sdk/netapp/arm-netapp/src/operations/backups.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { Backups } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -17,11 +17,11 @@ import { LroImpl } from "../lroImpl"; import { Backup, BackupsListOptionalParams, + BackupsListResponse, BackupsGetStatusOptionalParams, BackupsGetStatusResponse, BackupsGetVolumeRestoreStatusOptionalParams, BackupsGetVolumeRestoreStatusResponse, - BackupsListResponse, BackupsGetOptionalParams, BackupsGetResponse, BackupsCreateOptionalParams, @@ -73,13 +73,17 @@ export class BackupsImpl implements Backups { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, accountName, poolName, volumeName, - options + options, + settings ); } }; @@ -90,9 +94,11 @@ export class BackupsImpl implements Backups { accountName: string, poolName: string, volumeName: string, - options?: BackupsListOptionalParams + options?: BackupsListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( + let result: BackupsListResponse; + result = await this._list( resourceGroupName, accountName, poolName, diff --git a/sdk/netapp/arm-netapp/src/operations/netAppResource.ts b/sdk/netapp/arm-netapp/src/operations/netAppResource.ts index a871345467d4..a3a8f482efd1 100644 --- a/sdk/netapp/arm-netapp/src/operations/netAppResource.ts +++ b/sdk/netapp/arm-netapp/src/operations/netAppResource.ts @@ -40,19 +40,19 @@ export class NetAppResourceImpl implements NetAppResource { * Check if a resource name is available. * @param location The location * @param name Resource name to verify. - * @param resourceGroup Resource group name. * @param typeParam Resource type used for verification. + * @param resourceGroup Resource group name. * @param options The options parameters. */ checkNameAvailability( location: string, name: string, - resourceGroup: string, typeParam: CheckNameResourceTypes, + resourceGroup: string, options?: NetAppResourceCheckNameAvailabilityOptionalParams ): Promise { return this.client.sendOperationRequest( - { location, name, resourceGroup, typeParam, options }, + { location, name, typeParam, resourceGroup, options }, checkNameAvailabilityOperationSpec ); } @@ -81,19 +81,19 @@ export class NetAppResourceImpl implements NetAppResource { * Check if a quota is available. * @param location The location * @param name Name of the resource to verify. - * @param resourceGroup Resource group name. * @param typeParam Resource type used for verification. + * @param resourceGroup Resource group name. * @param options The options parameters. */ checkQuotaAvailability( location: string, name: string, - resourceGroup: string, typeParam: CheckQuotaNameResourceTypes, + resourceGroup: string, options?: NetAppResourceCheckQuotaAvailabilityOptionalParams ): Promise { return this.client.sendOperationRequest( - { location, name, resourceGroup, typeParam, options }, + { location, name, typeParam, resourceGroup, options }, checkQuotaAvailabilityOperationSpec ); } diff --git a/sdk/netapp/arm-netapp/src/operations/netAppResourceQuotaLimits.ts b/sdk/netapp/arm-netapp/src/operations/netAppResourceQuotaLimits.ts index 790feae5e260..f4d996c04242 100644 --- a/sdk/netapp/arm-netapp/src/operations/netAppResourceQuotaLimits.ts +++ b/sdk/netapp/arm-netapp/src/operations/netAppResourceQuotaLimits.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { NetAppResourceQuotaLimits } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -51,17 +51,22 @@ export class NetAppResourceQuotaLimitsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(location, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(location, options, settings); } }; } private async *listPagingPage( location: string, - options?: NetAppResourceQuotaLimitsListOptionalParams + options?: NetAppResourceQuotaLimitsListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(location, options); + let result: NetAppResourceQuotaLimitsListResponse; + result = await this._list(location, options); yield result.value || []; } diff --git a/sdk/netapp/arm-netapp/src/operations/operations.ts b/sdk/netapp/arm-netapp/src/operations/operations.ts index cf6f8a4c0a61..799ecf93a97a 100644 --- a/sdk/netapp/arm-netapp/src/operations/operations.ts +++ b/sdk/netapp/arm-netapp/src/operations/operations.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { Operations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -46,16 +46,21 @@ export class OperationsImpl implements Operations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: OperationsListOptionalParams + options?: OperationsListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); + let result: OperationsListResponse; + result = await this._list(options); yield result.value || []; } diff --git a/sdk/netapp/arm-netapp/src/operations/pools.ts b/sdk/netapp/arm-netapp/src/operations/pools.ts index dacbf8a08690..57ced0487250 100644 --- a/sdk/netapp/arm-netapp/src/operations/pools.ts +++ b/sdk/netapp/arm-netapp/src/operations/pools.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Pools } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -62,8 +63,16 @@ export class PoolsImpl implements Pools { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -71,11 +80,18 @@ export class PoolsImpl implements Pools { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: PoolsListOptionalParams + options?: PoolsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: PoolsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -84,7 +100,9 @@ export class PoolsImpl implements Pools { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -570,7 +588,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { }, default: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/netapp/arm-netapp/src/operations/snapshotPolicies.ts b/sdk/netapp/arm-netapp/src/operations/snapshotPolicies.ts index 4c07f2e99a82..8d0648da2557 100644 --- a/sdk/netapp/arm-netapp/src/operations/snapshotPolicies.ts +++ b/sdk/netapp/arm-netapp/src/operations/snapshotPolicies.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { SnapshotPolicies } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -62,8 +62,16 @@ export class SnapshotPoliciesImpl implements SnapshotPolicies { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -71,9 +79,11 @@ export class SnapshotPoliciesImpl implements SnapshotPolicies { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: SnapshotPoliciesListOptionalParams + options?: SnapshotPoliciesListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); + let result: SnapshotPoliciesListResponse; + result = await this._list(resourceGroupName, accountName, options); yield result.value || []; } diff --git a/sdk/netapp/arm-netapp/src/operations/snapshots.ts b/sdk/netapp/arm-netapp/src/operations/snapshots.ts index 733aeef0295f..7560664fe077 100644 --- a/sdk/netapp/arm-netapp/src/operations/snapshots.ts +++ b/sdk/netapp/arm-netapp/src/operations/snapshots.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { Snapshots } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -71,13 +71,17 @@ export class SnapshotsImpl implements Snapshots { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, accountName, poolName, volumeName, - options + options, + settings ); } }; @@ -88,9 +92,11 @@ export class SnapshotsImpl implements Snapshots { accountName: string, poolName: string, volumeName: string, - options?: SnapshotsListOptionalParams + options?: SnapshotsListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( + let result: SnapshotsListResponse; + result = await this._list( resourceGroupName, accountName, poolName, diff --git a/sdk/netapp/arm-netapp/src/operations/subvolumes.ts b/sdk/netapp/arm-netapp/src/operations/subvolumes.ts index ccc3efd57f2e..9275ffb6c213 100644 --- a/sdk/netapp/arm-netapp/src/operations/subvolumes.ts +++ b/sdk/netapp/arm-netapp/src/operations/subvolumes.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Subvolumes } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -74,13 +75,17 @@ export class SubvolumesImpl implements Subvolumes { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listByVolumePagingPage( resourceGroupName, accountName, poolName, volumeName, - options + options, + settings ); } }; @@ -91,17 +96,24 @@ export class SubvolumesImpl implements Subvolumes { accountName: string, poolName: string, volumeName: string, - options?: SubvolumesListByVolumeOptionalParams + options?: SubvolumesListByVolumeOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByVolume( - resourceGroupName, - accountName, - poolName, - volumeName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SubvolumesListByVolumeResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByVolume( + resourceGroupName, + accountName, + poolName, + volumeName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByVolumeNext( resourceGroupName, @@ -112,7 +124,9 @@ export class SubvolumesImpl implements Subvolumes { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -836,7 +850,6 @@ const listByVolumeNextOperationSpec: coreClient.OperationSpec = { }, default: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/netapp/arm-netapp/src/operations/vaults.ts b/sdk/netapp/arm-netapp/src/operations/vaults.ts index c8488eac0a49..2685d43a1d56 100644 --- a/sdk/netapp/arm-netapp/src/operations/vaults.ts +++ b/sdk/netapp/arm-netapp/src/operations/vaults.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { Vaults } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -46,8 +46,16 @@ export class VaultsImpl implements Vaults { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -55,9 +63,11 @@ export class VaultsImpl implements Vaults { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: VaultsListOptionalParams + options?: VaultsListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); + let result: VaultsListResponse; + result = await this._list(resourceGroupName, accountName, options); yield result.value || []; } diff --git a/sdk/netapp/arm-netapp/src/operations/volumeGroups.ts b/sdk/netapp/arm-netapp/src/operations/volumeGroups.ts index f36f45f7b61b..77f63052320c 100644 --- a/sdk/netapp/arm-netapp/src/operations/volumeGroups.ts +++ b/sdk/netapp/arm-netapp/src/operations/volumeGroups.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { VolumeGroups } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -62,11 +62,15 @@ export class VolumeGroupsImpl implements VolumeGroups { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listByNetAppAccountPagingPage( resourceGroupName, accountName, - options + options, + settings ); } }; @@ -75,9 +79,11 @@ export class VolumeGroupsImpl implements VolumeGroups { private async *listByNetAppAccountPagingPage( resourceGroupName: string, accountName: string, - options?: VolumeGroupsListByNetAppAccountOptionalParams + options?: VolumeGroupsListByNetAppAccountOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByNetAppAccount( + let result: VolumeGroupsListByNetAppAccountResponse; + result = await this._listByNetAppAccount( resourceGroupName, accountName, options diff --git a/sdk/netapp/arm-netapp/src/operations/volumeQuotaRules.ts b/sdk/netapp/arm-netapp/src/operations/volumeQuotaRules.ts index 9d620c3dae50..544641b2136f 100644 --- a/sdk/netapp/arm-netapp/src/operations/volumeQuotaRules.ts +++ b/sdk/netapp/arm-netapp/src/operations/volumeQuotaRules.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { VolumeQuotaRules } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -70,13 +70,17 @@ export class VolumeQuotaRulesImpl implements VolumeQuotaRules { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listByVolumePagingPage( resourceGroupName, accountName, poolName, volumeName, - options + options, + settings ); } }; @@ -87,9 +91,11 @@ export class VolumeQuotaRulesImpl implements VolumeQuotaRules { accountName: string, poolName: string, volumeName: string, - options?: VolumeQuotaRulesListByVolumeOptionalParams + options?: VolumeQuotaRulesListByVolumeOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByVolume( + let result: VolumeQuotaRulesListByVolumeResponse; + result = await this._listByVolume( resourceGroupName, accountName, poolName, diff --git a/sdk/netapp/arm-netapp/src/operations/volumes.ts b/sdk/netapp/arm-netapp/src/operations/volumes.ts index c259ca1cad02..8ffb79074c71 100644 --- a/sdk/netapp/arm-netapp/src/operations/volumes.ts +++ b/sdk/netapp/arm-netapp/src/operations/volumes.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Volumes } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,9 +19,10 @@ import { Volume, VolumesListNextOptionalParams, VolumesListOptionalParams, + VolumesListResponse, Replication, VolumesListReplicationsOptionalParams, - VolumesListResponse, + VolumesListReplicationsResponse, VolumesGetOptionalParams, VolumesGetResponse, VolumesCreateOrUpdateOptionalParams, @@ -37,7 +39,6 @@ import { VolumesReestablishReplicationOptionalParams, VolumesReplicationStatusOptionalParams, VolumesReplicationStatusResponse, - VolumesListReplicationsResponse, VolumesResyncReplicationOptionalParams, VolumesDeleteReplicationOptionalParams, AuthorizeRequest, @@ -90,12 +91,16 @@ export class VolumesImpl implements Volumes { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, accountName, poolName, - options + options, + settings ); } }; @@ -105,16 +110,23 @@ export class VolumesImpl implements Volumes { resourceGroupName: string, accountName: string, poolName: string, - options?: VolumesListOptionalParams + options?: VolumesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - resourceGroupName, - accountName, - poolName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: VolumesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + accountName, + poolName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -124,7 +136,9 @@ export class VolumesImpl implements Volumes { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -173,13 +187,17 @@ export class VolumesImpl implements Volumes { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listReplicationsPagingPage( resourceGroupName, accountName, poolName, volumeName, - options + options, + settings ); } }; @@ -190,9 +208,11 @@ export class VolumesImpl implements Volumes { accountName: string, poolName: string, volumeName: string, - options?: VolumesListReplicationsOptionalParams + options?: VolumesListReplicationsOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listReplications( + let result: VolumesListReplicationsResponse; + result = await this._listReplications( resourceGroupName, accountName, poolName, @@ -2152,7 +2172,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { }, default: {} }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/netapp/arm-netapp/src/operationsInterfaces/netAppResource.ts b/sdk/netapp/arm-netapp/src/operationsInterfaces/netAppResource.ts index 4bf44f7316df..697d0e3e5445 100644 --- a/sdk/netapp/arm-netapp/src/operationsInterfaces/netAppResource.ts +++ b/sdk/netapp/arm-netapp/src/operationsInterfaces/netAppResource.ts @@ -25,15 +25,15 @@ export interface NetAppResource { * Check if a resource name is available. * @param location The location * @param name Resource name to verify. - * @param resourceGroup Resource group name. * @param typeParam Resource type used for verification. + * @param resourceGroup Resource group name. * @param options The options parameters. */ checkNameAvailability( location: string, name: string, - resourceGroup: string, typeParam: CheckNameResourceTypes, + resourceGroup: string, options?: NetAppResourceCheckNameAvailabilityOptionalParams ): Promise; /** @@ -54,15 +54,15 @@ export interface NetAppResource { * Check if a quota is available. * @param location The location * @param name Name of the resource to verify. - * @param resourceGroup Resource group name. * @param typeParam Resource type used for verification. + * @param resourceGroup Resource group name. * @param options The options parameters. */ checkQuotaAvailability( location: string, name: string, - resourceGroup: string, typeParam: CheckQuotaNameResourceTypes, + resourceGroup: string, options?: NetAppResourceCheckQuotaAvailabilityOptionalParams ): Promise; /** diff --git a/sdk/netapp/arm-netapp/src/pagingHelper.ts b/sdk/netapp/arm-netapp/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/netapp/arm-netapp/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * 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. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * 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 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) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/netapp/arm-netapp/test/sampleTest.ts b/sdk/netapp/arm-netapp/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/netapp/arm-netapp/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/netapp/arm-netapp/tsconfig.json b/sdk/netapp/arm-netapp/tsconfig.json index 1772b5822344..3e6ae96443f3 100644 --- a/sdk/netapp/arm-netapp/tsconfig.json +++ b/sdk/netapp/arm-netapp/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-netapp": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"