diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index effaa47f703e..d09a77493e3d 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1021,9 +1021,6 @@ importers: '@rush-temp/iot-modelsrepository': specifier: file:./projects/iot-modelsrepository.tgz version: file:projects/iot-modelsrepository.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1) - '@rush-temp/mcp-server': - specifier: file:./projects/mcp-server.tgz - version: file:projects/mcp-server.tgz(@types/debug@4.1.12)(@vitest/browser@3.1.2)(yaml@2.7.1) '@rush-temp/keyvault-admin': specifier: file:./projects/keyvault-admin.tgz version: file:projects/keyvault-admin.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1) @@ -1063,6 +1060,9 @@ importers: '@rush-temp/maps-timezone': specifier: file:./projects/maps-timezone.tgz version: file:projects/maps-timezone.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1) + '@rush-temp/mcp-server': + specifier: file:./projects/mcp-server.tgz + version: file:projects/mcp-server.tgz(@types/debug@4.1.12)(@vitest/browser@3.1.2)(yaml@2.7.1) '@rush-temp/microsoft-playwright-testing': specifier: file:./projects/microsoft-playwright-testing.tgz version: file:projects/microsoft-playwright-testing.tgz(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1) @@ -2842,7 +2842,7 @@ packages: version: 0.0.0 '@rush-temp/arm-healthbot@file:projects/arm-healthbot.tgz': - resolution: {integrity: sha512-LpTF7Mowtiv7ji9C7nLcDxC9TaVZs6j6LcNl80bZJHf6S5pmfIUf10jHEWFB0Pj+4hoKudq7a6v2bqYY6oXSRg==, tarball: file:projects/arm-healthbot.tgz} + resolution: {integrity: sha512-Rl4S5K18VWTLImVCnGgyXfhT+Z7mh3f8hV2PGGnw55cRuyd4tHdKlmpVPsFPBmNxtReXKdtJtoGY72mbLX61zQ==, tarball: file:projects/arm-healthbot.tgz} version: 0.0.0 '@rush-temp/arm-healthcareapis@file:projects/arm-healthcareapis.tgz': @@ -3669,10 +3669,6 @@ packages: resolution: {integrity: sha512-nVEawKXIhltEp1Zvua0E46Gdg0Hs5JJDFD7WPgqFBycYtQjRVsw60x49ZTi8ZxYXPJGQBJC2xLvj1fg/A5uhyQ==, tarball: file:projects/iot-modelsrepository.tgz} version: 0.0.0 - '@rush-temp/mcp-server@file:projects/mcp-server.tgz': - resolution: {integrity: sha512-DuCikdWUz6hleAR8EjUp7JD4VAGR1YMfNRAshvzJ7W20qAMV10dscYCo2wq8Eqt5TtEwLOrJFFfnbHwGIhNTZQ==, tarball: file:projects/mcp-server.tgz} - version: 0.0.0 - '@rush-temp/keyvault-admin@file:projects/keyvault-admin.tgz': resolution: {integrity: sha512-+pLp6hMMbEHRNWIWBJHEb3ovy65MoQthJRuwfDYdXDDYMYgiazL7j3CLleRz+WpDlI5kJ8gyD24pIqCoVZvQqg==, tarball: file:projects/keyvault-admin.tgz} version: 0.0.0 @@ -3725,6 +3721,10 @@ packages: resolution: {integrity: sha512-LLoNu/hOKIZ5/eLQ0io6I6kDPrnkiI1C3rDtG0DEQlP097B9CoeeaQ2E+qbGYUAPvvyo6QththExkcmgUENgEg==, tarball: file:projects/maps-timezone.tgz} version: 0.0.0 + '@rush-temp/mcp-server@file:projects/mcp-server.tgz': + resolution: {integrity: sha512-xVj0UA/iOcFZso/cQiQ1Ug5juexp+mJOhFwNBANfNb0bzXo9BRrgR2/0DxaTIIS0lest23qzU0nMQUiZPPetpA==, tarball: file:projects/mcp-server.tgz} + version: 0.0.0 + '@rush-temp/microsoft-playwright-testing@file:projects/microsoft-playwright-testing.tgz': resolution: {integrity: sha512-sVU4AhYy8i4VhihEGOHMZLmUggC15w2JvBfGUC+i+q7nxmE3sIbO+EzicltK811tg0QQML6lAzKonojrK4FO6g==, tarball: file:projects/microsoft-playwright-testing.tgz} version: 0.0.0 @@ -13106,10 +13106,11 @@ snapshots: '@rush-temp/arm-healthbot@file:projects/arm-healthbot.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1)': dependencies: - '@azure/core-lro': 2.7.2 '@types/node': 18.19.87 '@vitest/browser': 3.1.2(playwright@1.52.0)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(vitest@3.1.2) '@vitest/coverage-istanbul': 3.1.2(vitest@3.1.2) + dotenv: 16.5.0 + eslint: 9.26.0 playwright: 1.52.0 tslib: 2.8.1 typescript: 5.8.3 @@ -20462,37 +20463,6 @@ snapshots: - webdriverio - yaml - '@rush-temp/mcp-server@file:projects/mcp-server.tgz(@types/debug@4.1.12)(@vitest/browser@3.1.2)(yaml@2.7.1)': - dependencies: - '@modelcontextprotocol/sdk': 1.11.0 - '@types/node': 18.19.87 - '@vitest/coverage-istanbul': 3.1.2(vitest@3.1.2) - '@vitest/expect': 3.1.2 - dotenv: 16.5.0 - eslint: 9.26.0 - tsx: 4.19.3 - typescript: 5.8.3 - vitest: 3.1.2(@types/debug@4.1.12)(@types/node@18.19.87)(@vitest/browser@3.1.2)(tsx@4.19.3)(yaml@2.7.1) - zod: 3.24.4 - transitivePeerDependencies: - - '@edge-runtime/vm' - - '@types/debug' - - '@vitest/browser' - - '@vitest/ui' - - happy-dom - - jiti - - jsdom - - less - - lightningcss - - msw - - sass - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - - yaml - '@rush-temp/keyvault-admin@file:projects/keyvault-admin.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1)': dependencies: '@azure/keyvault-keys': 4.9.0 @@ -20962,6 +20932,37 @@ snapshots: - webdriverio - yaml + '@rush-temp/mcp-server@file:projects/mcp-server.tgz(@types/debug@4.1.12)(@vitest/browser@3.1.2)(yaml@2.7.1)': + dependencies: + '@modelcontextprotocol/sdk': 1.11.0 + '@types/node': 18.19.87 + '@vitest/coverage-istanbul': 3.1.2(vitest@3.1.2) + '@vitest/expect': 3.1.2 + dotenv: 16.5.0 + eslint: 9.26.0 + tsx: 4.19.3 + typescript: 5.8.3 + vitest: 3.1.2(@types/debug@4.1.12)(@types/node@18.19.87)(@vitest/browser@3.1.2)(tsx@4.19.3)(yaml@2.7.1) + zod: 3.24.4 + transitivePeerDependencies: + - '@edge-runtime/vm' + - '@types/debug' + - '@vitest/browser' + - '@vitest/ui' + - happy-dom + - jiti + - jsdom + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - yaml + '@rush-temp/microsoft-playwright-testing@file:projects/microsoft-playwright-testing.tgz(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1)': dependencies: '@playwright/test': 1.52.0 diff --git a/sdk/healthbot/arm-healthbot/CHANGELOG.md b/sdk/healthbot/arm-healthbot/CHANGELOG.md index ead18752e772..439c88c6983e 100644 --- a/sdk/healthbot/arm-healthbot/CHANGELOG.md +++ b/sdk/healthbot/arm-healthbot/CHANGELOG.md @@ -1,15 +1,59 @@ # Release History - -## 2.1.1 (Unreleased) - + +## 3.0.0 (2025-05-12) + ### Features Added -### Breaking Changes + - Added operation group HealthBotsOperations + - Added Interface ErrorDetail + - Added Interface HealthBotClientOptionalParams + - Added Interface HealthBotKey + - Added Interface HealthBotKeysResponse + - Added Interface HealthBotsCreateOptionalParams + - Added Interface HealthBotsDeleteOptionalParams + - Added Interface HealthBotsGetOptionalParams + - Added Interface HealthBotsListByResourceGroupOptionalParams + - Added Interface HealthBotsListOptionalParams + - Added Interface HealthBotsListSecretsOptionalParams + - Added Interface HealthBotsRegenerateApiJwtSecretOptionalParams + - Added Interface HealthBotsUpdateOptionalParams + - Added Interface KeyVaultProperties + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface RestorePollerOptions + - Added Interface UserAssignedIdentityMap + - Added Class HealthBotClient + - Added Type Alias ContinuablePage + - Added Type Alias CreatedByType + - Interface HealthBotProperties has a new optional parameter keyVaultProperties + - Interface HealthBotUpdateParameters has a new optional parameter properties + - Added Enum KnownCreatedByType + - Added Enum KnownVersions + - Added function restorePoller -### Bugs Fixed - -### Other Changes +### Breaking Changes + - Removed operation group AvailableOperations + - Removed operation group Bots + - Deleted Class HealthbotClient + - Type of parameter info of interface ErrorAdditionalInfo is changed from Record to Record + - Type of parameter error of interface ErrorModel is changed from ErrorError to ErrorDetail + - Type of parameter tags of interface HealthBotUpdateParameters is changed from { + [propertyName: string]: string; + } to Record + - Type of parameter userAssignedIdentities of interface Identity is changed from { + [propertyName: string]: UserAssignedIdentity; + } to UserAssignedIdentityMap + - Type of parameter properties of interface OperationDetail is changed from Record to Record + - Type of parameter createdByType of interface SystemData is changed from IdentityType to CreatedByType + - Type of parameter lastModifiedByType of interface SystemData is changed from IdentityType to CreatedByType + - Type of parameter tags of interface TrackedResource is changed from { + [propertyName: string]: string; + } to Record + - Removed Enum KnownIdentityType + - Removed function getContinuationToken + + ## 2.1.0 (2022-11-25) ### Features Added @@ -26,4 +70,4 @@ To understand the detail of the change, please refer to [Changelog](https://aka. To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). -To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/healthbot/arm-healthbot/LICENSE b/sdk/healthbot/arm-healthbot/LICENSE index b2f52a2bad4e..63447fd8bbbf 100644 --- a/sdk/healthbot/arm-healthbot/LICENSE +++ b/sdk/healthbot/arm-healthbot/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/sdk/healthbot/arm-healthbot/README.md b/sdk/healthbot/arm-healthbot/README.md index 21b1c226eebe..e80742d41a52 100644 --- a/sdk/healthbot/arm-healthbot/README.md +++ b/sdk/healthbot/arm-healthbot/README.md @@ -1,13 +1,15 @@ -# Azure Healthbot client library for JavaScript +# Azure HealthBot client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Healthbot client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure HealthBot client. Azure Health Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-healthbot) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-healthbot) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-healthbot) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-healthbot?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot/samples) ## Getting started @@ -24,16 +26,16 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/arm-healthbot` package -Install the Azure Healthbot client library for JavaScript with `npm`: +Install the Azure HealthBot client library for JavaScript with `npm`: ```bash npm install @azure/arm-healthbot ``` -### Create and authenticate a `HealthbotClient` +### Create and authenticate a `HealthBotClient` -To create a client object to access the Azure Healthbot API, you will need the `endpoint` of your Azure Healthbot resource and a `credential`. The Azure Healthbot client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure Healthbot resource in the [Azure Portal][azure_portal]. +To create a client object to access the Azure HealthBot API, you will need the `endpoint` of your Azure HealthBot resource and a `credential`. The Azure HealthBot client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure HealthBot resource in the [Azure Portal][azure_portal]. You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). @@ -43,44 +45,42 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure Healthbot** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). -Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. +You will also need to **register a new AAD application and grant access to Azure HealthBot** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client. ```ts snippet:ReadmeSampleCreateClient_Node -import { HealthbotClient } from "@azure/arm-healthbot"; +import { HealthBotClient } from "@azure/arm-healthbot"; import { DefaultAzureCredential } from "@azure/identity"; const subscriptionId = "00000000-0000-0000-0000-000000000000"; -const client = new HealthbotClient(new DefaultAzureCredential(), subscriptionId); +const client = new HealthBotClient(new DefaultAzureCredential(), subscriptionId); ``` For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate. ```ts snippet:ReadmeSampleCreateClient_Browser import { InteractiveBrowserCredential } from "@azure/identity"; -import { HealthbotClient } from "@azure/arm-healthbot"; +import { HealthBotClient } from "@azure/arm-healthbot"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", - clientId: "", -}); -const client = new HealthbotClient(credential, subscriptionId); + clientId: "" + }); +const client = new HealthBotClient(credential, subscriptionId); ``` -### JavaScript Bundle +### JavaScript Bundle To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). ## Key concepts -### HealthbotClient +### HealthBotClient -`HealthbotClient` is the primary interface for developers using the Azure Healthbot client library. Explore the methods on this client object to understand the different features of the Azure Healthbot service that you can access. +`HealthBotClient` is the primary interface for developers using the Azure HealthBot client library. Explore the methods on this client object to understand the different features of the Azure HealthBot service that you can access. ## Troubleshooting @@ -98,7 +98,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## Next steps -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot/samples) directory for detailed examples on how to use this library. ## Contributing @@ -108,8 +108,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) -[azure_cli]: https://learn.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ [azure_sub]: https://azure.microsoft.com/free/ [azure_portal]: https://portal.azure.com [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity diff --git a/sdk/healthbot/arm-healthbot/_meta.json b/sdk/healthbot/arm-healthbot/_meta.json deleted file mode 100644 index 56c411411aa4..000000000000 --- a/sdk/healthbot/arm-healthbot/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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", - "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" -} diff --git a/sdk/healthbot/arm-healthbot/assets.json b/sdk/healthbot/arm-healthbot/assets.json deleted file mode 100644 index d43c1d74df4b..000000000000 --- a/sdk/healthbot/arm-healthbot/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/healthbot/arm-healthbot", - "Tag": "js/healthbot/arm-healthbot_01d2179c38" -} diff --git a/sdk/healthbot/arm-healthbot/eslint.config.mjs b/sdk/healthbot/arm-healthbot/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]); diff --git a/sdk/healthbot/arm-healthbot/package.json b/sdk/healthbot/arm-healthbot/package.json index c05b5e4368c6..134219183f71 100644 --- a/sdk/healthbot/arm-healthbot/package.json +++ b/sdk/healthbot/arm-healthbot/package.json @@ -1,111 +1,125 @@ { "name": "@azure/arm-healthbot", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for HealthbotClient.", - "version": "2.1.1", + "version": "3.0.0", + "description": "A generated SDK for HealthBotClient.", "engines": { "node": ">=18.0.0" }, - "dependencies": { - "@azure/abort-controller": "^2.1.2", - "@azure/core-auth": "^1.9.0", - "@azure/core-client": "^1.9.2", - "@azure/core-lro": "^2.2.0", - "@azure/core-paging": "^1.6.2", - "@azure/core-rest-pipeline": "^1.18.2", - "tslib": "^2.8.1" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/healthBots": "./src/api/healthBots/index.ts", + "./api/operations": "./src/api/operations/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false, + "project": "./tsconfig.src.json" }, + "type": "module", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", - "isomorphic", - "cloud" + "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", + "files": [ + "dist/", + "README.md", + "LICENSE", + "review/", + "CHANGELOG.md" + ], + "sdk-type": "mgmt", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/healthBotContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/core-util": "^1.12.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, "devDependencies": { "@azure-tools/test-credential": "^2.0.0", "@azure-tools/test-recorder": "^4.1.0", "@azure-tools/test-utils-vitest": "^1.0.0", "@azure/dev-tool": "^1.0.0", - "@azure/identity": "^4.6.0", - "@azure/logger": "^1.1.4", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^4.9.1", "@types/node": "^18.0.0", "@vitest/browser": "^3.0.9", "@vitest/coverage-istanbul": "^3.0.9", - "playwright": "^1.50.1", + "dotenv": "^16.0.0", + "eslint": "^9.9.0", + "playwright": "^1.52.0", "typescript": "~5.8.2", "vitest": "^3.0.9" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot", - "repository": "github:Azure/azure-sdk-for-js", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" - ], "scripts": { "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "echo skipped.", - "check-format": "echo skipped", + "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", + "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", + "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", - "lint": "echo skipped", + "execute:samples": "dev-tool samples run samples-dev", + "extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "lint": "eslint package.json api-extractor.json src test", + "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", + "minify": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "pack": "npm pack 2>&1", - "prepack": "npm run build", - "test": "npm run test:node && npm run test:browser", + "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", "test:browser": "echo skipped", "test:node": "dev-tool run test:vitest", - "test:node:esm": "dev-tool run test:vitest --esm", - "update-snippets": "dev-tool run update-snippets" + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", + "unit-test:node": "dev-tool run test:vitest", + "update-snippets": "dev-tool run update-snippets", + "test:node:esm": "dev-tool run test:vitest --esm" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/healthbotClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-healthbot", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-healthbot?view=azure-node-preview" }, - "type": "module", - "tshy": { - "project": "./tsconfig.src.json", - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false - }, "browser": "./dist/browser/index.js", "react-native": "./dist/react-native/index.js", "exports": { @@ -127,6 +141,81 @@ "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/healthBots": { + "browser": { + "types": "./dist/browser/api/healthBots/index.d.ts", + "default": "./dist/browser/api/healthBots/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/healthBots/index.d.ts", + "default": "./dist/react-native/api/healthBots/index.js" + }, + "import": { + "types": "./dist/esm/api/healthBots/index.d.ts", + "default": "./dist/esm/api/healthBots/index.js" + }, + "require": { + "types": "./dist/commonjs/api/healthBots/index.d.ts", + "default": "./dist/commonjs/api/healthBots/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/operations/index.d.ts", + "default": "./dist/react-native/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } } - } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/sdk/healthbot/arm-healthbot/review/arm-healthbot-api-healthBots.api.md b/sdk/healthbot/arm-healthbot/review/arm-healthbot-api-healthBots.api.md new file mode 100644 index 000000000000..6516b433bea9 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/review/arm-healthbot-api-healthBots.api.md @@ -0,0 +1,73 @@ +## API Report File for "@azure/arm-healthbot" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: HealthBotContext, resourceGroupName: string, botName: string, options?: HealthBotsDeleteOptionalParams): PollerLike, void>; + +// @public +export function create(context: HealthBotContext, resourceGroupName: string, botName: string, parameters: HealthBot, options?: HealthBotsCreateOptionalParams): PollerLike, HealthBot>; + +// @public +export function get(context: HealthBotContext, resourceGroupName: string, botName: string, options?: HealthBotsGetOptionalParams): Promise; + +// @public +export interface HealthBotsCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface HealthBotsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface HealthBotsGetOptionalParams extends OperationOptions { +} + +// @public +export interface HealthBotsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface HealthBotsListOptionalParams extends OperationOptions { +} + +// @public +export interface HealthBotsListSecretsOptionalParams extends OperationOptions { +} + +// @public +export interface HealthBotsRegenerateApiJwtSecretOptionalParams extends OperationOptions { +} + +// @public +export interface HealthBotsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function list(context: HealthBotContext, options?: HealthBotsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listByResourceGroup(context: HealthBotContext, resourceGroupName: string, options?: HealthBotsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listSecrets(context: HealthBotContext, resourceGroupName: string, botName: string, options?: HealthBotsListSecretsOptionalParams): Promise; + +// @public +export function regenerateApiJwtSecret(context: HealthBotContext, resourceGroupName: string, botName: string, options?: HealthBotsRegenerateApiJwtSecretOptionalParams): Promise; + +// @public +export function update(context: HealthBotContext, resourceGroupName: string, botName: string, parameters: HealthBotUpdateParameters, options?: HealthBotsUpdateOptionalParams): PollerLike, void>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/healthbot/arm-healthbot/review/arm-healthbot-api-operations.api.md b/sdk/healthbot/arm-healthbot/review/arm-healthbot-api-operations.api.md new file mode 100644 index 000000000000..849838545bf5 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/review/arm-healthbot-api-operations.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-healthbot" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function list(context: HealthBotContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/healthbot/arm-healthbot/review/arm-healthbot-api.api.md b/sdk/healthbot/arm-healthbot/review/arm-healthbot-api.api.md new file mode 100644 index 000000000000..76e6a99bcbfc --- /dev/null +++ b/sdk/healthbot/arm-healthbot/review/arm-healthbot-api.api.md @@ -0,0 +1,27 @@ +## API Report File for "@azure/arm-healthbot" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export function createHealthBot(credential: TokenCredential, subscriptionId: string, options?: HealthBotClientOptionalParams): HealthBotContext; + +// @public +export interface HealthBotClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +// @public +export interface HealthBotContext extends Client { + apiVersion: string; + subscriptionId: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/healthbot/arm-healthbot/review/arm-healthbot-models.api.md b/sdk/healthbot/arm-healthbot/review/arm-healthbot-models.api.md new file mode 100644 index 000000000000..cbcabc9957f0 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/review/arm-healthbot-models.api.md @@ -0,0 +1,159 @@ +## API Report File for "@azure/arm-healthbot" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorModel[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorModel { + error?: ErrorDetail; +} + +// @public +export interface HealthBot extends TrackedResource { + identity?: Identity; + properties?: HealthBotProperties; + sku: Sku; +} + +// @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; +} + +// @public +export interface HealthBotUpdateParameters { + identity?: Identity; + // (undocumented) + location?: string; + properties?: HealthBotProperties; + sku?: Sku; + tags?: Record; +} + +// @public +export interface Identity { + readonly principalId?: string; + readonly tenantId?: string; + type?: ResourceIdentityType; + userAssignedIdentities?: UserAssignedIdentityMap; +} + +// @public +export interface KeyVaultProperties { + keyName: string; + keyVaultUri: string; + keyVersion?: string; + userIdentity?: string; +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownVersions { + V20240201 = "2024-02-01" +} + +// @public +export interface OperationDetail { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; + properties?: Record; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type ResourceIdentityType = "SystemAssigned" | "UserAssigned" | "SystemAssigned, UserAssigned" | "None"; + +// @public +export interface Sku { + name: SkuName; +} + +// @public +export type SkuName = "F0" | "S1" | "C0" | "PES" | "C1"; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export interface UserAssignedIdentity { + readonly clientId?: string; + readonly principalId?: string; +} + +// @public +export interface UserAssignedIdentityMap { + additionalProperties?: Record; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/healthbot/arm-healthbot/review/arm-healthbot.api.md b/sdk/healthbot/arm-healthbot/review/arm-healthbot.api.md index 1782f5a8cc5a..5eb60c7a5ff7 100644 --- a/sdk/healthbot/arm-healthbot/review/arm-healthbot.api.md +++ b/sdk/healthbot/arm-healthbot/review/arm-healthbot.api.md @@ -4,149 +4,126 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { AbortSignalLike } from '@azure/abort-controller'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; import { PollerLike } from '@azure/core-lro'; -import { PollOperationState } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; // @public -export interface AvailableOperations { - nextLink?: string; - value?: OperationDetail[]; -} +export type ContinuablePage = TPage & { + continuationToken?: string; +}; // @public -export interface BotResponseList { - readonly nextLink?: string; - readonly value?: HealthBot[]; -} +export type CreatedByType = string; // @public -export interface Bots { - 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>>; - beginDeleteAndWait(resourceGroupName: string, botName: string, options?: BotsDeleteOptionalParams): 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; +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; } // @public -export interface BotsCreateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorModel[]; + readonly message?: string; + readonly target?: string; } // @public -export type BotsCreateResponse = HealthBot; - -// @public -export interface BotsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface ErrorModel { + error?: ErrorDetail; } // @public -export interface BotsGetOptionalParams extends coreClient.OperationOptions { +export interface HealthBot extends TrackedResource { + identity?: Identity; + properties?: HealthBotProperties; + sku: Sku; } -// @public -export type BotsGetResponse = HealthBot; - -// @public -export interface BotsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export class HealthBotClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: HealthBotClientOptionalParams); + readonly healthBots: HealthBotsOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; } // @public -export type BotsListByResourceGroupNextResponse = BotResponseList; - -// @public -export interface BotsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +export interface HealthBotClientOptionalParams extends ClientOptions { + apiVersion?: string; } // @public -export type BotsListByResourceGroupResponse = BotResponseList; - -// @public -export interface BotsListNextOptionalParams extends coreClient.OperationOptions { +export interface HealthBotKey { + keyName?: string; + value?: string; } // @public -export type BotsListNextResponse = BotResponseList; - -// @public -export interface BotsListOptionalParams extends coreClient.OperationOptions { +export interface HealthBotKeysResponse { + secrets?: HealthBotKey[]; } // @public -export type BotsListResponse = BotResponseList; - -// @public -export interface BotsUpdateOptionalParams extends coreClient.OperationOptions { +export interface HealthBotProperties { + readonly botManagementPortalLink?: string; + keyVaultProperties?: KeyVaultProperties; + readonly provisioningState?: string; } // @public -export type BotsUpdateResponse = HealthBot; +export interface HealthBotsCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} // @public -export interface ErrorAdditionalInfo { - readonly info?: Record; - readonly type?: string; +export interface HealthBotsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface ErrorError { - readonly additionalInfo?: ErrorAdditionalInfo[]; - readonly code?: string; - readonly details?: ErrorModel[]; - readonly message?: string; - readonly target?: string; +export interface HealthBotsGetOptionalParams extends OperationOptions { } // @public -export interface ErrorModel { - error?: ErrorError; +export interface HealthBotsListByResourceGroupOptionalParams extends OperationOptions { } // @public -export function getContinuationToken(page: unknown): string | undefined; +export interface HealthBotsListOptionalParams extends OperationOptions { +} // @public -export interface HealthBot extends TrackedResource { - identity?: Identity; - properties?: HealthBotProperties; - sku: Sku; +export interface HealthBotsListSecretsOptionalParams extends OperationOptions { } -// @public (undocumented) -export class HealthbotClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: HealthbotClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - bots: Bots; - // (undocumented) - operations: Operations; - // (undocumented) - subscriptionId: string; +// @public +export interface HealthBotsOperations { + create: (resourceGroupName: string, botName: string, parameters: HealthBot, options?: HealthBotsCreateOptionalParams) => PollerLike, HealthBot>; + delete: (resourceGroupName: string, botName: string, options?: HealthBotsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, botName: string, options?: HealthBotsGetOptionalParams) => Promise; + list: (options?: HealthBotsListOptionalParams) => PagedAsyncIterableIterator; + listByResourceGroup: (resourceGroupName: string, options?: HealthBotsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listSecrets: (resourceGroupName: string, botName: string, options?: HealthBotsListSecretsOptionalParams) => Promise; + regenerateApiJwtSecret: (resourceGroupName: string, botName: string, options?: HealthBotsRegenerateApiJwtSecretOptionalParams) => Promise; + update: (resourceGroupName: string, botName: string, parameters: HealthBotUpdateParameters, options?: HealthBotsUpdateOptionalParams) => PollerLike, void>; } // @public -export interface HealthbotClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; - apiVersion?: string; - endpoint?: string; +export interface HealthBotsRegenerateApiJwtSecretOptionalParams extends OperationOptions { } // @public -export interface HealthBotProperties { - readonly botManagementPortalLink?: string; - readonly provisioningState?: string; +export interface HealthBotsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public @@ -154,10 +131,9 @@ export interface HealthBotUpdateParameters { identity?: Identity; // (undocumented) location?: string; + properties?: HealthBotProperties; sku?: Sku; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public @@ -165,29 +141,37 @@ export interface Identity { readonly principalId?: string; readonly tenantId?: string; type?: ResourceIdentityType; - userAssignedIdentities?: { - [propertyName: string]: UserAssignedIdentity; - }; + userAssignedIdentities?: UserAssignedIdentityMap; } // @public -export type IdentityType = string; +export interface KeyVaultProperties { + keyName: string; + keyVaultUri: string; + keyVersion?: string; + userIdentity?: string; +} // @public -export enum KnownIdentityType { +export enum KnownCreatedByType { Application = "Application", Key = "Key", ManagedIdentity = "ManagedIdentity", User = "User" } +// @public +export enum KnownVersions { + V20240201 = "2024-02-01" +} + // @public export interface OperationDetail { display?: OperationDisplay; isDataAction?: boolean; name?: string; origin?: string; - properties?: Record; + properties?: Record; } // @public @@ -199,23 +183,25 @@ export interface OperationDisplay { } // @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export type OperationsListNextResponse = AvailableOperations; - -// @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } // @public -export type OperationsListResponse = AvailableOperations; +export interface PageSettings { + continuationToken?: string; +} // @public export interface Resource { @@ -228,30 +214,38 @@ export interface Resource { // @public export type ResourceIdentityType = "SystemAssigned" | "UserAssigned" | "SystemAssigned, UserAssigned" | "None"; +// @public +export function restorePoller(client: HealthBotClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + // @public export interface Sku { name: SkuName; } // @public -export type SkuName = "F0" | "S1" | "C0"; +export type SkuName = "F0" | "S1" | "C0" | "PES" | "C1"; // @public export interface SystemData { createdAt?: Date; createdBy?: string; - createdByType?: IdentityType; + createdByType?: CreatedByType; lastModifiedAt?: Date; lastModifiedBy?: string; - lastModifiedByType?: IdentityType; + lastModifiedByType?: CreatedByType; } // @public export interface TrackedResource extends Resource { location: string; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public @@ -261,8 +255,8 @@ export interface UserAssignedIdentity { } // @public -export interface ValidationResult { - status?: string; +export interface UserAssignedIdentityMap { + additionalProperties?: Record; } // (No @packageDocumentation comment for this package) diff --git a/sdk/healthbot/arm-healthbot/sample.env b/sdk/healthbot/arm-healthbot/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/healthbot/arm-healthbot/sample.env +++ b/sdk/healthbot/arm-healthbot/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/healthbot/arm-healthbot/samples-dev/botsCreateSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/botsCreateSample.ts deleted file mode 100644 index a72953906fc7..000000000000 --- a/sdk/healthbot/arm-healthbot/samples-dev/botsCreateSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import type { HealthBot } from "@azure/arm-healthbot"; -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Create a new Azure Health Bot. - * - * @summary Create a new Azure Health Bot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceCreationPut.json - */ -async function botCreate(): Promise { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const parameters: HealthBot = { - identity: { - type: "SystemAssigned, UserAssigned", - userAssignedIdentities: { - "/subscriptions/subscriptionId/resourcegroups/myrg/providers/microsoftManagedidentity/userassignedidentities/myMi": - {}, - "/subscriptions/subscriptionId/resourcegroups/myrg/providers/microsoftManagedidentity/userassignedidentities/myMi2": - {}, - }, - }, - location: "East US", - sku: { name: "F0" }, - }; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.beginCreateAndWait(resourceGroupName, botName, parameters); - console.log(result); -} - -botCreate().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/botsDeleteSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/botsDeleteSample.ts deleted file mode 100644 index 4732017704fd..000000000000 --- a/sdk/healthbot/arm-healthbot/samples-dev/botsDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Delete a HealthBot. - * - * @summary Delete a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceDeletionDelete.json - */ -async function botDelete(): Promise { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.beginDeleteAndWait(resourceGroupName, botName); - console.log(result); -} - -botDelete().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/botsGetSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/botsGetSample.ts deleted file mode 100644 index 5a4d88cdf007..000000000000 --- a/sdk/healthbot/arm-healthbot/samples-dev/botsGetSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Get a HealthBot. - * - * @summary Get a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceInfoGet.json - */ -async function resourceInfoGet(): Promise { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.get(resourceGroupName, botName); - console.log(result); -} - -resourceInfoGet().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/botsListByResourceGroupSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/botsListByResourceGroupSample.ts deleted file mode 100644 index 11d7f724416c..000000000000 --- a/sdk/healthbot/arm-healthbot/samples-dev/botsListByResourceGroupSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Returns all the resources of a particular type belonging to a resource group - * - * @summary Returns all the resources of a particular type belonging to a resource group - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsByResourceGroup.json - */ -async function listBotsByResourceGroup(): Promise { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.bots.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -listBotsByResourceGroup().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/botsListSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/botsListSample.ts deleted file mode 100644 index 9e7250c1153f..000000000000 --- a/sdk/healthbot/arm-healthbot/samples-dev/botsListSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription. - * - * @summary Returns all the resources of a particular type belonging to a subscription. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsBySubscription.json - */ -async function listBotsBySubscription(): Promise { - const subscriptionId = "subscription-id"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.bots.list()) { - resArray.push(item); - } - console.log(resArray); -} - -listBotsBySubscription().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/botsUpdateSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/botsUpdateSample.ts deleted file mode 100644 index 2b9edfe3d715..000000000000 --- a/sdk/healthbot/arm-healthbot/samples-dev/botsUpdateSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import type { HealthBotUpdateParameters } from "@azure/arm-healthbot"; -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Patch a HealthBot. - * - * @summary Patch a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceUpdatePatch.json - */ -async function botUpdate(): Promise { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const parameters: HealthBotUpdateParameters = { sku: { name: "F0" } }; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.update(resourceGroupName, botName, parameters); - console.log(result); -} - -botUpdate().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/healthBotsCreateSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsCreateSample.ts new file mode 100644 index 000000000000..dd17db360940 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsCreateSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a new Azure Health Bot. + * + * @summary create a new Azure Health Bot. + * x-ms-original-file: 2024-02-01/ResourceCreationPut.json + */ +async function botCreate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new HealthBotClient(credential, subscriptionId); + const result = await client.healthBots.create("healthbotClient", "samplebotname"); + console.log(result); +} + +async function main(): Promise { + await botCreate(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/healthBotsDeleteSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsDeleteSample.ts new file mode 100644 index 000000000000..05deee6ff523 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a HealthBot. + * + * @summary delete a HealthBot. + * x-ms-original-file: 2024-02-01/ResourceDeletionDelete.json + */ +async function botDelete(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new HealthBotClient(credential, subscriptionId); + await client.healthBots.delete("healthbotClient", "samplebotname"); +} + +async function main(): Promise { + await botDelete(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/healthBotsGetSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsGetSample.ts new file mode 100644 index 000000000000..fa2ca83d34f2 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a HealthBot. + * + * @summary get a HealthBot. + * x-ms-original-file: 2024-02-01/ResourceInfoGet.json + */ +async function resourceInfoGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new HealthBotClient(credential, subscriptionId); + const result = await client.healthBots.get("healthbotClient", "samplebotname"); + console.log(result); +} + +async function main(): Promise { + await resourceInfoGet(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListByResourceGroupSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListByResourceGroupSample.ts new file mode 100644 index 000000000000..6b10d0185ed5 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to returns all the resources of a particular type belonging to a resource group + * + * @summary returns all the resources of a particular type belonging to a resource group + * x-ms-original-file: 2024-02-01/ListBotsByResourceGroup.json + */ +async function listBotsByResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subscription-id"; + const client = new HealthBotClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.healthBots.listByResourceGroup("OneResourceGroupName")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listBotsByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListSample.ts new file mode 100644 index 000000000000..e8bf94b04167 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to returns all the resources of a particular type belonging to a subscription. + * + * @summary returns all the resources of a particular type belonging to a subscription. + * x-ms-original-file: 2024-02-01/ListBotsBySubscription.json + */ +async function listBotsBySubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subscription-id"; + const client = new HealthBotClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.healthBots.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listBotsBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListSecretsSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListSecretsSample.ts new file mode 100644 index 000000000000..7633a1b8a9cc --- /dev/null +++ b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsListSecretsSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list all secrets of a HealthBot. + * + * @summary list all secrets of a HealthBot. + * x-ms-original-file: 2024-02-01/ListSecrets.json + */ +async function botListSecrets(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new HealthBotClient(credential, subscriptionId); + const result = await client.healthBots.listSecrets("healthbotClient", "samplebotname"); + console.log(result); +} + +async function main(): Promise { + await botListSecrets(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/healthBotsRegenerateApiJwtSecretSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsRegenerateApiJwtSecretSample.ts new file mode 100644 index 000000000000..3f1fb60e9aee --- /dev/null +++ b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsRegenerateApiJwtSecretSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to regenerate the API JWT Secret of a HealthBot. + * + * @summary regenerate the API JWT Secret of a HealthBot. + * x-ms-original-file: 2024-02-01/RegenerateApiJwtSecret.json + */ +async function botRegenerateAPIJWTSecret(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new HealthBotClient(credential, subscriptionId); + const result = await client.healthBots.regenerateApiJwtSecret("healthbotClient", "samplebotname"); + console.log(result); +} + +async function main(): Promise { + await botRegenerateAPIJWTSecret(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/healthBotsUpdateSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsUpdateSample.ts new file mode 100644 index 000000000000..4adbfc842a2a --- /dev/null +++ b/sdk/healthbot/arm-healthbot/samples-dev/healthBotsUpdateSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to patch a HealthBot. + * + * @summary patch a HealthBot. + * x-ms-original-file: 2024-02-01/ResourceUpdatePatch.json + */ +async function botUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new HealthBotClient(credential, subscriptionId); + await client.healthBots.update("healthbotClient", "samplebotname"); +} + +async function main(): Promise { + await botUpdate(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples-dev/operationsListSample.ts b/sdk/healthbot/arm-healthbot/samples-dev/operationsListSample.ts index 2ab9db5b5cf3..85c1bee5b99f 100644 --- a/sdk/healthbot/arm-healthbot/samples-dev/operationsListSample.ts +++ b/sdk/healthbot/arm-healthbot/samples-dev/operationsListSample.ts @@ -1,28 +1,29 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { HealthbotClient } from "@azure/arm-healthbot"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "@azure/arm-healthbot"; import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Lists all the available Azure Health Bot operations. + * This sample demonstrates how to lists all the available Azure Health Bot operations. * - * @summary Lists all the available Azure Health Bot operations. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/GetOperations.json + * @summary lists all the available Azure Health Bot operations. + * x-ms-original-file: 2024-02-01/GetOperations.json */ async function getOperations(): Promise { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new HealthBotClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } -getOperations().catch(console.error); +async function main(): Promise { + await getOperations(); +} + +main().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/README.md b/sdk/healthbot/arm-healthbot/samples/v2/javascript/README.md deleted file mode 100644 index dca08a83a260..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [botsCreateSample.js][botscreatesample] | Create a new Azure Health Bot. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceCreationPut.json | -| [botsDeleteSample.js][botsdeletesample] | Delete a HealthBot. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceDeletionDelete.json | -| [botsGetSample.js][botsgetsample] | Get a HealthBot. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceInfoGet.json | -| [botsListByResourceGroupSample.js][botslistbyresourcegroupsample] | Returns all the resources of a particular type belonging to a resource group x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsByResourceGroup.json | -| [botsListSample.js][botslistsample] | Returns all the resources of a particular type belonging to a subscription. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsBySubscription.json | -| [botsUpdateSample.js][botsupdatesample] | Patch a HealthBot. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceUpdatePatch.json | -| [operationsListSample.js][operationslistsample] | Lists all the available Azure Health Bot operations. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/GetOperations.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node botsCreateSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env node botsCreateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[botscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsCreateSample.js -[botsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsDeleteSample.js -[botsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsGetSample.js -[botslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsListByResourceGroupSample.js -[botslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsListSample.js -[botsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsUpdateSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/javascript/operationsListSample.js -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-healthbot?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot/README.md diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsCreateSample.js b/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsCreateSample.js deleted file mode 100644 index 66115bfba317..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsCreateSample.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { HealthbotClient } = require("@azure/arm-healthbot"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Create a new Azure Health Bot. - * - * @summary Create a new Azure Health Bot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceCreationPut.json - */ -async function botCreate() { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const parameters = { - identity: { - type: "SystemAssigned, UserAssigned", - userAssignedIdentities: { - "/subscriptions/subscriptionId/resourcegroups/myrg/providers/microsoftManagedidentity/userassignedidentities/myMi": - {}, - "/subscriptions/subscriptionId/resourcegroups/myrg/providers/microsoftManagedidentity/userassignedidentities/myMi2": - {}, - }, - }, - location: "East US", - sku: { name: "F0" }, - }; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.beginCreateAndWait(resourceGroupName, botName, parameters); - console.log(result); -} - -botCreate().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsDeleteSample.js b/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsDeleteSample.js deleted file mode 100644 index 6056c3f3753b..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsDeleteSample.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { HealthbotClient } = require("@azure/arm-healthbot"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Delete a HealthBot. - * - * @summary Delete a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceDeletionDelete.json - */ -async function botDelete() { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.beginDeleteAndWait(resourceGroupName, botName); - console.log(result); -} - -botDelete().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsGetSample.js b/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsGetSample.js deleted file mode 100644 index f71faef1524b..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsGetSample.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { HealthbotClient } = require("@azure/arm-healthbot"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Get a HealthBot. - * - * @summary Get a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceInfoGet.json - */ -async function resourceInfoGet() { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.get(resourceGroupName, botName); - console.log(result); -} - -resourceInfoGet().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsListByResourceGroupSample.js b/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsListByResourceGroupSample.js deleted file mode 100644 index a21f6a6c3ba5..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsListByResourceGroupSample.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { HealthbotClient } = require("@azure/arm-healthbot"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Returns all the resources of a particular type belonging to a resource group - * - * @summary Returns all the resources of a particular type belonging to a resource group - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsByResourceGroup.json - */ -async function listBotsByResourceGroup() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.bots.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -listBotsByResourceGroup().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsListSample.js b/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsListSample.js deleted file mode 100644 index 282035affb6a..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsListSample.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { HealthbotClient } = require("@azure/arm-healthbot"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription. - * - * @summary Returns all the resources of a particular type belonging to a subscription. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsBySubscription.json - */ -async function listBotsBySubscription() { - const subscriptionId = "subscription-id"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.bots.list()) { - resArray.push(item); - } - console.log(resArray); -} - -listBotsBySubscription().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsUpdateSample.js b/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsUpdateSample.js deleted file mode 100644 index 0f4165558e44..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/botsUpdateSample.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { HealthbotClient } = require("@azure/arm-healthbot"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Patch a HealthBot. - * - * @summary Patch a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceUpdatePatch.json - */ -async function botUpdate() { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const parameters = { sku: { name: "F0" } }; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.update(resourceGroupName, botName, parameters); - console.log(result); -} - -botUpdate().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/operationsListSample.js b/sdk/healthbot/arm-healthbot/samples/v2/javascript/operationsListSample.js deleted file mode 100644 index d6b92a6aa95f..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/operationsListSample.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { HealthbotClient } = require("@azure/arm-healthbot"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Lists all the available Azure Health Bot operations. - * - * @summary Lists all the available Azure Health Bot operations. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/GetOperations.json - */ -async function getOperations() { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -getOperations().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/package.json b/sdk/healthbot/arm-healthbot/samples/v2/javascript/package.json deleted file mode 100644 index d249b3a1a4f2..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@azure-samples/arm-healthbot-js", - "private": true, - "version": "1.0.0", - "description": " client library samples for JavaScript", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/healthbot/arm-healthbot" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot", - "dependencies": { - "@azure/arm-healthbot": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - } -} diff --git a/sdk/healthbot/arm-healthbot/samples/v2/javascript/sample.env b/sdk/healthbot/arm-healthbot/samples/v2/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/README.md b/sdk/healthbot/arm-healthbot/samples/v2/typescript/README.md deleted file mode 100644 index d6863ee04d37..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [botsCreateSample.ts][botscreatesample] | Create a new Azure Health Bot. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceCreationPut.json | -| [botsDeleteSample.ts][botsdeletesample] | Delete a HealthBot. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceDeletionDelete.json | -| [botsGetSample.ts][botsgetsample] | Get a HealthBot. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceInfoGet.json | -| [botsListByResourceGroupSample.ts][botslistbyresourcegroupsample] | Returns all the resources of a particular type belonging to a resource group x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsByResourceGroup.json | -| [botsListSample.ts][botslistsample] | Returns all the resources of a particular type belonging to a subscription. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsBySubscription.json | -| [botsUpdateSample.ts][botsupdatesample] | Patch a HealthBot. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceUpdatePatch.json | -| [operationsListSample.ts][operationslistsample] | Lists all the available Azure Health Bot operations. x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/GetOperations.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/botsCreateSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env node dist/botsCreateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[botscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsCreateSample.ts -[botsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsDeleteSample.ts -[botsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsGetSample.ts -[botslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsListByResourceGroupSample.ts -[botslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsListSample.ts -[botsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsUpdateSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/operationsListSample.ts -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-healthbot?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/package.json b/sdk/healthbot/arm-healthbot/samples/v2/typescript/package.json deleted file mode 100644 index 290adbdb3900..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@azure-samples/arm-healthbot-ts", - "private": true, - "version": "1.0.0", - "description": " client library samples for TypeScript", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/healthbot/arm-healthbot" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthbot/arm-healthbot", - "dependencies": { - "@azure/arm-healthbot": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" - } -} diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/sample.env b/sdk/healthbot/arm-healthbot/samples/v2/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsCreateSample.ts b/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsCreateSample.ts deleted file mode 100644 index d9dca4fafd8c..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsCreateSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { HealthBot, HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Create a new Azure Health Bot. - * - * @summary Create a new Azure Health Bot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceCreationPut.json - */ -async function botCreate(): Promise { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const parameters: HealthBot = { - identity: { - type: "SystemAssigned, UserAssigned", - userAssignedIdentities: { - "/subscriptions/subscriptionId/resourcegroups/myrg/providers/microsoftManagedidentity/userassignedidentities/myMi": {}, - "/subscriptions/subscriptionId/resourcegroups/myrg/providers/microsoftManagedidentity/userassignedidentities/myMi2": {} - } - }, - location: "East US", - sku: { name: "F0" } - }; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.beginCreateAndWait( - resourceGroupName, - botName, - parameters - ); - console.log(result); -} - -botCreate().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsDeleteSample.ts b/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsDeleteSample.ts deleted file mode 100644 index 61db1af1425a..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsDeleteSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Delete a HealthBot. - * - * @summary Delete a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceDeletionDelete.json - */ -async function botDelete(): Promise { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.beginDeleteAndWait( - resourceGroupName, - botName - ); - console.log(result); -} - -botDelete().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsGetSample.ts b/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsGetSample.ts deleted file mode 100644 index 48729ea34fa8..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsGetSample.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Get a HealthBot. - * - * @summary Get a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceInfoGet.json - */ -async function resourceInfoGet(): Promise { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.get(resourceGroupName, botName); - console.log(result); -} - -resourceInfoGet().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsListByResourceGroupSample.ts b/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsListByResourceGroupSample.ts deleted file mode 100644 index ec960a239d9b..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsListByResourceGroupSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Returns all the resources of a particular type belonging to a resource group - * - * @summary Returns all the resources of a particular type belonging to a resource group - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsByResourceGroup.json - */ -async function listBotsByResourceGroup(): Promise { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.bots.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -listBotsByResourceGroup().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsListSample.ts b/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsListSample.ts deleted file mode 100644 index d98647ba981c..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsListSample.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Returns all the resources of a particular type belonging to a subscription. - * - * @summary Returns all the resources of a particular type belonging to a subscription. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsBySubscription.json - */ -async function listBotsBySubscription(): Promise { - const subscriptionId = "subscription-id"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.bots.list()) { - resArray.push(item); - } - console.log(resArray); -} - -listBotsBySubscription().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsUpdateSample.ts b/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsUpdateSample.ts deleted file mode 100644 index c8be2d7548fc..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/botsUpdateSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - HealthBotUpdateParameters, - HealthbotClient -} from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Patch a HealthBot. - * - * @summary Patch a HealthBot. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceUpdatePatch.json - */ -async function botUpdate(): Promise { - const subscriptionId = "subid"; - const resourceGroupName = "healthbotClient"; - const botName = "samplebotname"; - const parameters: HealthBotUpdateParameters = { sku: { name: "F0" } }; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const result = await client.bots.update( - resourceGroupName, - botName, - parameters - ); - console.log(result); -} - -botUpdate().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/operationsListSample.ts b/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/operationsListSample.ts deleted file mode 100644 index 651e0b8017c2..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { HealthbotClient } from "@azure/arm-healthbot"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Lists all the available Azure Health Bot operations. - * - * @summary Lists all the available Azure Health Bot operations. - * x-ms-original-file: specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/GetOperations.json - */ -async function getOperations(): Promise { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new HealthbotClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -getOperations().catch(console.error); diff --git a/sdk/healthbot/arm-healthbot/samples/v2/typescript/tsconfig.json b/sdk/healthbot/arm-healthbot/samples/v2/typescript/tsconfig.json deleted file mode 100644 index ad5ff9a19d36..000000000000 --- a/sdk/healthbot/arm-healthbot/samples/v2/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2018", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/healthbot/arm-healthbot/src/api/healthBotContext.ts b/sdk/healthbot/arm-healthbot/src/api/healthBotContext.ts new file mode 100644 index 000000000000..a1ea41135bdc --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/api/healthBotContext.ts @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +/** Azure Health Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. */ +export interface HealthBotContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; +} + +/** Optional parameters for the client. */ +export interface HealthBotClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Azure Health Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. */ +export function createHealthBot( + credential: TokenCredential, + subscriptionId: string, + options: HealthBotClientOptionalParams = {}, +): HealthBotContext { + const endpointUrl = options.endpoint ?? options.baseUrl ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-healthbot/3.0.0`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2024-02-01"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return { ...clientContext, apiVersion, subscriptionId } as HealthBotContext; +} diff --git a/sdk/healthbot/arm-healthbot/src/api/healthBots/index.ts b/sdk/healthbot/arm-healthbot/src/api/healthBots/index.ts new file mode 100644 index 000000000000..0003b3774880 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/api/healthBots/index.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + regenerateApiJwtSecret, + listSecrets, + list, + listByResourceGroup, + $delete, + update, + create, + get, +} from "./operations.js"; +export { + HealthBotsRegenerateApiJwtSecretOptionalParams, + HealthBotsListSecretsOptionalParams, + HealthBotsListOptionalParams, + HealthBotsListByResourceGroupOptionalParams, + HealthBotsDeleteOptionalParams, + HealthBotsUpdateOptionalParams, + HealthBotsCreateOptionalParams, + HealthBotsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/healthbot/arm-healthbot/src/api/healthBots/operations.ts b/sdk/healthbot/arm-healthbot/src/api/healthBots/operations.ts new file mode 100644 index 000000000000..50535c1dea67 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/api/healthBots/operations.ts @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotContext as Client } from "../index.js"; +import { + errorDeserializer, + HealthBot, + healthBotSerializer, + healthBotDeserializer, + HealthBotUpdateParameters, + healthBotUpdateParametersSerializer, + _BotResponseList, + _botResponseListDeserializer, + HealthBotKeysResponse, + healthBotKeysResponseDeserializer, + HealthBotKey, + healthBotKeyDeserializer, +} from "../../models/models.js"; +import { + HealthBotsRegenerateApiJwtSecretOptionalParams, + HealthBotsListSecretsOptionalParams, + HealthBotsListOptionalParams, + HealthBotsListByResourceGroupOptionalParams, + HealthBotsDeleteOptionalParams, + HealthBotsUpdateOptionalParams, + HealthBotsCreateOptionalParams, + HealthBotsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _regenerateApiJwtSecretSend( + context: Client, + resourceGroupName: string, + botName: string, + options: HealthBotsRegenerateApiJwtSecretOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}/regenerateApiJwtSecret{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + botName: botName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _regenerateApiJwtSecretDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return healthBotKeyDeserializer(result.body); +} + +/** Regenerate the API JWT Secret of a HealthBot. */ +export async function regenerateApiJwtSecret( + context: Client, + resourceGroupName: string, + botName: string, + options: HealthBotsRegenerateApiJwtSecretOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _regenerateApiJwtSecretSend(context, resourceGroupName, botName, options); + return _regenerateApiJwtSecretDeserialize(result); +} + +export function _listSecretsSend( + context: Client, + resourceGroupName: string, + botName: string, + options: HealthBotsListSecretsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}/listSecrets{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + botName: botName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listSecretsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return healthBotKeysResponseDeserializer(result.body); +} + +/** List all secrets of a HealthBot. */ +export async function listSecrets( + context: Client, + resourceGroupName: string, + botName: string, + options: HealthBotsListSecretsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSecretsSend(context, resourceGroupName, botName, options); + return _listSecretsDeserialize(result); +} + +export function _listSend( + context: Client, + options: HealthBotsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize(result: PathUncheckedResponse): Promise<_BotResponseList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return _botResponseListDeserializer(result.body); +} + +/** Returns all the resources of a particular type belonging to a subscription. */ +export function list( + context: Client, + options: HealthBotsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: HealthBotsListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_BotResponseList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return _botResponseListDeserializer(result.body); +} + +/** Returns all the resources of a particular type belonging to a resource group */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: HealthBotsListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + botName: string, + options: HealthBotsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + botName: botName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a HealthBot. */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + botName: string, + options: HealthBotsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _$deleteSend(context, resourceGroupName, botName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + botName: string, + parameters: HealthBotUpdateParameters, + options: HealthBotsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + botName: botName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: healthBotUpdateParametersSerializer(parameters), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return; +} + +/** Patch a HealthBot. */ +export function update( + context: Client, + resourceGroupName: string, + botName: string, + parameters: HealthBotUpdateParameters, + options: HealthBotsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _updateSend(context, resourceGroupName, botName, parameters, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + botName: string, + parameters: HealthBot, + options: HealthBotsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + botName: botName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: healthBotSerializer(parameters), + }); +} + +export async function _createDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return healthBotDeserializer(result.body); +} + +/** Create a new Azure Health Bot. */ +export function create( + context: Client, + resourceGroupName: string, + botName: string, + parameters: HealthBot, + options: HealthBotsCreateOptionalParams = { requestOptions: {} }, +): PollerLike, HealthBot> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _createSend(context, resourceGroupName, botName, parameters, options), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, HealthBot>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + botName: string, + options: HealthBotsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + botName: botName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return healthBotDeserializer(result.body); +} + +/** Get a HealthBot. */ +export async function get( + context: Client, + resourceGroupName: string, + botName: string, + options: HealthBotsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, botName, options); + return _getDeserialize(result); +} diff --git a/sdk/healthbot/arm-healthbot/src/api/healthBots/options.ts b/sdk/healthbot/arm-healthbot/src/api/healthBots/options.ts new file mode 100644 index 000000000000..933ad9e9f2c6 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/api/healthBots/options.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface HealthBotsRegenerateApiJwtSecretOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface HealthBotsListSecretsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface HealthBotsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface HealthBotsListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface HealthBotsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface HealthBotsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface HealthBotsCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface HealthBotsGetOptionalParams extends OperationOptions {} diff --git a/sdk/healthbot/arm-healthbot/src/api/index.ts b/sdk/healthbot/arm-healthbot/src/api/index.ts new file mode 100644 index 000000000000..0558259a0a8a --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createHealthBot, + HealthBotContext, + HealthBotClientOptionalParams, +} from "./healthBotContext.js"; diff --git a/sdk/healthbot/arm-healthbot/src/api/operations/index.ts b/sdk/healthbot/arm-healthbot/src/api/operations/index.ts new file mode 100644 index 000000000000..24a804d14fcf --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/healthbot/arm-healthbot/src/api/operations/operations.ts b/sdk/healthbot/arm-healthbot/src/api/operations/operations.ts new file mode 100644 index 000000000000..d4f7c64c6de2 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/api/operations/operations.ts @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotContext as Client } from "../index.js"; +import { + _AvailableOperations, + _availableOperationsDeserializer, + OperationDetail, + errorDeserializer, +} from "../../models/models.js"; +import { OperationsListOptionalParams } from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.HealthBot/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_AvailableOperations> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorDeserializer(result.body); + throw error; + } + + return _availableOperationsDeserializer(result.body); +} + +/** Lists all the available Azure Health Bot operations. */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/healthbot/arm-healthbot/src/api/operations/options.ts b/sdk/healthbot/arm-healthbot/src/api/operations/options.ts new file mode 100644 index 000000000000..c461016ad1c5 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/healthbot/arm-healthbot/src/classic/healthBots/index.ts b/sdk/healthbot/arm-healthbot/src/classic/healthBots/index.ts new file mode 100644 index 000000000000..bc101dfa6041 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/classic/healthBots/index.ts @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotContext } from "../../api/healthBotContext.js"; +import { + HealthBot, + HealthBotUpdateParameters, + HealthBotKeysResponse, + HealthBotKey, +} from "../../models/models.js"; +import { + HealthBotsRegenerateApiJwtSecretOptionalParams, + HealthBotsListSecretsOptionalParams, + HealthBotsListOptionalParams, + HealthBotsListByResourceGroupOptionalParams, + HealthBotsDeleteOptionalParams, + HealthBotsUpdateOptionalParams, + HealthBotsCreateOptionalParams, + HealthBotsGetOptionalParams, +} from "../../api/healthBots/options.js"; +import { + regenerateApiJwtSecret, + listSecrets, + list, + listByResourceGroup, + $delete, + update, + create, + get, +} from "../../api/healthBots/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a HealthBots operations. */ +export interface HealthBotsOperations { + /** Regenerate the API JWT Secret of a HealthBot. */ + regenerateApiJwtSecret: ( + resourceGroupName: string, + botName: string, + options?: HealthBotsRegenerateApiJwtSecretOptionalParams, + ) => Promise; + /** List all secrets of a HealthBot. */ + listSecrets: ( + resourceGroupName: string, + botName: string, + options?: HealthBotsListSecretsOptionalParams, + ) => Promise; + /** Returns all the resources of a particular type belonging to a subscription. */ + list: (options?: HealthBotsListOptionalParams) => PagedAsyncIterableIterator; + /** Returns all the resources of a particular type belonging to a resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: HealthBotsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a HealthBot. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + botName: string, + options?: HealthBotsDeleteOptionalParams, + ) => PollerLike, void>; + /** Patch a HealthBot. */ + update: ( + resourceGroupName: string, + botName: string, + parameters: HealthBotUpdateParameters, + options?: HealthBotsUpdateOptionalParams, + ) => PollerLike, void>; + /** Create a new Azure Health Bot. */ + create: ( + resourceGroupName: string, + botName: string, + parameters: HealthBot, + options?: HealthBotsCreateOptionalParams, + ) => PollerLike, HealthBot>; + /** Get a HealthBot. */ + get: ( + resourceGroupName: string, + botName: string, + options?: HealthBotsGetOptionalParams, + ) => Promise; +} + +function _getHealthBots(context: HealthBotContext) { + return { + regenerateApiJwtSecret: ( + resourceGroupName: string, + botName: string, + options?: HealthBotsRegenerateApiJwtSecretOptionalParams, + ) => regenerateApiJwtSecret(context, resourceGroupName, botName, options), + listSecrets: ( + resourceGroupName: string, + botName: string, + options?: HealthBotsListSecretsOptionalParams, + ) => listSecrets(context, resourceGroupName, botName, options), + list: (options?: HealthBotsListOptionalParams) => list(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: HealthBotsListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + botName: string, + options?: HealthBotsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, botName, options), + update: ( + resourceGroupName: string, + botName: string, + parameters: HealthBotUpdateParameters, + options?: HealthBotsUpdateOptionalParams, + ) => update(context, resourceGroupName, botName, parameters, options), + create: ( + resourceGroupName: string, + botName: string, + parameters: HealthBot, + options?: HealthBotsCreateOptionalParams, + ) => create(context, resourceGroupName, botName, parameters, options), + get: (resourceGroupName: string, botName: string, options?: HealthBotsGetOptionalParams) => + get(context, resourceGroupName, botName, options), + }; +} + +export function _getHealthBotsOperations(context: HealthBotContext): HealthBotsOperations { + return { + ..._getHealthBots(context), + }; +} diff --git a/sdk/healthbot/arm-healthbot/src/classic/index.ts b/sdk/healthbot/arm-healthbot/src/classic/index.ts new file mode 100644 index 000000000000..47161ad17c39 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/classic/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { HealthBotsOperations } from "./healthBots/index.js"; +export { OperationsOperations } from "./operations/index.js"; diff --git a/sdk/healthbot/arm-healthbot/src/classic/operations/index.ts b/sdk/healthbot/arm-healthbot/src/classic/operations/index.ts new file mode 100644 index 000000000000..c82fd751483b --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/classic/operations/index.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotContext } from "../../api/healthBotContext.js"; +import { OperationDetail } from "../../models/models.js"; +import { OperationsListOptionalParams } from "../../api/operations/options.js"; +import { list } from "../../api/operations/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** Lists all the available Azure Health Bot operations. */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +function _getOperations(context: HealthBotContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations(context: HealthBotContext): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/healthbot/arm-healthbot/src/healthBotClient.ts b/sdk/healthbot/arm-healthbot/src/healthBotClient.ts new file mode 100644 index 000000000000..4d228cd9e01e --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/healthBotClient.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createHealthBot, HealthBotContext, HealthBotClientOptionalParams } from "./api/index.js"; +import { HealthBotsOperations, _getHealthBotsOperations } from "./classic/healthBots/index.js"; +import { OperationsOperations, _getOperationsOperations } from "./classic/operations/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; + +export { HealthBotClientOptionalParams } from "./api/healthBotContext.js"; + +export class HealthBotClient { + private _client: HealthBotContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** Azure Health Bot is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. */ + constructor( + credential: TokenCredential, + subscriptionId: string, + options: HealthBotClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createHealthBot(credential, subscriptionId, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.healthBots = _getHealthBotsOperations(this._client); + this.operations = _getOperationsOperations(this._client); + } + + /** The operation groups for healthBots */ + public readonly healthBots: HealthBotsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; +} diff --git a/sdk/healthbot/arm-healthbot/src/healthbotClient.ts b/sdk/healthbot/arm-healthbot/src/healthbotClient.ts deleted file mode 100644 index 745e05eb7d38..000000000000 --- a/sdk/healthbot/arm-healthbot/src/healthbotClient.ts +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; -import { - PipelineRequest, - PipelineResponse, - SendRequest -} from "@azure/core-rest-pipeline"; -import * as coreAuth from "@azure/core-auth"; -import { BotsImpl, OperationsImpl } from "./operations/index.js"; -import { Bots, Operations } from "./operationsInterfaces/index.js"; -import { HealthbotClientOptionalParams } from "./models/index.js"; - -export class HealthbotClient extends coreClient.ServiceClient { - $host: string; - subscriptionId: string; - apiVersion: string; - - /** - * Initializes a new instance of the HealthbotClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId Azure Subscription ID. - * @param options The parameter options - */ - constructor( - credentials: coreAuth.TokenCredential, - subscriptionId: string, - options?: HealthbotClientOptionalParams - ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } - if (subscriptionId === undefined) { - throw new Error("'subscriptionId' cannot be null"); - } - - // Initializing default values for options - if (!options) { - options = {}; - } - const defaults: HealthbotClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials - }; - - const packageDetails = `azsdk-js-arm-healthbot/2.1.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, - ...options, - userAgentOptions: { - userAgentPrefix - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com" - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); - } - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-06-10"; - this.bots = new BotsImpl(this); - this.operations = new OperationsImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest( - request: PipelineRequest, - next: SendRequest - ): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - } - }; - this.pipeline.addPolicy(apiVersionPolicy); - } - - bots: Bots; - operations: Operations; -} diff --git a/sdk/healthbot/arm-healthbot/src/index.ts b/sdk/healthbot/arm-healthbot/src/index.ts index 26f96ab74c17..5c10e52e32ae 100644 --- a/sdk/healthbot/arm-healthbot/src/index.ts +++ b/sdk/healthbot/arm-healthbot/src/index.ts @@ -1,13 +1,50 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; -export { HealthbotClient } from "./healthbotClient.js"; -export * from "./operationsInterfaces/index.js"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { HealthBotClient } from "./healthBotClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + OperationDetail, + OperationDisplay, + ErrorModel, + ErrorDetail, + ErrorAdditionalInfo, + HealthBot, + Sku, + SkuName, + Identity, + ResourceIdentityType, + UserAssignedIdentityMap, + UserAssignedIdentity, + HealthBotProperties, + KeyVaultProperties, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + HealthBotUpdateParameters, + HealthBotKeysResponse, + HealthBotKey, + KnownVersions, +} from "./models/index.js"; +export { HealthBotClientOptionalParams } from "./api/index.js"; +export { + HealthBotsRegenerateApiJwtSecretOptionalParams, + HealthBotsListSecretsOptionalParams, + HealthBotsListOptionalParams, + HealthBotsListByResourceGroupOptionalParams, + HealthBotsDeleteOptionalParams, + HealthBotsUpdateOptionalParams, + HealthBotsCreateOptionalParams, + HealthBotsGetOptionalParams, +} from "./api/healthBots/index.js"; +export { OperationsListOptionalParams } from "./api/operations/index.js"; +export { HealthBotsOperations, OperationsOperations } from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/healthbot/arm-healthbot/src/logger.ts b/sdk/healthbot/arm-healthbot/src/logger.ts new file mode 100644 index 000000000000..69ed3de410c3 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-healthbot"); diff --git a/sdk/healthbot/arm-healthbot/src/lroImpl.ts b/sdk/healthbot/arm-healthbot/src/lroImpl.ts deleted file mode 100644 index 518d5f053b4e..000000000000 --- a/sdk/healthbot/arm-healthbot/src/lroImpl.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { 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" - }); - } -} diff --git a/sdk/healthbot/arm-healthbot/src/models/index.ts b/sdk/healthbot/arm-healthbot/src/models/index.ts index 6e74933f5226..9d99a26c626c 100644 --- a/sdk/healthbot/arm-healthbot/src/models/index.ts +++ b/sdk/healthbot/arm-healthbot/src/models/index.ts @@ -1,355 +1,28 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -/** The resource model definition representing SKU */ -export interface Sku { - /** The name of the Azure Health Bot SKU */ - name: SkuName; -} - -/** Identity for the resource. */ -export interface Identity { - /** - * The principal ID of resource identity. This property will only be provided for a system assigned identity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly principalId?: string; - /** - * The tenant ID of resource. This property will only be provided for a system assigned identity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly tenantId?: string; - /** The identity type. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the Azure Health Bot */ - type?: ResourceIdentityType; - /** - * The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - * - */ - userAssignedIdentities?: { [propertyName: string]: UserAssignedIdentity }; -} - -/** The details of the user assigned managed identity used by the Video Analyzer resource. */ -export interface UserAssignedIdentity { - /** - * The principal ID of user assigned identity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly principalId?: string; - /** - * The client ID of user assigned identity. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly clientId?: string; -} - -/** The properties of a Azure Health Bot. The Health Bot Service is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. */ -export interface HealthBotProperties { - /** - * The provisioning state of the Azure Health Bot resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: string; - /** - * The link. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly botManagementPortalLink?: string; -} - -/** The resource model definition for a ARM tracked top level resource */ -export interface Resource { - /** - * Fully qualified resource Id for the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * Metadata pertaining to creation and last modification of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** Read only system data */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource */ - createdByType?: IdentityType; - /** The timestamp of resource creation (UTC) */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource */ - lastModifiedByType?: IdentityType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** The resource management error response. */ -export interface ErrorModel { - /** The error object. */ - error?: ErrorError; -} - -/** The error object. */ -export interface ErrorError { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; - /** - * The error target. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; - /** - * The error details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ErrorModel[]; - /** - * The error additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** - * The additional info type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * The additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly info?: Record; -} - -/** Parameters for updating a Azure Health Bot. */ -export interface HealthBotUpdateParameters { - /** Tags for a Azure Health Bot. */ - tags?: { [propertyName: string]: string }; - /** SKU of the Azure Health Bot. */ - sku?: Sku; - /** The identity of the Azure Health Bot. */ - identity?: Identity; - location?: string; -} - -/** The list of Azure Health Bot operation response. */ -export interface BotResponseList { - /** - * The link used to get the next page of bot service resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; - /** - * Gets the list of Azure Health Bot results and their properties. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: HealthBot[]; -} - -/** Available operations of the service */ -export interface AvailableOperations { - /** Collection of available operation details */ - value?: OperationDetail[]; - /** - * URL client should use to fetch the next page (per server side paging). - * It's null for now, added for future use. - */ - nextLink?: string; -} - -/** Operation detail payload */ -export interface OperationDetail { - /** Name of the operation */ - name?: string; - /** Indicates whether the operation is a data action */ - isDataAction?: boolean; - /** Display of the operation */ - display?: OperationDisplay; - /** Origin of the operation */ - origin?: string; - /** Additional properties. */ - properties?: Record; -} - -/** Operation display payload */ -export interface OperationDisplay { - /** Resource provider of the operation */ - provider?: string; - /** Resource of the operation */ - resource?: string; - /** Localized friendly name for the operation */ - operation?: string; - /** Localized friendly description for the operation */ - description?: string; -} - -/** The response returned from validation process */ -export interface ValidationResult { - /** The status code of the response validation. */ - status?: string; -} - -/** The resource model definition for a ARM tracked top level resource */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The geo-location where the resource lives */ - location: string; -} - -/** Azure Health Bot resource definition */ -export interface HealthBot extends TrackedResource { - /** SKU of the Azure Health Bot. */ - sku: Sku; - /** The identity of the Azure Health Bot. */ - identity?: Identity; - /** The set of properties specific to Azure Health Bot resource. */ - properties?: HealthBotProperties; -} - -/** Known values of {@link IdentityType} that the service accepts. */ -export enum KnownIdentityType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key" -} - -/** - * Defines values for IdentityType. \ - * {@link KnownIdentityType} can be used interchangeably with IdentityType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type IdentityType = string; -/** Defines values for SkuName. */ -export type SkuName = "F0" | "S1" | "C0"; -/** Defines values for ResourceIdentityType. */ -export type ResourceIdentityType = - | "SystemAssigned" - | "UserAssigned" - | "SystemAssigned, UserAssigned" - | "None"; - -/** Optional parameters. */ -export interface BotsCreateOptionalParams 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 create operation. */ -export type BotsCreateResponse = HealthBot; - -/** Optional parameters. */ -export interface BotsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type BotsGetResponse = HealthBot; - -/** Optional parameters. */ -export interface BotsUpdateOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the update operation. */ -export type BotsUpdateResponse = HealthBot; - -/** Optional parameters. */ -export interface BotsDeleteOptionalParams 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; -} - -/** Optional parameters. */ -export interface BotsListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type BotsListByResourceGroupResponse = BotResponseList; - -/** Optional parameters. */ -export interface BotsListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type BotsListResponse = BotResponseList; - -/** Optional parameters. */ -export interface BotsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type BotsListByResourceGroupNextResponse = BotResponseList; - -/** Optional parameters. */ -export interface BotsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type BotsListNextResponse = BotResponseList; - -/** Optional parameters. */ -export interface OperationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = AvailableOperations; - -/** Optional parameters. */ -export interface OperationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type OperationsListNextResponse = AvailableOperations; - -/** Optional parameters. */ -export interface HealthbotClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + OperationDetail, + OperationDisplay, + ErrorModel, + ErrorDetail, + ErrorAdditionalInfo, + HealthBot, + Sku, + SkuName, + Identity, + ResourceIdentityType, + UserAssignedIdentityMap, + UserAssignedIdentity, + HealthBotProperties, + KeyVaultProperties, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + HealthBotUpdateParameters, + HealthBotKeysResponse, + HealthBotKey, + KnownVersions, +} from "./models.js"; diff --git a/sdk/healthbot/arm-healthbot/src/models/mappers.ts b/sdk/healthbot/arm-healthbot/src/models/mappers.ts deleted file mode 100644 index 6e36900d1d66..000000000000 --- a/sdk/healthbot/arm-healthbot/src/models/mappers.ts +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -export const Sku: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Sku", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "Enum", - allowedValues: ["F0", "S1", "C0"] - } - } - } - } -}; - -export const Identity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Identity", - modelProperties: { - principalId: { - serializedName: "principalId", - readOnly: true, - type: { - name: "String" - } - }, - tenantId: { - serializedName: "tenantId", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "Enum", - allowedValues: [ - "SystemAssigned", - "UserAssigned", - "SystemAssigned, UserAssigned", - "None" - ] - } - }, - userAssignedIdentities: { - serializedName: "userAssignedIdentities", - type: { - name: "Dictionary", - value: { - type: { name: "Composite", className: "UserAssignedIdentity" } - } - } - } - } - } -}; - -export const UserAssignedIdentity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserAssignedIdentity", - modelProperties: { - principalId: { - serializedName: "principalId", - readOnly: true, - type: { - name: "String" - } - }, - clientId: { - serializedName: "clientId", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const HealthBotProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "HealthBotProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String" - } - }, - botManagementPortalLink: { - serializedName: "botManagementPortalLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime" - } - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String" - } - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String" - } - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime" - } - } - } - } -}; - -export const ErrorModel: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorModel", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorError" - } - } - } - } -}; - -export const ErrorError: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorError", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String" - } - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String" - } - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String" - } - }, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorModel" - } - } - } - }, - additionalInfo: { - serializedName: "additionalInfo", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo" - } - } - } - } - } - } -}; - -export const ErrorAdditionalInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - info: { - serializedName: "info", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } } - } - } - } - } -}; - -export const HealthBotUpdateParameters: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "HealthBotUpdateParameters", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "Sku" - } - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "Identity" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } - } - } - } -}; - -export const BotResponseList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BotResponseList", - modelProperties: { - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - }, - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "HealthBot" - } - } - } - } - } - } -}; - -export const AvailableOperations: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AvailableOperations", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationDetail" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const OperationDetail: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDetail", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - isDataAction: { - serializedName: "isDataAction", - type: { - name: "Boolean" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - origin: { - serializedName: "origin", - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Dictionary", - value: { type: { name: "any" } } - } - } - } - } -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - type: { - name: "String" - } - }, - description: { - serializedName: "description", - type: { - name: "String" - } - } - } - } -}; - -export const ValidationResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ValidationResult", - modelProperties: { - status: { - serializedName: "status", - type: { - name: "String" - } - } - } - } -}; - -export const TrackedResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TrackedResource", - modelProperties: { - ...Resource.type.modelProperties, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - }, - location: { - serializedName: "location", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const HealthBot: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "HealthBot", - modelProperties: { - ...TrackedResource.type.modelProperties, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "Sku" - } - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "Identity" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "HealthBotProperties" - } - } - } - } -}; diff --git a/sdk/healthbot/arm-healthbot/src/models/models.ts b/sdk/healthbot/arm-healthbot/src/models/models.ts new file mode 100644 index 000000000000..24112b4c714b --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/models/models.ts @@ -0,0 +1,546 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { serializeRecord } from "../static-helpers/serialization/serialize-record.js"; + +/** Available operations of the service. */ +export interface _AvailableOperations { + /** Collection of available operation details. */ + value: OperationDetail[]; + /** + * URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + nextLink?: string; +} + +export function _availableOperationsDeserializer(item: any): _AvailableOperations { + return { + value: operationDetailArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDetailDeserializer(item); + }); +} + +/** Operation detail payload */ +export interface OperationDetail { + /** Name of the operation */ + name?: string; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; + /** Display of the operation */ + display?: OperationDisplay; + /** Origin of the operation */ + origin?: string; + /** Additional properties. */ + properties?: Record; +} + +export function operationDetailDeserializer(item: any): OperationDetail { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + properties: !item["properties"] + ? item["properties"] + : _operationDetailPropertiesDeserializer(item["properties"]), + }; +} + +/** Localized display information for and operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** model interface _OperationDetailProperties */ +export interface _OperationDetailProperties {} + +export function _operationDetailPropertiesDeserializer(item: any): _OperationDetailProperties { + return item; +} + +/** The resource management error response. */ +export interface ErrorModel { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorDeserializer(item: any): ErrorModel { + return { + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +/** The error object detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorModel[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** Additional information about an error. */ +export interface ErrorAdditionalInfo { + /** The type of the additional error information. */ + readonly type?: string; + /** The additional error information. */ + readonly info?: Record; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: !item["info"] ? item["info"] : _errorAdditionalInfoInfoDeserializer(item["info"]), + }; +} + +/** model interface _ErrorAdditionalInfoInfo */ +export interface _ErrorAdditionalInfoInfo {} + +export function _errorAdditionalInfoInfoDeserializer(item: any): _ErrorAdditionalInfoInfo { + return item; +} + +/** Azure Health Bot resource definition */ +export interface HealthBot extends TrackedResource { + /** SKU of the Azure Health Bot. */ + sku: Sku; + /** The identity of the Azure Health Bot. */ + identity?: Identity; + /** The set of properties specific to Azure Health Bot resource. */ + properties?: HealthBotProperties; +} + +export function healthBotSerializer(item: HealthBot): any { + return { + tags: item["tags"], + location: item["location"], + sku: skuSerializer(item["sku"]), + identity: !item["identity"] ? item["identity"] : identitySerializer(item["identity"]), + properties: !item["properties"] + ? item["properties"] + : healthBotPropertiesSerializer(item["properties"]), + }; +} + +export function healthBotDeserializer(item: any): HealthBot { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + sku: skuDeserializer(item["sku"]), + identity: !item["identity"] ? item["identity"] : identityDeserializer(item["identity"]), + properties: !item["properties"] + ? item["properties"] + : healthBotPropertiesDeserializer(item["properties"]), + }; +} + +/** The resource model definition representing SKU */ +export interface Sku { + /** The name of the Azure Health Bot SKU */ + name: SkuName; +} + +export function skuSerializer(item: Sku): any { + return { name: item["name"] }; +} + +export function skuDeserializer(item: any): Sku { + return { + name: item["name"], + }; +} + +/** The name of the Azure Health Bot SKU */ +export type SkuName = "F0" | "S1" | "C0" | "PES" | "C1"; + +/** Identity for the resource. */ +export interface Identity { + /** The principal ID of resource identity. This property will only be provided for a system assigned identity. */ + readonly principalId?: string; + /** The tenant ID of resource. This property will only be provided for a system assigned identity. */ + readonly tenantId?: string; + /** The identity type. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the Azure Health Bot */ + type?: ResourceIdentityType; + /** + * The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + userAssignedIdentities?: UserAssignedIdentityMap; +} + +export function identitySerializer(item: Identity): any { + return { + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userAssignedIdentityMapSerializer(item["userAssignedIdentities"]), + }; +} + +export function identityDeserializer(item: any): Identity { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userAssignedIdentityMapDeserializer(item["userAssignedIdentities"]), + }; +} + +/** The identity type. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the Azure Health Bot */ +export type ResourceIdentityType = + | "SystemAssigned" + | "UserAssigned" + | "SystemAssigned, UserAssigned" + | "None"; + +/** model interface UserAssignedIdentityMap */ +export interface UserAssignedIdentityMap { + /** Additional properties */ + additionalProperties?: Record; +} + +export function userAssignedIdentityMapSerializer(item: UserAssignedIdentityMap): any { + return { + ...serializeRecord(item.additionalProperties, undefined, userAssignedIdentitySerializer), + }; +} + +export function userAssignedIdentityMapDeserializer(item: any): UserAssignedIdentityMap { + return { + additionalProperties: serializeRecord(item, [], userAssignedIdentityDeserializer), + }; +} + +/** Represents a user-assigned identity. */ +export interface UserAssignedIdentity { + /** The principal ID of the user-assigned identity. */ + readonly principalId?: string; + /** The client ID of the user-assigned identity. */ + readonly clientId?: string; +} + +export function userAssignedIdentitySerializer(item: UserAssignedIdentity): any { + return item; +} + +export function userAssignedIdentityDeserializer(item: any): UserAssignedIdentity { + return { + principalId: item["principalId"], + clientId: item["clientId"], + }; +} + +/** The properties of a Azure Health Bot. The Health Bot Service is a cloud platform that empowers developers in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, that help them improve processes and reduce costs. */ +export interface HealthBotProperties { + /** The provisioning state of the Azure Health Bot resource. */ + readonly provisioningState?: string; + /** The link. */ + readonly botManagementPortalLink?: string; + /** KeyVault properties for the resource encryption. */ + keyVaultProperties?: KeyVaultProperties; +} + +export function healthBotPropertiesSerializer(item: HealthBotProperties): any { + return { + keyVaultProperties: !item["keyVaultProperties"] + ? item["keyVaultProperties"] + : keyVaultPropertiesSerializer(item["keyVaultProperties"]), + }; +} + +export function healthBotPropertiesDeserializer(item: any): HealthBotProperties { + return { + provisioningState: item["provisioningState"], + botManagementPortalLink: item["botManagementPortalLink"], + keyVaultProperties: !item["keyVaultProperties"] + ? item["keyVaultProperties"] + : keyVaultPropertiesDeserializer(item["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; +} + +export function keyVaultPropertiesSerializer(item: KeyVaultProperties): any { + return { + keyName: item["keyName"], + keyVersion: item["keyVersion"], + keyVaultUri: item["keyVaultUri"], + userIdentity: item["userIdentity"], + }; +} + +export function keyVaultPropertiesDeserializer(item: any): KeyVaultProperties { + return { + keyName: item["keyName"], + keyVersion: item["keyVersion"], + keyVaultUri: item["keyVaultUri"], + userIdentity: item["userIdentity"], + }; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnowncreatedByType} can be used interchangeably with createdByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** Parameters for updating a Azure Health Bot. */ +export interface HealthBotUpdateParameters { + /** Properties of Azure Health Bot. */ + properties?: HealthBotProperties; + /** Tags for a Azure Health Bot. */ + tags?: Record; + /** SKU of the Azure Health Bot. */ + sku?: Sku; + /** The identity of the Azure Health Bot. */ + identity?: Identity; + location?: string; +} + +export function healthBotUpdateParametersSerializer(item: HealthBotUpdateParameters): any { + return { + properties: !item["properties"] + ? item["properties"] + : healthBotPropertiesSerializer(item["properties"]), + tags: item["tags"], + sku: !item["sku"] ? item["sku"] : skuSerializer(item["sku"]), + identity: !item["identity"] ? item["identity"] : identitySerializer(item["identity"]), + location: item["location"], + }; +} + +/** The list of Azure Health Bot operation response. */ +export interface _BotResponseList { + /** The HealthBot items on this page */ + readonly value: HealthBot[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _botResponseListDeserializer(item: any): _BotResponseList { + return { + value: healthBotArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function healthBotArraySerializer(result: Array): any[] { + return result.map((item) => { + return healthBotSerializer(item); + }); +} + +export function healthBotArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return healthBotDeserializer(item); + }); +} + +/** Health Bot Keys Response. */ +export interface HealthBotKeysResponse { + /** Array of Azure Health Bot Secrets. */ + secrets?: HealthBotKey[]; +} + +export function healthBotKeysResponseDeserializer(item: any): HealthBotKeysResponse { + return { + secrets: !item["secrets"] ? item["secrets"] : healthBotKeyArrayDeserializer(item["secrets"]), + }; +} + +export function healthBotKeyArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return healthBotKeyDeserializer(item); + }); +} + +/** An entry of HealthBotKeysResponse */ +export interface HealthBotKey { + /** The name of the key. */ + keyName?: string; + /** The value of the key. */ + value?: string; +} + +export function healthBotKeyDeserializer(item: any): HealthBotKey { + return { + keyName: item["keyName"], + value: item["value"], + }; +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2024-02-01 API version. */ + V20240201 = "2024-02-01", +} diff --git a/sdk/healthbot/arm-healthbot/src/models/parameters.ts b/sdk/healthbot/arm-healthbot/src/models/parameters.ts deleted file mode 100644 index c83883c968d4..000000000000 --- a/sdk/healthbot/arm-healthbot/src/models/parameters.ts +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - OperationParameter, - OperationURLParameter, - OperationQueryParameter -} from "@azure/core-client"; -import { - HealthBot as HealthBotMapper, - HealthBotUpdateParameters as HealthBotUpdateParametersMapper -} from "../models/mappers.js"; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String" - } - } -}; - -export const parameters: OperationParameter = { - parameterPath: "parameters", - mapper: HealthBotMapper -}; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String" - } - } -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - serializedName: "subscriptionId", - required: true, - type: { - name: "String" - } - } -}; - -export const resourceGroupName: OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"), - MaxLength: 64, - MinLength: 2 - }, - serializedName: "resourceGroupName", - required: true, - type: { - name: "String" - } - } -}; - -export const botName: OperationURLParameter = { - parameterPath: "botName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"), - MaxLength: 64, - MinLength: 2 - }, - serializedName: "botName", - required: true, - type: { - name: "String" - } - } -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2021-06-10", - isConstant: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; - -export const parameters1: OperationParameter = { - parameterPath: "parameters", - mapper: HealthBotUpdateParametersMapper -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; diff --git a/sdk/healthbot/arm-healthbot/src/operations/bots.ts b/sdk/healthbot/arm-healthbot/src/operations/bots.ts deleted file mode 100644 index 0c0b09613357..000000000000 --- a/sdk/healthbot/arm-healthbot/src/operations/bots.ts +++ /dev/null @@ -1,619 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Bots } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { HealthbotClient } from "../healthbotClient.js"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl.js"; -import { - HealthBot, - BotsListByResourceGroupNextOptionalParams, - BotsListByResourceGroupOptionalParams, - BotsListByResourceGroupResponse, - BotsListNextOptionalParams, - BotsListOptionalParams, - BotsListResponse, - BotsCreateOptionalParams, - BotsCreateResponse, - BotsGetOptionalParams, - BotsGetResponse, - HealthBotUpdateParameters, - BotsUpdateOptionalParams, - BotsUpdateResponse, - BotsDeleteOptionalParams, - BotsListByResourceGroupNextResponse, - BotsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing Bots operations. */ -export class BotsImpl implements Bots { - private readonly client: HealthbotClient; - - /** - * Initialize a new instance of the class Bots class. - * @param client Reference to the service client - */ - constructor(client: HealthbotClient) { - this.client = client; - } - - /** - * 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. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroupName: string, - options?: BotsListByResourceGroupOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage( - resourceGroupName, - options, - settings - ); - } - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: BotsListByResourceGroupOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: BotsListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext( - resourceGroupName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroupName: string, - options?: BotsListByResourceGroupOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroupName, - options - )) { - yield* page; - } - } - - /** - * Returns all the resources of a particular type belonging to a subscription. - * @param options The options parameters. - */ - public list( - options?: BotsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - } - }; - } - - private async *listPagingPage( - options?: BotsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: BotsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: BotsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * Create a new Azure Health Bot. - * @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 created Azure Health Bot. - * @param options The options parameters. - */ - async beginCreate( - resourceGroupName: string, - botName: string, - parameters: HealthBot, - options?: BotsCreateOptionalParams - ): Promise< - PollerLike, BotsCreateResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperation = 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 = new LroImpl( - sendOperation, - { resourceGroupName, botName, parameters, options }, - createOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - lroResourceLocationConfig: "azure-async-operation" - }); - await poller.poll(); - return poller; - } - - /** - * Create a new Azure Health Bot. - * @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 created Azure Health Bot. - * @param options The options parameters. - */ - async beginCreateAndWait( - resourceGroupName: string, - botName: string, - parameters: HealthBot, - options?: BotsCreateOptionalParams - ): Promise { - const poller = await this.beginCreate( - resourceGroupName, - botName, - parameters, - options - ); - return poller.pollUntilDone(); - } - - /** - * Get 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. - */ - get( - resourceGroupName: string, - botName: string, - options?: BotsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, botName, options }, - getOperationSpec - ); - } - - /** - * 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. - */ - update( - resourceGroupName: string, - botName: string, - parameters: HealthBotUpdateParameters, - options?: BotsUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, botName, parameters, options }, - updateOperationSpec - ); - } - - /** - * Delete 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. - */ - async beginDelete( - resourceGroupName: string, - botName: string, - options?: BotsDeleteOptionalParams - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperation = 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 = new LroImpl( - sendOperation, - { resourceGroupName, botName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs - }); - await poller.poll(); - return poller; - } - - /** - * Delete 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. - */ - async beginDeleteAndWait( - resourceGroupName: string, - botName: string, - options?: BotsDeleteOptionalParams - ): Promise { - const poller = await this.beginDelete(resourceGroupName, botName, options); - return poller.pollUntilDone(); - } - - /** - * 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. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroupName: string, - options?: BotsListByResourceGroupOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec - ); - } - - /** - * Returns all the resources of a particular type belonging to a subscription. - * @param options The options parameters. - */ - private _list(options?: BotsListOptionalParams): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListByResourceGroupNext - * @param resourceGroupName The name of the Bot resource group in the user subscription. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroupName: string, - nextLink: string, - options?: BotsListByResourceGroupNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec - ); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: BotsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.HealthBot - }, - 201: { - bodyMapper: Mappers.HealthBot - }, - 202: { - bodyMapper: Mappers.HealthBot - }, - 204: { - bodyMapper: Mappers.HealthBot - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - requestBody: Parameters.parameters, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.botName - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.HealthBot - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.botName - ], - headerParameters: [Parameters.accept], - serializer -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.HealthBot - }, - 201: { - bodyMapper: Mappers.HealthBot - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - requestBody: Parameters.parameters1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.botName - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - 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", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BotResponseList - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BotResponseList - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BotResponseList - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.nextLink - ], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BotResponseList - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/healthbot/arm-healthbot/src/operations/index.ts b/sdk/healthbot/arm-healthbot/src/operations/index.ts deleted file mode 100644 index 58a93f03f1c6..000000000000 --- a/sdk/healthbot/arm-healthbot/src/operations/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./bots.js"; -export * from "./operations.js"; diff --git a/sdk/healthbot/arm-healthbot/src/operations/operations.ts b/sdk/healthbot/arm-healthbot/src/operations/operations.ts deleted file mode 100644 index aa55aa737159..000000000000 --- a/sdk/healthbot/arm-healthbot/src/operations/operations.ts +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Operations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { HealthbotClient } from "../healthbotClient.js"; -import { - OperationDetail, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: HealthbotClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: HealthbotClient) { - this.client = client; - } - - /** - * Lists all the available Azure Health Bot operations. - * @param options The options parameters. - */ - public list( - options?: OperationsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - } - }; - } - - private async *listPagingPage( - options?: OperationsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: OperationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: OperationsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * Lists all the available Azure Health Bot operations. - * @param options The options parameters. - */ - private _list( - options?: OperationsListOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.HealthBot/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AvailableOperations - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AvailableOperations - }, - default: { - 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 deleted file mode 100644 index 41fd043293cf..000000000000 --- a/sdk/healthbot/arm-healthbot/src/operationsInterfaces/bots.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; -import { - HealthBot, - BotsListByResourceGroupOptionalParams, - BotsListOptionalParams, - BotsCreateOptionalParams, - BotsCreateResponse, - BotsGetOptionalParams, - BotsGetResponse, - HealthBotUpdateParameters, - BotsUpdateOptionalParams, - BotsUpdateResponse, - BotsDeleteOptionalParams -} from "../models/index.js"; - -/// -/** Interface representing a Bots. */ -export interface Bots { - /** - * 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. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroupName: string, - options?: BotsListByResourceGroupOptionalParams - ): PagedAsyncIterableIterator; - /** - * Returns all the resources of a particular type belonging to a subscription. - * @param options The options parameters. - */ - list(options?: BotsListOptionalParams): PagedAsyncIterableIterator; - /** - * Create a new Azure Health Bot. - * @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 created Azure Health Bot. - * @param options The options parameters. - */ - beginCreate( - resourceGroupName: string, - botName: string, - parameters: HealthBot, - options?: BotsCreateOptionalParams - ): Promise< - PollerLike, BotsCreateResponse> - >; - /** - * Create a new Azure Health Bot. - * @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 created Azure Health Bot. - * @param options The options parameters. - */ - beginCreateAndWait( - resourceGroupName: string, - botName: string, - parameters: HealthBot, - options?: BotsCreateOptionalParams - ): Promise; - /** - * Get 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. - */ - get( - resourceGroupName: string, - botName: string, - options?: BotsGetOptionalParams - ): Promise; - /** - * 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. - */ - update( - resourceGroupName: string, - botName: string, - parameters: HealthBotUpdateParameters, - options?: BotsUpdateOptionalParams - ): Promise; - /** - * Delete 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. - */ - beginDelete( - resourceGroupName: string, - botName: string, - options?: BotsDeleteOptionalParams - ): Promise, void>>; - /** - * Delete 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. - */ - beginDeleteAndWait( - resourceGroupName: string, - botName: string, - options?: BotsDeleteOptionalParams - ): Promise; -} diff --git a/sdk/healthbot/arm-healthbot/src/operationsInterfaces/index.ts b/sdk/healthbot/arm-healthbot/src/operationsInterfaces/index.ts deleted file mode 100644 index 58a93f03f1c6..000000000000 --- a/sdk/healthbot/arm-healthbot/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./bots.js"; -export * from "./operations.js"; diff --git a/sdk/healthbot/arm-healthbot/src/operationsInterfaces/operations.ts b/sdk/healthbot/arm-healthbot/src/operationsInterfaces/operations.ts deleted file mode 100644 index 83e4f54fea4c..000000000000 --- a/sdk/healthbot/arm-healthbot/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { OperationDetail, OperationsListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * Lists all the available Azure Health Bot operations. - * @param options The options parameters. - */ - list( - options?: OperationsListOptionalParams - ): PagedAsyncIterableIterator; -} diff --git a/sdk/healthbot/arm-healthbot/src/pagingHelper.ts b/sdk/healthbot/arm-healthbot/src/pagingHelper.ts deleted file mode 100644 index d85fc13bce1e..000000000000 --- a/sdk/healthbot/arm-healthbot/src/pagingHelper.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given a result page from a pageable operation, 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(). - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/healthbot/arm-healthbot/src/restorePollerHelpers.ts b/sdk/healthbot/arm-healthbot/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..c30c556d75b9 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/restorePollerHelpers.ts @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { HealthBotClient } from "./healthBotClient.js"; +import { + _$deleteDeserialize, + _updateDeserialize, + _createDeserialize, +} from "./api/healthBots/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: HealthBotClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}": + { + deserializer: _$deleteDeserialize, + expectedStatuses: ["200", "202", "204"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}": + { deserializer: _updateDeserialize, expectedStatuses: ["200", "201"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}": + { deserializer: _createDeserialize, expectedStatuses: ["200", "201"] }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/healthbot/arm-healthbot/src/static-helpers/pagingHelpers.ts b/sdk/healthbot/arm-healthbot/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..ce33af5f4178 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/healthbot/arm-healthbot/src/static-helpers/pollingHelpers.ts b/sdk/healthbot/arm-healthbot/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..f01c41bab69d --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/sdk/healthbot/arm-healthbot/src/static-helpers/serialization/serialize-record.ts b/sdk/healthbot/arm-healthbot/src/static-helpers/serialization/serialize-record.ts new file mode 100644 index 000000000000..284e20878c1f --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/static-helpers/serialization/serialize-record.ts @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export function serializeRecord(item: any, excludes?: string[], serializer?: (item: any) => any) { + excludes = excludes ?? []; + const res: any = {}; + for (let key of Object.keys(item)) { + if (excludes.includes(key) || item[key] === undefined) { + continue; + } + if (serializer) { + res[key] = serializer(item[key]); + } else { + res[key] = item[key] as any; + } + } + return res; +} diff --git a/sdk/healthbot/arm-healthbot/src/static-helpers/urlTemplate.ts b/sdk/healthbot/arm-healthbot/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..cd03319fda35 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/src/static-helpers/urlTemplate.ts @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +//--------------------- +// interfaces +//--------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string) { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string) { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string) { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any) { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false) { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions) { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + named && val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions) { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + (op = expr[0]), (expr = expr.slice(1)); + } + const varList = expr.split(/,/g); + const result = []; + for (const varSpec of varList) { + const varMatch = /([^:\*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: result.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + result.push(varValue); + } + } + return result.join(""); + }); +} diff --git a/sdk/healthbot/arm-healthbot/test/healthbot.spec.ts b/sdk/healthbot/arm-healthbot/test/healthbot.spec.ts deleted file mode 100644 index f8c36cf35a5b..000000000000 --- a/sdk/healthbot/arm-healthbot/test/healthbot.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { RecorderStartOptions } from "@azure-tools/test-recorder"; -import { Recorder } from "@azure-tools/test-recorder"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const replaceableVariables: Record = { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id", -}; - -const recorderOptions: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - "AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section - ], -}; - -describe("My test", () => { - let recorder: Recorder; - - beforeEach(async (ctx) => { - recorder = new Recorder(ctx); - await recorder.start(recorderOptions); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("sample test", async function () { - assert(true); - }); -}); diff --git a/sdk/healthbot/arm-healthbot/test/public/sampleTest.spec.ts b/sdk/healthbot/arm-healthbot/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..e4591bbad342 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/test/public/sampleTest.spec.ts @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async () => { + // recorder = await createRecorder(this); + }); + + afterEach(async () => { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/healthbot/arm-healthbot/test/public/utils/recordedClient.ts b/sdk/healthbot/arm-healthbot/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..14dcd9fa397c --- /dev/null +++ b/sdk/healthbot/arm-healthbot/test/public/utils/recordedClient.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder(context: VitestTestContext): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/sdk/healthbot/arm-healthbot/test/snippets.spec.ts b/sdk/healthbot/arm-healthbot/test/snippets.spec.ts index b352998fb706..84f026aeb638 100644 --- a/sdk/healthbot/arm-healthbot/test/snippets.spec.ts +++ b/sdk/healthbot/arm-healthbot/test/snippets.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { HealthbotClient } from "../src/index.js"; +import { HealthBotClient } from "../src/index.js"; import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity"; import { setLogLevel } from "@azure/logger"; import { describe, it } from "vitest"; @@ -9,7 +9,7 @@ import { describe, it } from "vitest"; describe("snippets", () => { it("ReadmeSampleCreateClient_Node", async () => { const subscriptionId = "00000000-0000-0000-0000-000000000000"; - const client = new HealthbotClient(new DefaultAzureCredential(), subscriptionId); + const client = new HealthBotClient(new DefaultAzureCredential(), subscriptionId); }); it("ReadmeSampleCreateClient_Browser", async () => { @@ -18,7 +18,7 @@ describe("snippets", () => { tenantId: "", clientId: "", }); - const client = new HealthbotClient(credential, subscriptionId); + const client = new HealthBotClient(credential, subscriptionId); }); it("SetLogLevel", async () => { diff --git a/sdk/healthbot/arm-healthbot/tsp-location.yaml b/sdk/healthbot/arm-healthbot/tsp-location.yaml new file mode 100644 index 000000000000..730838caccc1 --- /dev/null +++ b/sdk/healthbot/arm-healthbot/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/healthbot/Healthbot.Management +commit: 928c03a2a93d9f93a6f244b7d8c4769873cc44b5 +repo: ../azure-rest-api-specs +additionalDirectories: diff --git a/sdk/healthbot/arm-healthbot/vitest.browser.config.ts b/sdk/healthbot/arm-healthbot/vitest.browser.config.ts index 10e70dbfa8ee..182729ab5ce9 100644 --- a/sdk/healthbot/arm-healthbot/vitest.browser.config.ts +++ b/sdk/healthbot/arm-healthbot/vitest.browser.config.ts @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. @@ -8,7 +9,7 @@ export default mergeConfig( viteConfig, defineConfig({ test: { - include: ["dist-test/browser/test/**/*.spec.js"], + include: ["dist-test/browser/test/**/*.spec.js",], testTimeout: 1200000, hookTimeout: 1200000, }, diff --git a/sdk/healthbot/arm-healthbot/vitest.config.ts b/sdk/healthbot/arm-healthbot/vitest.config.ts index 86a71911ccc2..40e031385dd8 100644 --- a/sdk/healthbot/arm-healthbot/vitest.config.ts +++ b/sdk/healthbot/arm-healthbot/vitest.config.ts @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/sdk/healthbot/arm-healthbot/vitest.esm.config.ts b/sdk/healthbot/arm-healthbot/vitest.esm.config.ts index 5e9735e9b144..a70127279fc9 100644 --- a/sdk/healthbot/arm-healthbot/vitest.esm.config.ts +++ b/sdk/healthbot/arm-healthbot/vitest.esm.config.ts @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. @@ -5,4 +6,7 @@ import { mergeConfig } from "vitest/config"; import vitestConfig from "./vitest.config.ts"; import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; -export default mergeConfig(vitestConfig, vitestEsmConfig); +export default mergeConfig( + vitestConfig, + vitestEsmConfig +); diff --git a/sdk/healthbot/ci.mgmt.yml b/sdk/healthbot/ci.mgmt.yml index 66dbf81e1210..507f451b3e2b 100644 --- a/sdk/healthbot/ci.mgmt.yml +++ b/sdk/healthbot/ci.mgmt.yml @@ -1,11 +1,13 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: - main - release/* - hotfix/* + exclude: + - feature/v4 paths: include: - sdk/healthbot/ci.mgmt.yml