From 29ccd2aed5c4449e9e5258c7faaacb1e479352c6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 8 Nov 2024 13:21:52 +0000 Subject: [PATCH] CodeGen from PR 31037 in Azure/azure-rest-api-specs Merge 93293ed71578a7875d49a798f892bb426391095c into 59fa2c3fd854c9f5f2beb56220bcc21d979ec52d --- common/config/rush/pnpm-lock.yaml | 70 +- rush.json | 9 +- sdk/impact/arm-impact/CHANGELOG.md | 7 + sdk/impact/arm-impact/LICENSE | 21 + sdk/impact/arm-impact/README.md | 109 ++ sdk/impact/arm-impact/_meta.json | 8 + sdk/impact/arm-impact/api-extractor.json | 31 + sdk/impact/arm-impact/package.json | 110 ++ .../arm-impact/review/arm-impact.api.md | 637 +++++++++ sdk/impact/arm-impact/sample.env | 4 + sdk/impact/arm-impact/src/index.ts | 13 + sdk/impact/arm-impact/src/lroImpl.ts | 42 + sdk/impact/arm-impact/src/microsoftImpact.ts | 161 +++ sdk/impact/arm-impact/src/models/index.ts | 952 +++++++++++++ sdk/impact/arm-impact/src/models/mappers.ts | 1258 +++++++++++++++++ .../arm-impact/src/models/parameters.ts | 196 +++ .../arm-impact/src/operations/connectors.ts | 399 ++++++ .../src/operations/impactCategories.ts | 197 +++ sdk/impact/arm-impact/src/operations/index.ts | 13 + .../arm-impact/src/operations/insights.ts | 305 ++++ .../arm-impact/src/operations/operations.ts | 149 ++ .../src/operations/workloadImpacts.ts | 357 +++++ .../src/operationsInterfaces/connectors.ts | 90 ++ .../operationsInterfaces/impactCategories.ts | 36 + .../src/operationsInterfaces/index.ts | 13 + .../src/operationsInterfaces/insights.ts | 67 + .../src/operationsInterfaces/operations.ts | 22 + .../operationsInterfaces/workloadImpacts.ts | 76 + sdk/impact/arm-impact/src/pagingHelper.ts | 39 + sdk/impact/arm-impact/test/sampleTest.ts | 43 + sdk/impact/arm-impact/tsconfig.json | 27 + sdk/impact/ci.mgmt.yml | 38 + 32 files changed, 5478 insertions(+), 21 deletions(-) create mode 100644 sdk/impact/arm-impact/CHANGELOG.md create mode 100644 sdk/impact/arm-impact/LICENSE create mode 100644 sdk/impact/arm-impact/README.md create mode 100644 sdk/impact/arm-impact/_meta.json create mode 100644 sdk/impact/arm-impact/api-extractor.json create mode 100644 sdk/impact/arm-impact/package.json create mode 100644 sdk/impact/arm-impact/review/arm-impact.api.md create mode 100644 sdk/impact/arm-impact/sample.env create mode 100644 sdk/impact/arm-impact/src/index.ts create mode 100644 sdk/impact/arm-impact/src/lroImpl.ts create mode 100644 sdk/impact/arm-impact/src/microsoftImpact.ts create mode 100644 sdk/impact/arm-impact/src/models/index.ts create mode 100644 sdk/impact/arm-impact/src/models/mappers.ts create mode 100644 sdk/impact/arm-impact/src/models/parameters.ts create mode 100644 sdk/impact/arm-impact/src/operations/connectors.ts create mode 100644 sdk/impact/arm-impact/src/operations/impactCategories.ts create mode 100644 sdk/impact/arm-impact/src/operations/index.ts create mode 100644 sdk/impact/arm-impact/src/operations/insights.ts create mode 100644 sdk/impact/arm-impact/src/operations/operations.ts create mode 100644 sdk/impact/arm-impact/src/operations/workloadImpacts.ts create mode 100644 sdk/impact/arm-impact/src/operationsInterfaces/connectors.ts create mode 100644 sdk/impact/arm-impact/src/operationsInterfaces/impactCategories.ts create mode 100644 sdk/impact/arm-impact/src/operationsInterfaces/index.ts create mode 100644 sdk/impact/arm-impact/src/operationsInterfaces/insights.ts create mode 100644 sdk/impact/arm-impact/src/operationsInterfaces/operations.ts create mode 100644 sdk/impact/arm-impact/src/operationsInterfaces/workloadImpacts.ts create mode 100644 sdk/impact/arm-impact/src/pagingHelper.ts create mode 100644 sdk/impact/arm-impact/test/sampleTest.ts create mode 100644 sdk/impact/arm-impact/tsconfig.json create mode 100644 sdk/impact/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e7ab49a095b8..119a0e7bb447 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -401,6 +401,9 @@ dependencies: '@rush-temp/arm-imagebuilder': specifier: file:./projects/arm-imagebuilder.tgz version: file:projects/arm-imagebuilder.tgz + '@rush-temp/arm-impact': + specifier: file:./projects/arm-impact.tgz + version: file:projects/arm-impact.tgz '@rush-temp/arm-informaticadatamanagement': specifier: file:./projects/arm-informaticadatamanagement.tgz version: file:projects/arm-informaticadatamanagement.tgz @@ -3796,13 +3799,13 @@ packages: resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==} dependencies: '@types/connect': 3.4.38 - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/bunyan@1.8.9: resolution: {integrity: sha512-ZqS9JGpBxVOvsawzmVt30sP++gSQMTejCkIAQ3VdadOcRE8izTyW66hufvwLeH+YEGP6Js2AW7Gz+RMyvrEbmw==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/chai-as-promised@7.1.8: @@ -3830,7 +3833,7 @@ packages: /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/cookie@0.4.1: @@ -3844,7 +3847,7 @@ packages: /@types/cors@2.8.17: resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/debug@4.1.12: @@ -3887,7 +3890,7 @@ packages: /@types/express-serve-static-core@4.19.6: resolution: {integrity: sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 '@types/qs': 6.9.16 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -3906,7 +3909,7 @@ packages: resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/http-errors@2.0.4: @@ -3933,7 +3936,7 @@ packages: /@types/jsonfile@6.1.4: resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/jsonwebtoken@9.0.7: @@ -3992,13 +3995,13 @@ packages: /@types/mysql@2.15.26: resolution: {integrity: sha512-DSLCOXhkvfS5WNNPbfn2KdICAmk8lLc+/PNvnPnF7gOdMZCxopXduqv0OQ13y/yA/zXTSikZZqVgybUxOEg6YQ==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/node-fetch@2.6.11: resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 form-data: 4.0.1 dev: false @@ -4037,7 +4040,7 @@ packages: /@types/pg@8.6.1: resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 pg-protocol: 1.7.0 pg-types: 2.2.0 dev: false @@ -4064,7 +4067,7 @@ packages: /@types/readdir-glob@1.1.5: resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/resolve@1.20.2: @@ -4083,14 +4086,14 @@ packages: resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==} dependencies: '@types/mime': 1.3.5 - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/serve-static@1.15.7: resolution: {integrity: sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==} dependencies: '@types/http-errors': 2.0.4 - '@types/node': 18.19.64 + '@types/node': 20.17.6 '@types/send': 0.17.4 dev: false @@ -4121,7 +4124,7 @@ packages: /@types/through@0.0.33: resolution: {integrity: sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/tough-cookie@4.0.5: @@ -4174,7 +4177,7 @@ packages: resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false optional: true @@ -5944,7 +5947,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.17 - '@types/node': 18.19.64 + '@types/node': 20.17.6 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.7.2 @@ -15185,6 +15188,35 @@ packages: - supports-color dev: false + file:projects/arm-impact.tgz: + resolution: {integrity: sha512-3VtiddPrAtYnYAqCmcV929r42M39DhBDfh6176qqx8fjQBWCEg/kKVoBDs5Pu8p/ZO4UDsXoBWLfo94eIGdgiA==, tarball: file:projects/arm-impact.tgz} + name: '@rush-temp/arm-impact' + version: 0.0.0 + dependencies: + '@azure-tools/test-credential': 1.3.1 + '@azure-tools/test-recorder': 3.5.2 + '@azure/core-lro': 2.7.2 + '@microsoft/api-extractor': 7.47.11(@types/node@18.19.64) + '@types/chai': 4.3.20 + '@types/mocha': 10.0.9 + '@types/node': 18.19.64 + chai: 4.3.10 + cross-env: 7.0.3 + dotenv: 16.4.5 + mkdirp: 3.0.1 + mocha: 10.8.2 + rimraf: 5.0.10 + ts-node: 10.9.2(@types/node@18.19.64)(typescript@5.5.4) + tslib: 2.8.1 + tsx: 4.19.2 + typescript: 5.5.4 + uglify-js: 3.19.3 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-informaticadatamanagement.tgz: resolution: {integrity: sha512-lcWSAf5y5zeosf4IQkPtk+qTs295m+rHavC4RUjsdu/LqksCoyk3fWVSbISH06AkcdfnkqIMiUUKq3GN7g9itA==, tarball: file:projects/arm-informaticadatamanagement.tgz} name: '@rush-temp/arm-informaticadatamanagement' @@ -18464,7 +18496,7 @@ packages: dev: false file:projects/batch.tgz: - resolution: {integrity: sha512-6RrcBorSumWEO4KlTeLQ0b5SZRPDSjfWrEndxfqI4fGeDn4hKIdU2SvGMftjsVbnkli6xpQlgRNwI7U0GlHMRw==, tarball: file:projects/batch.tgz} + resolution: {integrity: sha512-5aWGICBLDXaS8dyz90IUuG+KysKDtOr7RkVjdYzfxCimiWRMgPYdRmvP+k7Dkm5xkp16VRTIG8kTnJFVUBSMHw==, tarball: file:projects/batch.tgz} name: '@rush-temp/batch' version: 0.0.0 dependencies: @@ -18501,7 +18533,7 @@ packages: dev: false file:projects/communication-alpha-ids.tgz: - resolution: {integrity: sha512-bUA4Ndtn6P8msf1fAiWimRDZrHvv9BM5sdJf242sV2qbDvNlmDJp6nqyrZtlU1nMzgkhAy9SQ2cHVfKBJUp1OA==, tarball: file:projects/communication-alpha-ids.tgz} + resolution: {integrity: sha512-JoRTIDlwHZDPs7keNqgIU0MrximNBp+fJgAIZoRfwav8szwZz08PtN2HvqjTP1BZ8bFcnOkdlWJhZwvcHiPBsA==, tarball: file:projects/communication-alpha-ids.tgz} name: '@rush-temp/communication-alpha-ids' version: 0.0.0 dependencies: @@ -19542,7 +19574,7 @@ packages: dev: false file:projects/core-sse.tgz: - resolution: {integrity: sha512-EAxNqaujEkbx3igQiVu3RXXdE4owEiwiwS5+eeuI98VjbnysDkT9ckaOdJbUgel/CwOTEr8oz0JdDS1V36ngMw==, tarball: file:projects/core-sse.tgz} + resolution: {integrity: sha512-rxq/J1ftJ2e0MkPDv49RFsVQcu/68yCe6/h0R6+SdIkKBnhbYY12SkHzwOEOLFtemwLv+mh2SAqE6KHTYwJ8Lg==, tarball: file:projects/core-sse.tgz} name: '@rush-temp/core-sse' version: 0.0.0 dependencies: diff --git a/rush.json b/rush.json index b6f3ab160e70..9ca3b8328299 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -2306,6 +2306,11 @@ "packageName": "@azure/arm-containerorchestratorruntime", "projectFolder": "sdk/kubernetesruntime/arm-containerorchestratorruntime", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-impact", + "projectFolder": "sdk/impact/arm-impact", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/impact/arm-impact/CHANGELOG.md b/sdk/impact/arm-impact/CHANGELOG.md new file mode 100644 index 000000000000..3ca126d95dfc --- /dev/null +++ b/sdk/impact/arm-impact/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0-beta.1 (2024-11-08) + +### Features Added + +The package of @azure/arm-impact is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/impact/arm-impact/LICENSE b/sdk/impact/arm-impact/LICENSE new file mode 100644 index 000000000000..7d5934740965 --- /dev/null +++ b/sdk/impact/arm-impact/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 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/impact/arm-impact/README.md b/sdk/impact/arm-impact/README.md new file mode 100644 index 000000000000..f2c63ea5ea77 --- /dev/null +++ b/sdk/impact/arm-impact/README.md @@ -0,0 +1,109 @@ +# Azure MicrosoftImpact client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MicrosoftImpact client. + + + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/impact/arm-impact) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-impact) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-impact?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-impact` package + +Install the Azure MicrosoftImpact client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-impact +``` + +### Create and authenticate a `MicrosoftImpact` + +To create a client object to access the Azure MicrosoftImpact API, you will need the `endpoint` of your Azure MicrosoftImpact resource and a `credential`. The Azure MicrosoftImpact client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure MicrosoftImpact 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 MicrosoftImpact** 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 { MicrosoftImpact } = require("@azure/arm-impact"); +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 MicrosoftImpact(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new MicrosoftImpact(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 + +### MicrosoftImpact + +`MicrosoftImpact` is the primary interface for developers using the Azure MicrosoftImpact client library. Explore the methods on this client object to understand the different features of the Azure MicrosoftImpact 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%2Fimpact%2Farm-impact%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/impact/arm-impact/_meta.json b/sdk/impact/arm-impact/_meta.json new file mode 100644 index 000000000000..217bb6b3e821 --- /dev/null +++ b/sdk/impact/arm-impact/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "458771c3c4ec529beb8062ed137c384da4fccee1", + "readme": "specification/impact/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/impact/resource-manager/readme.md --use=@autorest/typescript@^6.0.12", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.16", + "use": "@autorest/typescript@^6.0.12" +} \ No newline at end of file diff --git a/sdk/impact/arm-impact/api-extractor.json b/sdk/impact/arm-impact/api-extractor.json new file mode 100644 index 000000000000..d3fb1c9c6257 --- /dev/null +++ b/sdk/impact/arm-impact/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-impact.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/impact/arm-impact/package.json b/sdk/impact/arm-impact/package.json new file mode 100644 index 000000000000..b6a5db4ef497 --- /dev/null +++ b/sdk/impact/arm-impact/package.json @@ -0,0 +1,110 @@ +{ + "name": "@azure/arm-impact", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for MicrosoftImpact.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^2.1.2", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.14.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-impact.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "mkdirp": "^3.0.1", + "typescript": "~5.5.3", + "uglify-js": "^3.4.9", + "rimraf": "^5.0.0", + "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/identity": "^4.2.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.1.0", + "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "tsx": "^4.7.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^18.0.0", + "ts-node": "^10.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", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && dev-tool run bundle && 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": "dev-tool run extract-api", + "lint": "echo skipped", + "clean": "rimraf --glob 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/microsoftImpact.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/impact/arm-impact" +} \ No newline at end of file diff --git a/sdk/impact/arm-impact/review/arm-impact.api.md b/sdk/impact/arm-impact/review/arm-impact.api.md new file mode 100644 index 000000000000..86c1551ec92b --- /dev/null +++ b/sdk/impact/arm-impact/review/arm-impact.api.md @@ -0,0 +1,637 @@ +## API Report File for "@azure/arm-impact" + +> 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 AdditionalField { + name: string; + value: string; +} + +// @public +export interface ClientIncidentDetails { + clientIncidentId?: string; + clientIncidentSource?: IncidentSource; +} + +// @public +export type ConfidenceLevel = string; + +// @public +export interface Connectivity { + port?: number; + protocol?: Protocol; + source?: SourceOrTarget; + target?: SourceOrTarget; +} + +// @public +export interface Connector extends ProxyResource { + properties?: ConnectorProperties; +} + +// @public +export interface ConnectorListResult { + nextLink?: string; + value: Connector[]; +} + +// @public +export interface ConnectorProperties { + readonly connectorId: string; + connectorType: Platform; + readonly lastRunTimeStamp: Date; + readonly provisioningState?: ProvisioningState; + readonly tenantId: string; +} + +// @public +export interface ConnectorPropertiesUpdate { + connectorType?: Platform; +} + +// @public +export interface Connectors { + beginCreateOrUpdate(connectorName: string, resource: Connector, options?: ConnectorsCreateOrUpdateOptionalParams): Promise, ConnectorsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(connectorName: string, resource: Connector, options?: ConnectorsCreateOrUpdateOptionalParams): Promise; + delete(connectorName: string, options?: ConnectorsDeleteOptionalParams): Promise; + get(connectorName: string, options?: ConnectorsGetOptionalParams): Promise; + listBySubscription(options?: ConnectorsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + update(connectorName: string, properties: ConnectorUpdate, options?: ConnectorsUpdateOptionalParams): Promise; +} + +// @public +export interface ConnectorsCreateOrUpdateHeaders { + azureAsyncOperation?: string; + retryAfter?: number; +} + +// @public +export interface ConnectorsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ConnectorsCreateOrUpdateResponse = Connector; + +// @public +export interface ConnectorsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ConnectorsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConnectorsGetResponse = Connector; + +// @public +export interface ConnectorsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConnectorsListBySubscriptionNextResponse = ConnectorListResult; + +// @public +export interface ConnectorsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConnectorsListBySubscriptionResponse = ConnectorListResult; + +// @public +export interface ConnectorsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConnectorsUpdateResponse = Connector; + +// @public +export interface ConnectorUpdate extends ProxyResource { + properties?: ConnectorPropertiesUpdate; +} + +// @public +export interface Content { + description: string; + title: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorDetailProperties { + errorCode?: string; + errorMessage?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface ExpectedValueRange { + max: number; + min: number; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface ImpactCategories { + get(impactCategoryName: string, options?: ImpactCategoriesGetOptionalParams): Promise; + listBySubscription(options?: ImpactCategoriesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ImpactCategoriesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ImpactCategoriesGetResponse = ImpactCategory; + +// @public +export interface ImpactCategoriesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ImpactCategoriesListBySubscriptionNextResponse = ImpactCategoryListResult; + +// @public +export interface ImpactCategoriesListBySubscriptionOptionalParams extends coreClient.OperationOptions { + categoryName?: string; + resourceType?: string; +} + +// @public +export type ImpactCategoriesListBySubscriptionResponse = ImpactCategoryListResult; + +// @public +export interface ImpactCategory extends ProxyResource { + properties?: ImpactCategoryProperties; +} + +// @public +export type ImpactCategoryEnum = string; + +// @public +export interface ImpactCategoryListResult { + nextLink?: string; + value: ImpactCategory[]; +} + +// @public +export interface ImpactCategoryProperties { + categoryId: string; + description?: string; + parentCategoryId?: string; + readonly provisioningState?: ProvisioningState; + requiredImpactProperties?: RequiredImpactProperties[]; +} + +// @public +export interface ImpactDetails { + endTime?: Date; + impactedResourceId: string; + impactId: string; + startTime: Date; +} + +// @public +export interface ImpactedResource { + impactedResourceId: string; +} + +// @public +export type IncidentSource = string; + +// @public +export interface Insight extends ProxyResource { + properties?: InsightProperties; +} + +// @public +export interface InsightCustomResourceCommonParameters { + apiVersion: string; + azureResourceId?: string; + provider: "Microsoft.Impact"; + subscriptionId: string; +} + +// @public +export interface InsightDetails { + azureResourceId?: string; +} + +// @public +export interface InsightListResult { + nextLink?: string; + value: Insight[]; +} + +// @public +export interface InsightProperties { + additionalDetails?: Record; + category: string; + content: Content; + eventId?: string; + eventTime?: Date; + groupId?: string; + impact: ImpactDetails; + insightUniqueId: string; + readonly provisioningState?: ProvisioningState; + status?: string; +} + +// @public +export interface Insights { + create(workloadImpactName: string, insightName: string, resource: Insight, options?: InsightsCreateOptionalParams): Promise; + delete(workloadImpactName: string, insightName: string, options?: InsightsDeleteOptionalParams): Promise; + get(workloadImpactName: string, insightName: string, options?: InsightsGetOptionalParams): Promise; + listBySubscription(workloadImpactName: string, options?: InsightsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface InsightsCreateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InsightsCreateResponse = Insight; + +// @public +export interface InsightsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface InsightsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InsightsGetResponse = Insight; + +// @public +export interface InsightsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InsightsListBySubscriptionNextResponse = InsightListResult; + +// @public +export interface InsightsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InsightsListBySubscriptionResponse = InsightListResult; + +// @public +export interface InsightUnderSubscription extends ProxyResource { + properties?: InsightProperties; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownConfidenceLevel { + High = "High", + Low = "Low", + Medium = "Medium" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownImpactCategoryEnum { + Availability = "Availability", + Other = "Other", + Performance = "Performance" +} + +// @public +export enum KnownIncidentSource { + AzureDevops = "AzureDevops", + ICM = "ICM", + Jira = "Jira", + Other = "Other", + ServiceNow = "ServiceNow" +} + +// @public +export enum KnownMetricUnit { + Bytes = "Bytes", + ByteSeconds = "ByteSeconds", + BytesPerSecond = "BytesPerSecond", + Cores = "Cores", + Count = "Count", + CountPerSecond = "CountPerSecond", + MilliCores = "MilliCores", + MilliSeconds = "MilliSeconds", + NanoCores = "NanoCores", + Other = "Other", + Percent = "Percent", + Seconds = "Seconds" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownPlatform { + AzureMonitor = "AzureMonitor" +} + +// @public +export enum KnownProtocol { + FTP = "FTP", + Http = "HTTP", + Https = "HTTPS", + Other = "Other", + RDP = "RDP", + SSH = "SSH", + TCP = "TCP", + UDP = "UDP" +} + +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownToolset { + Ansible = "Ansible", + ARM = "ARM", + Chef = "Chef", + Other = "Other", + Portal = "Portal", + Puppet = "Puppet", + SDK = "SDK", + Shell = "Shell", + Terraform = "Terraform" +} + +// @public +export type MetricUnit = string; + +// @public (undocumented) +export class MicrosoftImpact extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MicrosoftImpactOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + connectors: Connectors; + // (undocumented) + impactCategories: ImpactCategories; + // (undocumented) + insights: Insights; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; + // (undocumented) + workloadImpacts: WorkloadImpacts; +} + +// @public +export interface MicrosoftImpactOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @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 +interface Performance_2 { + actual?: number; + expected?: number; + expectedValueRange?: ExpectedValueRange; + metricName?: string; + unit?: MetricUnit; +} +export { Performance_2 as Performance } + +// @public +export type Platform = string; + +// @public +export type Protocol = string; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface RequiredImpactProperties { + allowedValues?: string[]; + name: string; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SourceOrTarget { + azureResourceId?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type Toolset = string; + +// @public +export interface Workload { + context?: string; + toolset?: Toolset; +} + +// @public +export interface WorkloadImpact extends ProxyResource { + properties?: WorkloadImpactProperties; +} + +// @public +export interface WorkloadImpactListResult { + nextLink?: string; + value: WorkloadImpact[]; +} + +// @public +export interface WorkloadImpactProperties { + additionalProperties?: Record; + armCorrelationIds?: string[]; + clientIncidentDetails?: ClientIncidentDetails; + confidenceLevel?: ConfidenceLevel; + connectivity?: Connectivity; + endDateTime?: Date; + errorDetails?: ErrorDetailProperties; + impactCategory: string; + impactDescription?: string; + impactedResourceId: string; + impactGroupId?: string; + readonly impactUniqueId?: string; + performance?: Performance_2[]; + readonly provisioningState?: ProvisioningState; + readonly reportedTimeUtc?: Date; + startDateTime: Date; + workload?: Workload; +} + +// @public +export interface WorkloadImpacts { + beginCreate(workloadImpactName: string, resource: WorkloadImpact, options?: WorkloadImpactsCreateOptionalParams): Promise, WorkloadImpactsCreateResponse>>; + beginCreateAndWait(workloadImpactName: string, resource: WorkloadImpact, options?: WorkloadImpactsCreateOptionalParams): Promise; + delete(workloadImpactName: string, options?: WorkloadImpactsDeleteOptionalParams): Promise; + get(workloadImpactName: string, options?: WorkloadImpactsGetOptionalParams): Promise; + listBySubscription(options?: WorkloadImpactsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface WorkloadImpactsCreateHeaders { + azureAsyncOperation?: string; + retryAfter?: number; +} + +// @public +export interface WorkloadImpactsCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type WorkloadImpactsCreateResponse = WorkloadImpact; + +// @public +export interface WorkloadImpactsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface WorkloadImpactsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkloadImpactsGetResponse = WorkloadImpact; + +// @public +export interface WorkloadImpactsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkloadImpactsListBySubscriptionNextResponse = WorkloadImpactListResult; + +// @public +export interface WorkloadImpactsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkloadImpactsListBySubscriptionResponse = WorkloadImpactListResult; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/impact/arm-impact/sample.env b/sdk/impact/arm-impact/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/impact/arm-impact/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/impact/arm-impact/src/index.ts b/sdk/impact/arm-impact/src/index.ts new file mode 100644 index 000000000000..6288aa2d8270 --- /dev/null +++ b/sdk/impact/arm-impact/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 { MicrosoftImpact } from "./microsoftImpact"; +export * from "./operationsInterfaces"; diff --git a/sdk/impact/arm-impact/src/lroImpl.ts b/sdk/impact/arm-impact/src/lroImpl.ts new file mode 100644 index 000000000000..5f88efab981b --- /dev/null +++ b/sdk/impact/arm-impact/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/impact/arm-impact/src/microsoftImpact.ts b/sdk/impact/arm-impact/src/microsoftImpact.ts new file mode 100644 index 000000000000..99e34a6aaee5 --- /dev/null +++ b/sdk/impact/arm-impact/src/microsoftImpact.ts @@ -0,0 +1,161 @@ +/* + * 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, + ConnectorsImpl, + ImpactCategoriesImpl, + WorkloadImpactsImpl, + InsightsImpl, +} from "./operations"; +import { + Operations, + Connectors, + ImpactCategories, + WorkloadImpacts, + Insights, +} from "./operationsInterfaces"; +import { MicrosoftImpactOptionalParams } from "./models"; + +export class MicrosoftImpact extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the MicrosoftImpact class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: MicrosoftImpactOptionalParams, + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: MicrosoftImpactOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials, + }; + + const packageDetails = `azsdk-js-arm-impact/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.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2024-05-01-preview"; + this.operations = new OperationsImpl(this); + this.connectors = new ConnectorsImpl(this); + this.impactCategories = new ImpactCategoriesImpl(this); + this.workloadImpacts = new WorkloadImpactsImpl(this); + this.insights = new InsightsImpl(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; + connectors: Connectors; + impactCategories: ImpactCategories; + workloadImpacts: WorkloadImpacts; + insights: Insights; +} diff --git a/sdk/impact/arm-impact/src/models/index.ts b/sdk/impact/arm-impact/src/models/index.ts new file mode 100644 index 000000000000..55e7f0ed4b87 --- /dev/null +++ b/sdk/impact/arm-impact/src/models/index.ts @@ -0,0 +1,952 @@ +/* + * 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 response of a Connector list operation. */ +export interface ConnectorListResult { + /** The Connector items on this page */ + value: Connector[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Details of the Connector. */ +export interface ConnectorProperties { + /** + * Resource provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * unique id of the connector. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly connectorId: string; + /** + * tenant id of this connector + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId: string; + /** connector type */ + connectorType: Platform; + /** + * last run time stamp of this connector in UTC time zone + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastRunTimeStamp: Date; +} + +/** 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; +} + +/** Details of the Connector. */ +export interface ConnectorPropertiesUpdate { + /** connector type */ + connectorType?: Platform; +} + +/** The response of a ImpactCategory list operation. */ +export interface ImpactCategoryListResult { + /** The ImpactCategory items on this page */ + value: ImpactCategory[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Impact category properties. */ +export interface ImpactCategoryProperties { + /** + * Resource provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Unique ID of the category */ + categoryId: string; + /** Unique ID of the parent category */ + parentCategoryId?: string; + /** Description of the category */ + description?: string; + /** The workloadImpact properties which are required when reporting with the impact category */ + requiredImpactProperties?: RequiredImpactProperties[]; +} + +/** Required impact properties */ +export interface RequiredImpactProperties { + /** Name of the property */ + name: string; + /** Allowed values values for the property */ + allowedValues?: string[]; +} + +/** The response of a WorkloadImpact list operation. */ +export interface WorkloadImpactListResult { + /** The WorkloadImpact items on this page */ + value: WorkloadImpact[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Workload impact properties */ +export interface WorkloadImpactProperties { + /** + * Resource provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Time at which impact was observed */ + startDateTime: Date; + /** Time at which impact has ended */ + endDateTime?: Date; + /** Azure resource id of the impacted resource */ + impactedResourceId: string; + /** + * Unique ID of the impact (UUID) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly impactUniqueId?: string; + /** + * Time at which impact is reported + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly reportedTimeUtc?: Date; + /** Category of the impact, details can found from /impactCategories API */ + impactCategory: string; + /** A detailed description of the impact */ + impactDescription?: string; + /** The ARM correlation ids, this is important field for control plane related impacts */ + armCorrelationIds?: string[]; + /** Details about performance issue. Applicable for performance impacts. */ + performance?: Performance[]; + /** Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about the network issue */ + connectivity?: Connectivity; + /** Additional fields related to impact, applicable fields per resource type are list under /impactCategories API */ + additionalProperties?: Record; + /** ARM error code and error message associated with the impact */ + errorDetails?: ErrorDetailProperties; + /** Information about the impacted workload */ + workload?: Workload; + /** Use this field to group impacts */ + impactGroupId?: string; + /** Degree of confidence on the impact being a platform issue */ + confidenceLevel?: ConfidenceLevel; + /** Client incident details ex: incidentId , incident source */ + clientIncidentDetails?: ClientIncidentDetails; +} + +/** Details about impacted performance metrics. Applicable for performance related impact */ +export interface Performance { + /** Name of the Metric examples: Disk, IOPs, CPU, GPU, Memory, details can be found from /impactCategories API */ + metricName?: string; + /** Threshold value for the metric */ + expected?: number; + /** Observed value for the metric */ + actual?: number; + /** Max and Min Threshold values for the metric */ + expectedValueRange?: ExpectedValueRange; + /** Unit of the metric ex: Bytes, Percentage, Count, Seconds, Milliseconds, Bytes/Second, Count/Second, etc.., Other */ + unit?: MetricUnit; +} + +/** Max and Min Threshold values for the metric */ +export interface ExpectedValueRange { + /** Min threshold value for the metric */ + min: number; + /** Max threshold value for the metric */ + max: number; +} + +/** Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource could be VM or the network. In such cases, the connectivity field will have the details about both VM and network. */ +export interface Connectivity { + /** Protocol used for the connection */ + protocol?: Protocol; + /** Port number for the connection */ + port?: number; + /** Source from which the connection was attempted */ + source?: SourceOrTarget; + /** target which connection was attempted */ + target?: SourceOrTarget; +} + +/** Resource details */ +export interface SourceOrTarget { + /** Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName} */ + azureResourceId?: string; +} + +/** ARM error code and error message associated with the impact */ +export interface ErrorDetailProperties { + /** ARM Error code associated with the impact. */ + errorCode?: string; + /** ARM Error Message associated with the impact */ + errorMessage?: string; +} + +/** Information about the impacted workload */ +export interface Workload { + /** the scenario for the workload */ + context?: string; + /** Tool used to interact with Azure. SDK, AzPortal, etc.., Other */ + toolset?: Toolset; +} + +/** Client incident details ex: incidentId , incident source */ +export interface ClientIncidentDetails { + /** Client incident id. ex : id of the incident created to investigate and address the impact if any. */ + clientIncidentId?: string; + /** Client incident source. ex : source system name where the incident is created */ + clientIncidentSource?: IncidentSource; +} + +/** The response of a Insight list operation. */ +export interface InsightListResult { + /** The Insight items on this page */ + value: Insight[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Impact category properties. */ +export interface InsightProperties { + /** + * Resource provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** category of the insight. */ + category: string; + /** status of the insight. example resolved, repaired, other. */ + status?: string; + /** Identifier of the event that has been correlated with this insight. This can be used to aggregate insights for the same event. */ + eventId?: string; + /** Identifier that can be used to group similar insights. */ + groupId?: string; + /** Contains title & description for the insight */ + content: Content; + /** Time of the event, which has been correlated the impact. */ + eventTime?: Date; + /** unique id of the insight. */ + insightUniqueId: string; + /** details of of the impact for which insight has been generated. */ + impact: ImpactDetails; + /** additional details of the insight. */ + additionalDetails?: Record; +} + +/** Article details of the insight like title, description etc */ +export interface Content { + /** Title of the insight */ + title: string; + /** Description of the insight */ + description: string; +} + +/** details of of the impact for which insight has been generated. */ +export interface ImpactDetails { + /** List of impacted Azure resources. */ + impactedResourceId: string; + /** Time at which impact was started according to reported impact. */ + startTime: Date; + /** Time at which impact was ended according to reported impact. */ + endTime?: Date; + /** Azure Id of the impact. */ + impactId: string; +} + +/** additional user defined field. */ +export interface AdditionalField { + /** name of the field. */ + name: string; + /** value of the field. */ + value: string; +} + +/** impacted azure resource id. */ +export interface ImpactedResource { + /** impacted azure resource id */ + impactedResourceId: string; +} + +/** context of post call for insight */ +export interface InsightCustomResourceCommonParameters { + /** The API version to use for this operation. */ + apiVersion: string; + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; + /** The provider namespace for the resource. */ + provider: "Microsoft.Impact"; + /** Filter by resource type */ + azureResourceId?: string; +} + +/** Body of the get all insights */ +export interface InsightDetails { + /** The ID of the azure resource. */ + azureResourceId?: 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 {} + +/** A connector is a resource that can be used to proactively report impacts against workloads in Azure to Microsoft. */ +export interface Connector extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: ConnectorProperties; +} + +/** A connector is a resource that can be used to proactively report impacts against workloads in Azure to Microsoft. */ +export interface ConnectorUpdate extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: ConnectorPropertiesUpdate; +} + +/** ImpactCategory resource */ +export interface ImpactCategory extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: ImpactCategoryProperties; +} + +/** Workload Impact properties */ +export interface WorkloadImpact extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: WorkloadImpactProperties; +} + +/** Insight resource */ +export interface Insight extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: InsightProperties; +} + +/** Insight resource */ +export interface InsightUnderSubscription extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: InsightProperties; +} + +/** Defines headers for Connectors_createOrUpdate operation. */ +export interface ConnectorsCreateOrUpdateHeaders { + /** A link to the status monitor */ + azureAsyncOperation?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for WorkloadImpacts_create operation. */ +export interface WorkloadImpactsCreateHeaders { + /** A link to the status monitor */ + azureAsyncOperation?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** 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 { + /** Provisioning Succeeded */ + Succeeded = "Succeeded", + /** Provisioning Failed */ + Failed = "Failed", + /** Provisioning 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**: Provisioning Succeeded \ + * **Failed**: Provisioning Failed \ + * **Canceled**: Provisioning Canceled + */ +export type ProvisioningState = string; + +/** Known values of {@link Platform} that the service accepts. */ +export enum KnownPlatform { + /** Type of Azure Monitor */ + AzureMonitor = "AzureMonitor", +} + +/** + * Defines values for Platform. \ + * {@link KnownPlatform} can be used interchangeably with Platform, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AzureMonitor**: Type of Azure Monitor + */ +export type Platform = 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; + +/** Known values of {@link MetricUnit} that the service accepts. */ +export enum KnownMetricUnit { + /** When measurement is in ByteSeconds */ + ByteSeconds = "ByteSeconds", + /** When measurement is in Bytes */ + Bytes = "Bytes", + /** When measurement is in BytesPerSecond */ + BytesPerSecond = "BytesPerSecond", + /** When measurement is in Cores */ + Cores = "Cores", + /** When measurement is in Count */ + Count = "Count", + /** When measurement is in CountPerSecond */ + CountPerSecond = "CountPerSecond", + /** When measurement is in MilliCores */ + MilliCores = "MilliCores", + /** When measurement is in MilliSeconds */ + MilliSeconds = "MilliSeconds", + /** When measurement is in NanoCores */ + NanoCores = "NanoCores", + /** When measurement is in Percent */ + Percent = "Percent", + /** When measurement is in Seconds */ + Seconds = "Seconds", + /** When measurement is in Other than listed */ + Other = "Other", +} + +/** + * Defines values for MetricUnit. \ + * {@link KnownMetricUnit} can be used interchangeably with MetricUnit, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ByteSeconds**: When measurement is in ByteSeconds \ + * **Bytes**: When measurement is in Bytes \ + * **BytesPerSecond**: When measurement is in BytesPerSecond \ + * **Cores**: When measurement is in Cores \ + * **Count**: When measurement is in Count \ + * **CountPerSecond**: When measurement is in CountPerSecond \ + * **MilliCores**: When measurement is in MilliCores \ + * **MilliSeconds**: When measurement is in MilliSeconds \ + * **NanoCores**: When measurement is in NanoCores \ + * **Percent**: When measurement is in Percent \ + * **Seconds**: When measurement is in Seconds \ + * **Other**: When measurement is in Other than listed + */ +export type MetricUnit = string; + +/** Known values of {@link Protocol} that the service accepts. */ +export enum KnownProtocol { + /** When communication protocol is TCP */ + TCP = "TCP", + /** When communication protocol is UDP */ + UDP = "UDP", + /** When communication protocol is HTTP */ + Http = "HTTP", + /** When communication protocol is HTTPS */ + Https = "HTTPS", + /** When communication protocol is RDP */ + RDP = "RDP", + /** When communication protocol is FTP */ + FTP = "FTP", + /** When communication protocol is SSH */ + SSH = "SSH", + /** When communication protocol is Other */ + Other = "Other", +} + +/** + * Defines values for Protocol. \ + * {@link KnownProtocol} can be used interchangeably with Protocol, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **TCP**: When communication protocol is TCP \ + * **UDP**: When communication protocol is UDP \ + * **HTTP**: When communication protocol is HTTP \ + * **HTTPS**: When communication protocol is HTTPS \ + * **RDP**: When communication protocol is RDP \ + * **FTP**: When communication protocol is FTP \ + * **SSH**: When communication protocol is SSH \ + * **Other**: When communication protocol is Other + */ +export type Protocol = string; + +/** Known values of {@link Toolset} that the service accepts. */ +export enum KnownToolset { + /** If communication toolset is Terraform */ + Terraform = "Terraform", + /** If communication toolset is Puppet */ + Puppet = "Puppet", + /** If communication toolset is Chef */ + Chef = "Chef", + /** If communication toolset is SDK */ + SDK = "SDK", + /** If communication toolset is Ansible */ + Ansible = "Ansible", + /** If communication toolset is ARM */ + ARM = "ARM", + /** If communication toolset is Portal */ + Portal = "Portal", + /** If communication toolset is Shell */ + Shell = "Shell", + /** If communication toolset is Other */ + Other = "Other", +} + +/** + * Defines values for Toolset. \ + * {@link KnownToolset} can be used interchangeably with Toolset, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Terraform**: If communication toolset is Terraform \ + * **Puppet**: If communication toolset is Puppet \ + * **Chef**: If communication toolset is Chef \ + * **SDK**: If communication toolset is SDK \ + * **Ansible**: If communication toolset is Ansible \ + * **ARM**: If communication toolset is ARM \ + * **Portal**: If communication toolset is Portal \ + * **Shell**: If communication toolset is Shell \ + * **Other**: If communication toolset is Other + */ +export type Toolset = string; + +/** Known values of {@link ConfidenceLevel} that the service accepts. */ +export enum KnownConfidenceLevel { + /** Low confidence on azure being the source of impact */ + Low = "Low", + /** Medium confidence on azure being the source of impact */ + Medium = "Medium", + /** High confidence on azure being the source of impact */ + High = "High", +} + +/** + * Defines values for ConfidenceLevel. \ + * {@link KnownConfidenceLevel} can be used interchangeably with ConfidenceLevel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Low**: Low confidence on azure being the source of impact \ + * **Medium**: Medium confidence on azure being the source of impact \ + * **High**: High confidence on azure being the source of impact + */ +export type ConfidenceLevel = string; + +/** Known values of {@link IncidentSource} that the service accepts. */ +export enum KnownIncidentSource { + /** When source of Incident is AzureDevops */ + AzureDevops = "AzureDevops", + /** When source of Incident is Microsoft ICM */ + ICM = "ICM", + /** When source of Incident is Jira */ + Jira = "Jira", + /** When source of Incident is ServiceNow */ + ServiceNow = "ServiceNow", + /** When source of Incident is Other */ + Other = "Other", +} + +/** + * Defines values for IncidentSource. \ + * {@link KnownIncidentSource} can be used interchangeably with IncidentSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AzureDevops**: When source of Incident is AzureDevops \ + * **ICM**: When source of Incident is Microsoft ICM \ + * **Jira**: When source of Incident is Jira \ + * **ServiceNow**: When source of Incident is ServiceNow \ + * **Other**: When source of Incident is Other + */ +export type IncidentSource = string; + +/** Known values of {@link ImpactCategoryEnum} that the service accepts. */ +export enum KnownImpactCategoryEnum { + /** Availability category */ + Availability = "Availability", + /** Performance category */ + Performance = "Performance", + /** Other category */ + Other = "Other", +} + +/** + * Defines values for ImpactCategoryEnum. \ + * {@link KnownImpactCategoryEnum} can be used interchangeably with ImpactCategoryEnum, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Availability**: Availability category \ + * **Performance**: Performance category \ + * **Other**: Other category + */ +export type ImpactCategoryEnum = 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 ConnectorsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type ConnectorsListBySubscriptionResponse = ConnectorListResult; + +/** Optional parameters. */ +export interface ConnectorsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ConnectorsGetResponse = Connector; + +/** Optional parameters. */ +export interface ConnectorsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type ConnectorsCreateOrUpdateResponse = Connector; + +/** Optional parameters. */ +export interface ConnectorsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ConnectorsUpdateResponse = Connector; + +/** Optional parameters. */ +export interface ConnectorsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ConnectorsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type ConnectorsListBySubscriptionNextResponse = ConnectorListResult; + +/** Optional parameters. */ +export interface ImpactCategoriesListBySubscriptionOptionalParams + extends coreClient.OperationOptions { + /** Filter by category name */ + categoryName?: string; + /** Filter by resource type */ + resourceType?: string; +} + +/** Contains response data for the listBySubscription operation. */ +export type ImpactCategoriesListBySubscriptionResponse = + ImpactCategoryListResult; + +/** Optional parameters. */ +export interface ImpactCategoriesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ImpactCategoriesGetResponse = ImpactCategory; + +/** Optional parameters. */ +export interface ImpactCategoriesListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type ImpactCategoriesListBySubscriptionNextResponse = + ImpactCategoryListResult; + +/** Optional parameters. */ +export interface WorkloadImpactsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type WorkloadImpactsListBySubscriptionResponse = + WorkloadImpactListResult; + +/** Optional parameters. */ +export interface WorkloadImpactsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type WorkloadImpactsGetResponse = WorkloadImpact; + +/** Optional parameters. */ +export interface WorkloadImpactsCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type WorkloadImpactsCreateResponse = WorkloadImpact; + +/** Optional parameters. */ +export interface WorkloadImpactsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface WorkloadImpactsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type WorkloadImpactsListBySubscriptionNextResponse = + WorkloadImpactListResult; + +/** Optional parameters. */ +export interface InsightsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type InsightsListBySubscriptionResponse = InsightListResult; + +/** Optional parameters. */ +export interface InsightsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type InsightsGetResponse = Insight; + +/** Optional parameters. */ +export interface InsightsCreateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the create operation. */ +export type InsightsCreateResponse = Insight; + +/** Optional parameters. */ +export interface InsightsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface InsightsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type InsightsListBySubscriptionNextResponse = InsightListResult; + +/** Optional parameters. */ +export interface MicrosoftImpactOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/impact/arm-impact/src/models/mappers.ts b/sdk/impact/arm-impact/src/models/mappers.ts new file mode 100644 index 000000000000..c0b1d5042363 --- /dev/null +++ b/sdk/impact/arm-impact/src/models/mappers.ts @@ -0,0 +1,1258 @@ +/* + * 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 ConnectorListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConnectorListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Connector", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ConnectorProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConnectorProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + connectorId: { + serializedName: "connectorId", + required: true, + readOnly: true, + type: { + name: "String", + }, + }, + tenantId: { + serializedName: "tenantId", + required: true, + readOnly: true, + type: { + name: "String", + }, + }, + connectorType: { + serializedName: "connectorType", + required: true, + type: { + name: "String", + }, + }, + lastRunTimeStamp: { + serializedName: "lastRunTimeStamp", + required: true, + readOnly: true, + type: { + name: "DateTime", + }, + }, + }, + }, +}; + +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 ConnectorPropertiesUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConnectorPropertiesUpdate", + modelProperties: { + connectorType: { + serializedName: "connectorType", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ImpactCategoryListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImpactCategoryListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ImpactCategory", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ImpactCategoryProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImpactCategoryProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + categoryId: { + constraints: { + Pattern: new RegExp( + "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", + ), + }, + serializedName: "categoryId", + required: true, + type: { + name: "String", + }, + }, + parentCategoryId: { + constraints: { + Pattern: new RegExp( + "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", + ), + }, + serializedName: "parentCategoryId", + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + type: { + name: "String", + }, + }, + requiredImpactProperties: { + serializedName: "requiredImpactProperties", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RequiredImpactProperties", + }, + }, + }, + }, + }, + }, +}; + +export const RequiredImpactProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RequiredImpactProperties", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String", + }, + }, + allowedValues: { + serializedName: "allowedValues", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + }, + }, +}; + +export const WorkloadImpactListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkloadImpactListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "WorkloadImpact", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const WorkloadImpactProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkloadImpactProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + startDateTime: { + serializedName: "startDateTime", + required: true, + type: { + name: "DateTime", + }, + }, + endDateTime: { + serializedName: "endDateTime", + type: { + name: "DateTime", + }, + }, + impactedResourceId: { + serializedName: "impactedResourceId", + required: true, + type: { + name: "String", + }, + }, + impactUniqueId: { + constraints: { + Pattern: new RegExp( + "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", + ), + }, + serializedName: "impactUniqueId", + readOnly: true, + type: { + name: "String", + }, + }, + reportedTimeUtc: { + serializedName: "reportedTimeUtc", + readOnly: true, + type: { + name: "DateTime", + }, + }, + impactCategory: { + serializedName: "impactCategory", + required: true, + type: { + name: "String", + }, + }, + impactDescription: { + serializedName: "impactDescription", + type: { + name: "String", + }, + }, + armCorrelationIds: { + serializedName: "armCorrelationIds", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + performance: { + serializedName: "performance", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Performance", + }, + }, + }, + }, + connectivity: { + serializedName: "connectivity", + type: { + name: "Composite", + className: "Connectivity", + }, + }, + additionalProperties: { + serializedName: "additionalProperties", + type: { + name: "Dictionary", + value: { type: { name: "any" } }, + }, + }, + errorDetails: { + serializedName: "errorDetails", + type: { + name: "Composite", + className: "ErrorDetailProperties", + }, + }, + workload: { + serializedName: "workload", + type: { + name: "Composite", + className: "Workload", + }, + }, + impactGroupId: { + serializedName: "impactGroupId", + type: { + name: "String", + }, + }, + confidenceLevel: { + serializedName: "confidenceLevel", + type: { + name: "String", + }, + }, + clientIncidentDetails: { + serializedName: "clientIncidentDetails", + type: { + name: "Composite", + className: "ClientIncidentDetails", + }, + }, + }, + }, +}; + +export const Performance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Performance", + modelProperties: { + metricName: { + serializedName: "metricName", + type: { + name: "String", + }, + }, + expected: { + serializedName: "expected", + type: { + name: "Number", + }, + }, + actual: { + serializedName: "actual", + type: { + name: "Number", + }, + }, + expectedValueRange: { + serializedName: "expectedValueRange", + type: { + name: "Composite", + className: "ExpectedValueRange", + }, + }, + unit: { + serializedName: "unit", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ExpectedValueRange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExpectedValueRange", + modelProperties: { + min: { + serializedName: "min", + required: true, + type: { + name: "Number", + }, + }, + max: { + serializedName: "max", + required: true, + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const Connectivity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Connectivity", + modelProperties: { + protocol: { + serializedName: "protocol", + type: { + name: "String", + }, + }, + port: { + serializedName: "port", + type: { + name: "Number", + }, + }, + source: { + serializedName: "source", + type: { + name: "Composite", + className: "SourceOrTarget", + }, + }, + target: { + serializedName: "target", + type: { + name: "Composite", + className: "SourceOrTarget", + }, + }, + }, + }, +}; + +export const SourceOrTarget: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SourceOrTarget", + modelProperties: { + azureResourceId: { + constraints: { + Pattern: new RegExp("(\\/[0-9a-zA-Z]+)*"), + }, + serializedName: "azureResourceId", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ErrorDetailProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetailProperties", + modelProperties: { + errorCode: { + serializedName: "errorCode", + type: { + name: "String", + }, + }, + errorMessage: { + serializedName: "errorMessage", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const Workload: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Workload", + modelProperties: { + context: { + serializedName: "context", + type: { + name: "String", + }, + }, + toolset: { + serializedName: "toolset", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ClientIncidentDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientIncidentDetails", + modelProperties: { + clientIncidentId: { + serializedName: "clientIncidentId", + type: { + name: "String", + }, + }, + clientIncidentSource: { + serializedName: "clientIncidentSource", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const InsightListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InsightListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Insight", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const InsightProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InsightProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + category: { + serializedName: "category", + required: true, + type: { + name: "String", + }, + }, + status: { + serializedName: "status", + type: { + name: "String", + }, + }, + eventId: { + serializedName: "eventId", + type: { + name: "String", + }, + }, + groupId: { + serializedName: "groupId", + type: { + name: "String", + }, + }, + content: { + serializedName: "content", + type: { + name: "Composite", + className: "Content", + }, + }, + eventTime: { + serializedName: "eventTime", + type: { + name: "DateTime", + }, + }, + insightUniqueId: { + serializedName: "insightUniqueId", + required: true, + type: { + name: "String", + }, + }, + impact: { + serializedName: "impact", + type: { + name: "Composite", + className: "ImpactDetails", + }, + }, + additionalDetails: { + serializedName: "additionalDetails", + type: { + name: "Dictionary", + value: { type: { name: "any" } }, + }, + }, + }, + }, +}; + +export const Content: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Content", + modelProperties: { + title: { + serializedName: "title", + required: true, + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ImpactDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImpactDetails", + modelProperties: { + impactedResourceId: { + serializedName: "impactedResourceId", + required: true, + type: { + name: "String", + }, + }, + startTime: { + serializedName: "startTime", + required: true, + type: { + name: "DateTime", + }, + }, + endTime: { + serializedName: "endTime", + type: { + name: "DateTime", + }, + }, + impactId: { + serializedName: "impactId", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const AdditionalField: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AdditionalField", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String", + }, + }, + value: { + serializedName: "value", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ImpactedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImpactedResource", + modelProperties: { + impactedResourceId: { + serializedName: "impactedResourceId", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const InsightCustomResourceCommonParameters: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "InsightCustomResourceCommonParameters", + modelProperties: { + apiVersion: { + constraints: { + MinLength: 1, + }, + serializedName: "apiVersion", + required: true, + type: { + name: "String", + }, + }, + subscriptionId: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String", + }, + }, + provider: { + defaultValue: "Microsoft.Impact", + isConstant: true, + serializedName: "provider", + type: { + name: "String", + }, + }, + azureResourceId: { + constraints: { + MinLength: 1, + }, + serializedName: "azureResourceId", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const InsightDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InsightDetails", + modelProperties: { + azureResourceId: { + serializedName: "azureResourceId", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties, + }, + }, +}; + +export const Connector: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Connector", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ConnectorProperties", + }, + }, + }, + }, +}; + +export const ConnectorUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConnectorUpdate", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ConnectorPropertiesUpdate", + }, + }, + }, + }, +}; + +export const ImpactCategory: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImpactCategory", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ImpactCategoryProperties", + }, + }, + }, + }, +}; + +export const WorkloadImpact: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkloadImpact", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "WorkloadImpactProperties", + }, + }, + }, + }, +}; + +export const Insight: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Insight", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "InsightProperties", + }, + }, + }, + }, +}; + +export const InsightUnderSubscription: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InsightUnderSubscription", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "InsightProperties", + }, + }, + }, + }, +}; + +export const ConnectorsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConnectorsCreateOrUpdateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const WorkloadImpactsCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkloadImpactsCreateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; diff --git a/sdk/impact/arm-impact/src/models/parameters.ts b/sdk/impact/arm-impact/src/models/parameters.ts new file mode 100644 index 000000000000..9c08cd7ba6da --- /dev/null +++ b/sdk/impact/arm-impact/src/models/parameters.ts @@ -0,0 +1,196 @@ +/* + * 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 { + Connector as ConnectorMapper, + ConnectorUpdate as ConnectorUpdateMapper, + WorkloadImpact as WorkloadImpactMapper, + Insight as InsightMapper, +} 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: "2024-05-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 subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1, + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String", + }, + }, +}; + +export const connectorName: OperationURLParameter = { + parameterPath: "connectorName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9-]{3,24}$"), + }, + serializedName: "connectorName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String", + }, + }, +}; + +export const resource: OperationParameter = { + parameterPath: "resource", + mapper: ConnectorMapper, +}; + +export const properties: OperationParameter = { + parameterPath: "properties", + mapper: ConnectorUpdateMapper, +}; + +export const categoryName: OperationQueryParameter = { + parameterPath: ["options", "categoryName"], + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9.]*[a-zA-Z0-9]{3,180}$"), + MinLength: 1, + }, + serializedName: "categoryName", + type: { + name: "String", + }, + }, +}; + +export const resourceType: OperationQueryParameter = { + parameterPath: ["options", "resourceType"], + mapper: { + constraints: { + MinLength: 1, + }, + serializedName: "resourceType", + type: { + name: "String", + }, + }, +}; + +export const impactCategoryName: OperationURLParameter = { + parameterPath: "impactCategoryName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9.]*[a-zA-Z0-9]{3,180}$"), + }, + serializedName: "impactCategoryName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const workloadImpactName: OperationURLParameter = { + parameterPath: "workloadImpactName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9-:]*[a-zA-Z0-9]{3,120}$"), + }, + serializedName: "workloadImpactName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource1: OperationParameter = { + parameterPath: "resource", + mapper: WorkloadImpactMapper, +}; + +export const insightName: OperationURLParameter = { + parameterPath: "insightName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9.]*[a-zA-Z0-9]{3,180}$"), + }, + serializedName: "insightName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource2: OperationParameter = { + parameterPath: "resource", + mapper: InsightMapper, +}; diff --git a/sdk/impact/arm-impact/src/operations/connectors.ts b/sdk/impact/arm-impact/src/operations/connectors.ts new file mode 100644 index 000000000000..c1e752eac0cf --- /dev/null +++ b/sdk/impact/arm-impact/src/operations/connectors.ts @@ -0,0 +1,399 @@ +/* + * 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 { Connectors } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftImpact } from "../microsoftImpact"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + Connector, + ConnectorsListBySubscriptionNextOptionalParams, + ConnectorsListBySubscriptionOptionalParams, + ConnectorsListBySubscriptionResponse, + ConnectorsGetOptionalParams, + ConnectorsGetResponse, + ConnectorsCreateOrUpdateOptionalParams, + ConnectorsCreateOrUpdateResponse, + ConnectorUpdate, + ConnectorsUpdateOptionalParams, + ConnectorsUpdateResponse, + ConnectorsDeleteOptionalParams, + ConnectorsListBySubscriptionNextResponse, +} from "../models"; + +/// +/** Class containing Connectors operations. */ +export class ConnectorsImpl implements Connectors { + private readonly client: MicrosoftImpact; + + /** + * Initialize a new instance of the class Connectors class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftImpact) { + this.client = client; + } + + /** + * List Connector resources by subscription ID + * @param options The options parameters. + */ + public listBySubscription( + options?: ConnectorsListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(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.listBySubscriptionPagingPage(options, settings); + }, + }; + } + + private async *listBySubscriptionPagingPage( + options?: ConnectorsListBySubscriptionOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: ConnectorsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionPagingAll( + options?: ConnectorsListBySubscriptionOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * List Connector resources by subscription ID + * @param options The options parameters. + */ + private _listBySubscription( + options?: ConnectorsListBySubscriptionOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec, + ); + } + + /** + * Get a Connector + * @param connectorName The name of the connector + * @param options The options parameters. + */ + get( + connectorName: string, + options?: ConnectorsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { connectorName, options }, + getOperationSpec, + ); + } + + /** + * Create a Connector + * @param connectorName The name of the connector + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + connectorName: string, + resource: Connector, + options?: ConnectorsCreateOrUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + ConnectorsCreateOrUpdateResponse + > + > { + 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: { connectorName, resource, options }, + spec: createOrUpdateOperationSpec, + }); + const poller = await createHttpPoller< + ConnectorsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Create a Connector + * @param connectorName The name of the connector + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + connectorName: string, + resource: Connector, + options?: ConnectorsCreateOrUpdateOptionalParams, + ): Promise { + const poller = await this.beginCreateOrUpdate( + connectorName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Update a Connector + * @param connectorName The name of the connector + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + connectorName: string, + properties: ConnectorUpdate, + options?: ConnectorsUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { connectorName, properties, options }, + updateOperationSpec, + ); + } + + /** + * Delete a Connector + * @param connectorName The name of the connector + * @param options The options parameters. + */ + delete( + connectorName: string, + options?: ConnectorsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { connectorName, options }, + deleteOperationSpec, + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: ConnectorsListBySubscriptionNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConnectorListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Connector, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.connectorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Connector, + }, + 201: { + bodyMapper: Mappers.Connector, + }, + 202: { + bodyMapper: Mappers.Connector, + }, + 204: { + bodyMapper: Mappers.Connector, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.connectorName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Connector, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.properties, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.connectorName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.connectorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConnectorListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/impact/arm-impact/src/operations/impactCategories.ts b/sdk/impact/arm-impact/src/operations/impactCategories.ts new file mode 100644 index 000000000000..17502dbcc8fd --- /dev/null +++ b/sdk/impact/arm-impact/src/operations/impactCategories.ts @@ -0,0 +1,197 @@ +/* + * 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 { ImpactCategories } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftImpact } from "../microsoftImpact"; +import { + ImpactCategory, + ImpactCategoriesListBySubscriptionNextOptionalParams, + ImpactCategoriesListBySubscriptionOptionalParams, + ImpactCategoriesListBySubscriptionResponse, + ImpactCategoriesGetOptionalParams, + ImpactCategoriesGetResponse, + ImpactCategoriesListBySubscriptionNextResponse, +} from "../models"; + +/// +/** Class containing ImpactCategories operations. */ +export class ImpactCategoriesImpl implements ImpactCategories { + private readonly client: MicrosoftImpact; + + /** + * Initialize a new instance of the class ImpactCategories class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftImpact) { + this.client = client; + } + + /** + * List ImpactCategory resources by subscription + * @param options The options parameters. + */ + public listBySubscription( + options?: ImpactCategoriesListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(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.listBySubscriptionPagingPage(options, settings); + }, + }; + } + + private async *listBySubscriptionPagingPage( + options?: ImpactCategoriesListBySubscriptionOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: ImpactCategoriesListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionPagingAll( + options?: ImpactCategoriesListBySubscriptionOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * List ImpactCategory resources by subscription + * @param options The options parameters. + */ + private _listBySubscription( + options?: ImpactCategoriesListBySubscriptionOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec, + ); + } + + /** + * Get a ImpactCategory + * @param impactCategoryName Name of the impact category + * @param options The options parameters. + */ + get( + impactCategoryName: string, + options?: ImpactCategoriesGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { impactCategoryName, options }, + getOperationSpec, + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: ImpactCategoriesListBySubscriptionNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ImpactCategoryListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.categoryName, + Parameters.resourceType, + ], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ImpactCategory, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.impactCategoryName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ImpactCategoryListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/impact/arm-impact/src/operations/index.ts b/sdk/impact/arm-impact/src/operations/index.ts new file mode 100644 index 000000000000..dca68985c2cb --- /dev/null +++ b/sdk/impact/arm-impact/src/operations/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 * from "./operations"; +export * from "./connectors"; +export * from "./impactCategories"; +export * from "./workloadImpacts"; +export * from "./insights"; diff --git a/sdk/impact/arm-impact/src/operations/insights.ts b/sdk/impact/arm-impact/src/operations/insights.ts new file mode 100644 index 000000000000..4541d9e6e5ff --- /dev/null +++ b/sdk/impact/arm-impact/src/operations/insights.ts @@ -0,0 +1,305 @@ +/* + * 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 { Insights } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftImpact } from "../microsoftImpact"; +import { + Insight, + InsightsListBySubscriptionNextOptionalParams, + InsightsListBySubscriptionOptionalParams, + InsightsListBySubscriptionResponse, + InsightsGetOptionalParams, + InsightsGetResponse, + InsightsCreateOptionalParams, + InsightsCreateResponse, + InsightsDeleteOptionalParams, + InsightsListBySubscriptionNextResponse, +} from "../models"; + +/// +/** Class containing Insights operations. */ +export class InsightsImpl implements Insights { + private readonly client: MicrosoftImpact; + + /** + * Initialize a new instance of the class Insights class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftImpact) { + this.client = client; + } + + /** + * List Insight resources by workloadImpactName + * @param workloadImpactName workloadImpact resource + * @param options The options parameters. + */ + public listBySubscription( + workloadImpactName: string, + options?: InsightsListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(workloadImpactName, 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.listBySubscriptionPagingPage( + workloadImpactName, + options, + settings, + ); + }, + }; + } + + private async *listBySubscriptionPagingPage( + workloadImpactName: string, + options?: InsightsListBySubscriptionOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: InsightsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(workloadImpactName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionNext( + workloadImpactName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionPagingAll( + workloadImpactName: string, + options?: InsightsListBySubscriptionOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage( + workloadImpactName, + options, + )) { + yield* page; + } + } + + /** + * List Insight resources by workloadImpactName + * @param workloadImpactName workloadImpact resource + * @param options The options parameters. + */ + private _listBySubscription( + workloadImpactName: string, + options?: InsightsListBySubscriptionOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { workloadImpactName, options }, + listBySubscriptionOperationSpec, + ); + } + + /** + * Get Insight resources by workloadImpactName and insightName + * @param workloadImpactName workloadImpact resource + * @param insightName Name of the insight + * @param options The options parameters. + */ + get( + workloadImpactName: string, + insightName: string, + options?: InsightsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { workloadImpactName, insightName, options }, + getOperationSpec, + ); + } + + /** + * Create Insight resource, This is Admin only operation + * @param workloadImpactName workloadImpact resource + * @param insightName Name of the insight + * @param resource Resource create parameters. + * @param options The options parameters. + */ + create( + workloadImpactName: string, + insightName: string, + resource: Insight, + options?: InsightsCreateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { workloadImpactName, insightName, resource, options }, + createOperationSpec, + ); + } + + /** + * Delete Insight resource, This is Admin only operation + * @param workloadImpactName workloadImpact resource + * @param insightName Name of the insight + * @param options The options parameters. + */ + delete( + workloadImpactName: string, + insightName: string, + options?: InsightsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { workloadImpactName, insightName, options }, + deleteOperationSpec, + ); + } + + /** + * ListBySubscriptionNext + * @param workloadImpactName workloadImpact resource + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + workloadImpactName: string, + nextLink: string, + options?: InsightsListBySubscriptionNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { workloadImpactName, nextLink, options }, + listBySubscriptionNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.InsightListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.workloadImpactName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Insight, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.workloadImpactName, + Parameters.insightName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Insight, + }, + 201: { + bodyMapper: Mappers.Insight, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.workloadImpactName, + Parameters.insightName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.workloadImpactName, + Parameters.insightName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.InsightListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.workloadImpactName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/impact/arm-impact/src/operations/operations.ts b/sdk/impact/arm-impact/src/operations/operations.ts new file mode 100644 index 000000000000..9ff5dc33ebca --- /dev/null +++ b/sdk/impact/arm-impact/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 { MicrosoftImpact } from "../microsoftImpact"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse, +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: MicrosoftImpact; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftImpact) { + this.client = client; + } + + /** + * List the operations for the provider + * @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; + } + } + + /** + * List the operations for the provider + * @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.Impact/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/impact/arm-impact/src/operations/workloadImpacts.ts b/sdk/impact/arm-impact/src/operations/workloadImpacts.ts new file mode 100644 index 000000000000..db673c6f3450 --- /dev/null +++ b/sdk/impact/arm-impact/src/operations/workloadImpacts.ts @@ -0,0 +1,357 @@ +/* + * 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 { WorkloadImpacts } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftImpact } from "../microsoftImpact"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + WorkloadImpact, + WorkloadImpactsListBySubscriptionNextOptionalParams, + WorkloadImpactsListBySubscriptionOptionalParams, + WorkloadImpactsListBySubscriptionResponse, + WorkloadImpactsGetOptionalParams, + WorkloadImpactsGetResponse, + WorkloadImpactsCreateOptionalParams, + WorkloadImpactsCreateResponse, + WorkloadImpactsDeleteOptionalParams, + WorkloadImpactsListBySubscriptionNextResponse, +} from "../models"; + +/// +/** Class containing WorkloadImpacts operations. */ +export class WorkloadImpactsImpl implements WorkloadImpacts { + private readonly client: MicrosoftImpact; + + /** + * Initialize a new instance of the class WorkloadImpacts class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftImpact) { + this.client = client; + } + + /** + * List WorkloadImpact resources by subscription ID + * @param options The options parameters. + */ + public listBySubscription( + options?: WorkloadImpactsListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(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.listBySubscriptionPagingPage(options, settings); + }, + }; + } + + private async *listBySubscriptionPagingPage( + options?: WorkloadImpactsListBySubscriptionOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: WorkloadImpactsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionPagingAll( + options?: WorkloadImpactsListBySubscriptionOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * List WorkloadImpact resources by subscription ID + * @param options The options parameters. + */ + private _listBySubscription( + options?: WorkloadImpactsListBySubscriptionOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec, + ); + } + + /** + * Get a WorkloadImpact + * @param workloadImpactName workloadImpact resource + * @param options The options parameters. + */ + get( + workloadImpactName: string, + options?: WorkloadImpactsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { workloadImpactName, options }, + getOperationSpec, + ); + } + + /** + * Create a WorkloadImpact + * @param workloadImpactName workloadImpact resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreate( + workloadImpactName: string, + resource: WorkloadImpact, + options?: WorkloadImpactsCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + WorkloadImpactsCreateResponse + > + > { + 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: { workloadImpactName, resource, options }, + spec: createOperationSpec, + }); + const poller = await createHttpPoller< + WorkloadImpactsCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Create a WorkloadImpact + * @param workloadImpactName workloadImpact resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateAndWait( + workloadImpactName: string, + resource: WorkloadImpact, + options?: WorkloadImpactsCreateOptionalParams, + ): Promise { + const poller = await this.beginCreate( + workloadImpactName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Delete a WorkloadImpact + * @param workloadImpactName workloadImpact resource + * @param options The options parameters. + */ + delete( + workloadImpactName: string, + options?: WorkloadImpactsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { workloadImpactName, options }, + deleteOperationSpec, + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: WorkloadImpactsListBySubscriptionNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkloadImpactListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkloadImpact, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.workloadImpactName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.WorkloadImpact, + }, + 201: { + bodyMapper: Mappers.WorkloadImpact, + }, + 202: { + bodyMapper: Mappers.WorkloadImpact, + }, + 204: { + bodyMapper: Mappers.WorkloadImpact, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.workloadImpactName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.workloadImpactName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkloadImpactListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/impact/arm-impact/src/operationsInterfaces/connectors.ts b/sdk/impact/arm-impact/src/operationsInterfaces/connectors.ts new file mode 100644 index 000000000000..19bb4a91138c --- /dev/null +++ b/sdk/impact/arm-impact/src/operationsInterfaces/connectors.ts @@ -0,0 +1,90 @@ +/* + * 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 { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + Connector, + ConnectorsListBySubscriptionOptionalParams, + ConnectorsGetOptionalParams, + ConnectorsGetResponse, + ConnectorsCreateOrUpdateOptionalParams, + ConnectorsCreateOrUpdateResponse, + ConnectorUpdate, + ConnectorsUpdateOptionalParams, + ConnectorsUpdateResponse, + ConnectorsDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a Connectors. */ +export interface Connectors { + /** + * List Connector resources by subscription ID + * @param options The options parameters. + */ + listBySubscription( + options?: ConnectorsListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Get a Connector + * @param connectorName The name of the connector + * @param options The options parameters. + */ + get( + connectorName: string, + options?: ConnectorsGetOptionalParams, + ): Promise; + /** + * Create a Connector + * @param connectorName The name of the connector + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + connectorName: string, + resource: Connector, + options?: ConnectorsCreateOrUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + ConnectorsCreateOrUpdateResponse + > + >; + /** + * Create a Connector + * @param connectorName The name of the connector + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + connectorName: string, + resource: Connector, + options?: ConnectorsCreateOrUpdateOptionalParams, + ): Promise; + /** + * Update a Connector + * @param connectorName The name of the connector + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + connectorName: string, + properties: ConnectorUpdate, + options?: ConnectorsUpdateOptionalParams, + ): Promise; + /** + * Delete a Connector + * @param connectorName The name of the connector + * @param options The options parameters. + */ + delete( + connectorName: string, + options?: ConnectorsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/impact/arm-impact/src/operationsInterfaces/impactCategories.ts b/sdk/impact/arm-impact/src/operationsInterfaces/impactCategories.ts new file mode 100644 index 000000000000..7db5ec492418 --- /dev/null +++ b/sdk/impact/arm-impact/src/operationsInterfaces/impactCategories.ts @@ -0,0 +1,36 @@ +/* + * 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 { + ImpactCategory, + ImpactCategoriesListBySubscriptionOptionalParams, + ImpactCategoriesGetOptionalParams, + ImpactCategoriesGetResponse, +} from "../models"; + +/// +/** Interface representing a ImpactCategories. */ +export interface ImpactCategories { + /** + * List ImpactCategory resources by subscription + * @param options The options parameters. + */ + listBySubscription( + options?: ImpactCategoriesListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Get a ImpactCategory + * @param impactCategoryName Name of the impact category + * @param options The options parameters. + */ + get( + impactCategoryName: string, + options?: ImpactCategoriesGetOptionalParams, + ): Promise; +} diff --git a/sdk/impact/arm-impact/src/operationsInterfaces/index.ts b/sdk/impact/arm-impact/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..dca68985c2cb --- /dev/null +++ b/sdk/impact/arm-impact/src/operationsInterfaces/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 * from "./operations"; +export * from "./connectors"; +export * from "./impactCategories"; +export * from "./workloadImpacts"; +export * from "./insights"; diff --git a/sdk/impact/arm-impact/src/operationsInterfaces/insights.ts b/sdk/impact/arm-impact/src/operationsInterfaces/insights.ts new file mode 100644 index 000000000000..5fb3e9cb9d96 --- /dev/null +++ b/sdk/impact/arm-impact/src/operationsInterfaces/insights.ts @@ -0,0 +1,67 @@ +/* + * 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 { + Insight, + InsightsListBySubscriptionOptionalParams, + InsightsGetOptionalParams, + InsightsGetResponse, + InsightsCreateOptionalParams, + InsightsCreateResponse, + InsightsDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a Insights. */ +export interface Insights { + /** + * List Insight resources by workloadImpactName + * @param workloadImpactName workloadImpact resource + * @param options The options parameters. + */ + listBySubscription( + workloadImpactName: string, + options?: InsightsListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Get Insight resources by workloadImpactName and insightName + * @param workloadImpactName workloadImpact resource + * @param insightName Name of the insight + * @param options The options parameters. + */ + get( + workloadImpactName: string, + insightName: string, + options?: InsightsGetOptionalParams, + ): Promise; + /** + * Create Insight resource, This is Admin only operation + * @param workloadImpactName workloadImpact resource + * @param insightName Name of the insight + * @param resource Resource create parameters. + * @param options The options parameters. + */ + create( + workloadImpactName: string, + insightName: string, + resource: Insight, + options?: InsightsCreateOptionalParams, + ): Promise; + /** + * Delete Insight resource, This is Admin only operation + * @param workloadImpactName workloadImpact resource + * @param insightName Name of the insight + * @param options The options parameters. + */ + delete( + workloadImpactName: string, + insightName: string, + options?: InsightsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/impact/arm-impact/src/operationsInterfaces/operations.ts b/sdk/impact/arm-impact/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..251f5f582e64 --- /dev/null +++ b/sdk/impact/arm-impact/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 { + /** + * List the operations for the provider + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator; +} diff --git a/sdk/impact/arm-impact/src/operationsInterfaces/workloadImpacts.ts b/sdk/impact/arm-impact/src/operationsInterfaces/workloadImpacts.ts new file mode 100644 index 000000000000..78bec0ce64d5 --- /dev/null +++ b/sdk/impact/arm-impact/src/operationsInterfaces/workloadImpacts.ts @@ -0,0 +1,76 @@ +/* + * 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 { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + WorkloadImpact, + WorkloadImpactsListBySubscriptionOptionalParams, + WorkloadImpactsGetOptionalParams, + WorkloadImpactsGetResponse, + WorkloadImpactsCreateOptionalParams, + WorkloadImpactsCreateResponse, + WorkloadImpactsDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a WorkloadImpacts. */ +export interface WorkloadImpacts { + /** + * List WorkloadImpact resources by subscription ID + * @param options The options parameters. + */ + listBySubscription( + options?: WorkloadImpactsListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Get a WorkloadImpact + * @param workloadImpactName workloadImpact resource + * @param options The options parameters. + */ + get( + workloadImpactName: string, + options?: WorkloadImpactsGetOptionalParams, + ): Promise; + /** + * Create a WorkloadImpact + * @param workloadImpactName workloadImpact resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreate( + workloadImpactName: string, + resource: WorkloadImpact, + options?: WorkloadImpactsCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + WorkloadImpactsCreateResponse + > + >; + /** + * Create a WorkloadImpact + * @param workloadImpactName workloadImpact resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateAndWait( + workloadImpactName: string, + resource: WorkloadImpact, + options?: WorkloadImpactsCreateOptionalParams, + ): Promise; + /** + * Delete a WorkloadImpact + * @param workloadImpactName workloadImpact resource + * @param options The options parameters. + */ + delete( + workloadImpactName: string, + options?: WorkloadImpactsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/impact/arm-impact/src/pagingHelper.ts b/sdk/impact/arm-impact/src/pagingHelper.ts new file mode 100644 index 000000000000..205cccc26592 --- /dev/null +++ b/sdk/impact/arm-impact/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/impact/arm-impact/test/sampleTest.ts b/sdk/impact/arm-impact/test/sampleTest.ts new file mode 100644 index 000000000000..d64be981b694 --- /dev/null +++ b/sdk/impact/arm-impact/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/impact/arm-impact/tsconfig.json b/sdk/impact/arm-impact/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/impact/arm-impact/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/impact/ci.mgmt.yml b/sdk/impact/ci.mgmt.yml new file mode 100644 index 000000000000..8bc17f3675f8 --- /dev/null +++ b/sdk/impact/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/impact/arm-impact + - sdk/impact/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/impact/arm-impact + - sdk/impact/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: impact + Artifacts: + - name: azure-arm-impact + safeName: azurearmimpact + \ No newline at end of file