From e9378de1807f5dbb30b7c343da774f4105e7f2ef Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 3 Aug 2023 09:10:35 +0000 Subject: [PATCH] CodeGen from PR 25148 in Azure/azure-rest-api-specs Merge 18c427004ed6b9e8a808e32120b4e2d57ae202b8 into d247207c59848d06facf8a7b4f884e356205c15c --- common/config/rush/pnpm-lock.yaml | 104 +- rush.json | 9 +- sdk/scom/arm-scom/CHANGELOG.md | 5 + sdk/scom/arm-scom/LICENSE | 21 + sdk/scom/arm-scom/README.md | 109 ++ sdk/scom/arm-scom/_meta.json | 8 + sdk/scom/arm-scom/api-extractor.json | 31 + sdk/scom/arm-scom/package.json | 115 +++ sdk/scom/arm-scom/review/arm-scom.api.md | 365 +++++++ sdk/scom/arm-scom/rollup.config.js | 122 +++ sdk/scom/arm-scom/sample.env | 4 + ...reAPIForManagingScomMonitoringInstances.ts | 142 +++ sdk/scom/arm-scom/src/index.ts | 13 + sdk/scom/arm-scom/src/lroImpl.ts | 42 + sdk/scom/arm-scom/src/models/index.ts | 577 +++++++++++ sdk/scom/arm-scom/src/models/mappers.ts | 775 +++++++++++++++ sdk/scom/arm-scom/src/models/parameters.ts | 143 +++ sdk/scom/arm-scom/src/operations/index.ts | 10 + sdk/scom/arm-scom/src/operations/instances.ts | 936 ++++++++++++++++++ .../arm-scom/src/operations/operations.ts | 174 ++++ .../src/operationsInterfaces/index.ts | 10 + .../src/operationsInterfaces/instances.ts | 185 ++++ .../src/operationsInterfaces/operations.ts | 24 + sdk/scom/arm-scom/src/pagingHelper.ts | 39 + sdk/scom/arm-scom/test/sampleTest.ts | 43 + sdk/scom/arm-scom/tsconfig.json | 27 + sdk/scom/ci.mgmt.yml | 38 + 27 files changed, 4032 insertions(+), 39 deletions(-) create mode 100644 sdk/scom/arm-scom/CHANGELOG.md create mode 100644 sdk/scom/arm-scom/LICENSE create mode 100644 sdk/scom/arm-scom/README.md create mode 100644 sdk/scom/arm-scom/_meta.json create mode 100644 sdk/scom/arm-scom/api-extractor.json create mode 100644 sdk/scom/arm-scom/package.json create mode 100644 sdk/scom/arm-scom/review/arm-scom.api.md create mode 100644 sdk/scom/arm-scom/rollup.config.js create mode 100644 sdk/scom/arm-scom/sample.env create mode 100644 sdk/scom/arm-scom/src/azureAPIForManagingScomMonitoringInstances.ts create mode 100644 sdk/scom/arm-scom/src/index.ts create mode 100644 sdk/scom/arm-scom/src/lroImpl.ts create mode 100644 sdk/scom/arm-scom/src/models/index.ts create mode 100644 sdk/scom/arm-scom/src/models/mappers.ts create mode 100644 sdk/scom/arm-scom/src/models/parameters.ts create mode 100644 sdk/scom/arm-scom/src/operations/index.ts create mode 100644 sdk/scom/arm-scom/src/operations/instances.ts create mode 100644 sdk/scom/arm-scom/src/operations/operations.ts create mode 100644 sdk/scom/arm-scom/src/operationsInterfaces/index.ts create mode 100644 sdk/scom/arm-scom/src/operationsInterfaces/instances.ts create mode 100644 sdk/scom/arm-scom/src/operationsInterfaces/operations.ts create mode 100644 sdk/scom/arm-scom/src/pagingHelper.ts create mode 100644 sdk/scom/arm-scom/test/sampleTest.ts create mode 100644 sdk/scom/arm-scom/tsconfig.json create mode 100644 sdk/scom/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 80db0d33996f..2e4c7e331a4b 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -187,6 +187,7 @@ specifiers: '@rush-temp/arm-resources': file:./projects/arm-resources.tgz '@rush-temp/arm-resources-profile-2020-09-01-hybrid': file:./projects/arm-resources-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-resources-subscriptions': file:./projects/arm-resources-subscriptions.tgz + '@rush-temp/arm-scom': file:./projects/arm-scom.tgz '@rush-temp/arm-scvmm': file:./projects/arm-scvmm.tgz '@rush-temp/arm-search': file:./projects/arm-search.tgz '@rush-temp/arm-security': file:./projects/arm-security.tgz @@ -540,6 +541,7 @@ dependencies: '@rush-temp/arm-resources': file:projects/arm-resources.tgz '@rush-temp/arm-resources-profile-2020-09-01-hybrid': file:projects/arm-resources-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-resources-subscriptions': file:projects/arm-resources-subscriptions.tgz + '@rush-temp/arm-scom': file:projects/arm-scom.tgz '@rush-temp/arm-scvmm': file:projects/arm-scvmm.tgz '@rush-temp/arm-search': file:projects/arm-search.tgz '@rush-temp/arm-security': file:projects/arm-security.tgz @@ -2844,7 +2846,7 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/chai-as-promised/7.1.5: @@ -2866,7 +2868,7 @@ packages: /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/cookie/0.4.1: @@ -2876,7 +2878,7 @@ packages: /@types/cors/2.8.13: resolution: {integrity: sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/debug/4.1.8: @@ -2888,7 +2890,7 @@ packages: /@types/decompress/4.2.4: resolution: {integrity: sha512-/C8kTMRTNiNuWGl5nEyKbPiMv6HA+0RbEXzFhFBEzASM6+oa4tJro9b8nj7eRlOFfuLdzUU+DS/GPDlvvzMOhA==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/eslint/8.4.10: @@ -2909,7 +2911,7 @@ packages: /@types/express-serve-static-core/4.17.35: resolution: {integrity: sha512-wALWQwrgiB2AWTT91CB62b6Yt0sNHpznUXeZEcnPU3DRdlDIz74x8Qg1UUYKSVFi+va5vKOLYRBI1bRKiLLKIg==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 '@types/send': 0.17.1 @@ -2927,13 +2929,13 @@ packages: /@types/fs-extra/8.1.2: resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/http-errors/2.0.1: @@ -2950,7 +2952,7 @@ packages: /@types/is-buffer/2.0.0: resolution: {integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/json-schema/7.0.12: @@ -2964,13 +2966,13 @@ packages: /@types/jsonwebtoken/9.0.2: resolution: {integrity: sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/jws/3.2.5: resolution: {integrity: sha512-xGTxZH34xOryaTN8CMsvhh9lfNqFuHiMoRvsLYWQdBJHqiECyfInXVl2eK8Jz2emxZWMIn5RBlmr3oDVPeWujw==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/linkify-it/3.0.2: @@ -3029,20 +3031,20 @@ packages: /@types/mysql/2.15.19: resolution: {integrity: sha512-wSRg2QZv14CWcZXkgdvHbbV2ACufNy5EgI8mBBxnJIptchv7DBy/h53VMa2jDhyo0C9MO4iowE6z9vF8Ja1DkQ==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 form-data: 3.0.1 dev: false /@types/node-fetch/2.6.4: resolution: {integrity: sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 form-data: 3.0.1 dev: false @@ -3075,7 +3077,7 @@ packages: /@types/pg/8.6.1: resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 pg-protocol: 1.6.0 pg-types: 2.2.0 dev: false @@ -3103,7 +3105,7 @@ packages: /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/resolve/1.20.2: @@ -3126,7 +3128,7 @@ packages: resolution: {integrity: sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==} dependencies: '@types/mime': 1.3.2 - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/serve-static/1.15.2: @@ -3134,7 +3136,7 @@ packages: dependencies: '@types/http-errors': 2.0.1 '@types/mime': 3.0.1 - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/shimmer/1.0.2: @@ -3154,13 +3156,13 @@ packages: /@types/stoppable/1.1.1: resolution: {integrity: sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/tough-cookie/4.0.2: @@ -3174,7 +3176,7 @@ packages: /@types/tunnel/0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/underscore/1.11.6: @@ -3192,19 +3194,19 @@ packages: /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/ws/8.5.5: resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/xml2js/0.4.11: resolution: {integrity: sha512-JdigeAKmCyoJUiQljjr7tQG3if9NkqGUgwEUqBvV0N7LM4HyQk7UXCnusRa1lnvXAEYJ8mw8GtZWioagNztOwA==} dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false /@types/yargs-parser/21.0.0: @@ -3221,7 +3223,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 14.18.54 + '@types/node': 16.18.39 dev: false optional: true @@ -4498,7 +4500,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug/3.2.7: @@ -4677,7 +4679,7 @@ packages: cosmiconfig: 7.1.0 debug: 4.3.4 deps-regex: 0.1.4 - ignore: 5.1.9 + ignore: 5.2.4 is-core-module: 2.12.1 js-yaml: 3.14.1 json5: 2.2.3 @@ -4818,7 +4820,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.2.0-dev.20230731 + typescript: 5.2.0-dev.20230803 dev: false /duplexer3/0.1.5: @@ -4880,7 +4882,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.13 - '@types/node': 14.18.54 + '@types/node': 16.18.39 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -5050,7 +5052,7 @@ packages: dependencies: debug: 3.2.7 is-core-module: 2.12.1 - resolve: 1.22.3 + resolve: 1.22.2 dev: false /eslint-module-utils/2.8.0_eslint@8.46.0: @@ -5869,7 +5871,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -6194,7 +6196,7 @@ packages: /ignore-walk/3.0.4: resolution: {integrity: sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==} dependencies: - minimatch: 3.0.8 + minimatch: 3.1.2 dev: false /ignore/5.1.9: @@ -6287,7 +6289,7 @@ packages: cli-cursor: 3.1.0 cli-width: 3.0.0 external-editor: 3.1.0 - figures: 3.0.0 + figures: 3.2.0 lodash: 4.17.21 mute-stream: 0.0.8 run-async: 2.4.1 @@ -8762,7 +8764,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 14.18.54 + '@types/node': 16.18.39 long: 5.2.3 dev: false @@ -10335,8 +10337,8 @@ packages: hasBin: true dev: false - /typescript/5.2.0-dev.20230731: - resolution: {integrity: sha512-RJVLgnDgu67ZrohYy0aBea+5TICfRod36+24zw0bR/KJDQJO9mlIjTC0k+/PKw87fXP5JuUHqepEk15PvFya7A==} + /typescript/5.2.0-dev.20230803: + resolution: {integrity: sha512-DwCyutWHyT7Il7xpJCxtx4/S5F4qjAo2SE6QDRSLhEUtBFGwGHTHCvuyfm9KNrdwn67jGitdlw4gpbSTVVjoww==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -16364,6 +16366,34 @@ packages: - supports-color dev: false + file:projects/arm-scom.tgz: + resolution: {integrity: sha512-WBAxtQqvVkGVtdWKKIRIH1gkZz33QlP3RpH5EfpMPGCywBas3ciK2IlN5if7cJwgEy3fqrnUoxeOjEAs5SAj0w==, tarball: file:projects/arm-scom.tgz} + name: '@rush-temp/arm-scom' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.36.3_@types+node@14.18.54 + '@rollup/plugin-commonjs': 24.1.0_rollup@2.79.1 + '@rollup/plugin-json': 6.0.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 6.0.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.5 + '@types/node': 14.18.54 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 16.3.1 + mkdirp: 2.1.6 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_dmbj5memikchm63lpeyt6ukdau + tslib: 2.6.1 + typescript: 5.0.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/arm-scvmm.tgz: resolution: {integrity: sha512-1mMM+51GplOxlcOs9DiFMQ5GxKeQ8K1cKi447BkcWzfb6GVYCQFTVvxFAbxeE+7rOEeZsht/VBWpNkTklepWDg==, tarball: file:projects/arm-scvmm.tgz} name: '@rush-temp/arm-scvmm' @@ -20408,7 +20438,7 @@ packages: dev: false file:projects/perf-ai-form-recognizer.tgz: - resolution: {integrity: sha512-FCdWABf3EgpULN8AvClM8zv9lCeDVvuNSA2dAb2upZBiJ6WftNFfdDLY/q8whjc97R5c1SmG9zriNqRGu0Xm6g==, tarball: file:projects/perf-ai-form-recognizer.tgz} + resolution: {integrity: sha512-+05JR31WLH5d8FD+GslDQxNHYPLOrvExWUugJJNalgNZpbtoqzQF0837G7tKGDg98VU4XjK6qZA7Gjo2n7O3yg==, tarball: file:projects/perf-ai-form-recognizer.tgz} name: '@rush-temp/perf-ai-form-recognizer' version: 0.0.0 dependencies: @@ -21511,7 +21541,7 @@ packages: dev: false file:projects/storage-file-share.tgz: - resolution: {integrity: sha512-XKoapSGfj9adWoSaAEOMkONC7brW8Pez+vfuoU0Viw46LuU2KTH9ZMWkRYDub+3xt331YRTyWuxdwvbKVzk/Kg==, tarball: file:projects/storage-file-share.tgz} + resolution: {integrity: sha512-tbnZhWCWiQTtvxAeRQm8UDHo89yoMoWis4kDc+5OvIxpTyXUk3Fwz3h1e2czVSscQUckjus9VILPNKxfEbQhsA==, tarball: file:projects/storage-file-share.tgz} name: '@rush-temp/storage-file-share' version: 0.0.0 dependencies: diff --git a/rush.json b/rush.json index 8efa6dffdc9d..b14e87c6ef00 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. @@ -2044,6 +2044,11 @@ "packageName": "@azure/arm-sphere", "projectFolder": "sdk/sphere/arm-sphere", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-scom", + "projectFolder": "sdk/scom/arm-scom", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/scom/arm-scom/CHANGELOG.md b/sdk/scom/arm-scom/CHANGELOG.md new file mode 100644 index 000000000000..2b5d9c0826ab --- /dev/null +++ b/sdk/scom/arm-scom/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-08-03) + +The package of @azure/arm-scom is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/scom/arm-scom/LICENSE b/sdk/scom/arm-scom/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/scom/arm-scom/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/scom/arm-scom/README.md b/sdk/scom/arm-scom/README.md new file mode 100644 index 000000000000..7dad61b5618c --- /dev/null +++ b/sdk/scom/arm-scom/README.md @@ -0,0 +1,109 @@ +# AzureApiForManagingScomMonitoringInstances client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzureApiForManagingScomMonitoringInstances client. + +SCOM monitoring instance management APIs + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/scom/arm-scom) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-scom) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-scom?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-scom` package + +Install the AzureApiForManagingScomMonitoringInstances client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-scom +``` + +### Create and authenticate a `AzureAPIForManagingScomMonitoringInstances` + +To create a client object to access the AzureApiForManagingScomMonitoringInstances API, you will need the `endpoint` of your AzureApiForManagingScomMonitoringInstances resource and a `credential`. The AzureApiForManagingScomMonitoringInstances client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your AzureApiForManagingScomMonitoringInstances 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 AzureApiForManagingScomMonitoringInstances** 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 { AzureAPIForManagingScomMonitoringInstances } = require("@azure/arm-scom"); +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 AzureAPIForManagingScomMonitoringInstances(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new AzureAPIForManagingScomMonitoringInstances(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 + +### AzureAPIForManagingScomMonitoringInstances + +`AzureAPIForManagingScomMonitoringInstances` is the primary interface for developers using the AzureApiForManagingScomMonitoringInstances client library. Explore the methods on this client object to understand the different features of the AzureApiForManagingScomMonitoringInstances 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%2Fscom%2Farm-scom%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/scom/arm-scom/_meta.json b/sdk/scom/arm-scom/_meta.json new file mode 100644 index 000000000000..5e5465484fe3 --- /dev/null +++ b/sdk/scom/arm-scom/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "60105d0adab5307e2b1d3b71c88ca9c9c9a37c75", + "readme": "specification/scom/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/scom/resource-manager/readme.md --use=@autorest/typescript@^6.0.4", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.1", + "use": "@autorest/typescript@^6.0.4" +} \ No newline at end of file diff --git a/sdk/scom/arm-scom/api-extractor.json b/sdk/scom/arm-scom/api-extractor.json new file mode 100644 index 000000000000..a02854341157 --- /dev/null +++ b/sdk/scom/arm-scom/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-scom.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/scom/arm-scom/package.json b/sdk/scom/arm-scom/package.json new file mode 100644 index 000000000000..1778869af658 --- /dev/null +++ b/sdk/scom/arm-scom/package.json @@ -0,0 +1,115 @@ +{ + "name": "@azure/arm-scom", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for AzureAPIForManagingScomMonitoringInstances.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-scom.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-multi-entry": "^6.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^2.1.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~5.0.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "dotenv": "^16.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^14.0.0", + "@azure/dev-tool": "^1.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/azureAPIForManagingScomMonitoringInstances.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/scom/arm-scom" +} \ No newline at end of file diff --git a/sdk/scom/arm-scom/review/arm-scom.api.md b/sdk/scom/arm-scom/review/arm-scom.api.md new file mode 100644 index 000000000000..d27633deeb15 --- /dev/null +++ b/sdk/scom/arm-scom/review/arm-scom.api.md @@ -0,0 +1,365 @@ +## API Report File for "@azure/arm-scom" + +> 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 (undocumented) +export class AzureAPIForManagingScomMonitoringInstances extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AzureAPIForManagingScomMonitoringInstancesOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + instances: Instances; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface AzureAPIForManagingScomMonitoringInstancesOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface AzureHybridBenefitProperties { + scomLicenseType?: HybridLicenseType; + sqlServerLicenseType?: HybridLicenseType; + windowsServerLicenseType?: HybridLicenseType; +} + +// @public +export type CreatedByType = string; + +// @public +export interface DatabaseInstanceProperties { + readonly databaseFqdn?: string; + databaseInstanceId?: string; + readonly dwDatabaseId?: string; + readonly dwDatabaseName?: string; + readonly operationalDatabaseId?: string; +} + +// @public +export interface DomainControllerProperties { + dnsServer?: string; + domainName?: string; + ouPath?: string; +} + +// @public +export interface DomainUserCredentials { + keyVaultUrl?: string; + passwordSecret?: string; + userNameSecret?: 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 GmsaDetails { + dnsName?: string; + gmsaAccount?: string; + loadBalancerIP?: string; + managementServerGroupName?: string; +} + +// @public +export type HybridLicenseType = string; + +// @public +export interface Instances { + beginCreateOrUpdate(resourceGroupName: string, instanceName: string, monitoringInstance: MonitoringInstance, options?: InstancesCreateOrUpdateOptionalParams): Promise, InstancesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, instanceName: string, monitoringInstance: MonitoringInstance, options?: InstancesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, instanceName: string, options?: InstancesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, instanceName: string, options?: InstancesDeleteOptionalParams): Promise; + beginPatchServers(resourceGroupName: string, instanceName: string, options?: InstancesPatchServersOptionalParams): Promise, void>>; + beginPatchServersAndWait(resourceGroupName: string, instanceName: string, options?: InstancesPatchServersOptionalParams): Promise; + beginScale(resourceGroupName: string, instanceName: string, body: ScalingProperties, options?: InstancesScaleOptionalParams): Promise, void>>; + beginScaleAndWait(resourceGroupName: string, instanceName: string, body: ScalingProperties, options?: InstancesScaleOptionalParams): Promise; + beginUpdate(resourceGroupName: string, instanceName: string, options?: InstancesUpdateOptionalParams): Promise, InstancesUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, instanceName: string, options?: InstancesUpdateOptionalParams): Promise; + get(resourceGroupName: string, instanceName: string, options?: InstancesGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: InstancesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: InstancesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface InstancesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; + validationMode?: boolean; +} + +// @public +export type InstancesCreateOrUpdateResponse = MonitoringInstance; + +// @public +export interface InstancesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface InstancesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InstancesGetResponse = MonitoringInstance; + +// @public +export interface InstancesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InstancesListByResourceGroupNextResponse = MonitoringInstanceList; + +// @public +export interface InstancesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InstancesListByResourceGroupResponse = MonitoringInstanceList; + +// @public +export interface InstancesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InstancesListBySubscriptionNextResponse = MonitoringInstanceList; + +// @public +export interface InstancesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type InstancesListBySubscriptionResponse = MonitoringInstanceList; + +// @public +export interface InstancesPatchServersOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface InstancesScaleOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface InstancesUpdateOptionalParams extends coreClient.OperationOptions { + monitoringInstance?: MonitoringInstancePatch; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type InstancesUpdateResponse = MonitoringInstance; + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownHybridLicenseType { + AzureHybridBenefit = "AzureHybridBenefit", + None = "None" +} + +// @public +export enum KnownManagedIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownOperationOrigin { + NotSpecified = "NotSpecified", + System = "system", + User = "user" +} + +// @public +export interface ManagedIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: ManagedIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserIdentity; + }; +} + +// @public +export type ManagedIdentityType = string; + +// @public +export interface ManagedInstanceOperationStatus { + readonly operationName?: string; + readonly operationState?: string; +} + +// @public +export interface ManagementServerProperties { + readonly fqdn?: string; + readonly healthState?: string; + readonly serverName?: string; + readonly serverRoles?: string; + readonly vmResId?: string; +} + +// @public +export interface MonitoringInstance extends TrackedResource { + identity?: ManagedIdentity; + properties?: MonitoringInstanceProperties; + readonly systemData?: SystemData; +} + +// @public +export interface MonitoringInstanceList { + readonly nextLink?: string; + readonly value?: MonitoringInstance[]; +} + +// @public +export interface MonitoringInstancePatch { + identity?: ManagedIdentity; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface MonitoringInstanceProperties { + azureHybridBenefit?: AzureHybridBenefitProperties; + databaseInstance?: DatabaseInstanceProperties; + domainController?: DomainControllerProperties; + domainUserCredentials?: DomainUserCredentials; + gmsaDetails?: GmsaDetails; + readonly managementEndpoints?: ManagementServerProperties[]; + readonly operationsStatus?: ManagedInstanceOperationStatus[]; + readonly productVersion?: string; + readonly provisioningState?: string; + vNetSubnetId?: string; +} + +// @public +export interface Operation { + readonly display?: OperationDisplay; + readonly name?: string; + readonly origin?: OperationOrigin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export type OperationOrigin = string; + +// @public +export interface Operations { + list(resourceGroupName: string, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsList { + readonly nextLink?: string; + value?: Operation[]; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationsList; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationsList; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface ScalingProperties { + serverCount?: number; +} + +// @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 UserIdentity { + readonly clientId?: string; + readonly principalId?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/scom/arm-scom/rollup.config.js b/sdk/scom/arm-scom/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/scom/arm-scom/rollup.config.js @@ -0,0 +1,122 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/scom/arm-scom/sample.env b/sdk/scom/arm-scom/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/scom/arm-scom/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/scom/arm-scom/src/azureAPIForManagingScomMonitoringInstances.ts b/sdk/scom/arm-scom/src/azureAPIForManagingScomMonitoringInstances.ts new file mode 100644 index 000000000000..59b569008879 --- /dev/null +++ b/sdk/scom/arm-scom/src/azureAPIForManagingScomMonitoringInstances.ts @@ -0,0 +1,142 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { OperationsImpl, InstancesImpl } from "./operations"; +import { Operations, Instances } from "./operationsInterfaces"; +import { AzureAPIForManagingScomMonitoringInstancesOptionalParams } from "./models"; + +export class AzureAPIForManagingScomMonitoringInstances extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; + + /** + * Initializes a new instance of the AzureAPIForManagingScomMonitoringInstances class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: AzureAPIForManagingScomMonitoringInstancesOptionalParams + ) { + 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: AzureAPIForManagingScomMonitoringInstancesOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-scom/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 || "2022-09-13-preview"; + this.operations = new OperationsImpl(this); + this.instances = new InstancesImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + instances: Instances; +} diff --git a/sdk/scom/arm-scom/src/index.ts b/sdk/scom/arm-scom/src/index.ts new file mode 100644 index 000000000000..c7e758f52d55 --- /dev/null +++ b/sdk/scom/arm-scom/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 { AzureAPIForManagingScomMonitoringInstances } from "./azureAPIForManagingScomMonitoringInstances"; +export * from "./operationsInterfaces"; diff --git a/sdk/scom/arm-scom/src/lroImpl.ts b/sdk/scom/arm-scom/src/lroImpl.ts new file mode 100644 index 000000000000..dd803cd5e28c --- /dev/null +++ b/sdk/scom/arm-scom/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/scom/arm-scom/src/models/index.ts b/sdk/scom/arm-scom/src/models/index.ts new file mode 100644 index 000000000000..5ff90548d8bc --- /dev/null +++ b/sdk/scom/arm-scom/src/models/index.ts @@ -0,0 +1,577 @@ +/* + * 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"; + +/** List of operations */ +export interface OperationsList { + /** List of operations */ + value?: Operation[]; + /** + * URL to get the next page if any + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** A REST API operation */ +export interface Operation { + /** + * Name of the operation being performed on this object + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Contains the localized display information for this operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly display?: OperationDisplay; + /** + * The intended executor of the operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: OperationOrigin; +} + +/** Contains the localized display information for this operation */ +export interface OperationDisplay { + /** + * Localized friendly form of the resource provider name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * Localized friendly form of the resource type related to this operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * Localized friendly name for the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * Localized friendly description for the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** A paged list of SCOM monitoring instances */ +export interface MonitoringInstanceList { + /** + * The items on the page + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: MonitoringInstance[]; + /** + * URL to get the next page if any + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The properties of a SCOM instance resource */ +export interface MonitoringInstanceProperties { + /** + * SCOM product version to be installed on instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly productVersion?: string; + /** Virtual Network subnet id on which Aquila instance will be provisioned */ + vNetSubnetId?: string; + /** + * List of management server endpoints + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly managementEndpoints?: ManagementServerProperties[]; + /** Database instance on which SCOM Operational and Warehouse database will be stored */ + databaseInstance?: DatabaseInstanceProperties; + /** Domain controller details */ + domainController?: DomainControllerProperties; + /** Domain user which will be used to join VMs to domain and login to VMs */ + domainUserCredentials?: DomainUserCredentials; + /** Gmsa Details for load balancer and vmss */ + gmsaDetails?: GmsaDetails; + /** The properties to enable Azure Hybrid benefit for various SCOM infrastructure license */ + azureHybridBenefit?: AzureHybridBenefitProperties; + /** + * Gets or sets the provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: string; + /** + * Gets status of current and latest SCOM managed instance Operations + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operationsStatus?: ManagedInstanceOperationStatus[]; +} + +/** The properties of management server */ +export interface ManagementServerProperties { + /** + * Management server Name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly serverName?: string; + /** + * Azure VM Resource Id of the Management server + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly vmResId?: string; + /** + * Management server Fully Qualified Domain Name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly fqdn?: string; + /** + * Represent whether the Server is a Management Server and/or Web Console Server + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly serverRoles?: string; + /** + * Management server health state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly healthState?: string; +} + +/** The properties of database instance */ +export interface DatabaseInstanceProperties { + /** Resource Id of existing database instance */ + databaseInstanceId?: string; + /** + * Fully qualified domain name of existing database instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly databaseFqdn?: string; + /** + * Name of warehouse database on database instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly dwDatabaseName?: string; + /** + * Resource Id of operational database on database instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operationalDatabaseId?: string; + /** + * Resource Id of warehouse database on database instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly dwDatabaseId?: string; +} + +/** The properties of domain controller to which SCOM and SQL servers join for AuthN/AuthZ */ +export interface DomainControllerProperties { + /** Fully qualified domain name */ + domainName?: string; + /** IP address of DNS server */ + dnsServer?: string; + /** Organizational Unit path in which the SCOM servers will be present */ + ouPath?: string; +} + +/** Get Domain user name and password from key vault */ +export interface DomainUserCredentials { + /** Key vault url to get the domain username and password */ + keyVaultUrl?: string; + /** Domain user name secret */ + userNameSecret?: string; + /** Domain Password secret */ + passwordSecret?: string; +} + +/** Gmsa Details */ +export interface GmsaDetails { + /** Frontend IP configuration for Load Balancer, which should be an available IP in customer VNet */ + loadBalancerIP?: string; + /** gMSA account under which context all Management Server services will run */ + gmsaAccount?: string; + /** OnPrem AD Computer Group where we will join VMs for ease of management */ + managementServerGroupName?: string; + /** Frontend DNS name for Load Balancer which will be used by Agents to initiate communication */ + dnsName?: string; +} + +/** The properties to maximize savings by using Azure Hybrid Benefit */ +export interface AzureHybridBenefitProperties { + /** SCOM license type. Maximize savings by using license you already own */ + scomLicenseType?: HybridLicenseType; + /** Specifies that the image or disk that is being used was licensed on-premises.

For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) */ + windowsServerLicenseType?: HybridLicenseType; + /** SQL Server license type. Maximize savings by using Azure Hybrid Benefit for SQL Server with license you already own */ + sqlServerLicenseType?: HybridLicenseType; +} + +/** Gets status of current and latest SCOM managed instance Operation */ +export interface ManagedInstanceOperationStatus { + /** + * Operation Name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operationName?: string; + /** + * Operation status + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operationState?: string; +} + +/** 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; +} + +/** Azure Active Directory identity configuration for a resource. */ +export interface ManagedIdentity { + /** The identity type */ + type?: ManagedIdentityType; + /** + * System Assigned Identity ObjectId. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The Azure Active Directory tenant id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** The resource ids of the user assigned identities to use */ + userAssignedIdentities?: { [propertyName: string]: UserIdentity }; +} + +/** Azure Active Directory identity configuration for a resource. */ +export interface UserIdentity { + /** + * The Azure Active Directory principal id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The Azure Active Directory client id. + * 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. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** Object containing updates for patch operations. */ +export interface MonitoringInstancePatch { + /** The Azure Active Directory identity of the SCOM instance */ + identity?: ManagedIdentity; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** Properties for Scaling */ +export interface ScalingProperties { + /** Required management server count */ + serverCount?: number; +} + +/** 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; +} + +/** A SCOM instance resource */ +export interface MonitoringInstance extends TrackedResource { + /** The properties of a SCOM instance resource */ + properties?: MonitoringInstanceProperties; + /** + * The system data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** The Azure Active Directory identity of the SCOM instance */ + identity?: ManagedIdentity; +} + +/** Known values of {@link OperationOrigin} that the service accepts. */ +export enum KnownOperationOrigin { + /** NotSpecified */ + NotSpecified = "NotSpecified", + /** User */ + User = "user", + /** System */ + System = "system" +} + +/** + * Defines values for OperationOrigin. \ + * {@link KnownOperationOrigin} can be used interchangeably with OperationOrigin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotSpecified** \ + * **user** \ + * **system** + */ +export type OperationOrigin = string; + +/** Known values of {@link HybridLicenseType} that the service accepts. */ +export enum KnownHybridLicenseType { + /** None */ + None = "None", + /** AzureHybridBenefit */ + AzureHybridBenefit = "AzureHybridBenefit" +} + +/** + * Defines values for HybridLicenseType. \ + * {@link KnownHybridLicenseType} can be used interchangeably with HybridLicenseType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **AzureHybridBenefit** + */ +export type HybridLicenseType = 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 ManagedIdentityType} that the service accepts. */ +export enum KnownManagedIdentityType { + /** None */ + None = "None", + /** UserAssigned */ + UserAssigned = "UserAssigned", + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** SystemAssignedUserAssigned */ + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned" +} + +/** + * Defines values for ManagedIdentityType. \ + * {@link KnownManagedIdentityType} can be used interchangeably with ManagedIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **UserAssigned** \ + * **SystemAssigned** \ + * **SystemAssigned,UserAssigned** + */ +export type ManagedIdentityType = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationsList; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationsList; + +/** Optional parameters. */ +export interface InstancesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type InstancesListByResourceGroupResponse = MonitoringInstanceList; + +/** Optional parameters. */ +export interface InstancesListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type InstancesListBySubscriptionResponse = MonitoringInstanceList; + +/** Optional parameters. */ +export interface InstancesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type InstancesGetResponse = MonitoringInstance; + +/** Optional parameters. */ +export interface InstancesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Validation mode for the SCOM monitoring instance */ + validationMode?: boolean; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type InstancesCreateOrUpdateResponse = MonitoringInstance; + +/** Optional parameters. */ +export interface InstancesUpdateOptionalParams + extends coreClient.OperationOptions { + /** SCOM monitoring instance properties update */ + monitoringInstance?: MonitoringInstancePatch; + /** 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 InstancesUpdateResponse = MonitoringInstance; + +/** Optional parameters. */ +export interface InstancesDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface InstancesScaleOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface InstancesPatchServersOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface InstancesListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type InstancesListByResourceGroupNextResponse = MonitoringInstanceList; + +/** Optional parameters. */ +export interface InstancesListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type InstancesListBySubscriptionNextResponse = MonitoringInstanceList; + +/** Optional parameters. */ +export interface AzureAPIForManagingScomMonitoringInstancesOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/scom/arm-scom/src/models/mappers.ts b/sdk/scom/arm-scom/src/models/mappers.ts new file mode 100644 index 000000000000..5abb16b915f4 --- /dev/null +++ b/sdk/scom/arm-scom/src/models/mappers.ts @@ -0,0 +1,775 @@ +/* + * 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 OperationsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationsList", + modelProperties: { + value: { + serializedName: "value", + 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" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const MonitoringInstanceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoringInstanceList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MonitoringInstance" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const MonitoringInstanceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoringInstanceProperties", + modelProperties: { + productVersion: { + serializedName: "productVersion", + readOnly: true, + type: { + name: "String" + } + }, + vNetSubnetId: { + serializedName: "vNetSubnetId", + type: { + name: "String" + } + }, + managementEndpoints: { + serializedName: "managementEndpoints", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ManagementServerProperties" + } + } + } + }, + databaseInstance: { + serializedName: "databaseInstance", + type: { + name: "Composite", + className: "DatabaseInstanceProperties" + } + }, + domainController: { + serializedName: "domainController", + type: { + name: "Composite", + className: "DomainControllerProperties" + } + }, + domainUserCredentials: { + serializedName: "domainUserCredentials", + type: { + name: "Composite", + className: "DomainUserCredentials" + } + }, + gmsaDetails: { + serializedName: "gmsaDetails", + type: { + name: "Composite", + className: "GmsaDetails" + } + }, + azureHybridBenefit: { + serializedName: "azureHybridBenefit", + type: { + name: "Composite", + className: "AzureHybridBenefitProperties" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + operationsStatus: { + serializedName: "operationsStatus", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ManagedInstanceOperationStatus" + } + } + } + } + } + } +}; + +export const ManagementServerProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagementServerProperties", + modelProperties: { + serverName: { + serializedName: "serverName", + readOnly: true, + type: { + name: "String" + } + }, + vmResId: { + serializedName: "vmResId", + readOnly: true, + type: { + name: "String" + } + }, + fqdn: { + serializedName: "fqdn", + readOnly: true, + type: { + name: "String" + } + }, + serverRoles: { + serializedName: "serverRoles", + readOnly: true, + type: { + name: "String" + } + }, + healthState: { + serializedName: "healthState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DatabaseInstanceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseInstanceProperties", + modelProperties: { + databaseInstanceId: { + serializedName: "databaseInstanceId", + type: { + name: "String" + } + }, + databaseFqdn: { + serializedName: "databaseFqdn", + readOnly: true, + type: { + name: "String" + } + }, + dwDatabaseName: { + serializedName: "dwDatabaseName", + readOnly: true, + type: { + name: "String" + } + }, + operationalDatabaseId: { + serializedName: "operationalDatabaseId", + readOnly: true, + type: { + name: "String" + } + }, + dwDatabaseId: { + serializedName: "dwDatabaseId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DomainControllerProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DomainControllerProperties", + modelProperties: { + domainName: { + serializedName: "domainName", + type: { + name: "String" + } + }, + dnsServer: { + serializedName: "dnsServer", + type: { + name: "String" + } + }, + ouPath: { + defaultValue: "", + serializedName: "ouPath", + type: { + name: "String" + } + } + } + } +}; + +export const DomainUserCredentials: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DomainUserCredentials", + modelProperties: { + keyVaultUrl: { + serializedName: "keyVaultUrl", + type: { + name: "String" + } + }, + userNameSecret: { + serializedName: "userNameSecret", + type: { + name: "String" + } + }, + passwordSecret: { + serializedName: "passwordSecret", + type: { + name: "String" + } + } + } + } +}; + +export const GmsaDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GmsaDetails", + modelProperties: { + loadBalancerIP: { + serializedName: "loadBalancerIP", + type: { + name: "String" + } + }, + gmsaAccount: { + serializedName: "gmsaAccount", + type: { + name: "String" + } + }, + managementServerGroupName: { + serializedName: "managementServerGroupName", + type: { + name: "String" + } + }, + dnsName: { + serializedName: "dnsName", + type: { + name: "String" + } + } + } + } +}; + +export const AzureHybridBenefitProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureHybridBenefitProperties", + modelProperties: { + scomLicenseType: { + serializedName: "scomLicenseType", + type: { + name: "String" + } + }, + windowsServerLicenseType: { + serializedName: "windowsServerLicenseType", + type: { + name: "String" + } + }, + sqlServerLicenseType: { + serializedName: "sqlServerLicenseType", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedInstanceOperationStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedInstanceOperationStatus", + modelProperties: { + operationName: { + serializedName: "operationName", + readOnly: true, + type: { + name: "String" + } + }, + operationState: { + serializedName: "operationState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +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 ManagedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedIdentity", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "String" + } + }, + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { type: { name: "Composite", className: "UserIdentity" } } + } + } + } + } +}; + +export const UserIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const MonitoringInstancePatch: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoringInstancePatch", + modelProperties: { + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedIdentity" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const ScalingProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ScalingProperties", + modelProperties: { + serverCount: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 1 + }, + serializedName: "serverCount", + type: { + name: "Number" + } + } + } + } +}; + +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 MonitoringInstance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoringInstance", + modelProperties: { + ...TrackedResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "MonitoringInstanceProperties" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedIdentity" + } + } + } + } +}; diff --git a/sdk/scom/arm-scom/src/models/parameters.ts b/sdk/scom/arm-scom/src/models/parameters.ts new file mode 100644 index 000000000000..30bd4ac49982 --- /dev/null +++ b/sdk/scom/arm-scom/src/models/parameters.ts @@ -0,0 +1,143 @@ +/* + * 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 { + MonitoringInstance as MonitoringInstanceMapper, + MonitoringInstancePatch as MonitoringInstancePatchMapper, + ScalingProperties as ScalingPropertiesMapper +} 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 subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-09-13-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const instanceName: OperationURLParameter = { + parameterPath: "instanceName", + mapper: { + serializedName: "instanceName", + 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 monitoringInstance: OperationParameter = { + parameterPath: "monitoringInstance", + mapper: MonitoringInstanceMapper +}; + +export const validationMode: OperationQueryParameter = { + parameterPath: ["options", "validationMode"], + mapper: { + serializedName: "validationMode", + type: { + name: "Boolean" + } + } +}; + +export const monitoringInstance1: OperationParameter = { + parameterPath: ["options", "monitoringInstance"], + mapper: MonitoringInstancePatchMapper +}; + +export const body: OperationParameter = { + parameterPath: "body", + mapper: ScalingPropertiesMapper +}; diff --git a/sdk/scom/arm-scom/src/operations/index.ts b/sdk/scom/arm-scom/src/operations/index.ts new file mode 100644 index 000000000000..9b34c6691a58 --- /dev/null +++ b/sdk/scom/arm-scom/src/operations/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./instances"; diff --git a/sdk/scom/arm-scom/src/operations/instances.ts b/sdk/scom/arm-scom/src/operations/instances.ts new file mode 100644 index 000000000000..1aaa311eca25 --- /dev/null +++ b/sdk/scom/arm-scom/src/operations/instances.ts @@ -0,0 +1,936 @@ +/* + * 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 { Instances } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureAPIForManagingScomMonitoringInstances } from "../azureAPIForManagingScomMonitoringInstances"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + MonitoringInstance, + InstancesListByResourceGroupNextOptionalParams, + InstancesListByResourceGroupOptionalParams, + InstancesListByResourceGroupResponse, + InstancesListBySubscriptionNextOptionalParams, + InstancesListBySubscriptionOptionalParams, + InstancesListBySubscriptionResponse, + InstancesGetOptionalParams, + InstancesGetResponse, + InstancesCreateOrUpdateOptionalParams, + InstancesCreateOrUpdateResponse, + InstancesUpdateOptionalParams, + InstancesUpdateResponse, + InstancesDeleteOptionalParams, + ScalingProperties, + InstancesScaleOptionalParams, + InstancesPatchServersOptionalParams, + InstancesListByResourceGroupNextResponse, + InstancesListBySubscriptionNextResponse +} from "../models"; + +/// +/** Class containing Instances operations. */ +export class InstancesImpl implements Instances { + private readonly client: AzureAPIForManagingScomMonitoringInstances; + + /** + * Initialize a new instance of the class Instances class. + * @param client Reference to the service client + */ + constructor(client: AzureAPIForManagingScomMonitoringInstances) { + this.client = client; + } + + /** + * Lists all SCOM monitoring instances in a 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?: InstancesListByResourceGroupOptionalParams + ): 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?: InstancesListByResourceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: InstancesListByResourceGroupResponse; + 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?: InstancesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Lists all SCOM monitoring instances in a subscription + * @param options The options parameters. + */ + public listBySubscription( + options?: InstancesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: InstancesListBySubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: InstancesListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionPagingAll( + options?: InstancesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all SCOM monitoring instances in a 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?: InstancesListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Lists all SCOM monitoring instances in a subscription + * @param options The options parameters. + */ + private _listBySubscription( + options?: InstancesListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Get SCOM monitoring instance details + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + get( + resourceGroupName: string, + instanceName: string, + options?: InstancesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, instanceName, options }, + getOperationSpec + ); + } + + /** + * Create or update SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param monitoringInstance SCOM Monitoring Instance + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + instanceName: string, + monitoringInstance: MonitoringInstance, + options?: InstancesCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + InstancesCreateOrUpdateResponse + > + > { + 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, instanceName, monitoringInstance, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + InstancesCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create or update SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param monitoringInstance SCOM Monitoring Instance + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + instanceName: string, + monitoringInstance: MonitoringInstance, + options?: InstancesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + instanceName, + monitoringInstance, + options + ); + return poller.pollUntilDone(); + } + + /** + * Patch SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + instanceName: string, + options?: InstancesUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + InstancesUpdateResponse + > + > { + 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, instanceName, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + InstancesUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Patch SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + instanceName: string, + options?: InstancesUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + instanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + instanceName: string, + options?: InstancesDeleteOptionalParams + ): Promise, void>> { + 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, instanceName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + instanceName: string, + options?: InstancesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + instanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Scaling SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param body Properties for Scaling + * @param options The options parameters. + */ + async beginScale( + resourceGroupName: string, + instanceName: string, + body: ScalingProperties, + options?: InstancesScaleOptionalParams + ): Promise, void>> { + 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, instanceName, body, options }, + spec: scaleOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Scaling SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param body Properties for Scaling + * @param options The options parameters. + */ + async beginScaleAndWait( + resourceGroupName: string, + instanceName: string, + body: ScalingProperties, + options?: InstancesScaleOptionalParams + ): Promise { + const poller = await this.beginScale( + resourceGroupName, + instanceName, + body, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update SCOM servers with latest scom software + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + async beginPatchServers( + resourceGroupName: string, + instanceName: string, + options?: InstancesPatchServersOptionalParams + ): Promise, void>> { + 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, instanceName, options }, + spec: patchServersOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Update SCOM servers with latest scom software + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + async beginPatchServersAndWait( + resourceGroupName: string, + instanceName: string, + options?: InstancesPatchServersOptionalParams + ): Promise { + const poller = await this.beginPatchServers( + resourceGroupName, + instanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * 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?: InstancesListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: InstancesListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scom/managedInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitoringInstanceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Scom/managedInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitoringInstanceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scom/managedInstances/{instanceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitoringInstance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.instanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scom/managedInstances/{instanceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.MonitoringInstance + }, + 201: { + bodyMapper: Mappers.MonitoringInstance + }, + 202: { + bodyMapper: Mappers.MonitoringInstance + }, + 204: { + bodyMapper: Mappers.MonitoringInstance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.monitoringInstance, + queryParameters: [Parameters.apiVersion, Parameters.validationMode], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.instanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scom/managedInstances/{instanceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.MonitoringInstance + }, + 201: { + bodyMapper: Mappers.MonitoringInstance + }, + 202: { + bodyMapper: Mappers.MonitoringInstance + }, + 204: { + bodyMapper: Mappers.MonitoringInstance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.monitoringInstance1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.instanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scom/managedInstances/{instanceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.instanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const scaleOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scom/managedInstances/{instanceName}/setServerCount", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.instanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const patchServersOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scom/managedInstances/{instanceName}/patchServers", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.instanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitoringInstanceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitoringInstanceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/scom/arm-scom/src/operations/operations.ts b/sdk/scom/arm-scom/src/operations/operations.ts new file mode 100644 index 000000000000..10a012000f17 --- /dev/null +++ b/sdk/scom/arm-scom/src/operations/operations.ts @@ -0,0 +1,174 @@ +/* + * 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 { AzureAPIForManagingScomMonitoringInstances } from "../azureAPIForManagingScomMonitoringInstances"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: AzureAPIForManagingScomMonitoringInstances; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: AzureAPIForManagingScomMonitoringInstances) { + this.client = client; + } + + /** + * Lists all available operations on SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(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.listPagingPage(resourceGroupName, options, settings); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + options?: OperationsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(resourceGroupName, options)) { + yield* page; + } + } + + /** + * Lists all available operations on SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scom/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/scom/arm-scom/src/operationsInterfaces/index.ts b/sdk/scom/arm-scom/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..9b34c6691a58 --- /dev/null +++ b/sdk/scom/arm-scom/src/operationsInterfaces/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./instances"; diff --git a/sdk/scom/arm-scom/src/operationsInterfaces/instances.ts b/sdk/scom/arm-scom/src/operationsInterfaces/instances.ts new file mode 100644 index 000000000000..e2feeb2b88d2 --- /dev/null +++ b/sdk/scom/arm-scom/src/operationsInterfaces/instances.ts @@ -0,0 +1,185 @@ +/* + * 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 { + MonitoringInstance, + InstancesListByResourceGroupOptionalParams, + InstancesListBySubscriptionOptionalParams, + InstancesGetOptionalParams, + InstancesGetResponse, + InstancesCreateOrUpdateOptionalParams, + InstancesCreateOrUpdateResponse, + InstancesUpdateOptionalParams, + InstancesUpdateResponse, + InstancesDeleteOptionalParams, + ScalingProperties, + InstancesScaleOptionalParams, + InstancesPatchServersOptionalParams +} from "../models"; + +/// +/** Interface representing a Instances. */ +export interface Instances { + /** + * Lists all SCOM monitoring instances in a resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: InstancesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists all SCOM monitoring instances in a subscription + * @param options The options parameters. + */ + listBySubscription( + options?: InstancesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get SCOM monitoring instance details + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + get( + resourceGroupName: string, + instanceName: string, + options?: InstancesGetOptionalParams + ): Promise; + /** + * Create or update SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param monitoringInstance SCOM Monitoring Instance + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + instanceName: string, + monitoringInstance: MonitoringInstance, + options?: InstancesCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + InstancesCreateOrUpdateResponse + > + >; + /** + * Create or update SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param monitoringInstance SCOM Monitoring Instance + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + instanceName: string, + monitoringInstance: MonitoringInstance, + options?: InstancesCreateOrUpdateOptionalParams + ): Promise; + /** + * Patch SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + instanceName: string, + options?: InstancesUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + InstancesUpdateResponse + > + >; + /** + * Patch SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + instanceName: string, + options?: InstancesUpdateOptionalParams + ): Promise; + /** + * Delete a SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + instanceName: string, + options?: InstancesDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + instanceName: string, + options?: InstancesDeleteOptionalParams + ): Promise; + /** + * Scaling SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param body Properties for Scaling + * @param options The options parameters. + */ + beginScale( + resourceGroupName: string, + instanceName: string, + body: ScalingProperties, + options?: InstancesScaleOptionalParams + ): Promise, void>>; + /** + * Scaling SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param body Properties for Scaling + * @param options The options parameters. + */ + beginScaleAndWait( + resourceGroupName: string, + instanceName: string, + body: ScalingProperties, + options?: InstancesScaleOptionalParams + ): Promise; + /** + * Update SCOM servers with latest scom software + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + beginPatchServers( + resourceGroupName: string, + instanceName: string, + options?: InstancesPatchServersOptionalParams + ): Promise, void>>; + /** + * Update SCOM servers with latest scom software + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param instanceName Name of the SCOM monitoring instance + * @param options The options parameters. + */ + beginPatchServersAndWait( + resourceGroupName: string, + instanceName: string, + options?: InstancesPatchServersOptionalParams + ): Promise; +} diff --git a/sdk/scom/arm-scom/src/operationsInterfaces/operations.ts b/sdk/scom/arm-scom/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..8a40ad0a402c --- /dev/null +++ b/sdk/scom/arm-scom/src/operationsInterfaces/operations.ts @@ -0,0 +1,24 @@ +/* + * 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 { + /** + * Lists all available operations on SCOM monitoring instance + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/scom/arm-scom/src/pagingHelper.ts b/sdk/scom/arm-scom/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/scom/arm-scom/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/scom/arm-scom/test/sampleTest.ts b/sdk/scom/arm-scom/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/scom/arm-scom/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/scom/arm-scom/tsconfig.json b/sdk/scom/arm-scom/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/scom/arm-scom/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/scom/ci.mgmt.yml b/sdk/scom/ci.mgmt.yml new file mode 100644 index 000000000000..ab2bb177eca5 --- /dev/null +++ b/sdk/scom/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/scom/arm-scom + - sdk/scom/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/scom/arm-scom + - sdk/scom/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: scom + Artifacts: + - name: azure-arm-scom + safeName: azurearmscom + \ No newline at end of file