diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e38fc9667b68..6a87f7e566c6 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3832,7 +3832,7 @@ packages: dependencies: semver: 7.5.1 shelljs: 0.8.5 - typescript: 5.2.0-dev.20230607 + typescript: 5.2.0-dev.20230608 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8413,6 +8413,12 @@ packages: hasBin: true dev: false + /typescript/4.8.4: + resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: false + /typescript/5.0.4: resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==} engines: {node: '>=12.20'} @@ -8425,8 +8431,8 @@ packages: hasBin: true dev: false - /typescript/5.2.0-dev.20230607: - resolution: {integrity: sha512-7Lgk1sNuuYpMNvHuXIMczqhLbJ99RpX3VgokK+Ir4DgliycYNrNGM/daAO38fHkk8n3lg2rP/6U5I545xTJdKA==} + /typescript/5.2.0-dev.20230608: + resolution: {integrity: sha512-My8VOVNpHAZ693+NgsvD2JXgXg5eosPJcEDzPcme8tU1vs+C6G6liR15r3qd1qSSNjDghmCe014GjWspVBZ7ag==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -12063,7 +12069,7 @@ packages: dev: false file:projects/arm-healthbot.tgz: - resolution: {integrity: sha512-AhsFUruhBEylGQuR3pCyRsb8peidBTO5R+fQG1GPHC5X5ULvjYBr/VjyCyGw6wUncL7mEI+ZAjeD1HRGT5+DGw==, 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: @@ -12077,13 +12083,14 @@ packages: '@types/node': 14.18.48 chai: 4.3.7 cross-env: 7.0.3 - mkdirp: 1.0.4 + dotenv: 16.1.4 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 rollup-plugin-sourcemaps: 0.6.3_6vxqa4pl2c5hli7lcaemfsm5je tslib: 2.5.3 - typescript: 5.0.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - supports-color @@ -19316,7 +19323,7 @@ packages: dev: false file:projects/storage-file-share.tgz: - resolution: {integrity: sha512-Ta2DL1i32tq8YzBuBOpmsMPn5ZwaEkk4UK/PIovIBFkm19A6Pb/TcIsJWYe2IDV6bmz9S4jLLFdRex0krtigYw==, tarball: file:projects/storage-file-share.tgz} + resolution: {integrity: sha512-P71uQ6hYBUOp8sAtiKzvb3oy1eskU0cjAcXH5W5MdCh12E5VENENL6BLv5YCHvt9VelKTdzXOtNw274eP80iAg==, tarball: file:projects/storage-file-share.tgz} name: '@rush-temp/storage-file-share' version: 0.0.0 dependencies: diff --git a/sdk/healthbot/arm-healthbot/CHANGELOG.md b/sdk/healthbot/arm-healthbot/CHANGELOG.md index 3765db0a87aa..489780c66552 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-06-08) + +**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..633070815700 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": "6a32879c2c62d094d3b4f765796f9280e508a5bd", + "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 e9190ac2d54a..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": "~5.0.0", + "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..7bae52b9a3dd 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", @@ -234,7 +274,7 @@ export interface Sku { } // @public -export type SkuName = "F0" | "S1" | "C0"; +export type SkuName = "F0" | "S1" | "C0" | "PES"; // @public export interface SystemData { diff --git a/sdk/healthbot/arm-healthbot/src/healthbotClient.ts b/sdk/healthbot/arm-healthbot/src/healthbotClient.ts index ec8f91d4ded0..a82256380fc1 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 || "2023-05-01"; 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..708e2cf412d3 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 { /** @@ -263,7 +293,7 @@ export enum KnownIdentityType { */ export type IdentityType = string; /** Defines values for SkuName. */ -export type SkuName = "F0" | "S1" | "C0"; +export type SkuName = "F0" | "S1" | "C0" | "PES"; /** Defines values for ResourceIdentityType. */ export type ResourceIdentityType = | "SystemAssigned" @@ -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..465696488927 100644 --- a/sdk/healthbot/arm-healthbot/src/models/mappers.ts +++ b/sdk/healthbot/arm-healthbot/src/models/mappers.ts @@ -18,7 +18,7 @@ export const Sku: coreClient.CompositeMapper = { required: true, type: { name: "Enum", - allowedValues: ["F0", "S1", "C0"] + allowedValues: ["F0", "S1", "C0", "PES"] } } } @@ -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..3a5ad605ac04 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: "2023-05-01", 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"