From b3b524e0a63aa3d665842d14b3028641be216495 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 18 Nov 2024 05:11:00 +0000 Subject: [PATCH] CodeGen from PR 31129 in Azure/azure-rest-api-specs Merge 4d908f613fcbbbc00a5805a6c0f8cfb2d55c97c8 into 297c3a012316e290e6a6ab737ec8944611554542 --- common/config/rush/pnpm-lock.yaml | 72 +- rush.json | 9 +- sdk/workloads/ci.mgmt.yml | 4 + sdk/workloads/sapmonitors/CHANGELOG.md | 7 + sdk/workloads/sapmonitors/LICENSE | 21 + sdk/workloads/sapmonitors/README.md | 109 + sdk/workloads/sapmonitors/_meta.json | 8 + sdk/workloads/sapmonitors/api-extractor.json | 31 + sdk/workloads/sapmonitors/package.json | 109 + .../review/arm-workloads-sapmonitors.api.md | 900 ++++++++ sdk/workloads/sapmonitors/sample.env | 1 + sdk/workloads/sapmonitors/src/index.ts | 13 + sdk/workloads/sapmonitors/src/lroImpl.ts | 42 + sdk/workloads/sapmonitors/src/models/index.ts | 1398 ++++++++++++ .../sapmonitors/src/models/mappers.ts | 1909 +++++++++++++++++ .../sapmonitors/src/models/parameters.ts | 207 ++ .../src/operations/alertTemplates.ts | 239 +++ .../sapmonitors/src/operations/alerts.ts | 506 +++++ .../sapmonitors/src/operations/index.ts | 14 + .../sapmonitors/src/operations/monitors.ts | 729 +++++++ .../sapmonitors/src/operations/operations.ts | 149 ++ .../src/operations/providerInstances.ts | 525 +++++ .../src/operations/sapLandscapeMonitor.ts | 376 ++++ .../operationsInterfaces/alertTemplates.ts | 46 + .../src/operationsInterfaces/alerts.ts | 115 + .../src/operationsInterfaces/index.ts | 14 + .../src/operationsInterfaces/monitors.ts | 148 ++ .../src/operationsInterfaces/operations.ts | 22 + .../operationsInterfaces/providerInstances.ts | 121 ++ .../sapLandscapeMonitor.ts | 89 + sdk/workloads/sapmonitors/src/pagingHelper.ts | 39 + .../sapmonitors/src/workloadsClient.ts | 165 ++ sdk/workloads/sapmonitors/test/sampleTest.ts | 43 + sdk/workloads/sapmonitors/tsconfig.json | 27 + 34 files changed, 8184 insertions(+), 23 deletions(-) create mode 100644 sdk/workloads/sapmonitors/CHANGELOG.md create mode 100644 sdk/workloads/sapmonitors/LICENSE create mode 100644 sdk/workloads/sapmonitors/README.md create mode 100644 sdk/workloads/sapmonitors/_meta.json create mode 100644 sdk/workloads/sapmonitors/api-extractor.json create mode 100644 sdk/workloads/sapmonitors/package.json create mode 100644 sdk/workloads/sapmonitors/review/arm-workloads-sapmonitors.api.md create mode 100644 sdk/workloads/sapmonitors/sample.env create mode 100644 sdk/workloads/sapmonitors/src/index.ts create mode 100644 sdk/workloads/sapmonitors/src/lroImpl.ts create mode 100644 sdk/workloads/sapmonitors/src/models/index.ts create mode 100644 sdk/workloads/sapmonitors/src/models/mappers.ts create mode 100644 sdk/workloads/sapmonitors/src/models/parameters.ts create mode 100644 sdk/workloads/sapmonitors/src/operations/alertTemplates.ts create mode 100644 sdk/workloads/sapmonitors/src/operations/alerts.ts create mode 100644 sdk/workloads/sapmonitors/src/operations/index.ts create mode 100644 sdk/workloads/sapmonitors/src/operations/monitors.ts create mode 100644 sdk/workloads/sapmonitors/src/operations/operations.ts create mode 100644 sdk/workloads/sapmonitors/src/operations/providerInstances.ts create mode 100644 sdk/workloads/sapmonitors/src/operations/sapLandscapeMonitor.ts create mode 100644 sdk/workloads/sapmonitors/src/operationsInterfaces/alertTemplates.ts create mode 100644 sdk/workloads/sapmonitors/src/operationsInterfaces/alerts.ts create mode 100644 sdk/workloads/sapmonitors/src/operationsInterfaces/index.ts create mode 100644 sdk/workloads/sapmonitors/src/operationsInterfaces/monitors.ts create mode 100644 sdk/workloads/sapmonitors/src/operationsInterfaces/operations.ts create mode 100644 sdk/workloads/sapmonitors/src/operationsInterfaces/providerInstances.ts create mode 100644 sdk/workloads/sapmonitors/src/operationsInterfaces/sapLandscapeMonitor.ts create mode 100644 sdk/workloads/sapmonitors/src/pagingHelper.ts create mode 100644 sdk/workloads/sapmonitors/src/workloadsClient.ts create mode 100644 sdk/workloads/sapmonitors/test/sampleTest.ts create mode 100644 sdk/workloads/sapmonitors/tsconfig.json diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e2ac4a887b9b..6431fe986fad 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -797,6 +797,9 @@ dependencies: '@rush-temp/arm-workloads': specifier: file:./projects/arm-workloads.tgz version: file:projects/arm-workloads.tgz + '@rush-temp/arm-workloads-sapmonitors': + specifier: file:./projects/arm-workloads-sapmonitors.tgz + version: file:projects/arm-workloads-sapmonitors.tgz '@rush-temp/arm-workloadssapvirtualinstance': specifier: file:./projects/arm-workloadssapvirtualinstance.tgz version: file:projects/arm-workloadssapvirtualinstance.tgz @@ -3822,13 +3825,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: @@ -3856,7 +3859,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: @@ -3870,7 +3873,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: @@ -3913,7 +3916,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 @@ -3932,7 +3935,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: @@ -3959,19 +3962,19 @@ 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: resolution: {integrity: sha512-ugo316mmTYBl2g81zDFnZ7cfxlut3o+/EQdaP7J8QN2kY6lJ22hmQYCK5EHcJHbrW+dkCGSCPgbG8JtYj6qSrg==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/jws@3.2.10: resolution: {integrity: sha512-cOevhttJmssERB88/+XvZXvsq5m9JLKZNUiGfgjUb5lcPRdV2ZQciU6dU76D/qXXFYpSqkP3PrSg4hMTiafTZw==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@types/linkify-it@5.0.0: @@ -4018,13 +4021,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 @@ -4063,7 +4066,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 @@ -4090,7 +4093,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: @@ -4109,14 +4112,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 @@ -4141,13 +4144,13 @@ packages: /@types/stoppable@1.1.3: resolution: {integrity: sha512-7wGKIBJGE4ZxFjk9NkjAxZMLlIXroETqP1FJCdoSvKmEznwmBxQFmTB1dsCkAvVcNemuSZM5qkkd9HE/NL2JTw==} dependencies: - '@types/node': 18.19.64 + '@types/node': 20.17.6 dev: false /@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: @@ -4200,7 +4203,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 @@ -6132,7 +6135,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 @@ -15416,7 +15419,7 @@ packages: dev: false file:projects/arm-hybridcompute.tgz: - resolution: {integrity: sha512-+DX7eIMt7WAbn6AD+QZpjVyoMuXdNpGH452FuoUH2UvFhOBtlZD3B5y8bwW/oE8d3E/u2eZ3B4N2cAFV32bgbw==, tarball: file:projects/arm-hybridcompute.tgz} + resolution: {integrity: sha512-IxFMCCeH0D2P6u+4Vwi9ROrWBKeO0DJEfs2jxyfJnrGNMrRKAWfplx0QVZY6ETK5Thjlm3myTMffxO2BT5PBiA==, tarball: file:projects/arm-hybridcompute.tgz} name: '@rush-temp/arm-hybridcompute' version: 0.0.0 dependencies: @@ -18729,6 +18732,33 @@ packages: - supports-color dev: false + file:projects/arm-workloads-sapmonitors.tgz: + resolution: {integrity: sha512-mDu7kmJLxwGeQpyIolCIFfRs+wVRWHk0pX6oewkzTNQ6n4bYqwbAzWITgt0NMl+O69DlCuYuW/2GKrZhkvOiUg==, tarball: file:projects/arm-workloads-sapmonitors.tgz} + name: '@rush-temp/arm-workloads-sapmonitors' + 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 + mocha: 10.8.2 + ts-node: 10.9.2(@types/node@18.19.64)(typescript@5.6.3) + tslib: 2.8.1 + tsx: 4.19.2 + typescript: 5.6.3 + uglify-js: 3.19.3 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-workloads.tgz: resolution: {integrity: sha512-RWQfpgvMRTCHIhZM0bD9lyj2R7hVQCEvLJ2F0TmuGSYTQZ5E3qw6NHUkYoISxj8rVxnB/xnyRJTFPLYuhIeNfg==, tarball: file:projects/arm-workloads.tgz} name: '@rush-temp/arm-workloads' @@ -19240,7 +19270,7 @@ packages: dev: false file:projects/communication-job-router.tgz: - resolution: {integrity: sha512-xPt7oEFIEnDcZHXkEsgPlaOBwbjSF6dQq4uDtXsp/yeslQgiTdGNnO5bUMfuqpTTiiwSsXCyCKEy2FmmrcRHLw==, tarball: file:projects/communication-job-router.tgz} + resolution: {integrity: sha512-2asWr03USbfs287ufZkj8sgX94e8AIkX8BU9mVvBxqPp+5NwM8F2I2OeKa/ZRb9z7dcawliux8IwyB2kNGIEAg==, tarball: file:projects/communication-job-router.tgz} name: '@rush-temp/communication-job-router' version: 0.0.0 dependencies: diff --git a/rush.json b/rush.json index b6f3ab160e70..eec7a4ca7339 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-workloads-sapmonitors", + "projectFolder": "sdk/workloads/sapmonitors", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/workloads/ci.mgmt.yml b/sdk/workloads/ci.mgmt.yml index 1db372db3ac0..88c6e8a5a111 100644 --- a/sdk/workloads/ci.mgmt.yml +++ b/sdk/workloads/ci.mgmt.yml @@ -14,6 +14,7 @@ trigger: - sdk/workloads/arm-workloads - sdk/workloads/ci.mgmt.yml - sdk/workloads/arm-workloadssapvirtualinstance + - sdk/workloads/sapmonitors pr: branches: include: @@ -28,6 +29,7 @@ pr: - sdk/workloads/arm-workloads - sdk/workloads/ci.mgmt.yml - sdk/workloads/arm-workloadssapvirtualinstance + - sdk/workloads/sapmonitors extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -37,3 +39,5 @@ extends: safeName: azurearmworkloads - name: azure-arm-workloadssapvirtualinstance safeName: azurearmworkloadssapvirtualinstance + - name: azure-arm-workloads-sapmonitors + safeName: azurearmworkloadssapmonitors diff --git a/sdk/workloads/sapmonitors/CHANGELOG.md b/sdk/workloads/sapmonitors/CHANGELOG.md new file mode 100644 index 000000000000..cb4b1f6f934e --- /dev/null +++ b/sdk/workloads/sapmonitors/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0-beta.1 (2024-11-18) + +### Features Added + +The package of @azure/arm-workloads-sapmonitors 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/workloads/sapmonitors/LICENSE b/sdk/workloads/sapmonitors/LICENSE new file mode 100644 index 000000000000..7d5934740965 --- /dev/null +++ b/sdk/workloads/sapmonitors/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/workloads/sapmonitors/README.md b/sdk/workloads/sapmonitors/README.md new file mode 100644 index 000000000000..720c277c984f --- /dev/null +++ b/sdk/workloads/sapmonitors/README.md @@ -0,0 +1,109 @@ +# Azure Workloads client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Workloads client. + +The workload SAP monitor Client. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/workloads/sapmonitors) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-workloads-sapmonitors) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-workloads-sapmonitors?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-workloads-sapmonitors` package + +Install the Azure Workloads client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-workloads-sapmonitors +``` + +### Create and authenticate a `WorkloadsClient` + +To create a client object to access the Azure Workloads API, you will need the `endpoint` of your Azure Workloads resource and a `credential`. The Azure Workloads client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Workloads 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 Workloads** 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 { WorkloadsClient } = require("@azure/arm-workloads-sapmonitors"); +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 WorkloadsClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new WorkloadsClient(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 + +### WorkloadsClient + +`WorkloadsClient` is the primary interface for developers using the Azure Workloads client library. Explore the methods on this client object to understand the different features of the Azure Workloads 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%2Fworkloads%2Fsapmonitors%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/workloads/sapmonitors/_meta.json b/sdk/workloads/sapmonitors/_meta.json new file mode 100644 index 000000000000..76d9cf6e9fda --- /dev/null +++ b/sdk/workloads/sapmonitors/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "3030eb460a65f0068b91c81f6b203fe71cccc107", + "readme": "specification/workloads/resource-manager/Microsoft.Workloads/monitors/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/workloads/resource-manager/Microsoft.Workloads/monitors/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/workloads/sapmonitors/api-extractor.json b/sdk/workloads/sapmonitors/api-extractor.json new file mode 100644 index 000000000000..6461a32aaa3a --- /dev/null +++ b/sdk/workloads/sapmonitors/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-workloads-sapmonitors.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/workloads/sapmonitors/package.json b/sdk/workloads/sapmonitors/package.json new file mode 100644 index 000000000000..240d228f298e --- /dev/null +++ b/sdk/workloads/sapmonitors/package.json @@ -0,0 +1,109 @@ +{ + "name": "@azure/arm-workloads-sapmonitors", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for WorkloadsClient.", + "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-workloads-sapmonitors.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "typescript": "~5.6.2", + "uglify-js": "^3.4.9", + "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 && dev-tool run vendored 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": "dev-tool run vendored 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", + "update-snippets": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/workloadsClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/workloads/sapmonitors" +} \ No newline at end of file diff --git a/sdk/workloads/sapmonitors/review/arm-workloads-sapmonitors.api.md b/sdk/workloads/sapmonitors/review/arm-workloads-sapmonitors.api.md new file mode 100644 index 000000000000..988132fc1f93 --- /dev/null +++ b/sdk/workloads/sapmonitors/review/arm-workloads-sapmonitors.api.md @@ -0,0 +1,900 @@ +## API Report File for "@azure/arm-workloads-sapmonitors" + +> 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 Alert extends ProxyResource { + alertRuleProperties?: AlertRuleProperties; + readonly alertRuleResourceId?: string; + readonly errors?: ErrorDetail; + providerNames?: string[]; + providerType?: string; + readonly provisioningState?: WorkloadMonitorProvisioningState; + templateName?: string; +} + +// @public +export type AlertAutoMitigate = string; + +// @public +export interface AlertListResult { + nextLink?: string; + value: Alert[]; +} + +// @public +export interface AlertQueryParameter { + name?: string; + value?: string; +} + +// @public +export interface AlertRuleProperties { + actionGroups?: string[]; + alertQueryParameters?: AlertQueryParameter[]; + autoMitigate?: AlertAutoMitigate; + dimension?: string; + evaluationFrequency?: number; + failingPeriodsOperator?: ConditionalOperator; + failingPeriodsToAlert?: number; + muteActionsDuration?: number; + severity?: number; + status?: AlertRuleStatus; + threshold?: number; + thresholdOperator?: ConditionalOperator; + windowSize?: number; +} + +// @public +export type AlertRuleStatus = string; + +// @public +export interface Alerts { + beginCreate(resourceGroupName: string, monitorName: string, alertName: string, resource: Alert, options?: AlertsCreateOptionalParams): Promise, AlertsCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, monitorName: string, alertName: string, resource: Alert, options?: AlertsCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, monitorName: string, alertName: string, options?: AlertsDeleteOptionalParams): Promise, AlertsDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, monitorName: string, alertName: string, options?: AlertsDeleteOptionalParams): Promise; + get(resourceGroupName: string, monitorName: string, alertName: string, options?: AlertsGetOptionalParams): Promise; + list(resourceGroupName: string, monitorName: string, options?: AlertsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface AlertsCreateHeaders { + azureAsyncOperation?: string; + retryAfter?: number; +} + +// @public +export interface AlertsCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type AlertsCreateResponse = Alert; + +// @public +export interface AlertsDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface AlertsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type AlertsDeleteResponse = AlertsDeleteHeaders; + +// @public +export interface AlertsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AlertsGetResponse = Alert; + +// @public +export interface AlertsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AlertsListNextResponse = AlertListResult; + +// @public +export interface AlertsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AlertsListResponse = AlertListResult; + +// @public +export interface AlertTemplate extends ProxyResource { + alertUnit?: string; + defaultThreshold?: number; + defaultThresholdInputOption?: DefaultThresholdInputOption; + description?: string; + readonly errors?: ErrorDetail; + lowerBound?: number; + metricMeasurement?: AlertTemplateMetricMeasurement; + providerType?: string; + readonly provisioningState?: WorkloadMonitorProvisioningState; + query?: string; + queryInputParameters?: AlertTemplateQueryInputParameter[]; + severity?: number; + templateDisplayName?: string; + thresholdOperator?: ConditionalOperator; + upperBound?: number; +} + +// @public +export interface AlertTemplateListResult { + nextLink?: string; + value: AlertTemplate[]; +} + +// @public +export interface AlertTemplateMetricMeasurement { + frequencyInMinutes?: number; + metricColumn?: string; + metricTriggerType?: AlertTemplateMetricTriggerType; + threshold?: number; + thresholdOperator?: ConditionalOperator; + timeWindowInMinutes?: number; +} + +// @public +export type AlertTemplateMetricTriggerType = string; + +// @public +export type AlertTemplateParameterType = string; + +// @public +export interface AlertTemplateQueryInputParameter { + defaultValue?: string; + description?: string; + displayName?: string; + laQuery?: string; + name?: string; + selectionMode?: AlertTemplateSelectionMode; + type?: AlertTemplateParameterType; +} + +// @public +export interface AlertTemplates { + get(resourceGroupName: string, monitorName: string, alertTemplateName: string, options?: AlertTemplatesGetOptionalParams): Promise; + list(resourceGroupName: string, monitorName: string, options?: AlertTemplatesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export type AlertTemplateSelectionMode = string; + +// @public +export interface AlertTemplatesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AlertTemplatesGetResponse = AlertTemplate; + +// @public +export interface AlertTemplatesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AlertTemplatesListNextResponse = AlertTemplateListResult; + +// @public +export interface AlertTemplatesListOptionalParams extends coreClient.OperationOptions { + providerType?: string; +} + +// @public +export type AlertTemplatesListResponse = AlertTemplateListResult; + +// @public +export interface AppServicePlanConfiguration { + capacity?: number; + tier?: AppServicePlanTier; +} + +// @public +export type AppServicePlanTier = string; + +// @public +export type ConditionalOperator = string; + +// @public +export type CreatedByType = string; + +// @public +export interface Db2ProviderInstanceProperties extends ProviderSpecificProperties { + dbName?: string; + dbPassword?: string; + dbPasswordUri?: string; + dbPort?: string; + dbUsername?: string; + hostname?: string; + providerType: "Db2"; + sapSid?: string; + sslCertificateUri?: string; + sslPreference?: SslPreference; +} + +// @public +export type DefaultThresholdInputOption = 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 ErrorResponse { + error?: ErrorDetail; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface HanaDbProviderInstanceProperties extends ProviderSpecificProperties { + dbName?: string; + dbPassword?: string; + dbPasswordUri?: string; + dbUsername?: string; + hostname?: string; + instanceNumber?: string; + providerType: "SapHana"; + sapSid?: string; + sqlPort?: string; + sslCertificateUri?: string; + sslHostNameInCertificate?: string; + sslPreference?: SslPreference; +} + +// @public +export interface Health { + readonly healthState?: WorkloadProviderInstanceHealthState; + readonly impactingReasons?: string; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownAlertAutoMitigate { + Disable = "Disable", + Enable = "Enable" +} + +// @public +export enum KnownAlertRuleStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownAlertTemplateMetricTriggerType { + Consecutive = "Consecutive", + Total = "Total" +} + +// @public +export enum KnownAlertTemplateParameterType { + CustomInput = "CustomInput", + LogAnalyticsQuery = "LogAnalyticsQuery", + ProviderProperty = "ProviderProperty" +} + +// @public +export enum KnownAlertTemplateSelectionMode { + Multiple = "Multiple", + Single = "Single" +} + +// @public +export enum KnownAppServicePlanTier { + ElasticPremium = "ElasticPremium", + PremiumV3 = "PremiumV3" +} + +// @public +export enum KnownConditionalOperator { + Equal = "Equal", + GreaterThan = "GreaterThan", + GreaterThanOrEqual = "GreaterThanOrEqual", + LessThan = "LessThan", + LessThanOrEqual = "LessThanOrEqual" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownDefaultThresholdInputOption { + NotRequired = "NotRequired", + Optional = "Optional", + Required = "Required" +} + +// @public +export enum KnownManagedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownRoutingPreference { + Default = "Default", + RouteAll = "RouteAll" +} + +// @public +export enum KnownSapLandscapeMonitorProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Created = "Created", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownSslPreference { + Disabled = "Disabled", + RootCertificate = "RootCertificate", + ServerCertificate = "ServerCertificate" +} + +// @public +export enum KnownWorkloadMonitorProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Migrating = "Migrating", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownWorkloadProviderInstanceHealthState { + Degraded = "Degraded", + Healthy = "Healthy", + Unavailable = "Unavailable", + Unknown = "Unknown" +} + +// @public +export interface ManagedResourceGroupConfiguration { + name?: string; +} + +// @public +export interface ManagedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: ManagedServiceIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentity | null; + }; +} + +// @public +export type ManagedServiceIdentityType = string; + +// @public +export interface Monitor extends TrackedResource { + appLocation?: string; + appServicePlanConfiguration?: AppServicePlanConfiguration; + readonly errors?: ErrorDetail; + identity?: ManagedServiceIdentity; + logAnalyticsWorkspaceArmId?: string; + managedResourceGroupConfiguration?: ManagedResourceGroupConfiguration; + monitorSubnet?: string; + readonly msiArmId?: string; + readonly provisioningState?: WorkloadMonitorProvisioningState; + routingPreference?: RoutingPreference; + readonly storageAccountArmId?: string; + zoneRedundancyPreference?: string; +} + +// @public +export interface MonitorListResult { + nextLink?: string; + value: Monitor[]; +} + +// @public +export interface Monitors { + beginCreate(resourceGroupName: string, monitorName: string, resource: Monitor, options?: MonitorsCreateOptionalParams): Promise, MonitorsCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, monitorName: string, resource: Monitor, options?: MonitorsCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, monitorName: string, options?: MonitorsDeleteOptionalParams): Promise, MonitorsDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, monitorName: string, options?: MonitorsDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, monitorName: string, properties: UpdateMonitorRequest, options?: MonitorsUpdateOptionalParams): Promise, MonitorsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, monitorName: string, properties: UpdateMonitorRequest, options?: MonitorsUpdateOptionalParams): Promise; + get(resourceGroupName: string, monitorName: string, options?: MonitorsGetOptionalParams): Promise; + list(options?: MonitorsListOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: MonitorsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface MonitorsCreateHeaders { + retryAfter?: number; +} + +// @public +export interface MonitorsCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MonitorsCreateResponse = Monitor; + +// @public +export interface MonitorsDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface MonitorsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MonitorsDeleteResponse = MonitorsDeleteHeaders; + +// @public +export interface MonitorsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsGetResponse = Monitor; + +// @public +export interface MonitorsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListByResourceGroupNextResponse = MonitorListResult; + +// @public +export interface MonitorsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListByResourceGroupResponse = MonitorListResult; + +// @public +export interface MonitorsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListNextResponse = MonitorListResult; + +// @public +export interface MonitorsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListResponse = MonitorListResult; + +// @public +export interface MonitorsUpdateHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface MonitorsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MonitorsUpdateResponse = Monitor; + +// @public +export interface MsSqlServerProviderInstanceProperties extends ProviderSpecificProperties { + dbPassword?: string; + dbPasswordUri?: string; + dbPort?: string; + dbUsername?: string; + hostname?: string; + providerType: "MsSqlServer"; + sapSid?: string; + sslCertificateUri?: string; + sslPreference?: SslPreference; +} + +// @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 interface OracleProviderInstanceProperties extends ProviderSpecificProperties { + dbName?: string; + dbPassword?: string; + dbPasswordUri?: string; + dbPort?: string; + dbUsername?: string; + hostname?: string; + providerType: "Oracle"; + sapSid?: string; + sslCertificateUri?: string; + sslPreference?: SslPreference; +} + +// @public +export type Origin = string; + +// @public +export interface PrometheusHaClusterProviderInstanceProperties extends ProviderSpecificProperties { + clusterName?: string; + hostname?: string; + prometheusUrl?: string; + providerType: "PrometheusHaCluster"; + sid?: string; + sslCertificateUri?: string; + sslPreference?: SslPreference; +} + +// @public +export interface PrometheusOsProviderInstanceProperties extends ProviderSpecificProperties { + prometheusUrl?: string; + providerType: "PrometheusOS"; + sapSid?: string; + sslCertificateUri?: string; + sslPreference?: SslPreference; +} + +// @public +export interface ProviderInstance extends ProxyResource { + readonly errors?: ErrorDetail; + readonly health?: Health; + providerSettings?: ProviderSpecificPropertiesUnion; + readonly provisioningState?: WorkloadMonitorProvisioningState; +} + +// @public +export interface ProviderInstanceListResult { + nextLink?: string; + value: ProviderInstance[]; +} + +// @public +export interface ProviderInstances { + beginCreate(resourceGroupName: string, monitorName: string, providerInstanceName: string, resource: ProviderInstance, options?: ProviderInstancesCreateOptionalParams): Promise, ProviderInstancesCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, monitorName: string, providerInstanceName: string, resource: ProviderInstance, options?: ProviderInstancesCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, monitorName: string, providerInstanceName: string, options?: ProviderInstancesDeleteOptionalParams): Promise, ProviderInstancesDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, monitorName: string, providerInstanceName: string, options?: ProviderInstancesDeleteOptionalParams): Promise; + get(resourceGroupName: string, monitorName: string, providerInstanceName: string, options?: ProviderInstancesGetOptionalParams): Promise; + listByMonitor(resourceGroupName: string, monitorName: string, options?: ProviderInstancesListByMonitorOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ProviderInstancesCreateHeaders { + retryAfter?: number; +} + +// @public +export interface ProviderInstancesCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ProviderInstancesCreateResponse = ProviderInstance; + +// @public +export interface ProviderInstancesDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface ProviderInstancesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ProviderInstancesDeleteResponse = ProviderInstancesDeleteHeaders; + +// @public +export interface ProviderInstancesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProviderInstancesGetResponse = ProviderInstance; + +// @public +export interface ProviderInstancesListByMonitorNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProviderInstancesListByMonitorNextResponse = ProviderInstanceListResult; + +// @public +export interface ProviderInstancesListByMonitorOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProviderInstancesListByMonitorResponse = ProviderInstanceListResult; + +// @public +export interface ProviderSpecificProperties { + providerType: "Db2" | "SapHana" | "MsSqlServer" | "Oracle" | "PrometheusHaCluster" | "PrometheusOS" | "SapNetWeaver"; +} + +// @public (undocumented) +export type ProviderSpecificPropertiesUnion = ProviderSpecificProperties | Db2ProviderInstanceProperties | HanaDbProviderInstanceProperties | MsSqlServerProviderInstanceProperties | OracleProviderInstanceProperties | PrometheusHaClusterProviderInstanceProperties | PrometheusOsProviderInstanceProperties | SapNetWeaverProviderInstanceProperties; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type RoutingPreference = string; + +// @public +export interface SapLandscapeMonitor { + create(resourceGroupName: string, monitorName: string, resource: SapLandscapeMonitorResource, options?: SapLandscapeMonitorCreateOptionalParams): Promise; + delete(resourceGroupName: string, monitorName: string, options?: SapLandscapeMonitorDeleteOptionalParams): Promise; + get(resourceGroupName: string, monitorName: string, options?: SapLandscapeMonitorGetOptionalParams): Promise; + listByMonitor(resourceGroupName: string, monitorName: string, options?: SapLandscapeMonitorListByMonitorOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, monitorName: string, properties: SapLandscapeMonitorResource, options?: SapLandscapeMonitorUpdateOptionalParams): Promise; +} + +// @public +export interface SapLandscapeMonitorCreateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapLandscapeMonitorCreateResponse = SapLandscapeMonitorResource; + +// @public +export interface SapLandscapeMonitorDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface SapLandscapeMonitorGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapLandscapeMonitorGetResponse = SapLandscapeMonitorResource; + +// @public +export interface SapLandscapeMonitorListByMonitorNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapLandscapeMonitorListByMonitorNextResponse = SapLandscapeMonitorResourceListResult; + +// @public +export interface SapLandscapeMonitorListByMonitorOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapLandscapeMonitorListByMonitorResponse = SapLandscapeMonitorResourceListResult; + +// @public +export interface SapLandscapeMonitorMetricThresholds { + green?: number; + name?: string; + red?: number; + yellow?: number; +} + +// @public +export interface SapLandscapeMonitorPropertiesGrouping { + landscape?: SapLandscapeMonitorSidMapping[]; + sapApplication?: SapLandscapeMonitorSidMapping[]; +} + +// @public +export type SapLandscapeMonitorProvisioningState = string; + +// @public +export interface SapLandscapeMonitorResource extends ProxyResource { + grouping?: SapLandscapeMonitorPropertiesGrouping; + readonly provisioningState?: SapLandscapeMonitorProvisioningState; + topMetricsThresholds?: SapLandscapeMonitorMetricThresholds[]; +} + +// @public +export interface SapLandscapeMonitorResourceListResult { + nextLink?: string; + value: SapLandscapeMonitorResource[]; +} + +// @public +export interface SapLandscapeMonitorSidMapping { + name?: string; + topSid?: string[]; +} + +// @public +export interface SapLandscapeMonitorUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapLandscapeMonitorUpdateResponse = SapLandscapeMonitorResource; + +// @public +export interface SapNetWeaverProviderInstanceProperties extends ProviderSpecificProperties { + providerType: "SapNetWeaver"; + sapClientId?: string; + sapHostFileEntries?: string[]; + sapHostname?: string; + sapInstanceNr?: string; + sapPassword?: string; + sapPasswordUri?: string; + sapPortNumber?: string; + sapSid?: string; + sapUsername?: string; + sslCertificateUri?: string; + sslPreference?: SslPreference; +} + +// @public +export type SslPreference = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface UpdateMonitorRequest { + identity?: ManagedServiceIdentity; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface UserAssignedIdentity { + readonly clientId?: string; + readonly principalId?: string; +} + +// @public +export type WorkloadMonitorProvisioningState = string; + +// @public +export type WorkloadProviderInstanceHealthState = string; + +// @public (undocumented) +export class WorkloadsClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: WorkloadsClientOptionalParams); + // (undocumented) + alerts: Alerts; + // (undocumented) + alertTemplates: AlertTemplates; + // (undocumented) + apiVersion: string; + // (undocumented) + monitors: Monitors; + // (undocumented) + operations: Operations; + // (undocumented) + providerInstances: ProviderInstances; + // (undocumented) + sapLandscapeMonitor: SapLandscapeMonitor; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface WorkloadsClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/workloads/sapmonitors/sample.env b/sdk/workloads/sapmonitors/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/workloads/sapmonitors/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/workloads/sapmonitors/src/index.ts b/sdk/workloads/sapmonitors/src/index.ts new file mode 100644 index 000000000000..f33285f16cda --- /dev/null +++ b/sdk/workloads/sapmonitors/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 { WorkloadsClient } from "./workloadsClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/workloads/sapmonitors/src/lroImpl.ts b/sdk/workloads/sapmonitors/src/lroImpl.ts new file mode 100644 index 000000000000..5f88efab981b --- /dev/null +++ b/sdk/workloads/sapmonitors/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/workloads/sapmonitors/src/models/index.ts b/sdk/workloads/sapmonitors/src/models/index.ts new file mode 100644 index 000000000000..fe5320d4014d --- /dev/null +++ b/sdk/workloads/sapmonitors/src/models/index.ts @@ -0,0 +1,1398 @@ +/* + * 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 type ProviderSpecificPropertiesUnion = + | ProviderSpecificProperties + | Db2ProviderInstanceProperties + | HanaDbProviderInstanceProperties + | MsSqlServerProviderInstanceProperties + | OracleProviderInstanceProperties + | PrometheusHaClusterProviderInstanceProperties + | PrometheusOsProviderInstanceProperties + | SapNetWeaverProviderInstanceProperties; + +/** The response of a Monitor list operation. */ +export interface MonitorListResult { + /** The Monitor items on this page */ + value: Monitor[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** 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; +} + +/** Managed resource group configuration */ +export interface ManagedResourceGroupConfiguration { + /** Managed resource group name */ + name?: string; +} + +/** Configuration details of app service plan */ +export interface AppServicePlanConfiguration { + /** The App Service plan tier. */ + tier?: AppServicePlanTier; + /** The number of workers in app service plan. If this is not set or set to 0, auto scale will be configured for the app service plan, otherwise, instance count is set to this number. */ + capacity?: number; +} + +/** Managed service identity (system assigned and/or user assigned identities) */ +export interface ManagedServiceIdentity { + /** + * The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ + type: ManagedServiceIdentityType; + /** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. */ + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentity | null; + }; +} + +/** User assigned identity properties */ +export interface UserAssignedIdentity { + /** + * The principal ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The client ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. E.g. "/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; +} + +/** 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; +} + +/** Defines the request body for updating SAP monitor resource. */ +export interface UpdateMonitorRequest { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The managed service identities assigned to this resource. */ + identity?: ManagedServiceIdentity; +} + +/** The response of a AlertTemplate list operation. */ +export interface AlertTemplateListResult { + /** The AlertTemplate items on this page */ + value: AlertTemplate[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Defines the Alert Template MetricMeasurement Properties. */ +export interface AlertTemplateMetricMeasurement { + /** Operator used for threshold comparison. */ + thresholdOperator?: ConditionalOperator; + /** The Threshold Value Associated with the Alert Template for Metric Measurement. */ + threshold?: number; + /** Metric Trigger Type Associated with the Alert Template for Metric Measurement. */ + metricTriggerType?: AlertTemplateMetricTriggerType; + /** Metric Column Associated with the Alert Template for Metric Measurement. */ + metricColumn?: string; + /** Frequency (mins) value Associated with the Alert Template for Metric Measurement. */ + frequencyInMinutes?: number; + /** Time Window (mins) Value Associated with the Alert Template for Metric Measurement. */ + timeWindowInMinutes?: number; +} + +/** Describes the Query Input Parameter properties in alerts template. */ +export interface AlertTemplateQueryInputParameter { + /** Name of the Query Input Parameter */ + name?: string; + /** Type of the Query Input Parameter */ + type?: AlertTemplateParameterType; + /** Description of the Query Input Parameter */ + description?: string; + /** Default Value of the Query Input Parameter */ + defaultValue?: string; + /** Log Analytics query associated with the parameter. */ + laQuery?: string; + /** Selection mode for the parameter. */ + selectionMode?: AlertTemplateSelectionMode; + /** Display Name of the Query Input Parameter. */ + displayName?: string; +} + +/** The response of a Alert list operation. */ +export interface AlertListResult { + /** The Alert items on this page */ + value: Alert[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Describes the properties of an alert. */ +export interface AlertRuleProperties { + /** Indicates whether the alert is in an enabled state. */ + status?: AlertRuleStatus; + /** Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. */ + severity?: number; + /** Action Group resource Ids to invoke when the alert fires */ + actionGroups?: string[]; + /** The threshold of the alert. */ + threshold?: number; + /** The threshold operator of the alert. */ + thresholdOperator?: ConditionalOperator; + /** The period of time on which the Alert query will be executed. */ + windowSize?: number; + /** How often the scheduled query rule is evaluated. */ + evaluationFrequency?: number; + /** The number of failing periods to trigger an alert. */ + failingPeriodsToAlert?: number; + /** The operator for failing periods. */ + failingPeriodsOperator?: ConditionalOperator; + /** Mute actions for the chosen period of time after the alert is fired. */ + muteActionsDuration?: number; + /** The value that indicates whether the alert should be automatically resolved or not. The default is Disable. */ + autoMitigate?: AlertAutoMitigate; + /** Evaluation of metric on a particular column. */ + dimension?: string; + /** The alert query parameters. */ + alertQueryParameters?: AlertQueryParameter[]; +} + +/** Defines the Alert Query Parameter. */ +export interface AlertQueryParameter { + /** The name of the alert query parameter. */ + name?: string; + /** The value of the alert query parameter. */ + value?: string; +} + +/** The response of a ProviderInstance list operation. */ +export interface ProviderInstanceListResult { + /** The ProviderInstance items on this page */ + value: ProviderInstance[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Resource health details */ +export interface Health { + /** + * Health state of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly healthState?: WorkloadProviderInstanceHealthState; + /** + * Reasons impacting health state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly impactingReasons?: string; +} + +/** Gets or sets the provider specific properties. */ +export interface ProviderSpecificProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + providerType: + | "Db2" + | "SapHana" + | "MsSqlServer" + | "Oracle" + | "PrometheusHaCluster" + | "PrometheusOS" + | "SapNetWeaver"; +} + +/** The response of a SapLandscapeMonitorResource list operation. */ +export interface SapLandscapeMonitorResourceListResult { + /** The SapLandscapeMonitorResource items on this page */ + value: SapLandscapeMonitorResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Gets or sets the SID groupings by landscape and Environment. */ +export interface SapLandscapeMonitorPropertiesGrouping { + /** Gets or sets the list of landscape to SID mappings. */ + landscape?: SapLandscapeMonitorSidMapping[]; + /** Gets or sets the list of Sap Applications to SID mappings. */ + sapApplication?: SapLandscapeMonitorSidMapping[]; +} + +/** Gets or sets the mapping for SID to Environment/Applications. */ +export interface SapLandscapeMonitorSidMapping { + /** Gets or sets the name of the grouping. */ + name?: string; + /** Gets or sets the list of SID's. */ + topSid?: string[]; +} + +/** Gets or sets the Threshold Values for Top Metrics Health. */ +export interface SapLandscapeMonitorMetricThresholds { + /** Gets or sets the name of the threshold. */ + name?: string; + /** Gets or sets the threshold value for Green. */ + green?: number; + /** Gets or sets the threshold value for Yellow. */ + yellow?: number; + /** Gets or sets the threshold value for Red. */ + red?: number; +} + +/** 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; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: 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 {} + +/** Gets or sets the DB2 provider properties. */ +export interface Db2ProviderInstanceProperties + extends ProviderSpecificProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + providerType: "Db2"; + /** Gets or sets the target virtual machine name. */ + hostname?: string; + /** Gets or sets the db2 database name. */ + dbName?: string; + /** Gets or sets the db2 database sql port. */ + dbPort?: string; + /** Gets or sets the db2 database user name. */ + dbUsername?: string; + /** + * Gets or sets the db2 database password. + * This value contains a credential. Consider obscuring before showing to users + */ + dbPassword?: string; + /** Gets or sets the key vault URI to secret with the database password. */ + dbPasswordUri?: string; + /** Gets or sets the SAP System Identifier */ + sapSid?: string; + /** Gets or sets certificate preference if secure communication is enabled. */ + sslPreference?: SslPreference; + /** Gets or sets the blob URI to SSL certificate for the DB2 Database. */ + sslCertificateUri?: string; +} + +/** Gets or sets the provider properties. */ +export interface HanaDbProviderInstanceProperties + extends ProviderSpecificProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + providerType: "SapHana"; + /** Gets or sets the target virtual machine size. */ + hostname?: string; + /** Gets or sets the hana database name. */ + dbName?: string; + /** Gets or sets the database sql port. */ + sqlPort?: string; + /** Gets or sets the database instance number. */ + instanceNumber?: string; + /** Gets or sets the database user name. */ + dbUsername?: string; + /** + * Gets or sets the database password. + * This value contains a credential. Consider obscuring before showing to users + */ + dbPassword?: string; + /** Gets or sets the key vault URI to secret with the database password. */ + dbPasswordUri?: string; + /** Gets or sets the blob URI to SSL certificate for the DB. */ + sslCertificateUri?: string; + /** Gets or sets the hostname(s) in the SSL certificate. */ + sslHostNameInCertificate?: string; + /** Gets or sets certificate preference if secure communication is enabled. */ + sslPreference?: SslPreference; + /** Gets or sets the SAP System Identifier. */ + sapSid?: string; +} + +/** Gets or sets the SQL server provider properties. */ +export interface MsSqlServerProviderInstanceProperties + extends ProviderSpecificProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + providerType: "MsSqlServer"; + /** Gets or sets the SQL server host name. */ + hostname?: string; + /** Gets or sets the database sql port. */ + dbPort?: string; + /** Gets or sets the database user name. */ + dbUsername?: string; + /** + * Gets or sets the database password. + * This value contains a credential. Consider obscuring before showing to users + */ + dbPassword?: string; + /** Gets or sets the key vault URI to secret with the database password. */ + dbPasswordUri?: string; + /** Gets or sets the SAP System Identifier */ + sapSid?: string; + /** Gets or sets certificate preference if secure communication is enabled. */ + sslPreference?: SslPreference; + /** Gets or sets the blob URI to SSL certificate for the SQL Database. */ + sslCertificateUri?: string; +} + +/** Gets or sets the Oracle provider properties. */ +export interface OracleProviderInstanceProperties + extends ProviderSpecificProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + providerType: "Oracle"; + /** Gets or sets the target virtual machine name. */ + hostname?: string; + /** Gets or sets the oracle database sql port. */ + dbPort?: string; + /** Gets or sets the oracle database name. */ + dbName?: string; + /** Gets or sets the oracle database user name. */ + dbUsername?: string; + /** + * Gets or sets the oracle database password. + * This value contains a credential. Consider obscuring before showing to users + */ + dbPassword?: string; + /** Gets or sets the key vault URI to secret with the database password. */ + dbPasswordUri?: string; + /** Gets or sets the SAP System Identifier */ + sapSid?: string; + /** Gets or sets certificate preference if secure communication is enabled. */ + sslPreference?: SslPreference; + /** Gets or sets the blob URI to SSL certificate for the Oracle Database. */ + sslCertificateUri?: string; +} + +/** Gets or sets the PrometheusHaCluster provider properties. */ +export interface PrometheusHaClusterProviderInstanceProperties + extends ProviderSpecificProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + providerType: "PrometheusHaCluster"; + /** URL of the Node Exporter endpoint. */ + prometheusUrl?: string; + /** Gets or sets the target machine name. */ + hostname?: string; + /** Gets or sets the cluster sid. */ + sid?: string; + /** Gets or sets the clusterName. */ + clusterName?: string; + /** Gets or sets certificate preference if secure communication is enabled. */ + sslPreference?: SslPreference; + /** Gets or sets the blob URI to SSL certificate for the HA cluster exporter. */ + sslCertificateUri?: string; +} + +/** Gets or sets the PrometheusOS provider properties. */ +export interface PrometheusOsProviderInstanceProperties + extends ProviderSpecificProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + providerType: "PrometheusOS"; + /** URL of the Node Exporter endpoint */ + prometheusUrl?: string; + /** Gets or sets certificate preference if secure communication is enabled. */ + sslPreference?: SslPreference; + /** Gets or sets the blob URI to SSL certificate for the prometheus node exporter. */ + sslCertificateUri?: string; + /** Gets or sets the SAP System Identifier */ + sapSid?: string; +} + +/** Gets or sets the provider properties. */ +export interface SapNetWeaverProviderInstanceProperties + extends ProviderSpecificProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + providerType: "SapNetWeaver"; + /** Gets or sets the SAP System Identifier */ + sapSid?: string; + /** Gets or sets the target virtual machine IP Address/FQDN. */ + sapHostname?: string; + /** Gets or sets the instance number of SAP NetWeaver. */ + sapInstanceNr?: string; + /** Gets or sets the list of HostFile Entries */ + sapHostFileEntries?: string[]; + /** Gets or sets the SAP user name. */ + sapUsername?: string; + /** + * Sets the SAP password. + * This value contains a credential. Consider obscuring before showing to users + */ + sapPassword?: string; + /** Gets or sets the key vault URI to secret with the SAP password. */ + sapPasswordUri?: string; + /** Gets or sets the SAP Client ID. */ + sapClientId?: string; + /** Gets or sets the SAP HTTP port number. */ + sapPortNumber?: string; + /** Gets or sets the blob URI to SSL certificate for the SAP system. */ + sslCertificateUri?: string; + /** Gets or sets certificate preference if secure communication is enabled. */ + sslPreference?: SslPreference; +} + +/** SAP monitor info on Azure (ARM properties and SAP monitor properties) */ +export interface Monitor extends TrackedResource { + /** The managed service identities assigned to this resource. */ + identity?: ManagedServiceIdentity; + /** + * State of provisioning of the SAP monitor. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: WorkloadMonitorProvisioningState; + /** + * Defines the SAP monitor errors. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: ErrorDetail; + /** The SAP monitor resources will be deployed in the SAP monitoring region. The subnet region should be same as the SAP monitoring region. */ + appLocation?: string; + /** Sets the routing preference of the SAP monitor. By default only RFC1918 traffic is routed to the customer VNET. */ + routingPreference?: RoutingPreference; + /** Sets the preference for zone redundancy on resources created for the SAP monitor. By default resources will be created which do not support zone redundancy. */ + zoneRedundancyPreference?: string; + /** Managed resource group configuration */ + managedResourceGroupConfiguration?: ManagedResourceGroupConfiguration; + /** The ARM ID of the Log Analytics Workspace that is used for SAP monitoring. */ + logAnalyticsWorkspaceArmId?: string; + /** The subnet which the SAP monitor will be deployed in */ + monitorSubnet?: string; + /** App service plan configuration */ + appServicePlanConfiguration?: AppServicePlanConfiguration; + /** + * The ARM ID of the MSI used for SAP monitoring. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly msiArmId?: string; + /** + * The ARM ID of the Storage account used for SAP monitoring. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly storageAccountArmId?: string; +} + +/** Concrete proxy resource types can be created by aliasing this type using a specific property type. */ +export interface AlertTemplate extends ProxyResource { + /** + * Defines the SAP monitor Alert Template errors. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: ErrorDetail; + /** + * State of provisioning of the Alert Template. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: WorkloadMonitorProvisioningState; + /** Display name of the alert template. */ + templateDisplayName?: string; + /** The provider type for alert template. For example, the value can be SapHana. */ + providerType?: string; + /** Description of the template. */ + description?: string; + /** Severity of the alert. Should be an integer between [0-4]. Value of 0 is most severe and value of 4 is least severe. */ + severity?: number; + /** Query associated with the alert template. */ + query?: string; + /** Operator used for threshold comparison. */ + thresholdOperator?: ConditionalOperator; + /** Default threshold value. */ + defaultThreshold?: number; + /** Minimum possible Default Threshold Value Associated with the Alert Template. */ + lowerBound?: number; + /** Maximum possible Default Threshold Value Associated with the Alert Template. */ + upperBound?: number; + /** Input option for the default threshold. */ + defaultThresholdInputOption?: DefaultThresholdInputOption; + /** Unit of the alert. */ + alertUnit?: string; + /** Describes the properties for metric measurement in alerts template. */ + metricMeasurement?: AlertTemplateMetricMeasurement; + /** Describes the Query Input Parameter properties in alerts template. */ + queryInputParameters?: AlertTemplateQueryInputParameter[]; +} + +/** A alert associated with SAP monitor. */ +export interface Alert extends ProxyResource { + /** + * Defines the alert instance errors. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: ErrorDetail; + /** + * ID of the alert rule resource created. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly alertRuleResourceId?: string; + /** Name of the alert template from which it was created. */ + templateName?: string; + /** The provider type for alert. For example, the value can be SapHana. */ + providerType?: string; + /** Name of provider instances associated with the alert. */ + providerNames?: string[]; + /** Describes the properties of an alert. */ + alertRuleProperties?: AlertRuleProperties; + /** + * State of provisioning of the alert instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: WorkloadMonitorProvisioningState; +} + +/** A provider instance associated with SAP monitor. */ +export interface ProviderInstance extends ProxyResource { + /** + * State of provisioning of the provider instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: WorkloadMonitorProvisioningState; + /** + * Resource health details + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly health?: Health; + /** + * Defines the provider instance errors. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: ErrorDetail; + /** Defines the provider specific properties. */ + providerSettings?: ProviderSpecificPropertiesUnion; +} + +/** configuration associated with SAP Landscape Monitor Dashboard. */ +export interface SapLandscapeMonitorResource extends ProxyResource { + /** + * State of provisioning of the SAP monitor. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: SapLandscapeMonitorProvisioningState; + /** Gets or sets the SID groupings by landscape and Environment. */ + grouping?: SapLandscapeMonitorPropertiesGrouping; + /** Gets or sets the list Top Metric Thresholds for SAP Landscape Monitor Dashboard */ + topMetricsThresholds?: SapLandscapeMonitorMetricThresholds[]; +} + +/** Defines headers for Monitors_create operation. */ +export interface MonitorsCreateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Monitors_update operation. */ +export interface MonitorsUpdateHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Monitors_delete operation. */ +export interface MonitorsDeleteHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Alerts_create operation. */ +export interface AlertsCreateHeaders { + /** 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 Alerts_delete operation. */ +export interface AlertsDeleteHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for ProviderInstances_create operation. */ +export interface ProviderInstancesCreateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for ProviderInstances_delete operation. */ +export interface ProviderInstancesDeleteHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Known values of {@link WorkloadMonitorProvisioningState} that the service accepts. */ +export enum KnownWorkloadMonitorProvisioningState { + /** The resource request has been accepted. */ + Accepted = "Accepted", + /** The resource is being created. */ + Creating = "Creating", + /** The resource is being updated. */ + Updating = "Updating", + /** The resource creation failed. */ + Failed = "Failed", + /** The resource creation has succeeded. */ + Succeeded = "Succeeded", + /** The resource is being deleted. */ + Deleting = "Deleting", + /** The resource is being migrated. */ + Migrating = "Migrating", + /** The resource operation was canceled. */ + Canceled = "Canceled", +} + +/** + * Defines values for WorkloadMonitorProvisioningState. \ + * {@link KnownWorkloadMonitorProvisioningState} can be used interchangeably with WorkloadMonitorProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted**: The resource request has been accepted. \ + * **Creating**: The resource is being created. \ + * **Updating**: The resource is being updated. \ + * **Failed**: The resource creation failed. \ + * **Succeeded**: The resource creation has succeeded. \ + * **Deleting**: The resource is being deleted. \ + * **Migrating**: The resource is being migrated. \ + * **Canceled**: The resource operation was canceled. + */ +export type WorkloadMonitorProvisioningState = string; + +/** Known values of {@link RoutingPreference} that the service accepts. */ +export enum KnownRoutingPreference { + /** Default routing preference. Only RFC1918 traffic is routed to the customer VNET. */ + Default = "Default", + /** Route all traffic to the customer VNET. */ + RouteAll = "RouteAll", +} + +/** + * Defines values for RoutingPreference. \ + * {@link KnownRoutingPreference} can be used interchangeably with RoutingPreference, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Default**: Default routing preference. Only RFC1918 traffic is routed to the customer VNET. \ + * **RouteAll**: Route all traffic to the customer VNET. + */ +export type RoutingPreference = string; + +/** Known values of {@link AppServicePlanTier} that the service accepts. */ +export enum KnownAppServicePlanTier { + /** Elastic Premium plan */ + ElasticPremium = "ElasticPremium", + /** Dedicated Premium V3 plan */ + PremiumV3 = "PremiumV3", +} + +/** + * Defines values for AppServicePlanTier. \ + * {@link KnownAppServicePlanTier} can be used interchangeably with AppServicePlanTier, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ElasticPremium**: Elastic Premium plan \ + * **PremiumV3**: Dedicated Premium V3 plan + */ +export type AppServicePlanTier = string; + +/** Known values of {@link ManagedServiceIdentityType} that the service accepts. */ +export enum KnownManagedServiceIdentityType { + /** None */ + None = "None", + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** UserAssigned */ + UserAssigned = "UserAssigned", + /** SystemAssignedUserAssigned */ + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", +} + +/** + * Defines values for ManagedServiceIdentityType. \ + * {@link KnownManagedServiceIdentityType} can be used interchangeably with ManagedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** \ + * **UserAssigned** \ + * **SystemAssigned,UserAssigned** + */ +export type ManagedServiceIdentityType = 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 ConditionalOperator} that the service accepts. */ +export enum KnownConditionalOperator { + /** The value is less than the specified value. */ + LessThan = "LessThan", + /** The value is greater than the specified value. */ + GreaterThan = "GreaterThan", + /** The value is equal to the specified value. */ + Equal = "Equal", + /** The value is greater than or equal to the specified value. */ + GreaterThanOrEqual = "GreaterThanOrEqual", + /** The value is less than or equal to the specified value. */ + LessThanOrEqual = "LessThanOrEqual", +} + +/** + * Defines values for ConditionalOperator. \ + * {@link KnownConditionalOperator} can be used interchangeably with ConditionalOperator, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **LessThan**: The value is less than the specified value. \ + * **GreaterThan**: The value is greater than the specified value. \ + * **Equal**: The value is equal to the specified value. \ + * **GreaterThanOrEqual**: The value is greater than or equal to the specified value. \ + * **LessThanOrEqual**: The value is less than or equal to the specified value. + */ +export type ConditionalOperator = string; + +/** Known values of {@link DefaultThresholdInputOption} that the service accepts. */ +export enum KnownDefaultThresholdInputOption { + /** The default threshold value is required. */ + Required = "Required", + /** The default threshold value is not required. */ + NotRequired = "NotRequired", + /** The default threshold value is optional. */ + Optional = "Optional", +} + +/** + * Defines values for DefaultThresholdInputOption. \ + * {@link KnownDefaultThresholdInputOption} can be used interchangeably with DefaultThresholdInputOption, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Required**: The default threshold value is required. \ + * **NotRequired**: The default threshold value is not required. \ + * **Optional**: The default threshold value is optional. + */ +export type DefaultThresholdInputOption = string; + +/** Known values of {@link AlertTemplateMetricTriggerType} that the service accepts. */ +export enum KnownAlertTemplateMetricTriggerType { + /** The metric trigger type is consecutive. */ + Consecutive = "Consecutive", + /** The metric trigger type is total. */ + Total = "Total", +} + +/** + * Defines values for AlertTemplateMetricTriggerType. \ + * {@link KnownAlertTemplateMetricTriggerType} can be used interchangeably with AlertTemplateMetricTriggerType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Consecutive**: The metric trigger type is consecutive. \ + * **Total**: The metric trigger type is total. + */ +export type AlertTemplateMetricTriggerType = string; + +/** Known values of {@link AlertTemplateParameterType} that the service accepts. */ +export enum KnownAlertTemplateParameterType { + /** Log Analytics query parameter */ + LogAnalyticsQuery = "LogAnalyticsQuery", + /** Provider property parameter */ + ProviderProperty = "ProviderProperty", + /** Custom input parameter */ + CustomInput = "CustomInput", +} + +/** + * Defines values for AlertTemplateParameterType. \ + * {@link KnownAlertTemplateParameterType} can be used interchangeably with AlertTemplateParameterType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **LogAnalyticsQuery**: Log Analytics query parameter \ + * **ProviderProperty**: Provider property parameter \ + * **CustomInput**: Custom input parameter + */ +export type AlertTemplateParameterType = string; + +/** Known values of {@link AlertTemplateSelectionMode} that the service accepts. */ +export enum KnownAlertTemplateSelectionMode { + /** The selection mode is single. */ + Single = "Single", + /** The selection mode is Multiple. */ + Multiple = "Multiple", +} + +/** + * Defines values for AlertTemplateSelectionMode. \ + * {@link KnownAlertTemplateSelectionMode} can be used interchangeably with AlertTemplateSelectionMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Single**: The selection mode is single. \ + * **Multiple**: The selection mode is Multiple. + */ +export type AlertTemplateSelectionMode = string; + +/** Known values of {@link AlertRuleStatus} that the service accepts. */ +export enum KnownAlertRuleStatus { + /** The scheduled query rule is enabled */ + Enabled = "Enabled", + /** The scheduled query rule is disabled */ + Disabled = "Disabled", +} + +/** + * Defines values for AlertRuleStatus. \ + * {@link KnownAlertRuleStatus} can be used interchangeably with AlertRuleStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: The scheduled query rule is enabled \ + * **Disabled**: The scheduled query rule is disabled + */ +export type AlertRuleStatus = string; + +/** Known values of {@link AlertAutoMitigate} that the service accepts. */ +export enum KnownAlertAutoMitigate { + /** The alert should be automatically resolved. */ + Enable = "Enable", + /** The alert should not be automatically resolved. */ + Disable = "Disable", +} + +/** + * Defines values for AlertAutoMitigate. \ + * {@link KnownAlertAutoMitigate} can be used interchangeably with AlertAutoMitigate, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enable**: The alert should be automatically resolved. \ + * **Disable**: The alert should not be automatically resolved. + */ +export type AlertAutoMitigate = string; + +/** Known values of {@link WorkloadProviderInstanceHealthState} that the service accepts. */ +export enum KnownWorkloadProviderInstanceHealthState { + /** The resource health status is Healthy */ + Healthy = "Healthy", + /** The resource health status is Degraded */ + Degraded = "Degraded", + /** The resource health status is Unavailable */ + Unavailable = "Unavailable", + /** The resource health status is Unknown */ + Unknown = "Unknown", +} + +/** + * Defines values for WorkloadProviderInstanceHealthState. \ + * {@link KnownWorkloadProviderInstanceHealthState} can be used interchangeably with WorkloadProviderInstanceHealthState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Healthy**: The resource health status is Healthy \ + * **Degraded**: The resource health status is Degraded \ + * **Unavailable**: The resource health status is Unavailable \ + * **Unknown**: The resource health status is Unknown + */ +export type WorkloadProviderInstanceHealthState = string; + +/** Known values of {@link SapLandscapeMonitorProvisioningState} that the service accepts. */ +export enum KnownSapLandscapeMonitorProvisioningState { + /** The resource request has been accepted. */ + Accepted = "Accepted", + /** The resource has been created. */ + Created = "Created", + /** The resource operation has failed. */ + Failed = "Failed", + /** The resource operation has succeeded. */ + Succeeded = "Succeeded", + /** The resource operation was canceled. */ + Canceled = "Canceled", +} + +/** + * Defines values for SapLandscapeMonitorProvisioningState. \ + * {@link KnownSapLandscapeMonitorProvisioningState} can be used interchangeably with SapLandscapeMonitorProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted**: The resource request has been accepted. \ + * **Created**: The resource has been created. \ + * **Failed**: The resource operation has failed. \ + * **Succeeded**: The resource operation has succeeded. \ + * **Canceled**: The resource operation was canceled. + */ +export type SapLandscapeMonitorProvisioningState = string; + +/** 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 SslPreference} that the service accepts. */ +export enum KnownSslPreference { + /** Secure communication is disabled. */ + Disabled = "Disabled", + /** Secure communication is enabled with root certificate. */ + RootCertificate = "RootCertificate", + /** Secure communication is enabled with server certificate. */ + ServerCertificate = "ServerCertificate", +} + +/** + * Defines values for SslPreference. \ + * {@link KnownSslPreference} can be used interchangeably with SslPreference, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Disabled**: Secure communication is disabled. \ + * **RootCertificate**: Secure communication is enabled with root certificate. \ + * **ServerCertificate**: Secure communication is enabled with server certificate. + */ +export type SslPreference = string; + +/** Optional parameters. */ +export interface MonitorsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type MonitorsListResponse = MonitorListResult; + +/** Optional parameters. */ +export interface MonitorsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type MonitorsListByResourceGroupResponse = MonitorListResult; + +/** Optional parameters. */ +export interface MonitorsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type MonitorsGetResponse = Monitor; + +/** Optional parameters. */ +export interface MonitorsCreateOptionalParams + 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 MonitorsCreateResponse = Monitor; + +/** Optional parameters. */ +export interface MonitorsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type MonitorsUpdateResponse = Monitor; + +/** Optional parameters. */ +export interface MonitorsDeleteOptionalParams + 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 delete operation. */ +export type MonitorsDeleteResponse = MonitorsDeleteHeaders; + +/** Optional parameters. */ +export interface MonitorsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type MonitorsListNextResponse = MonitorListResult; + +/** Optional parameters. */ +export interface MonitorsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type MonitorsListByResourceGroupNextResponse = MonitorListResult; + +/** Optional parameters. */ +export interface AlertTemplatesListOptionalParams + extends coreClient.OperationOptions { + /** The provider type for filtering alert templates. */ + providerType?: string; +} + +/** Contains response data for the list operation. */ +export type AlertTemplatesListResponse = AlertTemplateListResult; + +/** Optional parameters. */ +export interface AlertTemplatesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AlertTemplatesGetResponse = AlertTemplate; + +/** Optional parameters. */ +export interface AlertTemplatesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AlertTemplatesListNextResponse = AlertTemplateListResult; + +/** Optional parameters. */ +export interface AlertsListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AlertsListResponse = AlertListResult; + +/** Optional parameters. */ +export interface AlertsGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AlertsGetResponse = Alert; + +/** Optional parameters. */ +export interface AlertsCreateOptionalParams + 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 AlertsCreateResponse = Alert; + +/** Optional parameters. */ +export interface AlertsDeleteOptionalParams + 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 delete operation. */ +export type AlertsDeleteResponse = AlertsDeleteHeaders; + +/** Optional parameters. */ +export interface AlertsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AlertsListNextResponse = AlertListResult; + +/** Optional parameters. */ +export interface ProviderInstancesListByMonitorOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMonitor operation. */ +export type ProviderInstancesListByMonitorResponse = ProviderInstanceListResult; + +/** Optional parameters. */ +export interface ProviderInstancesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ProviderInstancesGetResponse = ProviderInstance; + +/** Optional parameters. */ +export interface ProviderInstancesCreateOptionalParams + 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 ProviderInstancesCreateResponse = ProviderInstance; + +/** Optional parameters. */ +export interface ProviderInstancesDeleteOptionalParams + 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 delete operation. */ +export type ProviderInstancesDeleteResponse = ProviderInstancesDeleteHeaders; + +/** Optional parameters. */ +export interface ProviderInstancesListByMonitorNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMonitorNext operation. */ +export type ProviderInstancesListByMonitorNextResponse = + ProviderInstanceListResult; + +/** Optional parameters. */ +export interface SapLandscapeMonitorListByMonitorOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMonitor operation. */ +export type SapLandscapeMonitorListByMonitorResponse = + SapLandscapeMonitorResourceListResult; + +/** Optional parameters. */ +export interface SapLandscapeMonitorGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SapLandscapeMonitorGetResponse = SapLandscapeMonitorResource; + +/** Optional parameters. */ +export interface SapLandscapeMonitorCreateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the create operation. */ +export type SapLandscapeMonitorCreateResponse = SapLandscapeMonitorResource; + +/** Optional parameters. */ +export interface SapLandscapeMonitorUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type SapLandscapeMonitorUpdateResponse = SapLandscapeMonitorResource; + +/** Optional parameters. */ +export interface SapLandscapeMonitorDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface SapLandscapeMonitorListByMonitorNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMonitorNext operation. */ +export type SapLandscapeMonitorListByMonitorNextResponse = + SapLandscapeMonitorResourceListResult; + +/** 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 WorkloadsClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/workloads/sapmonitors/src/models/mappers.ts b/sdk/workloads/sapmonitors/src/models/mappers.ts new file mode 100644 index 000000000000..751b14cc0afa --- /dev/null +++ b/sdk/workloads/sapmonitors/src/models/mappers.ts @@ -0,0 +1,1909 @@ +/* + * 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 MonitorListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitorListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Monitor", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +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 ManagedResourceGroupConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedResourceGroupConfiguration", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const AppServicePlanConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppServicePlanConfiguration", + modelProperties: { + tier: { + serializedName: "tier", + type: { + name: "String", + }, + }, + capacity: { + constraints: { + InclusiveMinimum: 0, + }, + serializedName: "capacity", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const ManagedServiceIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedServiceIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid", + }, + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "Uuid", + }, + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String", + }, + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { name: "Composite", className: "UserAssignedIdentity" }, + }, + }, + }, + }, + }, +}; + +export const UserAssignedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid", + }, + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "Uuid", + }, + }, + }, + }, +}; + +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 ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + }, + }, +}; + +export const UpdateMonitorRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateMonitorRequest", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } }, + }, + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity", + }, + }, + }, + }, +}; + +export const AlertTemplateListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertTemplateListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AlertTemplate", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const AlertTemplateMetricMeasurement: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertTemplateMetricMeasurement", + modelProperties: { + thresholdOperator: { + serializedName: "thresholdOperator", + type: { + name: "String", + }, + }, + threshold: { + serializedName: "threshold", + type: { + name: "Number", + }, + }, + metricTriggerType: { + serializedName: "metricTriggerType", + type: { + name: "String", + }, + }, + metricColumn: { + serializedName: "metricColumn", + type: { + name: "String", + }, + }, + frequencyInMinutes: { + serializedName: "frequencyInMinutes", + type: { + name: "Number", + }, + }, + timeWindowInMinutes: { + serializedName: "timeWindowInMinutes", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const AlertTemplateQueryInputParameter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertTemplateQueryInputParameter", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + type: { + serializedName: "type", + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + type: { + name: "String", + }, + }, + defaultValue: { + serializedName: "defaultValue", + type: { + name: "String", + }, + }, + laQuery: { + serializedName: "laQuery", + type: { + name: "String", + }, + }, + selectionMode: { + serializedName: "selectionMode", + type: { + name: "String", + }, + }, + displayName: { + serializedName: "displayName", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const AlertListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Alert", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const AlertRuleProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertRuleProperties", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "String", + }, + }, + severity: { + constraints: { + InclusiveMaximum: 4, + InclusiveMinimum: 0, + }, + serializedName: "severity", + type: { + name: "Number", + }, + }, + actionGroups: { + serializedName: "actionGroups", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + threshold: { + serializedName: "threshold", + type: { + name: "Number", + }, + }, + thresholdOperator: { + serializedName: "thresholdOperator", + type: { + name: "String", + }, + }, + windowSize: { + serializedName: "windowSize", + type: { + name: "Number", + }, + }, + evaluationFrequency: { + serializedName: "evaluationFrequency", + type: { + name: "Number", + }, + }, + failingPeriodsToAlert: { + serializedName: "failingPeriodsToAlert", + type: { + name: "Number", + }, + }, + failingPeriodsOperator: { + serializedName: "failingPeriodsOperator", + type: { + name: "String", + }, + }, + muteActionsDuration: { + serializedName: "muteActionsDuration", + type: { + name: "Number", + }, + }, + autoMitigate: { + serializedName: "autoMitigate", + type: { + name: "String", + }, + }, + dimension: { + serializedName: "dimension", + type: { + name: "String", + }, + }, + alertQueryParameters: { + serializedName: "alertQueryParameters", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AlertQueryParameter", + }, + }, + }, + }, + }, + }, +}; + +export const AlertQueryParameter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertQueryParameter", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + value: { + serializedName: "value", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ProviderInstanceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderInstanceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProviderInstance", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const Health: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Health", + modelProperties: { + healthState: { + serializedName: "healthState", + readOnly: true, + type: { + name: "String", + }, + }, + impactingReasons: { + serializedName: "impactingReasons", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ProviderSpecificProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderSpecificProperties", + uberParent: "ProviderSpecificProperties", + polymorphicDiscriminator: { + serializedName: "providerType", + clientName: "providerType", + }, + modelProperties: { + providerType: { + serializedName: "providerType", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const SapLandscapeMonitorResourceListResult: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "SapLandscapeMonitorResourceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SapLandscapeMonitorResource", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const SapLandscapeMonitorPropertiesGrouping: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "SapLandscapeMonitorPropertiesGrouping", + modelProperties: { + landscape: { + constraints: { + MaxItems: 50, + }, + serializedName: "landscape", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SapLandscapeMonitorSidMapping", + }, + }, + }, + }, + sapApplication: { + constraints: { + MaxItems: 50, + }, + serializedName: "sapApplication", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SapLandscapeMonitorSidMapping", + }, + }, + }, + }, + }, + }, + }; + +export const SapLandscapeMonitorSidMapping: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SapLandscapeMonitorSidMapping", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + topSid: { + constraints: { + MaxItems: 50, + }, + serializedName: "topSid", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + }, + }, +}; + +export const SapLandscapeMonitorMetricThresholds: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SapLandscapeMonitorMetricThresholds", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + green: { + serializedName: "green", + type: { + name: "Number", + }, + }, + yellow: { + serializedName: "yellow", + type: { + name: "Number", + }, + }, + red: { + serializedName: "red", + type: { + name: "Number", + }, + }, + }, + }, +}; + +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 TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } }, + }, + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties, + }, + }, +}; + +export const Db2ProviderInstanceProperties: coreClient.CompositeMapper = { + serializedName: "Db2", + type: { + name: "Composite", + className: "Db2ProviderInstanceProperties", + uberParent: "ProviderSpecificProperties", + polymorphicDiscriminator: + ProviderSpecificProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ProviderSpecificProperties.type.modelProperties, + hostname: { + serializedName: "hostname", + type: { + name: "String", + }, + }, + dbName: { + serializedName: "dbName", + type: { + name: "String", + }, + }, + dbPort: { + serializedName: "dbPort", + type: { + name: "String", + }, + }, + dbUsername: { + serializedName: "dbUsername", + type: { + name: "String", + }, + }, + dbPassword: { + serializedName: "dbPassword", + type: { + name: "String", + }, + }, + dbPasswordUri: { + serializedName: "dbPasswordUri", + type: { + name: "String", + }, + }, + sapSid: { + serializedName: "sapSid", + type: { + name: "String", + }, + }, + sslPreference: { + serializedName: "sslPreference", + type: { + name: "String", + }, + }, + sslCertificateUri: { + serializedName: "sslCertificateUri", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const HanaDbProviderInstanceProperties: coreClient.CompositeMapper = { + serializedName: "SapHana", + type: { + name: "Composite", + className: "HanaDbProviderInstanceProperties", + uberParent: "ProviderSpecificProperties", + polymorphicDiscriminator: + ProviderSpecificProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ProviderSpecificProperties.type.modelProperties, + hostname: { + serializedName: "hostname", + type: { + name: "String", + }, + }, + dbName: { + serializedName: "dbName", + type: { + name: "String", + }, + }, + sqlPort: { + serializedName: "sqlPort", + type: { + name: "String", + }, + }, + instanceNumber: { + serializedName: "instanceNumber", + type: { + name: "String", + }, + }, + dbUsername: { + serializedName: "dbUsername", + type: { + name: "String", + }, + }, + dbPassword: { + serializedName: "dbPassword", + type: { + name: "String", + }, + }, + dbPasswordUri: { + serializedName: "dbPasswordUri", + type: { + name: "String", + }, + }, + sslCertificateUri: { + serializedName: "sslCertificateUri", + type: { + name: "String", + }, + }, + sslHostNameInCertificate: { + serializedName: "sslHostNameInCertificate", + type: { + name: "String", + }, + }, + sslPreference: { + serializedName: "sslPreference", + type: { + name: "String", + }, + }, + sapSid: { + serializedName: "sapSid", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const MsSqlServerProviderInstanceProperties: coreClient.CompositeMapper = + { + serializedName: "MsSqlServer", + type: { + name: "Composite", + className: "MsSqlServerProviderInstanceProperties", + uberParent: "ProviderSpecificProperties", + polymorphicDiscriminator: + ProviderSpecificProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ProviderSpecificProperties.type.modelProperties, + hostname: { + serializedName: "hostname", + type: { + name: "String", + }, + }, + dbPort: { + serializedName: "dbPort", + type: { + name: "String", + }, + }, + dbUsername: { + serializedName: "dbUsername", + type: { + name: "String", + }, + }, + dbPassword: { + serializedName: "dbPassword", + type: { + name: "String", + }, + }, + dbPasswordUri: { + serializedName: "dbPasswordUri", + type: { + name: "String", + }, + }, + sapSid: { + serializedName: "sapSid", + type: { + name: "String", + }, + }, + sslPreference: { + serializedName: "sslPreference", + type: { + name: "String", + }, + }, + sslCertificateUri: { + serializedName: "sslCertificateUri", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const OracleProviderInstanceProperties: coreClient.CompositeMapper = { + serializedName: "Oracle", + type: { + name: "Composite", + className: "OracleProviderInstanceProperties", + uberParent: "ProviderSpecificProperties", + polymorphicDiscriminator: + ProviderSpecificProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ProviderSpecificProperties.type.modelProperties, + hostname: { + serializedName: "hostname", + type: { + name: "String", + }, + }, + dbPort: { + serializedName: "dbPort", + type: { + name: "String", + }, + }, + dbName: { + serializedName: "dbName", + type: { + name: "String", + }, + }, + dbUsername: { + serializedName: "dbUsername", + type: { + name: "String", + }, + }, + dbPassword: { + serializedName: "dbPassword", + type: { + name: "String", + }, + }, + dbPasswordUri: { + serializedName: "dbPasswordUri", + type: { + name: "String", + }, + }, + sapSid: { + serializedName: "sapSid", + type: { + name: "String", + }, + }, + sslPreference: { + serializedName: "sslPreference", + type: { + name: "String", + }, + }, + sslCertificateUri: { + serializedName: "sslCertificateUri", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const PrometheusHaClusterProviderInstanceProperties: coreClient.CompositeMapper = + { + serializedName: "PrometheusHaCluster", + type: { + name: "Composite", + className: "PrometheusHaClusterProviderInstanceProperties", + uberParent: "ProviderSpecificProperties", + polymorphicDiscriminator: + ProviderSpecificProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ProviderSpecificProperties.type.modelProperties, + prometheusUrl: { + serializedName: "prometheusUrl", + type: { + name: "String", + }, + }, + hostname: { + serializedName: "hostname", + type: { + name: "String", + }, + }, + sid: { + serializedName: "sid", + type: { + name: "String", + }, + }, + clusterName: { + serializedName: "clusterName", + type: { + name: "String", + }, + }, + sslPreference: { + serializedName: "sslPreference", + type: { + name: "String", + }, + }, + sslCertificateUri: { + serializedName: "sslCertificateUri", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const PrometheusOsProviderInstanceProperties: coreClient.CompositeMapper = + { + serializedName: "PrometheusOS", + type: { + name: "Composite", + className: "PrometheusOsProviderInstanceProperties", + uberParent: "ProviderSpecificProperties", + polymorphicDiscriminator: + ProviderSpecificProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ProviderSpecificProperties.type.modelProperties, + prometheusUrl: { + serializedName: "prometheusUrl", + type: { + name: "String", + }, + }, + sslPreference: { + serializedName: "sslPreference", + type: { + name: "String", + }, + }, + sslCertificateUri: { + serializedName: "sslCertificateUri", + type: { + name: "String", + }, + }, + sapSid: { + serializedName: "sapSid", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const SapNetWeaverProviderInstanceProperties: coreClient.CompositeMapper = + { + serializedName: "SapNetWeaver", + type: { + name: "Composite", + className: "SapNetWeaverProviderInstanceProperties", + uberParent: "ProviderSpecificProperties", + polymorphicDiscriminator: + ProviderSpecificProperties.type.polymorphicDiscriminator, + modelProperties: { + ...ProviderSpecificProperties.type.modelProperties, + sapSid: { + serializedName: "sapSid", + type: { + name: "String", + }, + }, + sapHostname: { + serializedName: "sapHostname", + type: { + name: "String", + }, + }, + sapInstanceNr: { + serializedName: "sapInstanceNr", + type: { + name: "String", + }, + }, + sapHostFileEntries: { + serializedName: "sapHostFileEntries", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + sapUsername: { + serializedName: "sapUsername", + type: { + name: "String", + }, + }, + sapPassword: { + serializedName: "sapPassword", + type: { + name: "String", + }, + }, + sapPasswordUri: { + serializedName: "sapPasswordUri", + type: { + name: "String", + }, + }, + sapClientId: { + serializedName: "sapClientId", + type: { + name: "String", + }, + }, + sapPortNumber: { + serializedName: "sapPortNumber", + type: { + name: "String", + }, + }, + sslCertificateUri: { + serializedName: "sslCertificateUri", + type: { + name: "String", + }, + }, + sslPreference: { + serializedName: "sslPreference", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const Monitor: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Monitor", + modelProperties: { + ...TrackedResource.type.modelProperties, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity", + }, + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + errors: { + serializedName: "properties.errors", + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + appLocation: { + serializedName: "properties.appLocation", + type: { + name: "String", + }, + }, + routingPreference: { + serializedName: "properties.routingPreference", + type: { + name: "String", + }, + }, + zoneRedundancyPreference: { + serializedName: "properties.zoneRedundancyPreference", + type: { + name: "String", + }, + }, + managedResourceGroupConfiguration: { + serializedName: "properties.managedResourceGroupConfiguration", + type: { + name: "Composite", + className: "ManagedResourceGroupConfiguration", + }, + }, + logAnalyticsWorkspaceArmId: { + serializedName: "properties.logAnalyticsWorkspaceArmId", + type: { + name: "String", + }, + }, + monitorSubnet: { + serializedName: "properties.monitorSubnet", + type: { + name: "String", + }, + }, + appServicePlanConfiguration: { + serializedName: "properties.appServicePlanConfiguration", + type: { + name: "Composite", + className: "AppServicePlanConfiguration", + }, + }, + msiArmId: { + serializedName: "properties.msiArmId", + readOnly: true, + type: { + name: "String", + }, + }, + storageAccountArmId: { + serializedName: "properties.storageAccountArmId", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const AlertTemplate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertTemplate", + modelProperties: { + ...ProxyResource.type.modelProperties, + errors: { + serializedName: "properties.errors", + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + templateDisplayName: { + serializedName: "properties.templateDisplayName", + type: { + name: "String", + }, + }, + providerType: { + serializedName: "properties.providerType", + type: { + name: "String", + }, + }, + description: { + serializedName: "properties.description", + type: { + name: "String", + }, + }, + severity: { + constraints: { + InclusiveMaximum: 4, + InclusiveMinimum: 0, + }, + serializedName: "properties.severity", + type: { + name: "Number", + }, + }, + query: { + serializedName: "properties.query", + type: { + name: "String", + }, + }, + thresholdOperator: { + serializedName: "properties.thresholdOperator", + type: { + name: "String", + }, + }, + defaultThreshold: { + serializedName: "properties.defaultThreshold", + type: { + name: "Number", + }, + }, + lowerBound: { + serializedName: "properties.lowerBound", + type: { + name: "Number", + }, + }, + upperBound: { + serializedName: "properties.upperBound", + type: { + name: "Number", + }, + }, + defaultThresholdInputOption: { + serializedName: "properties.defaultThresholdInputOption", + type: { + name: "String", + }, + }, + alertUnit: { + serializedName: "properties.alertUnit", + type: { + name: "String", + }, + }, + metricMeasurement: { + serializedName: "properties.metricMeasurement", + type: { + name: "Composite", + className: "AlertTemplateMetricMeasurement", + }, + }, + queryInputParameters: { + constraints: { + MaxItems: 50, + }, + serializedName: "properties.queryInputParameters", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AlertTemplateQueryInputParameter", + }, + }, + }, + }, + }, + }, +}; + +export const Alert: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Alert", + modelProperties: { + ...ProxyResource.type.modelProperties, + errors: { + serializedName: "properties.errors", + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + alertRuleResourceId: { + serializedName: "properties.alertRuleResourceId", + readOnly: true, + type: { + name: "String", + }, + }, + templateName: { + serializedName: "properties.templateName", + type: { + name: "String", + }, + }, + providerType: { + serializedName: "properties.providerType", + type: { + name: "String", + }, + }, + providerNames: { + serializedName: "properties.providerNames", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + alertRuleProperties: { + serializedName: "properties.alertRuleProperties", + type: { + name: "Composite", + className: "AlertRuleProperties", + }, + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ProviderInstance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderInstance", + modelProperties: { + ...ProxyResource.type.modelProperties, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + health: { + serializedName: "properties.health", + type: { + name: "Composite", + className: "Health", + }, + }, + errors: { + serializedName: "properties.errors", + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + providerSettings: { + serializedName: "properties.providerSettings", + type: { + name: "Composite", + className: "ProviderSpecificProperties", + }, + }, + }, + }, +}; + +export const SapLandscapeMonitorResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SapLandscapeMonitorResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + grouping: { + serializedName: "properties.grouping", + type: { + name: "Composite", + className: "SapLandscapeMonitorPropertiesGrouping", + }, + }, + topMetricsThresholds: { + constraints: { + MaxItems: 50, + }, + serializedName: "properties.topMetricsThresholds", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SapLandscapeMonitorMetricThresholds", + }, + }, + }, + }, + }, + }, +}; + +export const MonitorsCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitorsCreateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const MonitorsUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitorsUpdateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const MonitorsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitorsDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const AlertsCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertsCreateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const AlertsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AlertsDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const ProviderInstancesCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderInstancesCreateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const ProviderInstancesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderInstancesDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export let discriminators = { + ProviderSpecificProperties: ProviderSpecificProperties, + "ProviderSpecificProperties.Db2": Db2ProviderInstanceProperties, + "ProviderSpecificProperties.SapHana": HanaDbProviderInstanceProperties, + "ProviderSpecificProperties.MsSqlServer": + MsSqlServerProviderInstanceProperties, + "ProviderSpecificProperties.Oracle": OracleProviderInstanceProperties, + "ProviderSpecificProperties.PrometheusHaCluster": + PrometheusHaClusterProviderInstanceProperties, + "ProviderSpecificProperties.PrometheusOS": + PrometheusOsProviderInstanceProperties, + "ProviderSpecificProperties.SapNetWeaver": + SapNetWeaverProviderInstanceProperties, +}; diff --git a/sdk/workloads/sapmonitors/src/models/parameters.ts b/sdk/workloads/sapmonitors/src/models/parameters.ts new file mode 100644 index 000000000000..f49952f9e030 --- /dev/null +++ b/sdk/workloads/sapmonitors/src/models/parameters.ts @@ -0,0 +1,207 @@ +/* + * 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 { + Monitor as MonitorMapper, + UpdateMonitorRequest as UpdateMonitorRequestMapper, + Alert as AlertMapper, + ProviderInstance as ProviderInstanceMapper, + SapLandscapeMonitorResource as SapLandscapeMonitorResourceMapper, +} 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-02-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String", + }, + }, +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "Uuid", + }, + }, +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const monitorName: OperationURLParameter = { + parameterPath: "monitorName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9-_]+$"), + }, + serializedName: "monitorName", + 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: MonitorMapper, +}; + +export const properties: OperationParameter = { + parameterPath: "properties", + mapper: UpdateMonitorRequestMapper, +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const providerType: OperationQueryParameter = { + parameterPath: ["options", "providerType"], + mapper: { + constraints: { + MinLength: 1, + }, + serializedName: "providerType", + type: { + name: "String", + }, + }, +}; + +export const alertTemplateName: OperationURLParameter = { + parameterPath: "alertTemplateName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9-_]+$"), + MinLength: 1, + }, + serializedName: "alertTemplateName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const alertName: OperationURLParameter = { + parameterPath: "alertName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9-_]+$"), + MinLength: 1, + }, + serializedName: "alertName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource1: OperationParameter = { + parameterPath: "resource", + mapper: AlertMapper, +}; + +export const providerInstanceName: OperationURLParameter = { + parameterPath: "providerInstanceName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9-_]+$"), + }, + serializedName: "providerInstanceName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource2: OperationParameter = { + parameterPath: "resource", + mapper: ProviderInstanceMapper, +}; + +export const resource3: OperationParameter = { + parameterPath: "resource", + mapper: SapLandscapeMonitorResourceMapper, +}; + +export const properties1: OperationParameter = { + parameterPath: "properties", + mapper: SapLandscapeMonitorResourceMapper, +}; diff --git a/sdk/workloads/sapmonitors/src/operations/alertTemplates.ts b/sdk/workloads/sapmonitors/src/operations/alertTemplates.ts new file mode 100644 index 000000000000..cc55ab9aa87f --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operations/alertTemplates.ts @@ -0,0 +1,239 @@ +/* + * 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 { AlertTemplates } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WorkloadsClient } from "../workloadsClient"; +import { + AlertTemplate, + AlertTemplatesListNextOptionalParams, + AlertTemplatesListOptionalParams, + AlertTemplatesListResponse, + AlertTemplatesGetOptionalParams, + AlertTemplatesGetResponse, + AlertTemplatesListNextResponse, +} from "../models"; + +/// +/** Class containing AlertTemplates operations. */ +export class AlertTemplatesImpl implements AlertTemplates { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class AlertTemplates class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * Gets a list of alert templates in the specified SAP monitor. The operations returns various + * properties of each alert template. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + monitorName: string, + options?: AlertTemplatesListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, monitorName, 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( + resourceGroupName, + monitorName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + monitorName: string, + options?: AlertTemplatesListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: AlertTemplatesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, monitorName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + monitorName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + monitorName: string, + options?: AlertTemplatesListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + monitorName, + options, + )) { + yield* page; + } + } + + /** + * Gets a list of alert templates in the specified SAP monitor. The operations returns various + * properties of each alert template. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + monitorName: string, + options?: AlertTemplatesListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + listOperationSpec, + ); + } + + /** + * Gets properties of an alert template for the specified subscription, resource group, SAP monitor + * name, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertTemplateName SAP monitor alert template resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + alertTemplateName: string, + options?: AlertTemplatesGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, alertTemplateName, options }, + getOperationSpec, + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + monitorName: string, + nextLink: string, + options?: AlertTemplatesListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alertTemplates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AlertTemplateListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion, Parameters.providerType], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alertTemplates/{alertTemplateName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AlertTemplate, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.alertTemplateName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AlertTemplateListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/workloads/sapmonitors/src/operations/alerts.ts b/sdk/workloads/sapmonitors/src/operations/alerts.ts new file mode 100644 index 000000000000..deeceb01da25 --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operations/alerts.ts @@ -0,0 +1,506 @@ +/* + * 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 { Alerts } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WorkloadsClient } from "../workloadsClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + Alert, + AlertsListNextOptionalParams, + AlertsListOptionalParams, + AlertsListResponse, + AlertsGetOptionalParams, + AlertsGetResponse, + AlertsCreateOptionalParams, + AlertsCreateResponse, + AlertsDeleteOptionalParams, + AlertsDeleteResponse, + AlertsListNextResponse, +} from "../models"; + +/// +/** Class containing Alerts operations. */ +export class AlertsImpl implements Alerts { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class Alerts class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * Gets a list of alerts in the specified SAP monitor. The operations returns various properties of + * each alerts. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + monitorName: string, + options?: AlertsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, monitorName, 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( + resourceGroupName, + monitorName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + monitorName: string, + options?: AlertsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: AlertsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, monitorName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + monitorName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + monitorName: string, + options?: AlertsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + monitorName, + options, + )) { + yield* page; + } + } + + /** + * Gets a list of alerts in the specified SAP monitor. The operations returns various properties of + * each alerts. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + monitorName: string, + options?: AlertsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + listOperationSpec, + ); + } + + /** + * Gets properties of an alert for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + alertName: string, + options?: AlertsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, alertName, options }, + getOperationSpec, + ); + } + + /** + * Creates an alert for the specified subscription, resource group, SAP monitor name, and resource + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param resource Request body representing a SAP monitor's alert resource + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + monitorName: string, + alertName: string, + resource: Alert, + options?: AlertsCreateOptionalParams, + ): Promise< + SimplePollerLike, AlertsCreateResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, monitorName, alertName, resource, options }, + spec: createOperationSpec, + }); + const poller = await createHttpPoller< + AlertsCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Creates an alert for the specified subscription, resource group, SAP monitor name, and resource + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param resource Request body representing a SAP monitor's alert resource + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + monitorName: string, + alertName: string, + resource: Alert, + options?: AlertsCreateOptionalParams, + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + monitorName, + alertName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Deletes an alert for the specified subscription, resource group, SAP monitor name, and resource + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + monitorName: string, + alertName: string, + options?: AlertsDeleteOptionalParams, + ): Promise< + SimplePollerLike, AlertsDeleteResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, monitorName, alertName, options }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller< + AlertsDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Deletes an alert for the specified subscription, resource group, SAP monitor name, and resource + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + monitorName: string, + alertName: string, + options?: AlertsDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + monitorName, + alertName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + monitorName: string, + nextLink: string, + options?: AlertsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alerts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AlertListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alerts/{alertName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Alert, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.alertName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alerts/{alertName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Alert, + }, + 201: { + bodyMapper: Mappers.Alert, + }, + 202: { + bodyMapper: Mappers.Alert, + }, + 204: { + bodyMapper: Mappers.Alert, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.alertName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alerts/{alertName}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.AlertsDeleteHeaders, + }, + 201: { + headersMapper: Mappers.AlertsDeleteHeaders, + }, + 202: { + headersMapper: Mappers.AlertsDeleteHeaders, + }, + 204: { + headersMapper: Mappers.AlertsDeleteHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.alertName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AlertListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/workloads/sapmonitors/src/operations/index.ts b/sdk/workloads/sapmonitors/src/operations/index.ts new file mode 100644 index 000000000000..b0af78786295 --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operations/index.ts @@ -0,0 +1,14 @@ +/* + * 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 "./monitors"; +export * from "./alertTemplates"; +export * from "./alerts"; +export * from "./providerInstances"; +export * from "./sapLandscapeMonitor"; +export * from "./operations"; diff --git a/sdk/workloads/sapmonitors/src/operations/monitors.ts b/sdk/workloads/sapmonitors/src/operations/monitors.ts new file mode 100644 index 000000000000..30bd4797a813 --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operations/monitors.ts @@ -0,0 +1,729 @@ +/* + * 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 { Monitors } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WorkloadsClient } from "../workloadsClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + Monitor, + MonitorsListNextOptionalParams, + MonitorsListOptionalParams, + MonitorsListResponse, + MonitorsListByResourceGroupNextOptionalParams, + MonitorsListByResourceGroupOptionalParams, + MonitorsListByResourceGroupResponse, + MonitorsGetOptionalParams, + MonitorsGetResponse, + MonitorsCreateOptionalParams, + MonitorsCreateResponse, + UpdateMonitorRequest, + MonitorsUpdateOptionalParams, + MonitorsUpdateResponse, + MonitorsDeleteOptionalParams, + MonitorsDeleteResponse, + MonitorsListNextResponse, + MonitorsListByResourceGroupNextResponse, +} from "../models"; + +/// +/** Class containing Monitors operations. */ +export class MonitorsImpl implements Monitors { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class Monitors class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties + * of each SAP monitor. + * @param options The options parameters. + */ + public list( + options?: MonitorsListOptionalParams, + ): 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?: MonitorsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: MonitorsListResponse; + 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?: MonitorsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Gets a list of SAP monitors in the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings, + ); + }, + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: MonitorsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options, + )) { + yield* page; + } + } + + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties + * of each SAP monitor. + * @param options The options parameters. + */ + private _list( + options?: MonitorsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * Gets a list of SAP monitors in the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec, + ); + } + + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + options?: MonitorsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + getOperationSpec, + ); + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param resource Request body representing a SAP monitor + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + monitorName: string, + resource: Monitor, + options?: MonitorsCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MonitorsCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, monitorName, resource, options }, + spec: createOperationSpec, + }); + const poller = await createHttpPoller< + MonitorsCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param resource Request body representing a SAP monitor + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + monitorName: string, + resource: Monitor, + options?: MonitorsCreateOptionalParams, + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + monitorName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP + * monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param properties The Update SAP workload monitor request body. + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + monitorName: string, + properties: UpdateMonitorRequest, + options?: MonitorsUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MonitorsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, monitorName, properties, options }, + spec: updateOperationSpec, + }); + const poller = await createHttpPoller< + MonitorsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP + * monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param properties The Update SAP workload monitor request body. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + monitorName: string, + properties: UpdateMonitorRequest, + options?: MonitorsUpdateOptionalParams, + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + monitorName, + properties, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + monitorName: string, + options?: MonitorsDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MonitorsDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, monitorName, options }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller< + MonitorsDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + monitorName: string, + options?: MonitorsDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + monitorName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: MonitorsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec, + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: MonitorsListByResourceGroupNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitorListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer, +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitorListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Monitor, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Monitor, + }, + 201: { + bodyMapper: Mappers.Monitor, + }, + 202: { + bodyMapper: Mappers.Monitor, + }, + 204: { + bodyMapper: Mappers.Monitor, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Monitor, + }, + 201: { + bodyMapper: Mappers.Monitor, + }, + 202: { + bodyMapper: Mappers.Monitor, + }, + 204: { + bodyMapper: Mappers.Monitor, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.properties, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.MonitorsDeleteHeaders, + }, + 201: { + headersMapper: Mappers.MonitorsDeleteHeaders, + }, + 202: { + headersMapper: Mappers.MonitorsDeleteHeaders, + }, + 204: { + headersMapper: Mappers.MonitorsDeleteHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitorListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitorListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/workloads/sapmonitors/src/operations/operations.ts b/sdk/workloads/sapmonitors/src/operations/operations.ts new file mode 100644 index 000000000000..51ed166f0d30 --- /dev/null +++ b/sdk/workloads/sapmonitors/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 { WorkloadsClient } from "../workloadsClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse, +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + 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.Workloads/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/workloads/sapmonitors/src/operations/providerInstances.ts b/sdk/workloads/sapmonitors/src/operations/providerInstances.ts new file mode 100644 index 000000000000..01cecbba7c1c --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operations/providerInstances.ts @@ -0,0 +1,525 @@ +/* + * 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 { ProviderInstances } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WorkloadsClient } from "../workloadsClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + ProviderInstance, + ProviderInstancesListByMonitorNextOptionalParams, + ProviderInstancesListByMonitorOptionalParams, + ProviderInstancesListByMonitorResponse, + ProviderInstancesGetOptionalParams, + ProviderInstancesGetResponse, + ProviderInstancesCreateOptionalParams, + ProviderInstancesCreateResponse, + ProviderInstancesDeleteOptionalParams, + ProviderInstancesDeleteResponse, + ProviderInstancesListByMonitorNextResponse, +} from "../models"; + +/// +/** Class containing ProviderInstances operations. */ +export class ProviderInstancesImpl implements ProviderInstances { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class ProviderInstances class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various + * properties of each provider instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + public listByMonitor( + resourceGroupName: string, + monitorName: string, + options?: ProviderInstancesListByMonitorOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByMonitorPagingAll( + resourceGroupName, + monitorName, + 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.listByMonitorPagingPage( + resourceGroupName, + monitorName, + options, + settings, + ); + }, + }; + } + + private async *listByMonitorPagingPage( + resourceGroupName: string, + monitorName: string, + options?: ProviderInstancesListByMonitorOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: ProviderInstancesListByMonitorResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByMonitor( + resourceGroupName, + monitorName, + options, + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByMonitorNext( + resourceGroupName, + monitorName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByMonitorPagingAll( + resourceGroupName: string, + monitorName: string, + options?: ProviderInstancesListByMonitorOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByMonitorPagingPage( + resourceGroupName, + monitorName, + options, + )) { + yield* page; + } + } + + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various + * properties of each provider instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + private _listByMonitor( + resourceGroupName: string, + monitorName: string, + options?: ProviderInstancesListByMonitorOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + listByMonitorOperationSpec, + ); + } + + /** + * Gets properties of a provider instance for the specified subscription, resource group, SAP monitor + * name, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + options?: ProviderInstancesGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, providerInstanceName, options }, + getOperationSpec, + ); + } + + /** + * Creates a provider instance for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param resource Request body representing a provider instance associated with a SAP monitor. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + resource: ProviderInstance, + options?: ProviderInstancesCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + ProviderInstancesCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + monitorName, + providerInstanceName, + resource, + options, + }, + spec: createOperationSpec, + }); + const poller = await createHttpPoller< + ProviderInstancesCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + }); + await poller.poll(); + return poller; + } + + /** + * Creates a provider instance for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param resource Request body representing a provider instance associated with a SAP monitor. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + resource: ProviderInstance, + options?: ProviderInstancesCreateOptionalParams, + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + monitorName, + providerInstanceName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Deletes a provider instance for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + options?: ProviderInstancesDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + ProviderInstancesDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, monitorName, providerInstanceName, options }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller< + ProviderInstancesDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a provider instance for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + options?: ProviderInstancesDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + monitorName, + providerInstanceName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * ListByMonitorNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param nextLink The nextLink from the previous successful call to the ListByMonitor method. + * @param options The options parameters. + */ + private _listByMonitorNext( + resourceGroupName: string, + monitorName: string, + nextLink: string, + options?: ProviderInstancesListByMonitorNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, nextLink, options }, + listByMonitorNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByMonitorOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ProviderInstanceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ProviderInstance, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.providerInstanceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ProviderInstance, + }, + 201: { + bodyMapper: Mappers.ProviderInstance, + }, + 202: { + bodyMapper: Mappers.ProviderInstance, + }, + 204: { + bodyMapper: Mappers.ProviderInstance, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.providerInstanceName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.ProviderInstancesDeleteHeaders, + }, + 201: { + headersMapper: Mappers.ProviderInstancesDeleteHeaders, + }, + 202: { + headersMapper: Mappers.ProviderInstancesDeleteHeaders, + }, + 204: { + headersMapper: Mappers.ProviderInstancesDeleteHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.providerInstanceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByMonitorNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ProviderInstanceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/workloads/sapmonitors/src/operations/sapLandscapeMonitor.ts b/sdk/workloads/sapmonitors/src/operations/sapLandscapeMonitor.ts new file mode 100644 index 000000000000..3b831d1c40ba --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operations/sapLandscapeMonitor.ts @@ -0,0 +1,376 @@ +/* + * 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 { SapLandscapeMonitor } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WorkloadsClient } from "../workloadsClient"; +import { + SapLandscapeMonitorResource, + SapLandscapeMonitorListByMonitorNextOptionalParams, + SapLandscapeMonitorListByMonitorOptionalParams, + SapLandscapeMonitorListByMonitorResponse, + SapLandscapeMonitorGetOptionalParams, + SapLandscapeMonitorGetResponse, + SapLandscapeMonitorCreateOptionalParams, + SapLandscapeMonitorCreateResponse, + SapLandscapeMonitorUpdateOptionalParams, + SapLandscapeMonitorUpdateResponse, + SapLandscapeMonitorDeleteOptionalParams, + SapLandscapeMonitorListByMonitorNextResponse, +} from "../models"; + +/// +/** Class containing SapLandscapeMonitor operations. */ +export class SapLandscapeMonitorImpl implements SapLandscapeMonitor { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class SapLandscapeMonitor class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * Gets configuration values for Single Pane Of Glass for SAP monitor for the specified subscription, + * resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + public listByMonitor( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorListByMonitorOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByMonitorPagingAll( + resourceGroupName, + monitorName, + 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.listByMonitorPagingPage( + resourceGroupName, + monitorName, + options, + settings, + ); + }, + }; + } + + private async *listByMonitorPagingPage( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorListByMonitorOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: SapLandscapeMonitorListByMonitorResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByMonitor( + resourceGroupName, + monitorName, + options, + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByMonitorNext( + resourceGroupName, + monitorName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByMonitorPagingAll( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorListByMonitorOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByMonitorPagingPage( + resourceGroupName, + monitorName, + options, + )) { + yield* page; + } + } + + /** + * Gets configuration values for Single Pane Of Glass for SAP monitor for the specified subscription, + * resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + private _listByMonitor( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorListByMonitorOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + listByMonitorOperationSpec, + ); + } + + /** + * Gets configuration values for Single Pane Of Glass for SAP monitor for the specified subscription, + * resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + getOperationSpec, + ); + } + + /** + * Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param resource Request body representing a configuration for Sap Landscape Monitor Dashboard + * @param options The options parameters. + */ + create( + resourceGroupName: string, + monitorName: string, + resource: SapLandscapeMonitorResource, + options?: SapLandscapeMonitorCreateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, resource, options }, + createOperationSpec, + ); + } + + /** + * Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and SAP + * monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param properties Request body representing a configuration for Sap Landscape Monitor Dashboard + * @param options The options parameters. + */ + update( + resourceGroupName: string, + monitorName: string, + properties: SapLandscapeMonitorResource, + options?: SapLandscapeMonitorUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, properties, options }, + updateOperationSpec, + ); + } + + /** + * Deletes a SAP Landscape Monitor Dashboard with the specified subscription, resource group, and SAP + * monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + deleteOperationSpec, + ); + } + + /** + * ListByMonitorNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param nextLink The nextLink from the previous successful call to the ListByMonitor method. + * @param options The options parameters. + */ + private _listByMonitorNext( + resourceGroupName: string, + monitorName: string, + nextLink: string, + options?: SapLandscapeMonitorListByMonitorNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, nextLink, options }, + listByMonitorNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByMonitorOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SapLandscapeMonitorResourceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SapLandscapeMonitorResource, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SapLandscapeMonitorResource, + }, + 201: { + bodyMapper: Mappers.SapLandscapeMonitorResource, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.SapLandscapeMonitorResource, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.properties1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByMonitorNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SapLandscapeMonitorResourceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/workloads/sapmonitors/src/operationsInterfaces/alertTemplates.ts b/sdk/workloads/sapmonitors/src/operationsInterfaces/alertTemplates.ts new file mode 100644 index 000000000000..da68224ff682 --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operationsInterfaces/alertTemplates.ts @@ -0,0 +1,46 @@ +/* + * 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 { + AlertTemplate, + AlertTemplatesListOptionalParams, + AlertTemplatesGetOptionalParams, + AlertTemplatesGetResponse, +} from "../models"; + +/// +/** Interface representing a AlertTemplates. */ +export interface AlertTemplates { + /** + * Gets a list of alert templates in the specified SAP monitor. The operations returns various + * properties of each alert template. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + monitorName: string, + options?: AlertTemplatesListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets properties of an alert template for the specified subscription, resource group, SAP monitor + * name, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertTemplateName SAP monitor alert template resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + alertTemplateName: string, + options?: AlertTemplatesGetOptionalParams, + ): Promise; +} diff --git a/sdk/workloads/sapmonitors/src/operationsInterfaces/alerts.ts b/sdk/workloads/sapmonitors/src/operationsInterfaces/alerts.ts new file mode 100644 index 000000000000..abe35ff8c59b --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operationsInterfaces/alerts.ts @@ -0,0 +1,115 @@ +/* + * 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 { + Alert, + AlertsListOptionalParams, + AlertsGetOptionalParams, + AlertsGetResponse, + AlertsCreateOptionalParams, + AlertsCreateResponse, + AlertsDeleteOptionalParams, + AlertsDeleteResponse, +} from "../models"; + +/// +/** Interface representing a Alerts. */ +export interface Alerts { + /** + * Gets a list of alerts in the specified SAP monitor. The operations returns various properties of + * each alerts. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + monitorName: string, + options?: AlertsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets properties of an alert for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + alertName: string, + options?: AlertsGetOptionalParams, + ): Promise; + /** + * Creates an alert for the specified subscription, resource group, SAP monitor name, and resource + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param resource Request body representing a SAP monitor's alert resource + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + monitorName: string, + alertName: string, + resource: Alert, + options?: AlertsCreateOptionalParams, + ): Promise< + SimplePollerLike, AlertsCreateResponse> + >; + /** + * Creates an alert for the specified subscription, resource group, SAP monitor name, and resource + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param resource Request body representing a SAP monitor's alert resource + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + monitorName: string, + alertName: string, + resource: Alert, + options?: AlertsCreateOptionalParams, + ): Promise; + /** + * Deletes an alert for the specified subscription, resource group, SAP monitor name, and resource + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + monitorName: string, + alertName: string, + options?: AlertsDeleteOptionalParams, + ): Promise< + SimplePollerLike, AlertsDeleteResponse> + >; + /** + * Deletes an alert for the specified subscription, resource group, SAP monitor name, and resource + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param alertName Name of the SAP monitor alert resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + monitorName: string, + alertName: string, + options?: AlertsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/workloads/sapmonitors/src/operationsInterfaces/index.ts b/sdk/workloads/sapmonitors/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..b0af78786295 --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operationsInterfaces/index.ts @@ -0,0 +1,14 @@ +/* + * 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 "./monitors"; +export * from "./alertTemplates"; +export * from "./alerts"; +export * from "./providerInstances"; +export * from "./sapLandscapeMonitor"; +export * from "./operations"; diff --git a/sdk/workloads/sapmonitors/src/operationsInterfaces/monitors.ts b/sdk/workloads/sapmonitors/src/operationsInterfaces/monitors.ts new file mode 100644 index 000000000000..f3c13a8274a4 --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operationsInterfaces/monitors.ts @@ -0,0 +1,148 @@ +/* + * 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 { + Monitor, + MonitorsListOptionalParams, + MonitorsListByResourceGroupOptionalParams, + MonitorsGetOptionalParams, + MonitorsGetResponse, + MonitorsCreateOptionalParams, + MonitorsCreateResponse, + UpdateMonitorRequest, + MonitorsUpdateOptionalParams, + MonitorsUpdateResponse, + MonitorsDeleteOptionalParams, + MonitorsDeleteResponse, +} from "../models"; + +/// +/** Interface representing a Monitors. */ +export interface Monitors { + /** + * Gets a list of SAP monitors in the specified subscription. The operations returns various properties + * of each SAP monitor. + * @param options The options parameters. + */ + list( + options?: MonitorsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets a list of SAP monitors in the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + options?: MonitorsGetOptionalParams, + ): Promise; + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param resource Request body representing a SAP monitor + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + monitorName: string, + resource: Monitor, + options?: MonitorsCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MonitorsCreateResponse + > + >; + /** + * Creates a SAP monitor for the specified subscription, resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param resource Request body representing a SAP monitor + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + monitorName: string, + resource: Monitor, + options?: MonitorsCreateOptionalParams, + ): Promise; + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP + * monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param properties The Update SAP workload monitor request body. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + monitorName: string, + properties: UpdateMonitorRequest, + options?: MonitorsUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MonitorsUpdateResponse + > + >; + /** + * Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP + * monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param properties The Update SAP workload monitor request body. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + monitorName: string, + properties: UpdateMonitorRequest, + options?: MonitorsUpdateOptionalParams, + ): Promise; + /** + * Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + monitorName: string, + options?: MonitorsDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MonitorsDeleteResponse + > + >; + /** + * Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + monitorName: string, + options?: MonitorsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/workloads/sapmonitors/src/operationsInterfaces/operations.ts b/sdk/workloads/sapmonitors/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..251f5f582e64 --- /dev/null +++ b/sdk/workloads/sapmonitors/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/workloads/sapmonitors/src/operationsInterfaces/providerInstances.ts b/sdk/workloads/sapmonitors/src/operationsInterfaces/providerInstances.ts new file mode 100644 index 000000000000..dac3bfffd054 --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operationsInterfaces/providerInstances.ts @@ -0,0 +1,121 @@ +/* + * 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 { + ProviderInstance, + ProviderInstancesListByMonitorOptionalParams, + ProviderInstancesGetOptionalParams, + ProviderInstancesGetResponse, + ProviderInstancesCreateOptionalParams, + ProviderInstancesCreateResponse, + ProviderInstancesDeleteOptionalParams, + ProviderInstancesDeleteResponse, +} from "../models"; + +/// +/** Interface representing a ProviderInstances. */ +export interface ProviderInstances { + /** + * Gets a list of provider instances in the specified SAP monitor. The operations returns various + * properties of each provider instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + listByMonitor( + resourceGroupName: string, + monitorName: string, + options?: ProviderInstancesListByMonitorOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets properties of a provider instance for the specified subscription, resource group, SAP monitor + * name, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + options?: ProviderInstancesGetOptionalParams, + ): Promise; + /** + * Creates a provider instance for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param resource Request body representing a provider instance associated with a SAP monitor. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + resource: ProviderInstance, + options?: ProviderInstancesCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + ProviderInstancesCreateResponse + > + >; + /** + * Creates a provider instance for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param resource Request body representing a provider instance associated with a SAP monitor. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + resource: ProviderInstance, + options?: ProviderInstancesCreateOptionalParams, + ): Promise; + /** + * Deletes a provider instance for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + options?: ProviderInstancesDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + ProviderInstancesDeleteResponse + > + >; + /** + * Deletes a provider instance for the specified subscription, resource group, SAP monitor name, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param providerInstanceName Name of the provider instance. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + monitorName: string, + providerInstanceName: string, + options?: ProviderInstancesDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/workloads/sapmonitors/src/operationsInterfaces/sapLandscapeMonitor.ts b/sdk/workloads/sapmonitors/src/operationsInterfaces/sapLandscapeMonitor.ts new file mode 100644 index 000000000000..292733cefe8d --- /dev/null +++ b/sdk/workloads/sapmonitors/src/operationsInterfaces/sapLandscapeMonitor.ts @@ -0,0 +1,89 @@ +/* + * 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 { + SapLandscapeMonitorResource, + SapLandscapeMonitorListByMonitorOptionalParams, + SapLandscapeMonitorGetOptionalParams, + SapLandscapeMonitorGetResponse, + SapLandscapeMonitorCreateOptionalParams, + SapLandscapeMonitorCreateResponse, + SapLandscapeMonitorUpdateOptionalParams, + SapLandscapeMonitorUpdateResponse, + SapLandscapeMonitorDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a SapLandscapeMonitor. */ +export interface SapLandscapeMonitor { + /** + * Gets configuration values for Single Pane Of Glass for SAP monitor for the specified subscription, + * resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + listByMonitor( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorListByMonitorOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets configuration values for Single Pane Of Glass for SAP monitor for the specified subscription, + * resource group, and resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorGetOptionalParams, + ): Promise; + /** + * Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and + * resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param resource Request body representing a configuration for Sap Landscape Monitor Dashboard + * @param options The options parameters. + */ + create( + resourceGroupName: string, + monitorName: string, + resource: SapLandscapeMonitorResource, + options?: SapLandscapeMonitorCreateOptionalParams, + ): Promise; + /** + * Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and SAP + * monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param properties Request body representing a configuration for Sap Landscape Monitor Dashboard + * @param options The options parameters. + */ + update( + resourceGroupName: string, + monitorName: string, + properties: SapLandscapeMonitorResource, + options?: SapLandscapeMonitorUpdateOptionalParams, + ): Promise; + /** + * Deletes a SAP Landscape Monitor Dashboard with the specified subscription, resource group, and SAP + * monitor name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the SAP monitor resource. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + monitorName: string, + options?: SapLandscapeMonitorDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/workloads/sapmonitors/src/pagingHelper.ts b/sdk/workloads/sapmonitors/src/pagingHelper.ts new file mode 100644 index 000000000000..205cccc26592 --- /dev/null +++ b/sdk/workloads/sapmonitors/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/workloads/sapmonitors/src/workloadsClient.ts b/sdk/workloads/sapmonitors/src/workloadsClient.ts new file mode 100644 index 000000000000..c79c668ddada --- /dev/null +++ b/sdk/workloads/sapmonitors/src/workloadsClient.ts @@ -0,0 +1,165 @@ +/* + * 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 { + MonitorsImpl, + AlertTemplatesImpl, + AlertsImpl, + ProviderInstancesImpl, + SapLandscapeMonitorImpl, + OperationsImpl, +} from "./operations"; +import { + Monitors, + AlertTemplates, + Alerts, + ProviderInstances, + SapLandscapeMonitor, + Operations, +} from "./operationsInterfaces"; +import { WorkloadsClientOptionalParams } from "./models"; + +export class WorkloadsClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the WorkloadsClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: WorkloadsClientOptionalParams, + ) { + 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: WorkloadsClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials, + }; + + const packageDetails = `azsdk-js-arm-workloads-sapmonitors/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-02-01-preview"; + this.monitors = new MonitorsImpl(this); + this.alertTemplates = new AlertTemplatesImpl(this); + this.alerts = new AlertsImpl(this); + this.providerInstances = new ProviderInstancesImpl(this); + this.sapLandscapeMonitor = new SapLandscapeMonitorImpl(this); + this.operations = new OperationsImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest, + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + }, + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + monitors: Monitors; + alertTemplates: AlertTemplates; + alerts: Alerts; + providerInstances: ProviderInstances; + sapLandscapeMonitor: SapLandscapeMonitor; + operations: Operations; +} diff --git a/sdk/workloads/sapmonitors/test/sampleTest.ts b/sdk/workloads/sapmonitors/test/sampleTest.ts new file mode 100644 index 000000000000..d64be981b694 --- /dev/null +++ b/sdk/workloads/sapmonitors/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/workloads/sapmonitors/tsconfig.json b/sdk/workloads/sapmonitors/tsconfig.json new file mode 100644 index 000000000000..b35d05ad6e9d --- /dev/null +++ b/sdk/workloads/sapmonitors/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