diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 84d91e0ecae0..9f9e2a9e95cd 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -734,6 +734,7 @@ packages: /@azure/ai-form-recognizer/3.1.0-beta.3: resolution: {integrity: sha512-+4QtFKNyxAmdqpcYjuAtmWKm/MuOe9kZsbpS9jA9h0YHzngNj5gc67AA4egV9BXOq9x+1phjYTNC/rxiOUr1uQ==} engines: {node: '>=8.0.0'} + deprecated: Please migrate to a supported (non-beta) version of this package dependencies: '@azure/core-auth': 1.4.0 '@azure/core-http': 1.2.6 @@ -4035,7 +4036,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.1.0-dev.20230327 + typescript: 5.1.0-dev.20230328 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8677,37 +8678,6 @@ packages: hasBin: true dev: false - /ts-node/10.9.1_cda5npvz5vidcibznbsxxfupne: - 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.3 - '@types/node': 14.18.41 - 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: 5.0.2 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - dev: false - /ts-node/10.9.1_ksn4eycaeggbrckn3ykh37hwf4: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true @@ -8913,8 +8883,8 @@ packages: hasBin: true dev: false - /typescript/5.1.0-dev.20230327: - resolution: {integrity: sha512-tzeS6vmUF8qC4zFdvos88Oer1oNVrg0CVlIaxfI//pDrq8rur4nIUTLRWRlEMCeLQporHhD+z9sESoSr5GL+lw==} + /typescript/5.1.0-dev.20230328: + resolution: {integrity: sha512-pylwLhhCSsZX72UUJTSD+5DKoEUUKsqQg6w4bLdRVbYVXDCxPLExUayWWCaRSmx9WJjf00YwMA2MXS2z2t5+2g==} engines: {node: '>=12.20'} hasBin: true dev: false @@ -12433,7 +12403,7 @@ packages: dev: false file:projects/arm-healthbot.tgz: - resolution: {integrity: sha512-779ARsWmuS4gYFeqtFLnvFSMiAGJ3Mv8Ost8q2QzAzL9jl3/M/hSkoIloWkVAWmc8ONTFnkqoUYubinpqp3G6Q==, tarball: file:projects/arm-healthbot.tgz} + resolution: {integrity: sha512-r7a+eZ4YQjoqVH0RZjnK3NGHhkuSqGh19hwjSv5+7aw5W3Dv1srBK6YfWPCZiolo3k7Dds1Y8HfsqNzTMzl/mg==, tarball: file:projects/arm-healthbot.tgz} name: '@rush-temp/arm-healthbot' version: 0.0.0 dependencies: @@ -12447,7 +12417,8 @@ packages: '@types/node': 14.18.41 chai: 4.3.7 cross-env: 7.0.3 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 @@ -17018,7 +16989,7 @@ packages: rollup-plugin-sourcemaps: 0.6.3_qg36w4uagpty5et2swcu4ykn64 rollup-plugin-visualizer: 5.9.0_rollup@2.79.1 semver: 7.3.8 - ts-node: 10.9.1_cda5npvz5vidcibznbsxxfupne + ts-node: 10.9.1_rwcdhhaqkims6irrp2ypnntvry tslib: 2.5.0 typescript: 4.8.4 yaml: 1.10.2 diff --git a/sdk/healthbot/arm-healthbot/CHANGELOG.md b/sdk/healthbot/arm-healthbot/CHANGELOG.md index 3765db0a87aa..02d0c96339e2 100644 --- a/sdk/healthbot/arm-healthbot/CHANGELOG.md +++ b/sdk/healthbot/arm-healthbot/CHANGELOG.md @@ -1,15 +1,30 @@ # Release History + +## 3.0.0 (2023-03-28) + +**Features** -## 2.1.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added operation Bots.beginUpdate + - Added operation Bots.beginUpdateAndWait + - Added operation Bots.listSecrets + - Added operation Bots.regenerateApiJwtSecret + - Added Interface BotsListSecretsOptionalParams + - Added Interface BotsRegenerateApiJwtSecretOptionalParams + - Added Interface HealthBotKey + - Added Interface HealthBotKeysResponse + - Added Interface KeyVaultProperties + - Added Type Alias BotsListSecretsResponse + - Added Type Alias BotsRegenerateApiJwtSecretResponse + - Interface BotsUpdateOptionalParams has a new optional parameter resumeFrom + - Interface BotsUpdateOptionalParams has a new optional parameter updateIntervalInMs + - Interface HealthBotProperties has a new optional parameter keyVaultProperties + - Interface HealthBotUpdateParameters has a new optional parameter properties + +**Breaking Changes** + + - Removed operation Bots.update + + ## 2.1.0 (2022-11-25) **Features** diff --git a/sdk/healthbot/arm-healthbot/LICENSE b/sdk/healthbot/arm-healthbot/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/healthbot/arm-healthbot/LICENSE +++ b/sdk/healthbot/arm-healthbot/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/healthbot/arm-healthbot/_meta.json b/sdk/healthbot/arm-healthbot/_meta.json index db0fbd7a31cd..4db038ff0bf0 100644 --- a/sdk/healthbot/arm-healthbot/_meta.json +++ b/sdk/healthbot/arm-healthbot/_meta.json @@ -1,8 +1,8 @@ { - "commit": "1f1d5b0b9ce6cc94605b2fd619dce374fb6e033a", - "readme": "specification\\healthbot\\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\\healthbot\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.3.20221108.1 --generate-sample=true", + "commit": "b78cd5f7aa24bb434f8e5b42df960615832d7b6e", + "readme": "specification/healthbot/resource-manager/readme.md", + "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/healthbot/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.10", "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.0", + "use": "@autorest/typescript@6.0.0-rc.10" } \ No newline at end of file diff --git a/sdk/healthbot/arm-healthbot/package.json b/sdk/healthbot/arm-healthbot/package.json index 72d20d2b2271..4cbaaae3c3fc 100644 --- a/sdk/healthbot/arm-healthbot/package.json +++ b/sdk/healthbot/arm-healthbot/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for HealthbotClient.", - "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.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -33,12 +33,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -49,7 +50,6 @@ "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -111,12 +111,5 @@ ] }, "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-healthbot?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot" +} \ No newline at end of file diff --git a/sdk/healthbot/arm-healthbot/review/arm-healthbot.api.md b/sdk/healthbot/arm-healthbot/review/arm-healthbot.api.md index 1782f5a8cc5a..5f738caa4c4c 100644 --- a/sdk/healthbot/arm-healthbot/review/arm-healthbot.api.md +++ b/sdk/healthbot/arm-healthbot/review/arm-healthbot.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 AvailableOperations { @@ -24,14 +24,17 @@ export interface BotResponseList { // @public export interface Bots { - beginCreate(resourceGroupName: string, botName: string, parameters: HealthBot, options?: BotsCreateOptionalParams): Promise, BotsCreateResponse>>; + beginCreate(resourceGroupName: string, botName: string, parameters: HealthBot, options?: BotsCreateOptionalParams): Promise, BotsCreateResponse>>; beginCreateAndWait(resourceGroupName: string, botName: string, parameters: HealthBot, options?: BotsCreateOptionalParams): Promise; - beginDelete(resourceGroupName: string, botName: string, options?: BotsDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, botName: string, options?: BotsDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, botName: string, options?: BotsDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, botName: string, parameters: HealthBotUpdateParameters, options?: BotsUpdateOptionalParams): Promise, BotsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, botName: string, parameters: HealthBotUpdateParameters, options?: BotsUpdateOptionalParams): Promise; get(resourceGroupName: string, botName: string, options?: BotsGetOptionalParams): Promise; list(options?: BotsListOptionalParams): PagedAsyncIterableIterator; listByResourceGroup(resourceGroupName: string, options?: BotsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - update(resourceGroupName: string, botName: string, parameters: HealthBotUpdateParameters, options?: BotsUpdateOptionalParams): Promise; + listSecrets(resourceGroupName: string, botName: string, options?: BotsListSecretsOptionalParams): Promise; + regenerateApiJwtSecret(resourceGroupName: string, botName: string, options?: BotsRegenerateApiJwtSecretOptionalParams): Promise; } // @public @@ -84,8 +87,24 @@ export interface BotsListOptionalParams extends coreClient.OperationOptions { // @public export type BotsListResponse = BotResponseList; +// @public +export interface BotsListSecretsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BotsListSecretsResponse = HealthBotKeysResponse; + +// @public +export interface BotsRegenerateApiJwtSecretOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BotsRegenerateApiJwtSecretResponse = HealthBotKey; + // @public export interface BotsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public @@ -143,9 +162,21 @@ export interface HealthbotClientOptionalParams extends coreClient.ServiceClientO endpoint?: string; } +// @public +export interface HealthBotKey { + keyName?: string; + value?: string; +} + +// @public +export interface HealthBotKeysResponse { + secrets?: HealthBotKey[]; +} + // @public export interface HealthBotProperties { readonly botManagementPortalLink?: string; + keyVaultProperties?: KeyVaultProperties; readonly provisioningState?: string; } @@ -154,6 +185,7 @@ export interface HealthBotUpdateParameters { identity?: Identity; // (undocumented) location?: string; + properties?: HealthBotProperties; sku?: Sku; tags?: { [propertyName: string]: string; @@ -173,6 +205,14 @@ export interface Identity { // @public export type IdentityType = string; +// @public +export interface KeyVaultProperties { + keyName: string; + keyVaultUri: string; + keyVersion?: string; + userIdentity?: string; +} + // @public export enum KnownIdentityType { Application = "Application", diff --git a/sdk/healthbot/arm-healthbot/src/healthbotClient.ts b/sdk/healthbot/arm-healthbot/src/healthbotClient.ts index ec8f91d4ded0..52900d718bfc 100644 --- a/sdk/healthbot/arm-healthbot/src/healthbotClient.ts +++ b/sdk/healthbot/arm-healthbot/src/healthbotClient.ts @@ -50,7 +50,7 @@ export class HealthbotClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-healthbot/2.1.1`; + const packageDetails = `azsdk-js-arm-healthbot/3.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -103,7 +103,7 @@ export class HealthbotClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-06-10"; + this.apiVersion = options.apiVersion || "2022-08-08"; this.bots = new BotsImpl(this); this.operations = new OperationsImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); diff --git a/sdk/healthbot/arm-healthbot/src/lroImpl.ts b/sdk/healthbot/arm-healthbot/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/healthbot/arm-healthbot/src/lroImpl.ts +++ b/sdk/healthbot/arm-healthbot/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/healthbot/arm-healthbot/src/models/index.ts b/sdk/healthbot/arm-healthbot/src/models/index.ts index 6e74933f5226..d50edb37fbc0 100644 --- a/sdk/healthbot/arm-healthbot/src/models/index.ts +++ b/sdk/healthbot/arm-healthbot/src/models/index.ts @@ -62,6 +62,20 @@ export interface HealthBotProperties { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly botManagementPortalLink?: string; + /** KeyVault properties for the resource encryption. */ + keyVaultProperties?: KeyVaultProperties; +} + +/** Properties of the key vault. */ +export interface KeyVaultProperties { + /** The name of the key vault key. */ + keyName: string; + /** The version of the key vault key. */ + keyVersion?: string; + /** The Uri of the key vault. */ + keyVaultUri: string; + /** The user assigned identity (ARM resource id) that has access to the key. */ + userIdentity?: string; } /** The resource model definition for a ARM tracked top level resource */ @@ -155,6 +169,8 @@ export interface ErrorAdditionalInfo { /** Parameters for updating a Azure Health Bot. */ export interface HealthBotUpdateParameters { + /** Properties of Azure Health Bot. */ + properties?: HealthBotProperties; /** Tags for a Azure Health Bot. */ tags?: { [propertyName: string]: string }; /** SKU of the Azure Health Bot. */ @@ -164,6 +180,20 @@ export interface HealthBotUpdateParameters { location?: string; } +/** Health Bot Keys Response. */ +export interface HealthBotKeysResponse { + /** Array of Azure Health Bot Secrets. */ + secrets?: HealthBotKey[]; +} + +/** An entry of HealthBotKeysResponse */ +export interface HealthBotKey { + /** The name of the key. */ + keyName?: string; + /** The value of the key. */ + value?: string; +} + /** The list of Azure Health Bot operation response. */ export interface BotResponseList { /** @@ -289,7 +319,12 @@ export interface BotsGetOptionalParams extends coreClient.OperationOptions {} export type BotsGetResponse = HealthBot; /** Optional parameters. */ -export interface BotsUpdateOptionalParams extends coreClient.OperationOptions {} +export interface BotsUpdateOptionalParams 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 update operation. */ export type BotsUpdateResponse = HealthBot; @@ -302,6 +337,20 @@ export interface BotsDeleteOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; } +/** Optional parameters. */ +export interface BotsListSecretsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listSecrets operation. */ +export type BotsListSecretsResponse = HealthBotKeysResponse; + +/** Optional parameters. */ +export interface BotsRegenerateApiJwtSecretOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the regenerateApiJwtSecret operation. */ +export type BotsRegenerateApiJwtSecretResponse = HealthBotKey; + /** Optional parameters. */ export interface BotsListByResourceGroupOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/healthbot/arm-healthbot/src/models/mappers.ts b/sdk/healthbot/arm-healthbot/src/models/mappers.ts index 6e36900d1d66..423a1694987e 100644 --- a/sdk/healthbot/arm-healthbot/src/models/mappers.ts +++ b/sdk/healthbot/arm-healthbot/src/models/mappers.ts @@ -110,6 +110,48 @@ export const HealthBotProperties: coreClient.CompositeMapper = { type: { name: "String" } + }, + keyVaultProperties: { + serializedName: "keyVaultProperties", + type: { + name: "Composite", + className: "KeyVaultProperties" + } + } + } + } +}; + +export const KeyVaultProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultProperties", + modelProperties: { + keyName: { + serializedName: "keyName", + required: true, + type: { + name: "String" + } + }, + keyVersion: { + serializedName: "keyVersion", + type: { + name: "String" + } + }, + keyVaultUri: { + serializedName: "keyVaultUri", + required: true, + type: { + name: "String" + } + }, + userIdentity: { + serializedName: "userIdentity", + type: { + name: "String" + } } } } @@ -298,6 +340,13 @@ export const HealthBotUpdateParameters: coreClient.CompositeMapper = { name: "Composite", className: "HealthBotUpdateParameters", modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "HealthBotProperties" + } + }, tags: { serializedName: "tags", type: { @@ -329,6 +378,48 @@ export const HealthBotUpdateParameters: coreClient.CompositeMapper = { } }; +export const HealthBotKeysResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HealthBotKeysResponse", + modelProperties: { + secrets: { + serializedName: "secrets", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "HealthBotKey" + } + } + } + } + } + } +}; + +export const HealthBotKey: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HealthBotKey", + modelProperties: { + keyName: { + serializedName: "keyName", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + export const BotResponseList: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/healthbot/arm-healthbot/src/models/parameters.ts b/sdk/healthbot/arm-healthbot/src/models/parameters.ts index d4b84ec94740..3d4fbe3e84b9 100644 --- a/sdk/healthbot/arm-healthbot/src/models/parameters.ts +++ b/sdk/healthbot/arm-healthbot/src/models/parameters.ts @@ -103,7 +103,7 @@ export const botName: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-06-10", + defaultValue: "2022-08-08", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/healthbot/arm-healthbot/src/operations/bots.ts b/sdk/healthbot/arm-healthbot/src/operations/bots.ts index d054552d3421..42319841db31 100644 --- a/sdk/healthbot/arm-healthbot/src/operations/bots.ts +++ b/sdk/healthbot/arm-healthbot/src/operations/bots.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 { HealthbotClient } from "../healthbotClient"; -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 { HealthBot, BotsListByResourceGroupNextOptionalParams, @@ -31,6 +35,10 @@ import { BotsUpdateOptionalParams, BotsUpdateResponse, BotsDeleteOptionalParams, + BotsListSecretsOptionalParams, + BotsListSecretsResponse, + BotsRegenerateApiJwtSecretOptionalParams, + BotsRegenerateApiJwtSecretResponse, BotsListByResourceGroupNextResponse, BotsListNextResponse } from "../models"; @@ -184,7 +192,7 @@ export class BotsImpl implements Bots { parameters: HealthBot, options?: BotsCreateOptionalParams ): Promise< - PollerLike, BotsCreateResponse> + SimplePollerLike, BotsCreateResponse> > { const directSendOperation = async ( args: coreClient.OperationArguments, @@ -192,7 +200,7 @@ export class BotsImpl implements Bots { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -225,15 +233,18 @@ export class BotsImpl implements Bots { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, botName, parameters, options }, - createOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, botName, parameters, options }, + spec: createOperationSpec + }); + const poller = await createHttpPoller< + BotsCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" + resourceLocationConfig: "azure-async-operation" }); await poller.poll(); return poller; @@ -285,16 +296,89 @@ export class BotsImpl implements Bots { * @param parameters The parameters to provide for the required Azure Health Bot. * @param options The options parameters. */ - update( + async beginUpdate( + resourceGroupName: string, + botName: string, + parameters: HealthBotUpdateParameters, + options?: BotsUpdateOptionalParams + ): Promise< + SimplePollerLike, BotsUpdateResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, botName, parameters, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + BotsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Patch a HealthBot. + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters The parameters to provide for the required Azure Health Bot. + * @param options The options parameters. + */ + async beginUpdateAndWait( resourceGroupName: string, botName: string, parameters: HealthBotUpdateParameters, options?: BotsUpdateOptionalParams ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, botName, parameters, options }, - updateOperationSpec + const poller = await this.beginUpdate( + resourceGroupName, + botName, + parameters, + options ); + return poller.pollUntilDone(); } /** @@ -307,14 +391,14 @@ export class BotsImpl implements Bots { resourceGroupName: string, botName: string, options?: BotsDeleteOptionalParams - ): 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 ) => { @@ -347,13 +431,13 @@ export class BotsImpl implements Bots { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, botName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, botName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -375,6 +459,40 @@ export class BotsImpl implements Bots { return poller.pollUntilDone(); } + /** + * List all secrets of a HealthBot. + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param options The options parameters. + */ + listSecrets( + resourceGroupName: string, + botName: string, + options?: BotsListSecretsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, botName, options }, + listSecretsOperationSpec + ); + } + + /** + * Regenerate the API JWT Secret of a HealthBot. + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param options The options parameters. + */ + regenerateApiJwtSecret( + resourceGroupName: string, + botName: string, + options?: BotsRegenerateApiJwtSecretOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, botName, options }, + regenerateApiJwtSecretOperationSpec + ); + } + /** * Returns all the resources of a particular type belonging to a resource group * @param resourceGroupName The name of the Bot resource group in the user subscription. @@ -499,6 +617,12 @@ const updateOperationSpec: coreClient.OperationSpec = { 201: { bodyMapper: Mappers.HealthBot }, + 202: { + bodyMapper: Mappers.HealthBot + }, + 204: { + bodyMapper: Mappers.HealthBot + }, default: { bodyMapper: Mappers.ErrorModel } @@ -538,6 +662,50 @@ const deleteOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const listSecretsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}/listSecrets", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.HealthBotKeysResponse + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.botName + ], + headerParameters: [Parameters.accept], + serializer +}; +const regenerateApiJwtSecretOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}/regenerateApiJwtSecret", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.HealthBotKey + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.botName + ], + headerParameters: [Parameters.accept], + serializer +}; const listByResourceGroupOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots", @@ -587,7 +755,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -608,7 +775,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/healthbot/arm-healthbot/src/operations/operations.ts b/sdk/healthbot/arm-healthbot/src/operations/operations.ts index a1f22f766185..b8df3ee07cf8 100644 --- a/sdk/healthbot/arm-healthbot/src/operations/operations.ts +++ b/sdk/healthbot/arm-healthbot/src/operations/operations.ts @@ -143,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/healthbot/arm-healthbot/src/operationsInterfaces/bots.ts b/sdk/healthbot/arm-healthbot/src/operationsInterfaces/bots.ts index 70d9f8c878b3..509b4645dda5 100644 --- a/sdk/healthbot/arm-healthbot/src/operationsInterfaces/bots.ts +++ b/sdk/healthbot/arm-healthbot/src/operationsInterfaces/bots.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 { HealthBot, BotsListByResourceGroupOptionalParams, @@ -19,7 +19,11 @@ import { HealthBotUpdateParameters, BotsUpdateOptionalParams, BotsUpdateResponse, - BotsDeleteOptionalParams + BotsDeleteOptionalParams, + BotsListSecretsOptionalParams, + BotsListSecretsResponse, + BotsRegenerateApiJwtSecretOptionalParams, + BotsRegenerateApiJwtSecretResponse } from "../models"; /// @@ -52,7 +56,7 @@ export interface Bots { parameters: HealthBot, options?: BotsCreateOptionalParams ): Promise< - PollerLike, BotsCreateResponse> + SimplePollerLike, BotsCreateResponse> >; /** * Create a new Azure Health Bot. @@ -85,7 +89,22 @@ export interface Bots { * @param parameters The parameters to provide for the required Azure Health Bot. * @param options The options parameters. */ - update( + beginUpdate( + resourceGroupName: string, + botName: string, + parameters: HealthBotUpdateParameters, + options?: BotsUpdateOptionalParams + ): Promise< + SimplePollerLike, BotsUpdateResponse> + >; + /** + * Patch a HealthBot. + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param parameters The parameters to provide for the required Azure Health Bot. + * @param options The options parameters. + */ + beginUpdateAndWait( resourceGroupName: string, botName: string, parameters: HealthBotUpdateParameters, @@ -101,7 +120,7 @@ export interface Bots { resourceGroupName: string, botName: string, options?: BotsDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Delete a HealthBot. * @param resourceGroupName The name of the Bot resource group in the user subscription. @@ -113,4 +132,26 @@ export interface Bots { botName: string, options?: BotsDeleteOptionalParams ): Promise; + /** + * List all secrets of a HealthBot. + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param options The options parameters. + */ + listSecrets( + resourceGroupName: string, + botName: string, + options?: BotsListSecretsOptionalParams + ): Promise; + /** + * Regenerate the API JWT Secret of a HealthBot. + * @param resourceGroupName The name of the Bot resource group in the user subscription. + * @param botName The name of the Bot resource. + * @param options The options parameters. + */ + regenerateApiJwtSecret( + resourceGroupName: string, + botName: string, + options?: BotsRegenerateApiJwtSecretOptionalParams + ): Promise; } diff --git a/sdk/healthbot/arm-healthbot/src/pagingHelper.ts b/sdk/healthbot/arm-healthbot/src/pagingHelper.ts index d85fc13bce1e..269a2b9814b5 100644 --- a/sdk/healthbot/arm-healthbot/src/pagingHelper.ts +++ b/sdk/healthbot/arm-healthbot/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/healthbot/arm-healthbot/tsconfig.json b/sdk/healthbot/arm-healthbot/tsconfig.json index ab8d41e9349f..3e6ae96443f3 100644 --- a/sdk/healthbot/arm-healthbot/tsconfig.json +++ b/sdk/healthbot/arm-healthbot/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-healthbot": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"