diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 7ece47c88025..68356f34a03e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -101,6 +101,7 @@ specifiers: '@rush-temp/arm-hdinsight': file:./projects/arm-hdinsight.tgz '@rush-temp/arm-healthbot': file:./projects/arm-healthbot.tgz '@rush-temp/arm-healthcareapis': file:./projects/arm-healthcareapis.tgz + '@rush-temp/arm-help': file:./projects/arm-help.tgz '@rush-temp/arm-hybridcompute': file:./projects/arm-hybridcompute.tgz '@rush-temp/arm-hybridcontainerservice': file:./projects/arm-hybridcontainerservice.tgz '@rush-temp/arm-hybridkubernetes': file:./projects/arm-hybridkubernetes.tgz @@ -435,6 +436,7 @@ dependencies: '@rush-temp/arm-hdinsight': file:projects/arm-hdinsight.tgz '@rush-temp/arm-healthbot': file:projects/arm-healthbot.tgz '@rush-temp/arm-healthcareapis': file:projects/arm-healthcareapis.tgz + '@rush-temp/arm-help': file:projects/arm-help.tgz '@rush-temp/arm-hybridcompute': file:projects/arm-hybridcompute.tgz '@rush-temp/arm-hybridcontainerservice': file:projects/arm-hybridcontainerservice.tgz '@rush-temp/arm-hybridkubernetes': file:projects/arm-hybridkubernetes.tgz @@ -2258,7 +2260,7 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/chai-as-promised/7.1.5: @@ -2280,7 +2282,7 @@ packages: /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/cookie/0.4.1: @@ -2290,7 +2292,7 @@ packages: /@types/cors/2.8.13: resolution: {integrity: sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/debug/4.1.7: @@ -2302,7 +2304,7 @@ packages: /@types/decompress/4.2.4: resolution: {integrity: sha512-/C8kTMRTNiNuWGl5nEyKbPiMv6HA+0RbEXzFhFBEzASM6+oa4tJro9b8nj7eRlOFfuLdzUU+DS/GPDlvvzMOhA==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/eslint/8.4.10: @@ -2323,7 +2325,7 @@ packages: /@types/express-serve-static-core/4.17.33: resolution: {integrity: sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 dev: false @@ -2340,13 +2342,13 @@ packages: /@types/fs-extra/8.1.2: resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/inquirer/8.2.6: @@ -2359,7 +2361,7 @@ packages: /@types/is-buffer/2.0.0: resolution: {integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/json-schema/7.0.11: @@ -2373,13 +2375,13 @@ packages: /@types/jsonwebtoken/9.0.1: resolution: {integrity: sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/jws/3.2.5: resolution: {integrity: sha512-xGTxZH34xOryaTN8CMsvhh9lfNqFuHiMoRvsLYWQdBJHqiECyfInXVl2eK8Jz2emxZWMIn5RBlmr3oDVPeWujw==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/linkify-it/3.0.2: @@ -2426,7 +2428,7 @@ packages: /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 form-data: 3.0.1 dev: false @@ -2473,7 +2475,7 @@ packages: /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/semaphore/1.1.1: @@ -2488,7 +2490,7 @@ packages: resolution: {integrity: sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==} dependencies: '@types/mime': 3.0.1 - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/sinon/10.0.13: @@ -2510,13 +2512,13 @@ packages: /@types/stoppable/1.1.1: resolution: {integrity: sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/tough-cookie/4.0.2: @@ -2530,13 +2532,13 @@ packages: /@types/tunnel/0.0.1: resolution: {integrity: sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/tunnel/0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/underscore/1.11.4: @@ -2554,19 +2556,19 @@ packages: /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/ws/8.5.4: resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/xml2js/0.4.11: resolution: {integrity: sha512-JdigeAKmCyoJUiQljjr7tQG3if9NkqGUgwEUqBvV0N7LM4HyQk7UXCnusRa1lnvXAEYJ8mw8GtZWioagNztOwA==} dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false /@types/yargs-parser/21.0.0: @@ -2583,7 +2585,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 14.18.38 + '@types/node': 18.15.3 dev: false optional: true @@ -3653,7 +3655,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug/3.2.7: @@ -3942,7 +3944,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.13 - '@types/node': 14.18.38 + '@types/node': 18.15.3 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -4966,7 +4968,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -7370,7 +7372,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 14.18.38 + '@types/node': 18.15.3 long: 5.2.1 dev: false @@ -12302,6 +12304,36 @@ packages: - supports-color dev: false + file:projects/arm-help.tgz: + resolution: {integrity: sha512-qL5oQjsmBp/OnSC7LFuhFmLK7VeSkIK8sxPBK/qHayRdMtsYB0n+J3z4LvR3+gM0zPmRM4k6rFr7XkUmTDkT6g==, tarball: file:projects/arm-help.tgz} + name: '@rush-temp/arm-help' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 2.0.0 + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.34.4_@types+node@14.18.38 + '@rollup/plugin-commonjs': 24.0.1_rollup@2.79.1 + '@rollup/plugin-json': 6.0.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 6.0.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.4 + '@types/node': 14.18.38 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 16.0.3 + mkdirp: 2.1.5 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_rrfo4ccoq6ga3fxzubpgdsawvq + tslib: 2.5.0 + typescript: 4.8.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + file:projects/arm-hybridcompute.tgz: resolution: {integrity: sha512-o32+bFzGQICrI6zXMuyc4ceJcg5QjylK4Ck6jCiE82EPwY1XmXN/i9TAkfEYQMuSzYNL/Ps3MVun4szcKkaDFA==, tarball: file:projects/arm-hybridcompute.tgz} name: '@rush-temp/arm-hybridcompute' diff --git a/rush.json b/rush.json index 41472e529ae2..1047c3d11dcf 100644 --- a/rush.json +++ b/rush.json @@ -1947,6 +1947,11 @@ "packageName": "@azure/web-pubsub-client-protobuf", "projectFolder": "sdk/web-pubsub/web-pubsub-client-protobuf", "versionPolicyName": "client" + }, + { + "packageName": "@azure/arm-help", + "projectFolder": "sdk/help/arm-help", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/help/arm-help/CHANGELOG.md b/sdk/help/arm-help/CHANGELOG.md new file mode 100644 index 000000000000..3689cd891ed2 --- /dev/null +++ b/sdk/help/arm-help/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-03-21) + +The package of @azure/arm-help is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/help/arm-help/LICENSE b/sdk/help/arm-help/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/help/arm-help/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +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. \ No newline at end of file diff --git a/sdk/help/arm-help/README.md b/sdk/help/arm-help/README.md new file mode 100644 index 000000000000..f725d40fbca9 --- /dev/null +++ b/sdk/help/arm-help/README.md @@ -0,0 +1,109 @@ +# Azure HelpRP client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure HelpRP client. + +Help RP provider + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/help/arm-help) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-help) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-help?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-help` package + +Install the Azure HelpRP client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-help +``` + +### Create and authenticate a `HelpRP` + +To create a client object to access the Azure HelpRP API, you will need the `endpoint` of your Azure HelpRP resource and a `credential`. The Azure HelpRP client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure HelpRP 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). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure HelpRP** 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`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { HelpRP } = require("@azure/arm-help"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new HelpRP(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new HelpRP(credential, subscriptionId); +``` + + +### 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 + +### HelpRP + +`HelpRP` is the primary interface for developers using the Azure HelpRP client library. Explore the methods on this client object to understand the different features of the Azure HelpRP service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## 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. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fhelp%2Farm-help%2FREADME.png) + +[azure_cli]: https://docs.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 +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/help/arm-help/_meta.json b/sdk/help/arm-help/_meta.json new file mode 100644 index 000000000000..4691003f959c --- /dev/null +++ b/sdk/help/arm-help/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "53a9fdb77a4b1783ae46a9fad2af2528c68ce2b4", + "readme": "specification/help/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/help/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.9", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", + "use": "@autorest/typescript@6.0.0-rc.9" +} \ No newline at end of file diff --git a/sdk/help/arm-help/api-extractor.json b/sdk/help/arm-help/api-extractor.json new file mode 100644 index 000000000000..a5d1af148d53 --- /dev/null +++ b/sdk/help/arm-help/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-help.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/help/arm-help/package.json b/sdk/help/arm-help/package.json new file mode 100644 index 000000000000..e8d7a57c92f6 --- /dev/null +++ b/sdk/help/arm-help/package.json @@ -0,0 +1,115 @@ +{ + "name": "@azure/arm-help", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for HelpRP.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-help.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-multi-entry": "^6.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^2.1.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.8.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "dotenv": "^16.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^14.0.0", + "@azure/dev-tool": "^1.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/helpRP.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/help/arm-help" +} \ No newline at end of file diff --git a/sdk/help/arm-help/review/arm-help.api.md b/sdk/help/arm-help/review/arm-help.api.md new file mode 100644 index 000000000000..b6a815357cc4 --- /dev/null +++ b/sdk/help/arm-help/review/arm-help.api.md @@ -0,0 +1,318 @@ +## API Report File for "@azure/arm-help" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export type ActionType = string; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface Diagnostic { + error?: ErrorModel; + insights?: Insight[]; + solutionId?: string; + status?: Status; +} + +// @public +export interface DiagnosticInvocation { + additionalParameters?: { + [propertyName: string]: string; + }; + solutionId?: string; +} + +// @public +export interface DiagnosticResource extends ProxyResource { + readonly acceptedAt?: string; + readonly diagnostics?: Diagnostic[]; + globalParameters?: { + [propertyName: string]: string; + }; + insights?: DiagnosticInvocation[]; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface Diagnostics { + beginCreate(options?: DiagnosticsCreateOptionalParams): Promise, DiagnosticsCreateResponse>>; + beginCreateAndWait(options?: DiagnosticsCreateOptionalParams): Promise; + checkNameAvailability(options?: DiagnosticsCheckNameAvailabilityOptionalParams): Promise; + get(options?: DiagnosticsGetOptionalParams): Promise; +} + +// @public +export interface DiagnosticsCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { + checkNameAvailabilityRequest?: CheckNameAvailabilityRequest; +} + +// @public +export type DiagnosticsCheckNameAvailabilityResponse = CheckNameAvailabilityResponse; + +// @public +export interface DiagnosticsCreateOptionalParams extends coreClient.OperationOptions { + diagnosticResourceRequest?: DiagnosticResource; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DiagnosticsCreateResponse = DiagnosticResource; + +// @public +export interface DiagnosticsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DiagnosticsGetResponse = DiagnosticResource; + +// @public +export interface DiscoveryResponse { + nextLink?: string; + value?: SolutionMetadata[]; +} + +// @public +export interface DiscoverySolution { + list(options?: DiscoverySolutionListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DiscoverySolutionListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DiscoverySolutionListNextResponse = DiscoveryResponse; + +// @public +export interface DiscoverySolutionListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DiscoverySolutionListResponse = DiscoveryResponse; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorModel { + readonly code?: string; + details?: ErrorModel[]; + readonly message?: string; + readonly type?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public (undocumented) +export class HelpRP extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, scope: string, diagnosticsResourceName: string, options?: HelpRPOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + diagnostics: Diagnostics; + // (undocumented) + diagnosticsResourceName: string; + // (undocumented) + discoverySolution: DiscoverySolution; + // (undocumented) + filter?: string; + // (undocumented) + operations: Operations; + // (undocumented) + scope: string; + // (undocumented) + skiptoken?: string; +} + +// @public +export interface HelpRPOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; + filter?: string; + skiptoken?: string; +} + +// @public +export type ImportanceLevel = string; + +// @public +export interface Insight { + id?: string; + importanceLevel?: ImportanceLevel; + results?: string; + title?: string; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownImportanceLevel { + Critical = "Critical", + Information = "Information", + Warning = "Warning" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Failed = "Failed", + PartialComplete = "PartialComplete", + Succeeded = "Succeeded" +} + +// @public +export enum KnownStatus { + Failed = "Failed", + MissingInputs = "MissingInputs", + Running = "Running", + Succeeded = "Succeeded", + Timeout = "Timeout" +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationListResult { + readonly nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export type Origin = string; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SolutionMetadata { + description?: string; + requiredParameterSets?: string[][]; + solutionId?: string; + solutionType?: string; +} + +// @public +export type Status = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/help/arm-help/rollup.config.js b/sdk/help/arm-help/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/help/arm-help/rollup.config.js @@ -0,0 +1,122 @@ +/* + * 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 nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/help/arm-help/sample.env b/sdk/help/arm-help/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/help/arm-help/sample.env @@ -0,0 +1,4 @@ +# 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/help/arm-help/src/helpRP.ts b/sdk/help/arm-help/src/helpRP.ts new file mode 100644 index 000000000000..f420e748c693 --- /dev/null +++ b/sdk/help/arm-help/src/helpRP.ts @@ -0,0 +1,162 @@ +/* + * 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 { + OperationsImpl, + DiagnosticsImpl, + DiscoverySolutionImpl +} from "./operations"; +import { + Operations, + Diagnostics, + DiscoverySolution +} from "./operationsInterfaces"; +import { HelpRPOptionalParams } from "./models"; + +export class HelpRP extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + scope: string; + diagnosticsResourceName: string; + filter?: string; + skiptoken?: string; + + /** + * Initializes a new instance of the HelpRP class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param scope This is an extension resource provider and only resource level extension is supported + * at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + scope: string, + diagnosticsResourceName: string, + options?: HelpRPOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (scope === undefined) { + throw new Error("'scope' cannot be null"); + } + if (diagnosticsResourceName === undefined) { + throw new Error("'diagnosticsResourceName' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: HelpRPOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-help/1.0.0-beta.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.scope = scope; + this.diagnosticsResourceName = diagnosticsResourceName; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2023-01-01-preview"; + this.operations = new OperationsImpl(this); + this.diagnostics = new DiagnosticsImpl(this); + this.discoverySolution = new DiscoverySolutionImpl(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); + } + + operations: Operations; + diagnostics: Diagnostics; + discoverySolution: DiscoverySolution; +} diff --git a/sdk/help/arm-help/src/index.ts b/sdk/help/arm-help/src/index.ts new file mode 100644 index 000000000000..8b1ae2428849 --- /dev/null +++ b/sdk/help/arm-help/src/index.ts @@ -0,0 +1,13 @@ +/* + * 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 { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { HelpRP } from "./helpRP"; +export * from "./operationsInterfaces"; diff --git a/sdk/help/arm-help/src/lroImpl.ts b/sdk/help/arm-help/src/lroImpl.ts new file mode 100644 index 000000000000..dd803cd5e28c --- /dev/null +++ b/sdk/help/arm-help/src/lroImpl.ts @@ -0,0 +1,42 @@ +/* + * 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 { AbortSignalLike } from "@azure/abort-controller"; +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; +} diff --git a/sdk/help/arm-help/src/models/index.ts b/sdk/help/arm-help/src/models/index.ts new file mode 100644 index 000000000000..38a001eb03eb --- /dev/null +++ b/sdk/help/arm-help/src/models/index.ts @@ -0,0 +1,484 @@ +/* + * 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"; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** + * List of operations supported by the resource provider + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Operation[]; + /** + * URL to get the next set of operation list results (if there are any). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: Origin; + /** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionType?: ActionType; +} + +/** Localized display information for this particular operation. */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * 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?: ErrorDetail[]; + /** + * 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; +} + +/** The check availability request body. */ +export interface CheckNameAvailabilityRequest { + /** The name of the resource for which availability needs to be checked. */ + name?: string; + /** The resource type. */ + type?: string; +} + +/** Response for whether the requested resource name is available or not. */ +export interface CheckNameAvailabilityResponse { + /** Returns true or false depending on the availability of the name */ + nameAvailable?: boolean; + /** Reason for why value is not available. This field is returned if nameAvailable is false. */ + reason?: string; + /** Gets an error message explaining the 'reason' value with more details. This field is returned iif nameAvailable is false. */ + message?: string; +} + +/** Solution Invocation with additional params needed for invocation. */ +export interface DiagnosticInvocation { + /** Solution Id to invoke. */ + solutionId?: string; + /** Additional parameters required to invoke the solutionId. */ + additionalParameters?: { [propertyName: string]: string }; +} + +/** Properties returned with in an insight. */ +export interface Diagnostic { + /** Solution Id */ + solutionId?: string; + /** Denotes the status of the diagnostic resource. */ + status?: Status; + /** The problems (if any) detected by this insight. */ + insights?: Insight[]; + /** Error definition. */ + error?: ErrorModel; +} + +/** Detailed insights(s) obtained via the invocation of an insight diagnostic troubleshooter. */ +export interface Insight { + /** Article id. */ + id?: string; + /** This insight's title. */ + title?: string; + /** Detailed result content. */ + results?: string; + /** Importance level of the insight. */ + importanceLevel?: ImportanceLevel; +} + +/** Error definition. */ +export interface ErrorModel { + /** + * Service specific error code which serves as the substatus for the HTTP error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * Service specific error type which serves as additional context for the error herein. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Description of the error. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** An array of additional nested error response info objects, as described by this contract. */ + details?: ErrorModel[]; +} + +/** 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} + * 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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: 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; +} + +/** Discovery response. */ +export interface DiscoveryResponse { + /** The list of solution metadata. */ + value?: SolutionMetadata[]; + /** The link used to get the next page of solution metadata. */ + nextLink?: string; +} + +/** Diagnostic solution metadata. */ +export interface SolutionMetadata { + /** Solution Id. */ + solutionId?: string; + /** Solution Type. */ + solutionType?: string; + /** A detailed description of solution. */ + description?: string; + /** Required parameters for invoking this particular solution. */ + requiredParameterSets?: string[][]; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +/** Diagnostic resource */ +export interface DiagnosticResource extends ProxyResource { + /** Global parameters that can be passed to all solutionIds. */ + globalParameters?: { [propertyName: string]: string }; + /** SolutionIds that are needed to be invoked. */ + insights?: DiagnosticInvocation[]; + /** + * Diagnostic Request Accepted time. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly acceptedAt?: string; + /** + * Status of diagnostic provisioning. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * Array of Diagnostics. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly diagnostics?: Diagnostic[]; +} + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** User */ + User = "user", + /** System */ + System = "system", + /** UserSystem */ + UserSystem = "user,system" +} + +/** + * Defines values for Origin. \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user** \ + * **system** \ + * **user,system** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + /** Internal */ + Internal = "Internal" +} + +/** + * Defines values for ActionType. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal** + */ +export type ActionType = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** All Diagnostics in the Batch succeeded. */ + Succeeded = "Succeeded", + /** Some Diagnostics are still running or failed. */ + PartialComplete = "PartialComplete", + /** All Diagnostics failed to run. */ + Failed = "Failed", + /** When Diagnostic request gets canceled. */ + Canceled = "Canceled" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: All Diagnostics in the Batch succeeded. \ + * **PartialComplete**: Some Diagnostics are still running or failed. \ + * **Failed**: All Diagnostics failed to run. \ + * **Canceled**: When Diagnostic request gets canceled. + */ +export type ProvisioningState = string; + +/** Known values of {@link Status} that the service accepts. */ +export enum KnownStatus { + /** Diagnostic creation failed. */ + Failed = "Failed", + /** Request is missing required inputs to run. */ + MissingInputs = "MissingInputs", + /** Diagnostic is still running. */ + Running = "Running", + /** Diagnostic creation succeeded. */ + Succeeded = "Succeeded", + /** Diagnostic was timed out. */ + Timeout = "Timeout" +} + +/** + * Defines values for Status. \ + * {@link KnownStatus} can be used interchangeably with Status, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Failed**: Diagnostic creation failed. \ + * **MissingInputs**: Request is missing required inputs to run. \ + * **Running**: Diagnostic is still running. \ + * **Succeeded**: Diagnostic creation succeeded. \ + * **Timeout**: Diagnostic was timed out. + */ +export type Status = string; + +/** Known values of {@link ImportanceLevel} that the service accepts. */ +export enum KnownImportanceLevel { + /** A critical insight has been found after running the diagnostic. */ + Critical = "Critical", + /** A warning insight has been found after running the diagnostic. */ + Warning = "Warning", + /** An information insight has been found after running the diagnostic. */ + Information = "Information" +} + +/** + * Defines values for ImportanceLevel. \ + * {@link KnownImportanceLevel} can be used interchangeably with ImportanceLevel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Critical**: A critical insight has been found after running the diagnostic. \ + * **Warning**: A warning insight has been found after running the diagnostic. \ + * **Information**: An information insight has been found after running the diagnostic. + */ +export type ImportanceLevel = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@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** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface DiagnosticsCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions { + /** The required parameters for availability check. */ + checkNameAvailabilityRequest?: CheckNameAvailabilityRequest; +} + +/** Contains response data for the checkNameAvailability operation. */ +export type DiagnosticsCheckNameAvailabilityResponse = CheckNameAvailabilityResponse; + +/** Optional parameters. */ +export interface DiagnosticsCreateOptionalParams + extends coreClient.OperationOptions { + /** The required request body for this insightResource invocation. */ + diagnosticResourceRequest?: DiagnosticResource; + /** 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 DiagnosticsCreateResponse = DiagnosticResource; + +/** Optional parameters. */ +export interface DiagnosticsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type DiagnosticsGetResponse = DiagnosticResource; + +/** Optional parameters. */ +export interface DiscoverySolutionListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type DiscoverySolutionListResponse = DiscoveryResponse; + +/** Optional parameters. */ +export interface DiscoverySolutionListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type DiscoverySolutionListNextResponse = DiscoveryResponse; + +/** Optional parameters. */ +export interface HelpRPOptionalParams extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. */ + filter?: string; + /** Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. */ + skiptoken?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/help/arm-help/src/models/mappers.ts b/sdk/help/arm-help/src/models/mappers.ts new file mode 100644 index 000000000000..44a0f2c4ae91 --- /dev/null +++ b/sdk/help/arm-help/src/models/mappers.ts @@ -0,0 +1,618 @@ +/* + * 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 OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String" + } + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + 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: "ErrorDetail" + } + } + } + }, + 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 CheckNameAvailabilityRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityRequest", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityResponse", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const DiagnosticInvocation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DiagnosticInvocation", + modelProperties: { + solutionId: { + serializedName: "solutionId", + type: { + name: "String" + } + }, + additionalParameters: { + serializedName: "additionalParameters", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const Diagnostic: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Diagnostic", + modelProperties: { + solutionId: { + serializedName: "solutionId", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + insights: { + serializedName: "insights", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Insight" + } + } + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + } +}; + +export const Insight: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Insight", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + title: { + serializedName: "title", + type: { + name: "String" + } + }, + results: { + serializedName: "results", + type: { + name: "String" + } + }, + importanceLevel: { + serializedName: "importanceLevel", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + } + } + } +}; + +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 DiscoveryResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DiscoveryResponse", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SolutionMetadata" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const SolutionMetadata: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SolutionMetadata", + modelProperties: { + solutionId: { + serializedName: "solutionId", + type: { + name: "String" + } + }, + solutionType: { + serializedName: "solutionType", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + requiredParameterSets: { + serializedName: "requiredParameterSets", + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const DiagnosticResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DiagnosticResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + globalParameters: { + serializedName: "properties.globalParameters", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + insights: { + serializedName: "properties.insights", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DiagnosticInvocation" + } + } + } + }, + acceptedAt: { + serializedName: "properties.acceptedAt", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + diagnostics: { + serializedName: "properties.diagnostics", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Diagnostic" + } + } + } + } + } + } +}; diff --git a/sdk/help/arm-help/src/models/parameters.ts b/sdk/help/arm-help/src/models/parameters.ts new file mode 100644 index 000000000000..2655035ef527 --- /dev/null +++ b/sdk/help/arm-help/src/models/parameters.ts @@ -0,0 +1,136 @@ +/* + * 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 { + CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper, + DiagnosticResource as DiagnosticResourceMapper +} from "../models/mappers"; + +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 apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2023-01-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const checkNameAvailabilityRequest: OperationParameter = { + parameterPath: ["options", "checkNameAvailabilityRequest"], + mapper: CheckNameAvailabilityRequestMapper +}; + +export const scope: OperationURLParameter = { + parameterPath: "scope", + mapper: { + serializedName: "scope", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const diagnosticResourceRequest: OperationParameter = { + parameterPath: ["options", "diagnosticResourceRequest"], + mapper: DiagnosticResourceMapper +}; + +export const diagnosticsResourceName: OperationURLParameter = { + parameterPath: "diagnosticsResourceName", + mapper: { + constraints: { + Pattern: new RegExp("^[A-Za-z0-9-+@()_]+$"), + MaxLength: 100, + MinLength: 1 + }, + serializedName: "diagnosticsResourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const filter: OperationQueryParameter = { + parameterPath: "filter", + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const skiptoken: OperationQueryParameter = { + parameterPath: "skiptoken", + mapper: { + serializedName: "$skiptoken", + type: { + name: "String" + } + } +}; diff --git a/sdk/help/arm-help/src/operations/diagnostics.ts b/sdk/help/arm-help/src/operations/diagnostics.ts new file mode 100644 index 000000000000..e8ef1e5f3f3d --- /dev/null +++ b/sdk/help/arm-help/src/operations/diagnostics.ts @@ -0,0 +1,247 @@ +/* + * 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 { Diagnostics } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { HelpRP } from "../helpRP"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + DiagnosticsCheckNameAvailabilityOptionalParams, + DiagnosticsCheckNameAvailabilityResponse, + DiagnosticsCreateOptionalParams, + DiagnosticsCreateResponse, + DiagnosticsGetOptionalParams, + DiagnosticsGetResponse +} from "../models"; + +/** Class containing Diagnostics operations. */ +export class DiagnosticsImpl implements Diagnostics { + private readonly client: HelpRP; + + /** + * Initialize a new instance of the class Diagnostics class. + * @param client Reference to the service client + */ + constructor(client: HelpRP) { + this.client = client; + } + + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * @param options The options parameters. + */ + checkNameAvailability( + options?: DiagnosticsCheckNameAvailabilityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + checkNameAvailabilityOperationSpec + ); + } + + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites.
DiagnosticsCreate and Get + * diagnostics for issues with Azure resources based on prerequisites (see + * below).

Prerequisites for Diagnostics:

The diagnostics + * API is called after solutions discovery and returns diagnostic info for your Azure issue.
+ *
You must have reader + * access role at the resource level to create diagnostics.

'RequiredParameterSets' + * from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as a key-value pairs to Diagnostics Api. + * @param options The options parameters. + */ + async beginCreate( + options?: DiagnosticsCreateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DiagnosticsCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { options }, + spec: createOperationSpec + }); + const poller = await createHttpPoller< + DiagnosticsCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites.
DiagnosticsCreate and Get + * diagnostics for issues with Azure resources based on prerequisites (see + * below).

Prerequisites for Diagnostics:

The diagnostics + * API is called after solutions discovery and returns diagnostic info for your Azure issue.
+ *
You must have reader + * access role at the resource level to create diagnostics.

'RequiredParameterSets' + * from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as a key-value pairs to Diagnostics Api. + * @param options The options parameters. + */ + async beginCreateAndWait( + options?: DiagnosticsCreateOptionalParams + ): Promise { + const poller = await this.beginCreate(options); + return poller.pollUntilDone(); + } + + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites.
DiagnosticsCreate and Get + * diagnostics for issues with Azure resources based on prerequisites (see + * below).

Prerequisites for Diagnostics:

The diagnostics + * API is called after solutions discovery and returns diagnostic info for your Azure issue.
+ *
You must have reader + * access role at the resource level to get the diagnostics.

'RequiredParameterSets' + * from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as a key-value pairs to Diagnostics Api. + * @param options The options parameters. + */ + get(options?: DiagnosticsGetOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, getOperationSpec); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.Help/checkNameAvailability", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckNameAvailabilityResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.checkNameAvailabilityRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.scope], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.DiagnosticResource + }, + 201: { + bodyMapper: Mappers.DiagnosticResource + }, + 202: { + bodyMapper: Mappers.DiagnosticResource + }, + 204: { + bodyMapper: Mappers.DiagnosticResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.diagnosticResourceRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.scope, + Parameters.diagnosticsResourceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DiagnosticResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.scope, + Parameters.diagnosticsResourceName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/help/arm-help/src/operations/discoverySolution.ts b/sdk/help/arm-help/src/operations/discoverySolution.ts new file mode 100644 index 000000000000..29158a71aef1 --- /dev/null +++ b/sdk/help/arm-help/src/operations/discoverySolution.ts @@ -0,0 +1,187 @@ +/* + * 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"; +import { DiscoverySolution } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { HelpRP } from "../helpRP"; +import { + SolutionMetadata, + DiscoverySolutionListNextOptionalParams, + DiscoverySolutionListOptionalParams, + DiscoverySolutionListResponse, + DiscoverySolutionListNextResponse +} from "../models"; + +/// +/** Class containing DiscoverySolution operations. */ +export class DiscoverySolutionImpl implements DiscoverySolution { + private readonly client: HelpRP; + + /** + * Initialize a new instance of the class DiscoverySolution class. + * @param client Reference to the service client + */ + constructor(client: HelpRP) { + this.client = client; + } + + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites (see + * below).
DiagnosticsCreate and Get diagnostics for issues with Azure + * resources.

Prerequisites for solution discovery:

You can + * call the API to discover solutions with the following inputs:
i. Required inputs: resourceUri. + *
ii. Optional input: problemClassificationId.

This API enables discovery of + * diagnostics for a defined list of Azure support issues, and is not supported for all + * ProblemClassificationId(s) at the moment. For ProblemClassificationId(s) that are not supported, the + * API response will not return any diagnostics. You can use ProblemClassifications API to get the + * problem categories and ProblemClassificationId(s) reference. + *

You must have reader + * access role at the resource level to get the solutions.

Note: + * 'RequiredParameterSets' from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as an input to Diagnostics API.

+ * @param options The options parameters. + */ + public list( + options?: DiscoverySolutionListOptionalParams + ): 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?: DiscoverySolutionListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DiscoverySolutionListResponse; + 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?: DiscoverySolutionListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites (see + * below).
DiagnosticsCreate and Get diagnostics for issues with Azure + * resources.

Prerequisites for solution discovery:

You can + * call the API to discover solutions with the following inputs:
i. Required inputs: resourceUri. + *
ii. Optional input: problemClassificationId.

This API enables discovery of + * diagnostics for a defined list of Azure support issues, and is not supported for all + * ProblemClassificationId(s) at the moment. For ProblemClassificationId(s) that are not supported, the + * API response will not return any diagnostics. You can use ProblemClassifications API to get the + * problem categories and ProblemClassificationId(s) reference. + *

You must have reader + * access role at the resource level to get the solutions.

Note: + * 'RequiredParameterSets' from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as an input to Diagnostics API.

+ * @param options The options parameters. + */ + private _list( + options?: DiscoverySolutionListOptionalParams + ): 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?: DiscoverySolutionListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.Help/discoverySolutions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DiscoveryResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.skiptoken + ], + urlParameters: [Parameters.$host, Parameters.scope], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DiscoveryResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/help/arm-help/src/operations/index.ts b/sdk/help/arm-help/src/operations/index.ts new file mode 100644 index 000000000000..4ee86d82b8ef --- /dev/null +++ b/sdk/help/arm-help/src/operations/index.ts @@ -0,0 +1,11 @@ +/* + * 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 "./operations"; +export * from "./diagnostics"; +export * from "./discoverySolution"; diff --git a/sdk/help/arm-help/src/operations/operations.ts b/sdk/help/arm-help/src/operations/operations.ts new file mode 100644 index 000000000000..0bb34b7e54bc --- /dev/null +++ b/sdk/help/arm-help/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * 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"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { HelpRP } from "../helpRP"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: HelpRP; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: HelpRP) { + this.client = client; + } + + /** + * Returns list of 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; + } + } + + /** + * Returns list of 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.Help/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/help/arm-help/src/operationsInterfaces/diagnostics.ts b/sdk/help/arm-help/src/operationsInterfaces/diagnostics.ts new file mode 100644 index 000000000000..68858b598e65 --- /dev/null +++ b/sdk/help/arm-help/src/operationsInterfaces/diagnostics.ts @@ -0,0 +1,85 @@ +/* + * 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 { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + DiagnosticsCheckNameAvailabilityOptionalParams, + DiagnosticsCheckNameAvailabilityResponse, + DiagnosticsCreateOptionalParams, + DiagnosticsCreateResponse, + DiagnosticsGetOptionalParams, + DiagnosticsGetResponse +} from "../models"; + +/** Interface representing a Diagnostics. */ +export interface Diagnostics { + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * @param options The options parameters. + */ + checkNameAvailability( + options?: DiagnosticsCheckNameAvailabilityOptionalParams + ): Promise; + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites.
DiagnosticsCreate and Get + * diagnostics for issues with Azure resources based on prerequisites (see + * below).

Prerequisites for Diagnostics:

The diagnostics + * API is called after solutions discovery and returns diagnostic info for your Azure issue.
+ *
You must have reader + * access role at the resource level to create diagnostics.

'RequiredParameterSets' + * from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as a key-value pairs to Diagnostics Api. + * @param options The options parameters. + */ + beginCreate( + options?: DiagnosticsCreateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DiagnosticsCreateResponse + > + >; + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites.
DiagnosticsCreate and Get + * diagnostics for issues with Azure resources based on prerequisites (see + * below).

Prerequisites for Diagnostics:

The diagnostics + * API is called after solutions discovery and returns diagnostic info for your Azure issue.
+ *
You must have reader + * access role at the resource level to create diagnostics.

'RequiredParameterSets' + * from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as a key-value pairs to Diagnostics Api. + * @param options The options parameters. + */ + beginCreateAndWait( + options?: DiagnosticsCreateOptionalParams + ): Promise; + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites.
DiagnosticsCreate and Get + * diagnostics for issues with Azure resources based on prerequisites (see + * below).

Prerequisites for Diagnostics:

The diagnostics + * API is called after solutions discovery and returns diagnostic info for your Azure issue.
+ *
You must have reader + * access role at the resource level to get the diagnostics.

'RequiredParameterSets' + * from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as a key-value pairs to Diagnostics Api. + * @param options The options parameters. + */ + get(options?: DiagnosticsGetOptionalParams): Promise; +} diff --git a/sdk/help/arm-help/src/operationsInterfaces/discoverySolution.ts b/sdk/help/arm-help/src/operationsInterfaces/discoverySolution.ts new file mode 100644 index 000000000000..d10256dbb2d0 --- /dev/null +++ b/sdk/help/arm-help/src/operationsInterfaces/discoverySolution.ts @@ -0,0 +1,42 @@ +/* + * 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 { + SolutionMetadata, + DiscoverySolutionListOptionalParams +} from "../models"; + +/// +/** Interface representing a DiscoverySolution. */ +export interface DiscoverySolution { + /** + *

Overview:

Azure Help API programmatically helps you troubleshoot Azure issues and + * provides access to rich and powerful self-help solutions and diagnostics. Using the API, you can + * perform the following operations:
Solution DiscoveryLists the diagnostics + * for an Azure issue based on the prerequisites (see + * below).
DiagnosticsCreate and Get diagnostics for issues with Azure + * resources.

Prerequisites for solution discovery:

You can + * call the API to discover solutions with the following inputs:
i. Required inputs: resourceUri. + *
ii. Optional input: problemClassificationId.

This API enables discovery of + * diagnostics for a defined list of Azure support issues, and is not supported for all + * ProblemClassificationId(s) at the moment. For ProblemClassificationId(s) that are not supported, the + * API response will not return any diagnostics. You can use ProblemClassifications API to get the + * problem categories and ProblemClassificationId(s) reference. + *

You must have reader + * access role at the resource level to get the solutions.

Note: + * 'RequiredParameterSets' from Discovery Solutions API response has to be passed via + * 'properties.insights.additionalParameters' as an input to Diagnostics API.

+ * @param options The options parameters. + */ + list( + options?: DiscoverySolutionListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/help/arm-help/src/operationsInterfaces/index.ts b/sdk/help/arm-help/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..4ee86d82b8ef --- /dev/null +++ b/sdk/help/arm-help/src/operationsInterfaces/index.ts @@ -0,0 +1,11 @@ +/* + * 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 "./operations"; +export * from "./diagnostics"; +export * from "./discoverySolution"; diff --git a/sdk/help/arm-help/src/operationsInterfaces/operations.ts b/sdk/help/arm-help/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..0c50b09b459e --- /dev/null +++ b/sdk/help/arm-help/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * 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 { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Returns list of operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/help/arm-help/src/pagingHelper.ts b/sdk/help/arm-help/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/help/arm-help/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/help/arm-help/test/sampleTest.ts b/sdk/help/arm-help/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/help/arm-help/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/help/arm-help/tsconfig.json b/sdk/help/arm-help/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/help/arm-help/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/help/ci.mgmt.yml b/sdk/help/ci.mgmt.yml new file mode 100644 index 000000000000..964b5e4802ed --- /dev/null +++ b/sdk/help/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/help/arm-help + - sdk/help/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/help/arm-help + - sdk/help/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: help + Artifacts: + - name: azure-arm-help + safeName: azurearmhelp + \ No newline at end of file