diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index ede2972f0022..7cb2b65dc5ed 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -10707,7 +10707,7 @@ packages: dev: false file:projects/arm-changes.tgz: - resolution: {integrity: sha512-+qYywNd3L4gKpjjJrwOi3/bqmHcOcebcVTH0Jeby9bMczXE2CzV2yMwwF6WDUK4adrjaRhOM+B6NmolXHee0Xw==, tarball: file:projects/arm-changes.tgz} + resolution: {integrity: sha512-+YlFIdudCG6kli3k5ZwzdmhYnam7aXPDfcMsxamRqQxrUMa8CSSXnAGz6e1Zn/vtK9pvZtExHBN+09XD1FZ37w==, tarball: file:projects/arm-changes.tgz} name: '@rush-temp/arm-changes' version: 0.0.0 dependencies: @@ -10721,7 +10721,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 @@ -12458,7 +12459,7 @@ packages: dev: false file:projects/arm-features.tgz: - resolution: {integrity: sha512-Sp28YQF4lhVvL8MqzPTF1tni6BFWayaYXJHys7DJfv/FePXbJjPD9fLqJeZFb8/1NNwYfJeZq4jIVN4hza3hhQ==, tarball: file:projects/arm-features.tgz} + resolution: {integrity: sha512-S/vKDjY0bEo9BHwlclQfuAs5Ozy1Wq45AeVU6Kt144d+GPgY9doeT78m0D4I9xY3omXlejtzl5kqRpQoDX4OHA==, tarball: file:projects/arm-features.tgz} name: '@rush-temp/arm-features' version: 0.0.0 dependencies: @@ -12472,7 +12473,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 @@ -13133,7 +13135,7 @@ packages: dev: false file:projects/arm-links.tgz: - resolution: {integrity: sha512-LgHooiqQuktSt8UscG1X4S6qLt7emNhNvblPhrjL48lyOEjVsyijQVL3Dr+HejIj1fail50gtLOKRsxnRXxwZw==, tarball: file:projects/arm-links.tgz} + resolution: {integrity: sha512-NH2PB8rarRaCwXtvXTcNgdp6fbxd6CytaECWcrlWV1rl14LOzvSCO2wxtWMgsQmZDhjiljKt7P8ljT0h1/fRGQ==, tarball: file:projects/arm-links.tgz} name: '@rush-temp/arm-links' version: 0.0.0 dependencies: @@ -13147,7 +13149,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 @@ -13225,7 +13228,7 @@ packages: dev: false file:projects/arm-locks.tgz: - resolution: {integrity: sha512-R8Y7ehof84D1wssBNCuw8IDH35vG1taiXGprBRc/g2Jcl/xm3y6IYxRTdNBe4CzVqFINCfyqDrR7I5CTrB6LuA==, tarball: file:projects/arm-locks.tgz} + resolution: {integrity: sha512-dy7RIG9y5gH8+QwkX0TTBxInefOkwLNeJW8XlHNrAg2A8A7fmLOCGJRbaA5HalOOkVNMOAf7m8RycKlA4mJx2w==, tarball: file:projects/arm-locks.tgz} name: '@rush-temp/arm-locks' version: 0.0.0 dependencies: @@ -13239,7 +13242,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 @@ -13377,7 +13381,7 @@ packages: dev: false file:projects/arm-managedapplications.tgz: - resolution: {integrity: sha512-l+pncXDhFwTze0AYcleRnD0vjlPpyRmwtCDgpmVDSa3L/7UFMKJN8sSusWW9fzn3Y7Aigl0xIW/vYNgyUr7rTw==, tarball: file:projects/arm-managedapplications.tgz} + resolution: {integrity: sha512-bZfHTmMJ4hSePfpZHiSQXWPSi2DV2IgD8UkV3iTQiTagER29E18/F0hSqQz944gn6Hyg2N7N8zVDRmVReBcicQ==, tarball: file:projects/arm-managedapplications.tgz} name: '@rush-temp/arm-managedapplications' version: 0.0.0 dependencies: @@ -13391,7 +13395,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 @@ -14376,7 +14381,7 @@ packages: dev: false file:projects/arm-policy.tgz: - resolution: {integrity: sha512-n6KwX80aCVYIEXhoOG4IXisALy2vqw15NwO2moHCsdXMi3Y/wTdwnWrQbxc5gGX/4aAvfmVvMz/QtXNXaiRavw==, tarball: file:projects/arm-policy.tgz} + resolution: {integrity: sha512-N5x9mzDyXbrsHMqFNG1cvPuxF0FeH3Mi5EcqxdIg/tF4h9xIfkAn4L+PEwNASlDtmmqynbyPtTPkHUgxZ0gLug==, tarball: file:projects/arm-policy.tgz} name: '@rush-temp/arm-policy' version: 0.0.0 dependencies: @@ -15114,7 +15119,7 @@ packages: dev: false file:projects/arm-resources-subscriptions.tgz: - resolution: {integrity: sha512-BqanBpSQ+hgtRa+FvPiW7VTnadBFo0+8DOqeJ8VGVz66S4UcXubqKfEYpJ1CXaPuWL2OzqrIhQCRycX4ZSPK6g==, tarball: file:projects/arm-resources-subscriptions.tgz} + resolution: {integrity: sha512-GOh8ZqMMh02SssS5E9DS2sLKnLBdrK3FDy2YzwcnjKruRcjRTecq5c8rGuXaauoNaIvqqBWA4XvWQYI1S+7cTw==, tarball: file:projects/arm-resources-subscriptions.tgz} name: '@rush-temp/arm-resources-subscriptions' version: 0.0.0 dependencies: @@ -15145,7 +15150,7 @@ packages: dev: false file:projects/arm-resources.tgz: - resolution: {integrity: sha512-85gtgCY6fzVsQ4H8oYvP3ugvJIEr88K9G8R85XcCRfoow/FpUyOF6URbGujsXCOqoxBu5AAriaQL2FWkkoMIhA==, tarball: file:projects/arm-resources.tgz} + resolution: {integrity: sha512-pHiHT+7E68ivvTnUpgA8DWedJCeYZMBuZPU1Cwqid3ftlPERIEHVLM04T6LHACZNoO2amYLP29IEyCRnKcwWqg==, tarball: file:projects/arm-resources.tgz} name: '@rush-temp/arm-resources' version: 0.0.0 dependencies: @@ -16142,7 +16147,7 @@ packages: dev: false file:projects/arm-templatespecs.tgz: - resolution: {integrity: sha512-GMvbBQdIWLa4+77FFRafZZ1Cf4oxRYORHo586AfgdQgPjoBUoWyc4WhylR29Ad2eRMbveZsTMshwOpz+Mf5Bxg==, tarball: file:projects/arm-templatespecs.tgz} + resolution: {integrity: sha512-6D5m+7UV2JMCg3dur5BXkydlaHGBWqWgxYJJMCHBjz5YSj9YWFtD+ATMH4856LKtPcYAndjUWUgii7zu9bcLaA==, tarball: file:projects/arm-templatespecs.tgz} name: '@rush-temp/arm-templatespecs' version: 0.0.0 dependencies: @@ -16156,7 +16161,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 diff --git a/sdk/managedapplications/arm-managedapplications/CHANGELOG.md b/sdk/managedapplications/arm-managedapplications/CHANGELOG.md index 8f5d6f78bcbc..766d4f95c52c 100644 --- a/sdk/managedapplications/arm-managedapplications/CHANGELOG.md +++ b/sdk/managedapplications/arm-managedapplications/CHANGELOG.md @@ -1,15 +1,12 @@ # Release History + +## 3.0.0 (2023-08-24) + +**Breaking Changes** -## 2.1.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Class ApplicationClient has a new signature + + ## 2.1.0 (2022-11-22) **Features** diff --git a/sdk/managedapplications/arm-managedapplications/LICENSE b/sdk/managedapplications/arm-managedapplications/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/managedapplications/arm-managedapplications/LICENSE +++ b/sdk/managedapplications/arm-managedapplications/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/managedapplications/arm-managedapplications/_meta.json b/sdk/managedapplications/arm-managedapplications/_meta.json index c7ad3e56f301..f7f70d4063ab 100644 --- a/sdk/managedapplications/arm-managedapplications/_meta.json +++ b/sdk/managedapplications/arm-managedapplications/_meta.json @@ -1,8 +1,8 @@ { - "commit": "a42f1b58607091c4f255ead152a8ef323fa0b280", + "commit": "f2f5e6e95f2fdb742e65e1bfc74526b382292f0b", "readme": "specification/resources/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\\resources\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.3.20221108.1 --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/resources/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.2", + "use": "@autorest/typescript@^6.0.4" } \ No newline at end of file diff --git a/sdk/managedapplications/arm-managedapplications/package.json b/sdk/managedapplications/arm-managedapplications/package.json index 801674429685..24edcabc9ba9 100644 --- a/sdk/managedapplications/arm-managedapplications/package.json +++ b/sdk/managedapplications/arm-managedapplications/package.json @@ -3,17 +3,17 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ApplicationClient.", - "version": "2.1.1", + "version": "3.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", + "@azure/core-rest-pipeline": "^1.12.0", "tslib": "^2.2.0" }, "keywords": [ @@ -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", @@ -47,10 +48,9 @@ "chai": "^4.2.0", "cross-env": "^7.0.2", "@types/node": "^14.0.0", - "@azure/dev-tool": "^1.0.0", - "ts-node": "^10.0.0" + "ts-node": "^10.0.0", + "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managedapplications/arm-managedapplications", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -112,12 +112,5 @@ ] }, "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-managedapplications?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managedapplications/arm-managedapplications" +} \ No newline at end of file diff --git a/sdk/managedapplications/arm-managedapplications/review/arm-managedapplications.api.md b/sdk/managedapplications/arm-managedapplications/review/arm-managedapplications.api.md index f7731713e577..5e482eb6142f 100644 --- a/sdk/managedapplications/arm-managedapplications/review/arm-managedapplications.api.md +++ b/sdk/managedapplications/arm-managedapplications/review/arm-managedapplications.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 export interface Application extends GenericResource { @@ -36,6 +36,7 @@ export class ApplicationClient extends coreClient.ServiceClient { // (undocumented) $host: string; constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ApplicationClientOptionalParams); + constructor(credentials: coreAuth.TokenCredential, options?: ApplicationClientOptionalParams); // (undocumented) apiVersion: string; // (undocumented) @@ -44,7 +45,7 @@ export class ApplicationClient extends coreClient.ServiceClient { applications: Applications; listOperations(options?: ListOperationsOptionalParams): PagedAsyncIterableIterator; // (undocumented) - subscriptionId: string; + subscriptionId?: string; } // @public @@ -75,13 +76,13 @@ export interface ApplicationDefinitionListResult { // @public export interface ApplicationDefinitions { - beginCreateOrUpdate(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateOptionalParams): Promise, ApplicationDefinitionsCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateOptionalParams): Promise, ApplicationDefinitionsCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateOptionalParams): Promise; - beginCreateOrUpdateById(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams): Promise, ApplicationDefinitionsCreateOrUpdateByIdResponse>>; + beginCreateOrUpdateById(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams): Promise, ApplicationDefinitionsCreateOrUpdateByIdResponse>>; beginCreateOrUpdateByIdAndWait(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams): Promise; - beginDelete(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteOptionalParams): Promise; - beginDeleteById(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteByIdOptionalParams): Promise, void>>; + beginDeleteById(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteByIdOptionalParams): Promise, void>>; beginDeleteByIdAndWait(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteByIdOptionalParams): Promise; get(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsGetOptionalParams): Promise; getById(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsGetByIdOptionalParams): Promise; @@ -174,13 +175,13 @@ export interface ApplicationProviderAuthorization { // @public export interface Applications { - beginCreateOrUpdate(resourceGroupName: string, applicationName: string, parameters: Application, options?: ApplicationsCreateOrUpdateOptionalParams): Promise, ApplicationsCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceGroupName: string, applicationName: string, parameters: Application, options?: ApplicationsCreateOrUpdateOptionalParams): Promise, ApplicationsCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceGroupName: string, applicationName: string, parameters: Application, options?: ApplicationsCreateOrUpdateOptionalParams): Promise; - beginCreateOrUpdateById(applicationId: string, parameters: Application, options?: ApplicationsCreateOrUpdateByIdOptionalParams): Promise, ApplicationsCreateOrUpdateByIdResponse>>; + beginCreateOrUpdateById(applicationId: string, parameters: Application, options?: ApplicationsCreateOrUpdateByIdOptionalParams): Promise, ApplicationsCreateOrUpdateByIdResponse>>; beginCreateOrUpdateByIdAndWait(applicationId: string, parameters: Application, options?: ApplicationsCreateOrUpdateByIdOptionalParams): Promise; - beginDelete(resourceGroupName: string, applicationName: string, options?: ApplicationsDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, applicationName: string, options?: ApplicationsDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, applicationName: string, options?: ApplicationsDeleteOptionalParams): Promise; - beginDeleteById(applicationId: string, options?: ApplicationsDeleteByIdOptionalParams): Promise, void>>; + beginDeleteById(applicationId: string, options?: ApplicationsDeleteByIdOptionalParams): Promise, void>>; beginDeleteByIdAndWait(applicationId: string, options?: ApplicationsDeleteByIdOptionalParams): Promise; get(resourceGroupName: string, applicationName: string, options?: ApplicationsGetOptionalParams): Promise; getById(applicationId: string, options?: ApplicationsGetByIdOptionalParams): Promise; diff --git a/sdk/managedapplications/arm-managedapplications/src/applicationClient.ts b/sdk/managedapplications/arm-managedapplications/src/applicationClient.ts index 634fc3cbcbcb..763414c7e3a4 100644 --- a/sdk/managedapplications/arm-managedapplications/src/applicationClient.ts +++ b/sdk/managedapplications/arm-managedapplications/src/applicationClient.ts @@ -33,7 +33,7 @@ import { export class ApplicationClient extends coreClient.ServiceClient { $host: string; apiVersion: string; - subscriptionId: string; + subscriptionId?: string; /** * Initializes a new instance of the ApplicationClient class. @@ -45,12 +45,26 @@ export class ApplicationClient extends coreClient.ServiceClient { credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ApplicationClientOptionalParams + ); + constructor( + credentials: coreAuth.TokenCredential, + options?: ApplicationClientOptionalParams + ); + constructor( + credentials: coreAuth.TokenCredential, + subscriptionIdOrOptions?: ApplicationClientOptionalParams | string, + options?: ApplicationClientOptionalParams ) { if (credentials === undefined) { throw new Error("'credentials' cannot be null"); } - if (subscriptionId === undefined) { - throw new Error("'subscriptionId' cannot be null"); + + let subscriptionId: string | undefined; + + if (typeof subscriptionIdOrOptions === "string") { + subscriptionId = subscriptionIdOrOptions; + } else if (typeof subscriptionIdOrOptions === "object") { + options = subscriptionIdOrOptions; } // Initializing default values for options @@ -62,7 +76,7 @@ export class ApplicationClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-managedapplications/2.1.1`; + const packageDetails = `azsdk-js-arm-managedapplications/3.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -255,7 +269,6 @@ const listOperationsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.OperationListResult } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/managedapplications/arm-managedapplications/src/lroImpl.ts b/sdk/managedapplications/arm-managedapplications/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/managedapplications/arm-managedapplications/src/lroImpl.ts +++ b/sdk/managedapplications/arm-managedapplications/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/managedapplications/arm-managedapplications/src/operations/applicationDefinitions.ts b/sdk/managedapplications/arm-managedapplications/src/operations/applicationDefinitions.ts index df7caefc5052..9f82f8911dd3 100644 --- a/sdk/managedapplications/arm-managedapplications/src/operations/applicationDefinitions.ts +++ b/sdk/managedapplications/arm-managedapplications/src/operations/applicationDefinitions.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 { ApplicationClient } from "../applicationClient"; -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 { ApplicationDefinition, ApplicationDefinitionsListByResourceGroupNextOptionalParams, @@ -142,14 +146,14 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteOptionalParams - ): 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 ) => { @@ -182,13 +186,13 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, applicationDefinitionName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, applicationDefinitionName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -227,8 +231,8 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ApplicationDefinitionsCreateOrUpdateResponse > > { @@ -238,7 +242,7 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -271,13 +275,21 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, applicationDefinitionName, parameters, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + applicationDefinitionName, + parameters, + options + }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + ApplicationDefinitionsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -348,14 +360,14 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteByIdOptionalParams - ): 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 ) => { @@ -388,13 +400,13 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, applicationDefinitionName, options }, - deleteByIdOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, applicationDefinitionName, options }, + spec: deleteByIdOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -433,8 +445,8 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ApplicationDefinitionsCreateOrUpdateByIdResponse > > { @@ -444,7 +456,7 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -477,13 +489,21 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, applicationDefinitionName, parameters, options }, - createOrUpdateByIdOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + applicationDefinitionName, + parameters, + options + }, + spec: createOrUpdateByIdOperationSpec + }); + const poller = await createHttpPoller< + ApplicationDefinitionsCreateOrUpdateByIdResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -722,7 +742,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.nextLink, diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/applications.ts b/sdk/managedapplications/arm-managedapplications/src/operations/applications.ts index 3a47582a06e2..f8721e78bce1 100644 --- a/sdk/managedapplications/arm-managedapplications/src/operations/applications.ts +++ b/sdk/managedapplications/arm-managedapplications/src/operations/applications.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 { ApplicationClient } from "../applicationClient"; -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 { Application, ApplicationsListByResourceGroupNextOptionalParams, @@ -204,14 +208,14 @@ export class ApplicationsImpl implements Applications { resourceGroupName: string, applicationName: string, options?: ApplicationsDeleteOptionalParams - ): 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 ) => { @@ -244,13 +248,13 @@ export class ApplicationsImpl implements Applications { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, applicationName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, applicationName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -289,8 +293,8 @@ export class ApplicationsImpl implements Applications { parameters: Application, options?: ApplicationsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ApplicationsCreateOrUpdateResponse > > { @@ -300,7 +304,7 @@ export class ApplicationsImpl implements Applications { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -333,13 +337,16 @@ export class ApplicationsImpl implements Applications { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, applicationName, parameters, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, applicationName, parameters, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + ApplicationsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -441,14 +448,14 @@ export class ApplicationsImpl implements Applications { async beginDeleteById( applicationId: string, options?: ApplicationsDeleteByIdOptionalParams - ): 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 ) => { @@ -481,13 +488,13 @@ export class ApplicationsImpl implements Applications { }; }; - const lro = new LroImpl( - sendOperation, - { applicationId, options }, - deleteByIdOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { applicationId, options }, + spec: deleteByIdOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -522,8 +529,8 @@ export class ApplicationsImpl implements Applications { parameters: Application, options?: ApplicationsCreateOrUpdateByIdOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ApplicationsCreateOrUpdateByIdResponse > > { @@ -533,7 +540,7 @@ export class ApplicationsImpl implements Applications { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -566,13 +573,16 @@ export class ApplicationsImpl implements Applications { }; }; - const lro = new LroImpl( - sendOperation, - { applicationId, parameters, options }, - createOrUpdateByIdOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { applicationId, parameters, options }, + spec: createOrUpdateByIdOperationSpec + }); + const poller = await createHttpPoller< + ApplicationsCreateOrUpdateByIdResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -884,7 +894,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.nextLink, @@ -905,7 +914,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.nextLink, diff --git a/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applicationDefinitions.ts b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applicationDefinitions.ts index c9d7af01a3e3..ac174546be36 100644 --- a/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applicationDefinitions.ts +++ b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applicationDefinitions.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 { ApplicationDefinition, ApplicationDefinitionsListByResourceGroupOptionalParams, @@ -56,7 +56,7 @@ export interface ApplicationDefinitions { resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Deletes the managed application definition. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -81,8 +81,8 @@ export interface ApplicationDefinitions { parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ApplicationDefinitionsCreateOrUpdateResponse > >; @@ -120,7 +120,7 @@ export interface ApplicationDefinitions { resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteByIdOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Deletes the managed application definition. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -145,8 +145,8 @@ export interface ApplicationDefinitions { parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ApplicationDefinitionsCreateOrUpdateByIdResponse > >; diff --git a/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applications.ts b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applications.ts index fc88cc2159a9..33cd27cca1b3 100644 --- a/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applications.ts +++ b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applications.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 { Application, ApplicationsListByResourceGroupOptionalParams, @@ -68,7 +68,7 @@ export interface Applications { resourceGroupName: string, applicationName: string, options?: ApplicationsDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Deletes the managed application. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -93,8 +93,8 @@ export interface Applications { parameters: Application, options?: ApplicationsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ApplicationsCreateOrUpdateResponse > >; @@ -144,7 +144,7 @@ export interface Applications { beginDeleteById( applicationId: string, options?: ApplicationsDeleteByIdOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Deletes the managed application. * @param applicationId The fully qualified ID of the managed application, including the managed @@ -169,8 +169,8 @@ export interface Applications { parameters: Application, options?: ApplicationsCreateOrUpdateByIdOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ApplicationsCreateOrUpdateByIdResponse > >; diff --git a/sdk/managedapplications/arm-managedapplications/src/pagingHelper.ts b/sdk/managedapplications/arm-managedapplications/src/pagingHelper.ts index d85fc13bce1e..269a2b9814b5 100644 --- a/sdk/managedapplications/arm-managedapplications/src/pagingHelper.ts +++ b/sdk/managedapplications/arm-managedapplications/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/managedapplications/arm-managedapplications/tsconfig.json b/sdk/managedapplications/arm-managedapplications/tsconfig.json index 49542979a476..5e2d9266f916 100644 --- a/sdk/managedapplications/arm-managedapplications/tsconfig.json +++ b/sdk/managedapplications/arm-managedapplications/tsconfig.json @@ -15,25 +15,16 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-managedapplications": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", "./test/**/*.ts", - "samples-dev/**/*.ts", "./test/**/*.ts", - "samples-dev/**/*.ts", "./test/**/*.ts", - "samples-dev/**/*.ts", "./test/**/*.ts", - "samples-dev/**/*.ts", "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"