From 745204205a7e170dca97268aabcff4eeed6b3b87 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 24 Mar 2023 15:53:28 +0800 Subject: [PATCH] newrelicobservability release (#25351) https://github.com/Azure/sdk-release-request/issues/3821 --- common/config/rush/pnpm-lock.yaml | 36 +- eng/ignore-links.txt | 1 + rush.json | 5 + .../arm-newrelicobservability/CHANGELOG.md | 5 + .../arm-newrelicobservability/LICENSE | 21 + .../arm-newrelicobservability/README.md | 109 ++ .../arm-newrelicobservability/_meta.json | 8 + .../api-extractor.json | 31 + .../arm-newrelicobservability/package.json | 123 ++ .../recording_operations_list_test.json | 282 +++ .../review/arm-newrelicobservability.api.md | 903 +++++++++ .../rollup.config.js | 122 ++ .../arm-newrelicobservability/sample.env | 4 + .../samples-dev/accountsListSample.ts | 62 + .../monitorsCreateOrUpdateSample.ts | 85 + .../samples-dev/monitorsDeleteSample.ts | 68 + .../monitorsGetMetricRulesSample.ts | 71 + .../monitorsGetMetricStatusSample.ts | 76 + .../samples-dev/monitorsGetSample.ts | 39 + .../monitorsListAppServicesSample.ts | 82 + .../monitorsListByResourceGroupSample.ts | 43 + .../monitorsListBySubscriptionSample.ts | 39 + .../samples-dev/monitorsListHostsSample.ts | 83 + .../monitorsListMonitoredResourcesSample.ts | 70 + .../monitorsSwitchBillingSample.ts | 83 + .../samples-dev/monitorsUpdateSample.ts | 80 + .../monitorsVMHostPayloadSample.ts | 64 + .../samples-dev/operationsListSample.ts | 60 + .../samples-dev/organizationsListSample.ts | 62 + .../samples-dev/plansListSample.ts | 64 + .../tagRulesCreateOrUpdateSample.ts | 99 + .../samples-dev/tagRulesDeleteSample.ts | 68 + .../samples-dev/tagRulesGetSample.ts | 68 + ...ulesListByNewRelicMonitorResourceSample.ts | 70 + .../samples-dev/tagRulesUpdateSample.ts | 98 + .../samples/v1-beta/javascript/README.md | 92 + .../v1-beta/javascript/accountsListSample.js | 58 + .../monitorsCreateOrUpdateSample.js | 78 + .../javascript/monitorsDeleteSample.js | 62 + .../monitorsGetMetricRulesSample.js | 54 + .../monitorsGetMetricStatusSample.js | 59 + .../v1-beta/javascript/monitorsGetSample.js | 35 + .../monitorsListAppServicesSample.js | 65 + .../monitorsListByResourceGroupSample.js | 37 + .../monitorsListBySubscriptionSample.js | 36 + .../javascript/monitorsListHostsSample.js | 66 + .../monitorsListMonitoredResourcesSample.js | 58 + .../javascript/monitorsSwitchBillingSample.js | 66 + .../javascript/monitorsUpdateSample.js | 69 + .../javascript/monitorsVMHostPayloadSample.js | 52 + .../javascript/operationsListSample.js | 56 + .../javascript/organizationsListSample.js | 58 + .../samples/v1-beta/javascript/package.json | 32 + .../v1-beta/javascript/plansListSample.js | 57 + .../samples/v1-beta/javascript/sample.env | 4 + .../tagRulesCreateOrUpdateSample.js | 90 + .../javascript/tagRulesDeleteSample.js | 62 + .../v1-beta/javascript/tagRulesGetSample.js | 54 + ...ulesListByNewRelicMonitorResourceSample.js | 64 + .../javascript/tagRulesUpdateSample.js | 89 + .../samples/v1-beta/typescript/README.md | 105 ++ .../samples/v1-beta/typescript/package.json | 41 + .../samples/v1-beta/typescript/sample.env | 4 + .../typescript/src/accountsListSample.ts | 62 + .../src/monitorsCreateOrUpdateSample.ts | 85 + .../typescript/src/monitorsDeleteSample.ts | 68 + .../src/monitorsGetMetricRulesSample.ts | 71 + .../src/monitorsGetMetricStatusSample.ts | 76 + .../typescript/src/monitorsGetSample.ts | 39 + .../src/monitorsListAppServicesSample.ts | 82 + .../src/monitorsListByResourceGroupSample.ts | 43 + .../src/monitorsListBySubscriptionSample.ts | 39 + .../typescript/src/monitorsListHostsSample.ts | 83 + .../monitorsListMonitoredResourcesSample.ts | 70 + .../src/monitorsSwitchBillingSample.ts | 83 + .../typescript/src/monitorsUpdateSample.ts | 80 + .../src/monitorsVMHostPayloadSample.ts | 64 + .../typescript/src/operationsListSample.ts | 60 + .../typescript/src/organizationsListSample.ts | 62 + .../v1-beta/typescript/src/plansListSample.ts | 64 + .../src/tagRulesCreateOrUpdateSample.ts | 99 + .../typescript/src/tagRulesDeleteSample.ts | 68 + .../typescript/src/tagRulesGetSample.ts | 68 + ...ulesListByNewRelicMonitorResourceSample.ts | 70 + .../typescript/src/tagRulesUpdateSample.ts | 98 + .../samples/v1-beta/typescript/tsconfig.json | 17 + .../arm-newrelicobservability/src/index.ts | 13 + .../arm-newrelicobservability/src/lroImpl.ts | 42 + .../src/models/index.ts | 1302 +++++++++++++ .../src/models/mappers.ts | 1636 +++++++++++++++++ .../src/models/parameters.ts | 222 +++ .../src/newRelicObservability.ts | 164 ++ .../src/operations/accounts.ts | 177 ++ .../src/operations/index.ts | 14 + .../src/operations/monitors.ts | 1354 ++++++++++++++ .../src/operations/operations.ts | 149 ++ .../src/operations/organizations.ts | 177 ++ .../src/operations/plans.ts | 156 ++ .../src/operations/tagRules.ts | 552 ++++++ .../src/operationsInterfaces/accounts.ts | 26 + .../src/operationsInterfaces/index.ts | 14 + .../src/operationsInterfaces/monitors.ts | 231 +++ .../src/operationsInterfaces/operations.ts | 22 + .../src/operationsInterfaces/organizations.ts | 29 + .../src/operationsInterfaces/plans.ts | 22 + .../src/operationsInterfaces/tagRules.ts | 127 ++ .../src/pagingHelper.ts | 39 + ...icobservability_operations_test.spec.ts.ts | 68 + .../arm-newrelicobservability/tsconfig.json | 33 + sdk/newrelicobservability/ci.mgmt.yml | 38 + 110 files changed, 12942 insertions(+), 3 deletions(-) create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/CHANGELOG.md create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/LICENSE create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/README.md create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/_meta.json create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/api-extractor.json create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/package.json create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/recordings/node/newrelicobservability_test/recording_operations_list_test.json create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/review/arm-newrelicobservability.api.md create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/rollup.config.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/sample.env create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/accountsListSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsCreateOrUpdateSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsDeleteSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetMetricRulesSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetMetricStatusSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListAppServicesSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListByResourceGroupSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListBySubscriptionSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListHostsSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListMonitoredResourcesSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsSwitchBillingSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsUpdateSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsVMHostPayloadSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/operationsListSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/organizationsListSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/plansListSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesCreateOrUpdateSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesDeleteSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesGetSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesListByNewRelicMonitorResourceSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesUpdateSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/README.md create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/accountsListSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsCreateOrUpdateSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsDeleteSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricRulesSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricStatusSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListAppServicesSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListByResourceGroupSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListBySubscriptionSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListHostsSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListMonitoredResourcesSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsSwitchBillingSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsUpdateSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsVMHostPayloadSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/operationsListSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/organizationsListSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/package.json create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/plansListSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/sample.env create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesCreateOrUpdateSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesDeleteSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesGetSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesListByNewRelicMonitorResourceSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesUpdateSample.js create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/README.md create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/package.json create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/sample.env create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/accountsListSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsCreateOrUpdateSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsDeleteSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricRulesSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricStatusSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListAppServicesSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListByResourceGroupSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListBySubscriptionSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListHostsSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListMonitoredResourcesSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsSwitchBillingSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsUpdateSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsVMHostPayloadSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/operationsListSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/organizationsListSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/plansListSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesCreateOrUpdateSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesDeleteSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesGetSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesListByNewRelicMonitorResourceSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesUpdateSample.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/tsconfig.json create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/index.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/lroImpl.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/models/index.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/models/mappers.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/models/parameters.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/newRelicObservability.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operations/accounts.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operations/index.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operations/monitors.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operations/operations.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operations/organizations.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operations/plans.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operations/tagRules.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/accounts.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/index.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/monitors.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/operations.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/organizations.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/plans.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/tagRules.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/src/pagingHelper.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/test/newrelicobservability_operations_test.spec.ts.ts create mode 100644 sdk/newrelicobservability/arm-newrelicobservability/tsconfig.json create mode 100644 sdk/newrelicobservability/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 6f73aca27026..5f7d2d31b743 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -143,6 +143,7 @@ specifiers: '@rush-temp/arm-network-1': file:./projects/arm-network-1.tgz '@rush-temp/arm-network-profile-2020-09-01-hybrid': file:./projects/arm-network-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-networkfunction': file:./projects/arm-networkfunction.tgz + '@rush-temp/arm-newrelicobservability': file:./projects/arm-newrelicobservability.tgz '@rush-temp/arm-nginx': file:./projects/arm-nginx.tgz '@rush-temp/arm-notificationhubs': file:./projects/arm-notificationhubs.tgz '@rush-temp/arm-oep': file:./projects/arm-oep.tgz @@ -478,6 +479,7 @@ dependencies: '@rush-temp/arm-network-1': file:projects/arm-network-1.tgz '@rush-temp/arm-network-profile-2020-09-01-hybrid': file:projects/arm-network-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-networkfunction': file:projects/arm-networkfunction.tgz + '@rush-temp/arm-newrelicobservability': file:projects/arm-newrelicobservability.tgz '@rush-temp/arm-nginx': file:projects/arm-nginx.tgz '@rush-temp/arm-notificationhubs': file:projects/arm-notificationhubs.tgz '@rush-temp/arm-oep': file:projects/arm-oep.tgz @@ -3908,7 +3910,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.1.0-dev.20230321 + typescript: 5.1.0-dev.20230322 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8764,8 +8766,8 @@ packages: hasBin: true dev: false - /typescript/5.1.0-dev.20230321: - resolution: {integrity: sha512-GFq3xvjbJImoKgCDJEiB7Bsa1wQdu/9tlb8Qj475ydSraETbCLzy+Ao3cqQ+KWBM6Mqo+0b1rrpe2Gj0DZz2+w==} + /typescript/5.1.0-dev.20230322: + resolution: {integrity: sha512-sRsSUZOCpLClaHzhRo1ZsoEnQe6+1FMEQzBzgtxC8f9rklwY5H4TcyKoa9wRpYvvJ34Farr8nEU/Uz+hnruyLw==} engines: {node: '>=12.20'} hasBin: true dev: false @@ -13501,6 +13503,34 @@ packages: - supports-color dev: false + file:projects/arm-newrelicobservability.tgz: + resolution: {integrity: sha512-LmrvBWJ+OebmXjF6lOR1y6vJ046P5xTHpT2YmIkGFBCFMutjoap2SgJPlvfcTpITxnbJhQIboh+gfymCxNrzZA==, tarball: file:projects/arm-newrelicobservability.tgz} + name: '@rush-temp/arm-newrelicobservability' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.34.4_@types+node@14.18.38 + '@rollup/plugin-commonjs': 24.0.1_rollup@2.79.1 + '@rollup/plugin-json': 6.0.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 6.0.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.4 + '@types/node': 14.18.38 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 16.0.3 + mkdirp: 2.1.5 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_rrfo4ccoq6ga3fxzubpgdsawvq + tslib: 2.5.0 + typescript: 4.8.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/arm-nginx.tgz: resolution: {integrity: sha512-t46u42VI5HPyrYRNqN8V+0aUYplz3/EZ3a7nyv48lUwTBW8DdIUowTsIA34+GH2XlhuEh8Vm9mQq8exeow0Ymw==, tarball: file:projects/arm-nginx.tgz} name: '@rush-temp/arm-nginx' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index bbfa9d678e07..4cc044649a91 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -9,3 +9,4 @@ https://docs.microsoft.com/javascript/api/@azure-rest/purview-sharing?view=azure https://docs.microsoft.com/javascript/api/@azure/arm-voiceservices https://docs.microsoft.com/javascript/api/@azure/arm-voiceservices?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-graphservices?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/arm-newrelicobservability?view=azure-node-preview diff --git a/rush.json b/rush.json index af893b78158c..2a9463ae25db 100644 --- a/rush.json +++ b/rush.json @@ -1952,6 +1952,11 @@ "packageName": "@azure/arm-graphservices", "projectFolder": "sdk/graphservices/arm-graphservices", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-newrelicobservability", + "projectFolder": "sdk/newrelicobservability/arm-newrelicobservability", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/newrelicobservability/arm-newrelicobservability/CHANGELOG.md b/sdk/newrelicobservability/arm-newrelicobservability/CHANGELOG.md new file mode 100644 index 000000000000..6204cb254f7d --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-03-23) + +The package of @azure/arm-newrelicobservability 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/newrelicobservability/arm-newrelicobservability/LICENSE b/sdk/newrelicobservability/arm-newrelicobservability/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/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/newrelicobservability/arm-newrelicobservability/README.md b/sdk/newrelicobservability/arm-newrelicobservability/README.md new file mode 100644 index 000000000000..b29bb1990eda --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/README.md @@ -0,0 +1,109 @@ +# Azure NewRelicObservability client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure NewRelicObservability client. + + + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/newrelicobservability/arm-newrelicobservability) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-newrelicobservability) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-newrelicobservability?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-newrelicobservability` package + +Install the Azure NewRelicObservability client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-newrelicobservability +``` + +### Create and authenticate a `NewRelicObservability` + +To create a client object to access the Azure NewRelicObservability API, you will need the `endpoint` of your Azure NewRelicObservability resource and a `credential`. The Azure NewRelicObservability client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure NewRelicObservability resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure NewRelicObservability** 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 { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +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 NewRelicObservability(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new NewRelicObservability(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 + +### NewRelicObservability + +`NewRelicObservability` is the primary interface for developers using the Azure NewRelicObservability client library. Explore the methods on this client object to understand the different features of the Azure NewRelicObservability 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%2Fnewrelicobservability%2Farm-newrelicobservability%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/newrelicobservability/arm-newrelicobservability/_meta.json b/sdk/newrelicobservability/arm-newrelicobservability/_meta.json new file mode 100644 index 000000000000..6464f30a32e1 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "fc450164d4c1ed7944efd86df569fcc118cb8fbc", + "readme": "specification/newrelic/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=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\newrelic\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.10 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", + "use": "@autorest/typescript@6.0.0-rc.10" +} \ No newline at end of file diff --git a/sdk/newrelicobservability/arm-newrelicobservability/api-extractor.json b/sdk/newrelicobservability/arm-newrelicobservability/api-extractor.json new file mode 100644 index 000000000000..026ee989c143 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/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-newrelicobservability.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/newrelicobservability/arm-newrelicobservability/package.json b/sdk/newrelicobservability/arm-newrelicobservability/package.json new file mode 100644 index 000000000000..d4741121dd8c --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/package.json @@ -0,0 +1,123 @@ +{ + "name": "@azure/arm-newrelicobservability", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for NewRelicObservability.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-newrelicobservability.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-multi-entry": "^6.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^2.1.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.8.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "dotenv": "^16.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^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/newRelicObservability.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/newrelicobservability/arm-newrelicobservability", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-newrelicobservability?view=azure-node-preview" + } +} \ No newline at end of file diff --git a/sdk/newrelicobservability/arm-newrelicobservability/recordings/node/newrelicobservability_test/recording_operations_list_test.json b/sdk/newrelicobservability/arm-newrelicobservability/recordings/node/newrelicobservability_test/recording_operations_list_test.json new file mode 100644 index 000000000000..bb7fa0aafca3 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/recordings/node/newrelicobservability_test/recording_operations_list_test.json @@ -0,0 +1,282 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/providers/NewRelic.Observability/operations?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-newrelicobservability/1.0.0-beta.1 core-rest-pipeline/1.10.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "5331f479-3bfc-4a5d-96d7-8ffa1ec2acc1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 24 Mar 2023 03:08:04 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "cdd26872-fbe1-4860-9f54-e57fecbb2feb", + "x-ms-providerhub-traffic": "True", + "x-ms-ratelimit-remaining-tenant-reads": "11999", + "x-ms-request-id": "391c7706-dfb4-4e40-8d73-11cc6201ff77", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230324T030805Z:cdd26872-fbe1-4860-9f54-e57fecbb2feb" + }, + "ResponseBody": { + "value": [ + { + "name": "NewRelic.Observability/monitors/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "Monitors", + "operation": "Get/List monitor resources", + "description": "Read monitors" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/write", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "Monitors", + "operation": "Create/Update monitor resources", + "description": "Write monitors" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/delete", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "Monitors", + "operation": "Delete monitor resources", + "description": "Delete monitors" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/tagRules/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "TagRules", + "operation": "Get tag rules resource", + "description": "Read tag rules" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/tagRules/write", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "TagRules", + "operation": "Create/Update tag rules resource", + "description": "Write tag rules" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/monitoredResources/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "ListMonitoredResources", + "operation": "List monitored resources", + "description": "List all resources that are being monitored by the monitor resource" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/registeredSubscriptions/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "RegisteredSubscriptions", + "operation": "Get registered subscriptions", + "description": "Get registered subscription details" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/locations/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "Locations", + "operation": "Get locations", + "description": "Get locations" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/locations/operationStatuses/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "OperationStatuses", + "operation": "Get operation statuses", + "description": "Get operation statuses" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/locations/operationStatuses/write", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "OperationStatuses", + "operation": "Write operation statuses", + "description": "Write operation statuses" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/operations/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "operations", + "operation": "List available Operations in NewRelic.Observability", + "description": "List available Operations in NewRelic.Observability" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/register/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "register", + "operation": "Registers NewRelic.Observability Resource provider", + "description": "Registers NewRelic.Observability Resource provider" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/unregister/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "unregister", + "operation": "Unregisters NewRelic.Observability Resource provider", + "description": "Unregisters NewRelic.Observability Resource provider" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/vmHostPayloads/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "VMHostPayload", + "operation": "Payload for VM Host", + "description": "The payload to be sent for installing NewRelic agent on VM" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/listAppServices/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "listAppServices", + "operation": "List App services", + "description": "List all the app services that have NewRelic agent installed" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/listHosts/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "ListHosts", + "operation": "List VM Hosts", + "description": "List all VMs that are sending compute logs for a monitor" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/getMetricRules/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "getMetricRules", + "operation": "Get Metric Rules", + "description": "Get Metric rules for a NewRelic resource" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/getMetricStatus/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "getMetricStatus", + "operation": "Get Metric Status", + "description": "Get Metric status for resources" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/accounts/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "ListAccounts", + "operation": "List Accounts", + "description": "List all Accounts that for a user" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/organizations/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "Listorganizations", + "operation": "List organizations", + "description": "List all organizations for a user" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/monitors/switchBilling/action", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "switchBilling", + "operation": "Switch Billing", + "description": "Switches billing for NewRelic monitor resource to Azure" + }, + "properties": null + }, + { + "name": "NewRelic.Observability/plans/read", + "isDataAction": false, + "display": { + "provider": "NewRelic.Observability", + "resource": "ListPlandata", + "operation": "List plandata", + "description": "List plan data for a account or organization" + }, + "properties": null + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/review/arm-newrelicobservability.api.md b/sdk/newrelicobservability/arm-newrelicobservability/review/arm-newrelicobservability.api.md new file mode 100644 index 000000000000..e184105ecc32 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/review/arm-newrelicobservability.api.md @@ -0,0 +1,903 @@ +## API Report File for "@azure/arm-newrelicobservability" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export type AccountCreationSource = string; + +// @public +export interface AccountInfo { + accountId?: string; + ingestionKey?: string; + region?: string; +} + +// @public +export interface AccountResource extends ProxyResource { + accountId?: string; + accountName?: string; + organizationId?: string; + region?: string; +} + +// @public +export interface Accounts { + list(userEmail: string, location: string, options?: AccountsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface AccountsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccountsListNextResponse = AccountsListResponse; + +// @public +export type AccountsListOperationResponse = AccountsListResponse; + +// @public +export interface AccountsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface AccountsListResponse { + nextLink?: string; + value: AccountResource[]; +} + +// @public +export type ActionType = string; + +// @public +export interface AppServiceInfo { + agentStatus?: string; + agentVersion?: string; + azureResourceId?: string; +} + +// @public +export interface AppServicesGetParameter { + request: AppServicesGetRequest; +} + +// @public +export interface AppServicesGetRequest { + azureResourceIds?: string[]; + userEmail: string; +} + +// @public +export interface AppServicesListResponse { + nextLink?: string; + value: AppServiceInfo[]; +} + +// @public +export type BillingCycle = string; + +// @public +export type BillingSource = string; + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface FilteringTag { + action?: TagAction; + name?: string; + value?: string; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface HostsGetParameter { + request: HostsGetRequest; +} + +// @public +export interface HostsGetRequest { + userEmail: string; + vmIds?: string[]; +} + +// @public +export enum KnownAccountCreationSource { + Liftr = "LIFTR", + Newrelic = "NEWRELIC" +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownBillingCycle { + Monthly = "MONTHLY", + Weekly = "WEEKLY", + Yearly = "YEARLY" +} + +// @public +export enum KnownBillingSource { + Azure = "AZURE", + Newrelic = "NEWRELIC" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownLiftrResourceCategories { + MonitorLogs = "MonitorLogs", + Unknown = "Unknown" +} + +// @public +export enum KnownManagedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownMarketplaceSubscriptionStatus { + Active = "Active", + Suspended = "Suspended" +} + +// @public +export enum KnownMonitoringStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownOrgCreationSource { + Liftr = "LIFTR", + Newrelic = "NEWRELIC" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Creating = "Creating", + Deleted = "Deleted", + Deleting = "Deleting", + Failed = "Failed", + NotSpecified = "NotSpecified", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownSendAadLogsStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownSendActivityLogsStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownSendingLogsStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownSendingMetricsStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownSendMetricsStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownSendSubscriptionLogsStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownSingleSignOnStates { + Disable = "Disable", + Enable = "Enable", + Existing = "Existing", + Initial = "Initial" +} + +// @public +export enum KnownTagAction { + Exclude = "Exclude", + Include = "Include" +} + +// @public +export enum KnownUsageType { + Committed = "COMMITTED", + Payg = "PAYG" +} + +// @public +export type LiftrResourceCategories = string; + +// @public +export interface LogRules { + filteringTags?: FilteringTag[]; + sendAadLogs?: SendAadLogsStatus; + sendActivityLogs?: SendActivityLogsStatus; + sendSubscriptionLogs?: SendSubscriptionLogsStatus; +} + +// @public +export interface ManagedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: ManagedServiceIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentity; + }; +} + +// @public +export type ManagedServiceIdentityType = string; + +// @public +export type MarketplaceSubscriptionStatus = string; + +// @public +export interface MetricRules { + filteringTags?: FilteringTag[]; + sendMetrics?: SendMetricsStatus; + userEmail?: string; +} + +// @public +export interface MetricsRequest { + userEmail: string; +} + +// @public +export interface MetricsRequestParameter { + request: MetricsRequest; +} + +// @public +export interface MetricsStatusRequest { + azureResourceIds?: string[]; + userEmail: string; +} + +// @public +export interface MetricsStatusRequestParameter { + request: MetricsStatusRequest; +} + +// @public +export interface MetricsStatusResponse { + azureResourceIds?: string[]; +} + +// @public +export interface MonitoredResource { + id?: string; + reasonForLogsStatus?: string; + reasonForMetricsStatus?: string; + sendingLogs?: SendingLogsStatus; + sendingMetrics?: SendingMetricsStatus; +} + +// @public +export interface MonitoredResourceListResponse { + nextLink?: string; + value: MonitoredResource[]; +} + +// @public +export type MonitoringStatus = string; + +// @public +export interface Monitors { + beginCreateOrUpdate(resourceGroupName: string, monitorName: string, resource: NewRelicMonitorResource, options?: MonitorsCreateOrUpdateOptionalParams): Promise, MonitorsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, monitorName: string, resource: NewRelicMonitorResource, options?: MonitorsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, userEmail: string, monitorName: string, options?: MonitorsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, userEmail: string, monitorName: string, options?: MonitorsDeleteOptionalParams): Promise; + get(resourceGroupName: string, monitorName: string, options?: MonitorsGetOptionalParams): Promise; + getMetricRules(resourceGroupName: string, monitorName: string, request: MetricsRequest, options?: MonitorsGetMetricRulesOptionalParams): Promise; + getMetricStatus(resourceGroupName: string, monitorName: string, request: MetricsStatusRequest, options?: MonitorsGetMetricStatusOptionalParams): Promise; + listAppServices(resourceGroupName: string, monitorName: string, request: AppServicesGetRequest, options?: MonitorsListAppServicesOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: MonitorsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: MonitorsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + listHosts(resourceGroupName: string, monitorName: string, request: HostsGetRequest, options?: MonitorsListHostsOptionalParams): PagedAsyncIterableIterator; + listMonitoredResources(resourceGroupName: string, monitorName: string, options?: MonitorsListMonitoredResourcesOptionalParams): PagedAsyncIterableIterator; + switchBilling(resourceGroupName: string, monitorName: string, request: SwitchBillingRequest, options?: MonitorsSwitchBillingOptionalParams): Promise; + update(resourceGroupName: string, monitorName: string, properties: NewRelicMonitorResourceUpdate, options?: MonitorsUpdateOptionalParams): Promise; + vmHostPayload(resourceGroupName: string, monitorName: string, options?: MonitorsVmHostPayloadOptionalParams): Promise; +} + +// @public +export interface MonitorsCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface MonitorsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MonitorsCreateOrUpdateResponse = NewRelicMonitorResource; + +// @public +export interface MonitorsDeleteHeaders { + retryAfter?: number; +} + +// @public +export interface MonitorsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface MonitorsGetMetricRulesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsGetMetricRulesResponse = MetricRules; + +// @public +export interface MonitorsGetMetricStatusOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsGetMetricStatusResponse = MetricsStatusResponse; + +// @public +export interface MonitorsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsGetResponse = NewRelicMonitorResource; + +// @public +export interface MonitorsListAppServicesNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListAppServicesNextResponse = AppServicesListResponse; + +// @public +export interface MonitorsListAppServicesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListAppServicesResponse = AppServicesListResponse; + +// @public +export interface MonitorsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListByResourceGroupNextResponse = NewRelicMonitorResourceListResult; + +// @public +export interface MonitorsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListByResourceGroupResponse = NewRelicMonitorResourceListResult; + +// @public +export interface MonitorsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListBySubscriptionNextResponse = NewRelicMonitorResourceListResult; + +// @public +export interface MonitorsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListBySubscriptionResponse = NewRelicMonitorResourceListResult; + +// @public +export interface MonitorsListHostsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListHostsNextResponse = VMHostsListResponse; + +// @public +export interface MonitorsListHostsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListHostsResponse = VMHostsListResponse; + +// @public +export interface MonitorsListMonitoredResourcesNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListMonitoredResourcesNextResponse = MonitoredResourceListResponse; + +// @public +export interface MonitorsListMonitoredResourcesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsListMonitoredResourcesResponse = MonitoredResourceListResponse; + +// @public +export interface MonitorsSwitchBillingOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface MonitorsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsUpdateResponse = NewRelicMonitorResource; + +// @public +export interface MonitorsVmHostPayloadOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MonitorsVmHostPayloadResponse = VMExtensionPayload; + +// @public +export interface NewRelicAccountProperties { + accountInfo?: AccountInfo; + organizationInfo?: OrganizationInfo; + singleSignOnProperties?: NewRelicSingleSignOnProperties; + userId?: string; +} + +// @public +export interface NewRelicMonitorResource extends TrackedResource { + accountCreationSource?: AccountCreationSource; + identity?: ManagedServiceIdentity; + readonly liftrResourceCategory?: LiftrResourceCategories; + readonly liftrResourcePreference?: number; + readonly marketplaceSubscriptionId?: string; + readonly marketplaceSubscriptionStatus?: MarketplaceSubscriptionStatus; + readonly monitoringStatus?: MonitoringStatus; + newRelicAccountProperties?: NewRelicAccountProperties; + orgCreationSource?: OrgCreationSource; + planData?: PlanData; + readonly provisioningState?: ProvisioningState; + userInfo?: UserInfo; +} + +// @public +export interface NewRelicMonitorResourceListResult { + nextLink?: string; + value: NewRelicMonitorResource[]; +} + +// @public +export interface NewRelicMonitorResourceUpdate { + accountCreationSource?: AccountCreationSource; + identity?: ManagedServiceIdentity; + newRelicAccountProperties?: NewRelicAccountProperties; + orgCreationSource?: OrgCreationSource; + planData?: PlanData; + tags?: { + [propertyName: string]: string; + }; + userInfo?: UserInfo; +} + +// @public (undocumented) +export class NewRelicObservability extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: NewRelicObservabilityOptionalParams); + // (undocumented) + accounts: Accounts; + // (undocumented) + apiVersion: string; + // (undocumented) + monitors: Monitors; + // (undocumented) + operations: Operations; + // (undocumented) + organizations: Organizations; + // (undocumented) + plans: Plans; + // (undocumented) + subscriptionId: string; + // (undocumented) + tagRules: TagRules; +} + +// @public +export interface NewRelicObservabilityOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface NewRelicSingleSignOnProperties { + enterpriseAppId?: string; + provisioningState?: ProvisioningState; + singleSignOnState?: SingleSignOnStates; + singleSignOnUrl?: string; +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationListResult { + readonly nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export interface OrganizationInfo { + organizationId?: string; +} + +// @public +export interface OrganizationResource extends ProxyResource { + billingSource?: BillingSource; + organizationId?: string; + organizationName?: string; +} + +// @public +export interface Organizations { + list(userEmail: string, location: string, options?: OrganizationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OrganizationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OrganizationsListNextResponse = OrganizationsListResponse; + +// @public +export type OrganizationsListOperationResponse = OrganizationsListResponse; + +// @public +export interface OrganizationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface OrganizationsListResponse { + nextLink?: string; + value: OrganizationResource[]; +} + +// @public +export type OrgCreationSource = string; + +// @public +export type Origin = string; + +// @public +export interface PlanData { + billingCycle?: BillingCycle; + effectiveDate?: Date; + planDetails?: string; + usageType?: UsageType; +} + +// @public +export interface PlanDataListResponse { + nextLink?: string; + value: PlanDataResource[]; +} + +// @public +export interface PlanDataResource extends ProxyResource { + accountCreationSource?: AccountCreationSource; + orgCreationSource?: OrgCreationSource; + planData?: PlanData; +} + +// @public +export interface Plans { + list(options?: PlansListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface PlansListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PlansListNextResponse = PlanDataListResponse; + +// @public +export interface PlansListOptionalParams extends coreClient.OperationOptions { + accountId?: string; + organizationId?: string; +} + +// @public +export type PlansListResponse = PlanDataListResponse; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type SendAadLogsStatus = string; + +// @public +export type SendActivityLogsStatus = string; + +// @public +export type SendingLogsStatus = string; + +// @public +export type SendingMetricsStatus = string; + +// @public +export type SendMetricsStatus = string; + +// @public +export type SendSubscriptionLogsStatus = string; + +// @public +export type SingleSignOnStates = string; + +// @public +export interface SwitchBillingParameter { + request: SwitchBillingRequest; +} + +// @public +export interface SwitchBillingRequest { + azureResourceId?: string; + organizationId?: string; + planData?: PlanData; + userEmail: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type TagAction = string; + +// @public +export interface TagRule extends ProxyResource { + logRules?: LogRules; + metricRules?: MetricRules; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface TagRuleListResult { + nextLink?: string; + value: TagRule[]; +} + +// @public +export interface TagRules { + beginCreateOrUpdate(resourceGroupName: string, monitorName: string, ruleSetName: string, resource: TagRule, options?: TagRulesCreateOrUpdateOptionalParams): Promise, TagRulesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, monitorName: string, ruleSetName: string, resource: TagRule, options?: TagRulesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: TagRulesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: TagRulesDeleteOptionalParams): Promise; + get(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: TagRulesGetOptionalParams): Promise; + listByNewRelicMonitorResource(resourceGroupName: string, monitorName: string, options?: TagRulesListByNewRelicMonitorResourceOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, monitorName: string, ruleSetName: string, properties: TagRuleUpdate, options?: TagRulesUpdateOptionalParams): Promise; +} + +// @public +export interface TagRulesCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface TagRulesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type TagRulesCreateOrUpdateResponse = TagRule; + +// @public +export interface TagRulesDeleteHeaders { + retryAfter?: number; +} + +// @public +export interface TagRulesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface TagRulesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TagRulesGetResponse = TagRule; + +// @public +export interface TagRulesListByNewRelicMonitorResourceNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TagRulesListByNewRelicMonitorResourceNextResponse = TagRuleListResult; + +// @public +export interface TagRulesListByNewRelicMonitorResourceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TagRulesListByNewRelicMonitorResourceResponse = TagRuleListResult; + +// @public +export interface TagRulesUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TagRulesUpdateResponse = TagRule; + +// @public +export interface TagRuleUpdate { + logRules?: LogRules; + metricRules?: MetricRules; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type UsageType = string; + +// @public +export interface UserAssignedIdentity { + readonly clientId?: string; + readonly principalId?: string; +} + +// @public +export interface UserInfo { + country?: string; + emailAddress?: string; + firstName?: string; + lastName?: string; + phoneNumber?: string; +} + +// @public +export interface VMExtensionPayload { + ingestionKey?: string; +} + +// @public +export interface VMHostsListResponse { + nextLink?: string; + value: VMInfo[]; +} + +// @public +export interface VMInfo { + agentStatus?: string; + agentVersion?: string; + vmId?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/newrelicobservability/arm-newrelicobservability/rollup.config.js b/sdk/newrelicobservability/arm-newrelicobservability/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/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/newrelicobservability/arm-newrelicobservability/sample.env b/sdk/newrelicobservability/arm-newrelicobservability/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/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/newrelicobservability/arm-newrelicobservability/samples-dev/accountsListSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/accountsListSample.ts new file mode 100644 index 000000000000..208ad3ee9cae --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/accountsListSample.ts @@ -0,0 +1,62 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all the existing accounts + * + * @summary List all the existing accounts + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json + */ +async function accountsListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accounts.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List all the existing accounts + * + * @summary List all the existing accounts + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MinimumSet_Gen.json + */ +async function accountsListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accounts.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + accountsListMaximumSetGen(); + accountsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsCreateOrUpdateSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..7cce25718f33 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsCreateOrUpdateSample.ts @@ -0,0 +1,85 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + NewRelicMonitorResource, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create a NewRelicMonitorResource + * + * @summary Create a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json + */ +async function monitorsCreateOrUpdateMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const resource: NewRelicMonitorResource = { + accountCreationSource: "LIFTR", + identity: { type: "None", userAssignedIdentities: { key8903: {} } }, + liftrResourceCategory: "Unknown", + location: "k", + marketplaceSubscriptionStatus: "Active", + monitoringStatus: "Enabled", + newRelicAccountProperties: { + accountInfo: { + accountId: "xhqmg", + ingestionKey: "wltnimmhqt", + region: "ljcf" + }, + organizationInfo: { organizationId: "k" }, + singleSignOnProperties: { + enterpriseAppId: "kwiwfz", + provisioningState: "Accepted", + singleSignOnState: "Initial", + singleSignOnUrl: "kvseueuljsxmfwpqctz" + }, + userId: "vcscxlncofcuduadesd" + }, + orgCreationSource: "LIFTR", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG" + }, + provisioningState: "Accepted", + tags: { key6976: "oaxfhf" }, + userInfo: { + country: "hslqnwdanrconqyekwbnttaetv", + emailAddress: "%6%@4-g.N1.3F-kI1.Ue-.lJso", + firstName: "vdftzcggirefejajwahhwhyibutramdaotvnuf", + lastName: "bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc", + phoneNumber: "krf" + } + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + resource + ); + console.log(result); +} + +async function main() { + monitorsCreateOrUpdateMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsDeleteSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsDeleteSample.ts new file mode 100644 index 000000000000..283370cf6294 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsDeleteSample.ts @@ -0,0 +1,68 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a NewRelicMonitorResource + * + * @summary Delete a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json + */ +async function monitorsDeleteMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + userEmail, + monitorName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Delete a NewRelicMonitorResource + * + * @summary Delete a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MinimumSet_Gen.json + */ +async function monitorsDeleteMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + userEmail, + monitorName + ); + console.log(result); +} + +async function main() { + monitorsDeleteMaximumSetGen(); + monitorsDeleteMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetMetricRulesSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetMetricRulesSample.ts new file mode 100644 index 000000000000..8e5d136c836d --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetMetricRulesSample.ts @@ -0,0 +1,71 @@ +/* + * 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 { + MetricsRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get metric rules + * + * @summary Get metric rules + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json + */ +async function monitorsGetMetricRulesMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: MetricsRequest = { userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricRules( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get metric rules + * + * @summary Get metric rules + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MinimumSet_Gen.json + */ +async function monitorsGetMetricRulesMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: MetricsRequest = { userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricRules( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +async function main() { + monitorsGetMetricRulesMaximumSetGen(); + monitorsGetMetricRulesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetMetricStatusSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetMetricStatusSample.ts new file mode 100644 index 000000000000..b2fca29948a8 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetMetricStatusSample.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MetricsStatusRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get metric status + * + * @summary Get metric status + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json + */ +async function monitorsGetMetricStatusMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: MetricsStatusRequest = { + azureResourceIds: ["enfghpfw"], + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricStatus( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get metric status + * + * @summary Get metric status + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MinimumSet_Gen.json + */ +async function monitorsGetMetricStatusMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: MetricsStatusRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricStatus( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +async function main() { + monitorsGetMetricStatusMaximumSetGen(); + monitorsGetMetricStatusMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetSample.ts new file mode 100644 index 000000000000..68241b5669fb --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a NewRelicMonitorResource + * + * @summary Get a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json + */ +async function monitorsGetMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.get(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + monitorsGetMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListAppServicesSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListAppServicesSample.ts new file mode 100644 index 000000000000..411b40954e7f --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListAppServicesSample.ts @@ -0,0 +1,82 @@ +/* + * 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 { + AppServicesGetRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the app service resources currently being monitored by the NewRelic resource. + * + * @summary List the app service resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json + */ +async function monitorsListAppServicesMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: AppServicesGetRequest = { + azureResourceIds: ["pvzrksrmzowobuhxpwiotnpcvjbu"], + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listAppServices( + resourceGroupName, + monitorName, + request + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the app service resources currently being monitored by the NewRelic resource. + * + * @summary List the app service resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MinimumSet_Gen.json + */ +async function monitorsListAppServicesMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: AppServicesGetRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listAppServices( + resourceGroupName, + monitorName, + request + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListAppServicesMaximumSetGen(); + monitorsListAppServicesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListByResourceGroupSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListByResourceGroupSample.ts new file mode 100644 index 000000000000..e5032038b0cd --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List NewRelicMonitorResource resources by resource group + * + * @summary List NewRelicMonitorResource resources by resource group + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json + */ +async function monitorsListByResourceGroupMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListByResourceGroupMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListBySubscriptionSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListBySubscriptionSample.ts new file mode 100644 index 000000000000..c3c26e0d8239 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List NewRelicMonitorResource resources by subscription ID + * + * @summary List NewRelicMonitorResource resources by subscription ID + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json + */ +async function monitorsListBySubscriptionMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListBySubscriptionMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListHostsSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListHostsSample.ts new file mode 100644 index 000000000000..0b90e9833558 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListHostsSample.ts @@ -0,0 +1,83 @@ +/* + * 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 { + HostsGetRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the compute vm resources currently being monitored by the NewRelic resource. + * + * @summary List the compute vm resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json + */ +async function monitorsListHostsMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const request: HostsGetRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + vmIds: ["xzphvxvfmvjrnsgyns"] + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts( + resourceGroupName, + monitorName, + request + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the compute vm resources currently being monitored by the NewRelic resource. + * + * @summary List the compute vm resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MinimumSet_Gen.json + */ +async function monitorsListHostsMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const request: HostsGetRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + vmIds: ["xzphvxvfmvjrnsgyns"] + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts( + resourceGroupName, + monitorName, + request + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListHostsMaximumSetGen(); + monitorsListHostsMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListMonitoredResourcesSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListMonitoredResourcesSample.ts new file mode 100644 index 000000000000..eca9e7191e0a --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsListMonitoredResourcesSample.ts @@ -0,0 +1,70 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the resources currently being monitored by the NewRelic monitor resource. + * + * @summary List the resources currently being monitored by the NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json + */ +async function monitorsListMonitoredResourcesMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the resources currently being monitored by the NewRelic monitor resource. + * + * @summary List the resources currently being monitored by the NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MinimumSet_Gen.json + */ +async function monitorsListMonitoredResourcesMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListMonitoredResourcesMaximumSetGen(); + monitorsListMonitoredResourcesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsSwitchBillingSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsSwitchBillingSample.ts new file mode 100644 index 000000000000..15b772d305aa --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsSwitchBillingSample.ts @@ -0,0 +1,83 @@ +/* + * 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 { + SwitchBillingRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Switches the billing for NewRelic monitor resource. + * + * @summary Switches the billing for NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json + */ +async function monitorsSwitchBillingMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: SwitchBillingRequest = { + azureResourceId: "enfghpfw", + organizationId: "k", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG" + }, + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.switchBilling( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +/** + * This sample demonstrates how to Switches the billing for NewRelic monitor resource. + * + * @summary Switches the billing for NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MinimumSet_Gen.json + */ +async function monitorsSwitchBillingMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: SwitchBillingRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.switchBilling( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +async function main() { + monitorsSwitchBillingMaximumSetGen(); + monitorsSwitchBillingMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsUpdateSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsUpdateSample.ts new file mode 100644 index 000000000000..7f7938b2f50f --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsUpdateSample.ts @@ -0,0 +1,80 @@ +/* + * 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 { + NewRelicMonitorResourceUpdate, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update a NewRelicMonitorResource + * + * @summary Update a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json + */ +async function monitorsUpdateMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const properties: NewRelicMonitorResourceUpdate = { + accountCreationSource: "LIFTR", + identity: { type: "None", userAssignedIdentities: { key8903: {} } }, + newRelicAccountProperties: { + accountInfo: { + accountId: "xhqmg", + ingestionKey: "wltnimmhqt", + region: "ljcf" + }, + organizationInfo: { organizationId: "k" }, + singleSignOnProperties: { + enterpriseAppId: "kwiwfz", + provisioningState: "Accepted", + singleSignOnState: "Initial", + singleSignOnUrl: "kvseueuljsxmfwpqctz" + }, + userId: "vcscxlncofcuduadesd" + }, + orgCreationSource: "LIFTR", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG" + }, + tags: { key164: "jqakdrrmmyzytqu" }, + userInfo: { + country: "hslqnwdanrconqyekwbnttaetv", + emailAddress: "%6%@4-g.N1.3F-kI1.Ue-.lJso", + firstName: "vdftzcggirefejajwahhwhyibutramdaotvnuf", + lastName: "bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc", + phoneNumber: "krf" + } + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.update( + resourceGroupName, + monitorName, + properties + ); + console.log(result); +} + +async function main() { + monitorsUpdateMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsVMHostPayloadSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsVMHostPayloadSample.ts new file mode 100644 index 000000000000..7b89f18d1e36 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/monitorsVMHostPayloadSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @summary Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json + */ +async function monitorsVMHostPayloadMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.vmHostPayload( + resourceGroupName, + monitorName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @summary Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MinimumSet_Gen.json + */ +async function monitorsVMHostPayloadMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.vmHostPayload( + resourceGroupName, + monitorName + ); + console.log(result); +} + +async function main() { + monitorsVMHostPayloadMaximumSetGen(); + monitorsVMHostPayloadMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/operationsListSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..7f1e5314d7a0 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/operationsListSample.ts @@ -0,0 +1,60 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json + */ +async function operationsListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MinimumSet_Gen.json + */ +async function operationsListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + operationsListMaximumSetGen(); + operationsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/organizationsListSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/organizationsListSample.ts new file mode 100644 index 000000000000..1ba01c2ab7e9 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/organizationsListSample.ts @@ -0,0 +1,62 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all the existing organizations + * + * @summary List all the existing organizations + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json + */ +async function organizationsListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.organizations.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List all the existing organizations + * + * @summary List all the existing organizations + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MinimumSet_Gen.json + */ +async function organizationsListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.organizations.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + organizationsListMaximumSetGen(); + organizationsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/plansListSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/plansListSample.ts new file mode 100644 index 000000000000..20546217c608 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/plansListSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { + PlansListOptionalParams, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List plans data + * + * @summary List plans data + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json + */ +async function plansListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const accountId = "pwuxgvrmkk"; + const organizationId = "hilawwjz"; + const options: PlansListOptionalParams = { accountId, organizationId }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.plans.list(options)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List plans data + * + * @summary List plans data + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MinimumSet_Gen.json + */ +async function plansListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.plans.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + plansListMaximumSetGen(); + plansListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesCreateOrUpdateSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..d6b7502a2589 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesCreateOrUpdateSample.ts @@ -0,0 +1,99 @@ +/* + * 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 { + TagRule, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create a TagRule + * + * @summary Create a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json + */ +async function tagRulesCreateOrUpdateMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const resource: TagRule = { + logRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb" + } + ], + sendAadLogs: "Enabled", + sendActivityLogs: "Enabled", + sendSubscriptionLogs: "Enabled" + }, + metricRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb" + } + ], + userEmail: "test@testing.com" + }, + provisioningState: "Accepted" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + ruleSetName, + resource + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create a TagRule + * + * @summary Create a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MinimumSet_Gen.json + */ +async function tagRulesCreateOrUpdateMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const resource: TagRule = {}; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + ruleSetName, + resource + ); + console.log(result); +} + +async function main() { + tagRulesCreateOrUpdateMaximumSetGen(); + tagRulesCreateOrUpdateMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesDeleteSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesDeleteSample.ts new file mode 100644 index 000000000000..dae01463241d --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesDeleteSample.ts @@ -0,0 +1,68 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a TagRule + * + * @summary Delete a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json + */ +async function tagRulesDeleteMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginDeleteAndWait( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Delete a TagRule + * + * @summary Delete a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MinimumSet_Gen.json + */ +async function tagRulesDeleteMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginDeleteAndWait( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +async function main() { + tagRulesDeleteMaximumSetGen(); + tagRulesDeleteMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesGetSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesGetSample.ts new file mode 100644 index 000000000000..1b12978e2757 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesGetSample.ts @@ -0,0 +1,68 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a TagRule + * + * @summary Get a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json + */ +async function tagRulesGetMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.get( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get a TagRule + * + * @summary Get a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MinimumSet_Gen.json + */ +async function tagRulesGetMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.get( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +async function main() { + tagRulesGetMaximumSetGen(); + tagRulesGetMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesListByNewRelicMonitorResourceSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesListByNewRelicMonitorResourceSample.ts new file mode 100644 index 000000000000..4db5c4e70e0d --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesListByNewRelicMonitorResourceSample.ts @@ -0,0 +1,70 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List TagRule resources by NewRelicMonitorResource + * + * @summary List TagRule resources by NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json + */ +async function tagRulesListByNewRelicMonitorResourceMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.listByNewRelicMonitorResource( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List TagRule resources by NewRelicMonitorResource + * + * @summary List TagRule resources by NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen.json + */ +async function tagRulesListByNewRelicMonitorResourceMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.listByNewRelicMonitorResource( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + tagRulesListByNewRelicMonitorResourceMaximumSetGen(); + tagRulesListByNewRelicMonitorResourceMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesUpdateSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesUpdateSample.ts new file mode 100644 index 000000000000..4b652335c660 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples-dev/tagRulesUpdateSample.ts @@ -0,0 +1,98 @@ +/* + * 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 { + TagRuleUpdate, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update a TagRule + * + * @summary Update a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json + */ +async function tagRulesUpdateMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const properties: TagRuleUpdate = { + logRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb" + } + ], + sendAadLogs: "Enabled", + sendActivityLogs: "Enabled", + sendSubscriptionLogs: "Enabled" + }, + metricRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb" + } + ], + userEmail: "test@testing.com" + } + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.update( + resourceGroupName, + monitorName, + ruleSetName, + properties + ); + console.log(result); +} + +/** + * This sample demonstrates how to Update a TagRule + * + * @summary Update a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MinimumSet_Gen.json + */ +async function tagRulesUpdateMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const properties: TagRuleUpdate = {}; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.update( + resourceGroupName, + monitorName, + ruleSetName, + properties + ); + console.log(result); +} + +async function main() { + tagRulesUpdateMaximumSetGen(); + tagRulesUpdateMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/README.md b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..9294586009e2 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/README.md @@ -0,0 +1,92 @@ +# client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [accountsListSample.js][accountslistsample] | List all the existing accounts x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json | +| [monitorsCreateOrUpdateSample.js][monitorscreateorupdatesample] | Create a NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json | +| [monitorsDeleteSample.js][monitorsdeletesample] | Delete a NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json | +| [monitorsGetMetricRulesSample.js][monitorsgetmetricrulessample] | Get metric rules x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json | +| [monitorsGetMetricStatusSample.js][monitorsgetmetricstatussample] | Get metric status x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json | +| [monitorsGetSample.js][monitorsgetsample] | Get a NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json | +| [monitorsListAppServicesSample.js][monitorslistappservicessample] | List the app service resources currently being monitored by the NewRelic resource. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json | +| [monitorsListByResourceGroupSample.js][monitorslistbyresourcegroupsample] | List NewRelicMonitorResource resources by resource group x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json | +| [monitorsListBySubscriptionSample.js][monitorslistbysubscriptionsample] | List NewRelicMonitorResource resources by subscription ID x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json | +| [monitorsListHostsSample.js][monitorslisthostssample] | List the compute vm resources currently being monitored by the NewRelic resource. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json | +| [monitorsListMonitoredResourcesSample.js][monitorslistmonitoredresourcessample] | List the resources currently being monitored by the NewRelic monitor resource. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json | +| [monitorsSwitchBillingSample.js][monitorsswitchbillingsample] | Switches the billing for NewRelic monitor resource. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json | +| [monitorsUpdateSample.js][monitorsupdatesample] | Update a NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json | +| [monitorsVMHostPayloadSample.js][monitorsvmhostpayloadsample] | Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json | +| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json | +| [organizationsListSample.js][organizationslistsample] | List all the existing organizations x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json | +| [plansListSample.js][planslistsample] | List plans data x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json | +| [tagRulesCreateOrUpdateSample.js][tagrulescreateorupdatesample] | Create a TagRule x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json | +| [tagRulesDeleteSample.js][tagrulesdeletesample] | Delete a TagRule x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json | +| [tagRulesGetSample.js][tagrulesgetsample] | Get a TagRule x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json | +| [tagRulesListByNewRelicMonitorResourceSample.js][tagruleslistbynewrelicmonitorresourcesample] | List TagRule resources by NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json | +| [tagRulesUpdateSample.js][tagrulesupdatesample] | Update a TagRule x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node accountsListSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env NEWRELICOBSERVABILITY_SUBSCRIPTION_ID="" NEWRELICOBSERVABILITY_SUBSCRIPTION_ID="" node accountsListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accountslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/accountsListSample.js +[monitorscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsCreateOrUpdateSample.js +[monitorsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsDeleteSample.js +[monitorsgetmetricrulessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricRulesSample.js +[monitorsgetmetricstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricStatusSample.js +[monitorsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetSample.js +[monitorslistappservicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListAppServicesSample.js +[monitorslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListByResourceGroupSample.js +[monitorslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListBySubscriptionSample.js +[monitorslisthostssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListHostsSample.js +[monitorslistmonitoredresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListMonitoredResourcesSample.js +[monitorsswitchbillingsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsSwitchBillingSample.js +[monitorsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsUpdateSample.js +[monitorsvmhostpayloadsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsVMHostPayloadSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/operationsListSample.js +[organizationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/organizationsListSample.js +[planslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/plansListSample.js +[tagrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesCreateOrUpdateSample.js +[tagrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesDeleteSample.js +[tagrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesGetSample.js +[tagruleslistbynewrelicmonitorresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesListByNewRelicMonitorResourceSample.js +[tagrulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-newrelicobservability?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/newrelicobservability/arm-newrelicobservability/README.md diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/accountsListSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/accountsListSample.js new file mode 100644 index 000000000000..790fc05e5f47 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/accountsListSample.js @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all the existing accounts + * + * @summary List all the existing accounts + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json + */ +async function accountsListMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accounts.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List all the existing accounts + * + * @summary List all the existing accounts + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MinimumSet_Gen.json + */ +async function accountsListMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accounts.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + accountsListMaximumSetGen(); + accountsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsCreateOrUpdateSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsCreateOrUpdateSample.js new file mode 100644 index 000000000000..8db8d335484b --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsCreateOrUpdateSample.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create a NewRelicMonitorResource + * + * @summary Create a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json + */ +async function monitorsCreateOrUpdateMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const resource = { + accountCreationSource: "LIFTR", + identity: { type: "None", userAssignedIdentities: { key8903: {} } }, + liftrResourceCategory: "Unknown", + location: "k", + marketplaceSubscriptionStatus: "Active", + monitoringStatus: "Enabled", + newRelicAccountProperties: { + accountInfo: { + accountId: "xhqmg", + ingestionKey: "wltnimmhqt", + region: "ljcf", + }, + organizationInfo: { organizationId: "k" }, + singleSignOnProperties: { + enterpriseAppId: "kwiwfz", + provisioningState: "Accepted", + singleSignOnState: "Initial", + singleSignOnUrl: "kvseueuljsxmfwpqctz", + }, + userId: "vcscxlncofcuduadesd", + }, + orgCreationSource: "LIFTR", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG", + }, + provisioningState: "Accepted", + tags: { key6976: "oaxfhf" }, + userInfo: { + country: "hslqnwdanrconqyekwbnttaetv", + emailAddress: "%6%@4-g.N1.3F-kI1.Ue-.lJso", + firstName: "vdftzcggirefejajwahhwhyibutramdaotvnuf", + lastName: "bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc", + phoneNumber: "krf", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + resource + ); + console.log(result); +} + +async function main() { + monitorsCreateOrUpdateMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsDeleteSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsDeleteSample.js new file mode 100644 index 000000000000..bc3b8bbcd1f6 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsDeleteSample.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a NewRelicMonitorResource + * + * @summary Delete a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json + */ +async function monitorsDeleteMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + userEmail, + monitorName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Delete a NewRelicMonitorResource + * + * @summary Delete a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MinimumSet_Gen.json + */ +async function monitorsDeleteMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + userEmail, + monitorName + ); + console.log(result); +} + +async function main() { + monitorsDeleteMaximumSetGen(); + monitorsDeleteMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricRulesSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricRulesSample.js new file mode 100644 index 000000000000..ba08fa815df3 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricRulesSample.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get metric rules + * + * @summary Get metric rules + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json + */ +async function monitorsGetMetricRulesMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request = { userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricRules(resourceGroupName, monitorName, request); + console.log(result); +} + +/** + * This sample demonstrates how to Get metric rules + * + * @summary Get metric rules + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MinimumSet_Gen.json + */ +async function monitorsGetMetricRulesMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request = { userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricRules(resourceGroupName, monitorName, request); + console.log(result); +} + +async function main() { + monitorsGetMetricRulesMaximumSetGen(); + monitorsGetMetricRulesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricStatusSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricStatusSample.js new file mode 100644 index 000000000000..866a6487646c --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetMetricStatusSample.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get metric status + * + * @summary Get metric status + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json + */ +async function monitorsGetMetricStatusMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request = { + azureResourceIds: ["enfghpfw"], + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricStatus(resourceGroupName, monitorName, request); + console.log(result); +} + +/** + * This sample demonstrates how to Get metric status + * + * @summary Get metric status + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MinimumSet_Gen.json + */ +async function monitorsGetMetricStatusMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricStatus(resourceGroupName, monitorName, request); + console.log(result); +} + +async function main() { + monitorsGetMetricStatusMaximumSetGen(); + monitorsGetMetricStatusMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetSample.js new file mode 100644 index 000000000000..7af222ee06f8 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a NewRelicMonitorResource + * + * @summary Get a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json + */ +async function monitorsGetMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.get(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + monitorsGetMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListAppServicesSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListAppServicesSample.js new file mode 100644 index 000000000000..d48ae57ebd64 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListAppServicesSample.js @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List the app service resources currently being monitored by the NewRelic resource. + * + * @summary List the app service resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json + */ +async function monitorsListAppServicesMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request = { + azureResourceIds: ["pvzrksrmzowobuhxpwiotnpcvjbu"], + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listAppServices(resourceGroupName, monitorName, request)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the app service resources currently being monitored by the NewRelic resource. + * + * @summary List the app service resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MinimumSet_Gen.json + */ +async function monitorsListAppServicesMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listAppServices(resourceGroupName, monitorName, request)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListAppServicesMaximumSetGen(); + monitorsListAppServicesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListByResourceGroupSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListByResourceGroupSample.js new file mode 100644 index 000000000000..5241a49cb093 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListByResourceGroupSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List NewRelicMonitorResource resources by resource group + * + * @summary List NewRelicMonitorResource resources by resource group + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json + */ +async function monitorsListByResourceGroupMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListByResourceGroupMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListBySubscriptionSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListBySubscriptionSample.js new file mode 100644 index 000000000000..bae3b772f448 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListBySubscriptionSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List NewRelicMonitorResource resources by subscription ID + * + * @summary List NewRelicMonitorResource resources by subscription ID + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json + */ +async function monitorsListBySubscriptionMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListBySubscriptionMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListHostsSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListHostsSample.js new file mode 100644 index 000000000000..79c0b32e7a4b --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListHostsSample.js @@ -0,0 +1,66 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List the compute vm resources currently being monitored by the NewRelic resource. + * + * @summary List the compute vm resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json + */ +async function monitorsListHostsMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const request = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + vmIds: ["xzphvxvfmvjrnsgyns"], + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts(resourceGroupName, monitorName, request)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the compute vm resources currently being monitored by the NewRelic resource. + * + * @summary List the compute vm resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MinimumSet_Gen.json + */ +async function monitorsListHostsMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const request = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + vmIds: ["xzphvxvfmvjrnsgyns"], + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts(resourceGroupName, monitorName, request)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListHostsMaximumSetGen(); + monitorsListHostsMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListMonitoredResourcesSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListMonitoredResourcesSample.js new file mode 100644 index 000000000000..be3459d3e7de --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsListMonitoredResourcesSample.js @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List the resources currently being monitored by the NewRelic monitor resource. + * + * @summary List the resources currently being monitored by the NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json + */ +async function monitorsListMonitoredResourcesMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the resources currently being monitored by the NewRelic monitor resource. + * + * @summary List the resources currently being monitored by the NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MinimumSet_Gen.json + */ +async function monitorsListMonitoredResourcesMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources(resourceGroupName, monitorName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListMonitoredResourcesMaximumSetGen(); + monitorsListMonitoredResourcesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsSwitchBillingSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsSwitchBillingSample.js new file mode 100644 index 000000000000..9ee83b8b1989 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsSwitchBillingSample.js @@ -0,0 +1,66 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Switches the billing for NewRelic monitor resource. + * + * @summary Switches the billing for NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json + */ +async function monitorsSwitchBillingMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request = { + azureResourceId: "enfghpfw", + organizationId: "k", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG", + }, + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.switchBilling(resourceGroupName, monitorName, request); + console.log(result); +} + +/** + * This sample demonstrates how to Switches the billing for NewRelic monitor resource. + * + * @summary Switches the billing for NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MinimumSet_Gen.json + */ +async function monitorsSwitchBillingMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.switchBilling(resourceGroupName, monitorName, request); + console.log(result); +} + +async function main() { + monitorsSwitchBillingMaximumSetGen(); + monitorsSwitchBillingMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsUpdateSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsUpdateSample.js new file mode 100644 index 000000000000..e13e966afdb0 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsUpdateSample.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Update a NewRelicMonitorResource + * + * @summary Update a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json + */ +async function monitorsUpdateMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const properties = { + accountCreationSource: "LIFTR", + identity: { type: "None", userAssignedIdentities: { key8903: {} } }, + newRelicAccountProperties: { + accountInfo: { + accountId: "xhqmg", + ingestionKey: "wltnimmhqt", + region: "ljcf", + }, + organizationInfo: { organizationId: "k" }, + singleSignOnProperties: { + enterpriseAppId: "kwiwfz", + provisioningState: "Accepted", + singleSignOnState: "Initial", + singleSignOnUrl: "kvseueuljsxmfwpqctz", + }, + userId: "vcscxlncofcuduadesd", + }, + orgCreationSource: "LIFTR", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG", + }, + tags: { key164: "jqakdrrmmyzytqu" }, + userInfo: { + country: "hslqnwdanrconqyekwbnttaetv", + emailAddress: "%6%@4-g.N1.3F-kI1.Ue-.lJso", + firstName: "vdftzcggirefejajwahhwhyibutramdaotvnuf", + lastName: "bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc", + phoneNumber: "krf", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.update(resourceGroupName, monitorName, properties); + console.log(result); +} + +async function main() { + monitorsUpdateMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsVMHostPayloadSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsVMHostPayloadSample.js new file mode 100644 index 000000000000..bb3be5d00b88 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/monitorsVMHostPayloadSample.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @summary Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json + */ +async function monitorsVMHostPayloadMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.vmHostPayload(resourceGroupName, monitorName); + console.log(result); +} + +/** + * This sample demonstrates how to Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @summary Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MinimumSet_Gen.json + */ +async function monitorsVMHostPayloadMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.vmHostPayload(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + monitorsVMHostPayloadMaximumSetGen(); + monitorsVMHostPayloadMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/operationsListSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..343cee7ee5db --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/operationsListSample.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json + */ +async function operationsListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MinimumSet_Gen.json + */ +async function operationsListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + operationsListMaximumSetGen(); + operationsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/organizationsListSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/organizationsListSample.js new file mode 100644 index 000000000000..533644a9e1fc --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/organizationsListSample.js @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all the existing organizations + * + * @summary List all the existing organizations + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json + */ +async function organizationsListMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.organizations.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List all the existing organizations + * + * @summary List all the existing organizations + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MinimumSet_Gen.json + */ +async function organizationsListMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.organizations.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + organizationsListMaximumSetGen(); + organizationsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/package.json b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..27f8e9feb722 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-newrelicobservability-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/newrelicobservability/arm-newrelicobservability" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/newrelicobservability/arm-newrelicobservability", + "dependencies": { + "@azure/arm-newrelicobservability": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/plansListSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/plansListSample.js new file mode 100644 index 000000000000..8d6d0073331f --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/plansListSample.js @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List plans data + * + * @summary List plans data + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json + */ +async function plansListMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const accountId = "pwuxgvrmkk"; + const organizationId = "hilawwjz"; + const options = { accountId, organizationId }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.plans.list(options)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List plans data + * + * @summary List plans data + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MinimumSet_Gen.json + */ +async function plansListMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.plans.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + plansListMaximumSetGen(); + plansListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/sample.env b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/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/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesCreateOrUpdateSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..d58c40207978 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesCreateOrUpdateSample.js @@ -0,0 +1,90 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create a TagRule + * + * @summary Create a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json + */ +async function tagRulesCreateOrUpdateMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const resource = { + logRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb", + }, + ], + sendAadLogs: "Enabled", + sendActivityLogs: "Enabled", + sendSubscriptionLogs: "Enabled", + }, + metricRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb", + }, + ], + userEmail: "test@testing.com", + }, + provisioningState: "Accepted", + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + ruleSetName, + resource + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create a TagRule + * + * @summary Create a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MinimumSet_Gen.json + */ +async function tagRulesCreateOrUpdateMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const resource = {}; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + ruleSetName, + resource + ); + console.log(result); +} + +async function main() { + tagRulesCreateOrUpdateMaximumSetGen(); + tagRulesCreateOrUpdateMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesDeleteSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesDeleteSample.js new file mode 100644 index 000000000000..9379b7ad906c --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesDeleteSample.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a TagRule + * + * @summary Delete a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json + */ +async function tagRulesDeleteMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginDeleteAndWait( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Delete a TagRule + * + * @summary Delete a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MinimumSet_Gen.json + */ +async function tagRulesDeleteMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginDeleteAndWait( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +async function main() { + tagRulesDeleteMaximumSetGen(); + tagRulesDeleteMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesGetSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesGetSample.js new file mode 100644 index 000000000000..9074b79fa1b6 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesGetSample.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a TagRule + * + * @summary Get a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json + */ +async function tagRulesGetMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.get(resourceGroupName, monitorName, ruleSetName); + console.log(result); +} + +/** + * This sample demonstrates how to Get a TagRule + * + * @summary Get a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MinimumSet_Gen.json + */ +async function tagRulesGetMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.get(resourceGroupName, monitorName, ruleSetName); + console.log(result); +} + +async function main() { + tagRulesGetMaximumSetGen(); + tagRulesGetMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesListByNewRelicMonitorResourceSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesListByNewRelicMonitorResourceSample.js new file mode 100644 index 000000000000..8173873c7c11 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesListByNewRelicMonitorResourceSample.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List TagRule resources by NewRelicMonitorResource + * + * @summary List TagRule resources by NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json + */ +async function tagRulesListByNewRelicMonitorResourceMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.listByNewRelicMonitorResource( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List TagRule resources by NewRelicMonitorResource + * + * @summary List TagRule resources by NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen.json + */ +async function tagRulesListByNewRelicMonitorResourceMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.listByNewRelicMonitorResource( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + tagRulesListByNewRelicMonitorResourceMaximumSetGen(); + tagRulesListByNewRelicMonitorResourceMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesUpdateSample.js b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesUpdateSample.js new file mode 100644 index 000000000000..4b96ada87f67 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/javascript/tagRulesUpdateSample.js @@ -0,0 +1,89 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { NewRelicObservability } = require("@azure/arm-newrelicobservability"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Update a TagRule + * + * @summary Update a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json + */ +async function tagRulesUpdateMaximumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const properties = { + logRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb", + }, + ], + sendAadLogs: "Enabled", + sendActivityLogs: "Enabled", + sendSubscriptionLogs: "Enabled", + }, + metricRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb", + }, + ], + userEmail: "test@testing.com", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.update( + resourceGroupName, + monitorName, + ruleSetName, + properties + ); + console.log(result); +} + +/** + * This sample demonstrates how to Update a TagRule + * + * @summary Update a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MinimumSet_Gen.json + */ +async function tagRulesUpdateMinimumSetGen() { + const subscriptionId = process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const properties = {}; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.update( + resourceGroupName, + monitorName, + ruleSetName, + properties + ); + console.log(result); +} + +async function main() { + tagRulesUpdateMaximumSetGen(); + tagRulesUpdateMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/README.md b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..d24f1775abb3 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/README.md @@ -0,0 +1,105 @@ +# client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [accountsListSample.ts][accountslistsample] | List all the existing accounts x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json | +| [monitorsCreateOrUpdateSample.ts][monitorscreateorupdatesample] | Create a NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json | +| [monitorsDeleteSample.ts][monitorsdeletesample] | Delete a NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json | +| [monitorsGetMetricRulesSample.ts][monitorsgetmetricrulessample] | Get metric rules x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json | +| [monitorsGetMetricStatusSample.ts][monitorsgetmetricstatussample] | Get metric status x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json | +| [monitorsGetSample.ts][monitorsgetsample] | Get a NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json | +| [monitorsListAppServicesSample.ts][monitorslistappservicessample] | List the app service resources currently being monitored by the NewRelic resource. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json | +| [monitorsListByResourceGroupSample.ts][monitorslistbyresourcegroupsample] | List NewRelicMonitorResource resources by resource group x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json | +| [monitorsListBySubscriptionSample.ts][monitorslistbysubscriptionsample] | List NewRelicMonitorResource resources by subscription ID x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json | +| [monitorsListHostsSample.ts][monitorslisthostssample] | List the compute vm resources currently being monitored by the NewRelic resource. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json | +| [monitorsListMonitoredResourcesSample.ts][monitorslistmonitoredresourcessample] | List the resources currently being monitored by the NewRelic monitor resource. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json | +| [monitorsSwitchBillingSample.ts][monitorsswitchbillingsample] | Switches the billing for NewRelic monitor resource. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json | +| [monitorsUpdateSample.ts][monitorsupdatesample] | Update a NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json | +| [monitorsVMHostPayloadSample.ts][monitorsvmhostpayloadsample] | Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json | +| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json | +| [organizationsListSample.ts][organizationslistsample] | List all the existing organizations x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json | +| [plansListSample.ts][planslistsample] | List plans data x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json | +| [tagRulesCreateOrUpdateSample.ts][tagrulescreateorupdatesample] | Create a TagRule x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json | +| [tagRulesDeleteSample.ts][tagrulesdeletesample] | Delete a TagRule x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json | +| [tagRulesGetSample.ts][tagrulesgetsample] | Get a TagRule x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json | +| [tagRulesListByNewRelicMonitorResourceSample.ts][tagruleslistbynewrelicmonitorresourcesample] | List TagRule resources by NewRelicMonitorResource x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json | +| [tagRulesUpdateSample.ts][tagrulesupdatesample] | Update a TagRule x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/accountsListSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env NEWRELICOBSERVABILITY_SUBSCRIPTION_ID="" NEWRELICOBSERVABILITY_SUBSCRIPTION_ID="" node dist/accountsListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accountslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/accountsListSample.ts +[monitorscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsCreateOrUpdateSample.ts +[monitorsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsDeleteSample.ts +[monitorsgetmetricrulessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricRulesSample.ts +[monitorsgetmetricstatussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricStatusSample.ts +[monitorsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetSample.ts +[monitorslistappservicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListAppServicesSample.ts +[monitorslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListByResourceGroupSample.ts +[monitorslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListBySubscriptionSample.ts +[monitorslisthostssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListHostsSample.ts +[monitorslistmonitoredresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListMonitoredResourcesSample.ts +[monitorsswitchbillingsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsSwitchBillingSample.ts +[monitorsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsUpdateSample.ts +[monitorsvmhostpayloadsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsVMHostPayloadSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/operationsListSample.ts +[organizationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/organizationsListSample.ts +[planslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/plansListSample.ts +[tagrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesCreateOrUpdateSample.ts +[tagrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesDeleteSample.ts +[tagrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesGetSample.ts +[tagruleslistbynewrelicmonitorresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesListByNewRelicMonitorResourceSample.ts +[tagrulesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-newrelicobservability?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/newrelicobservability/arm-newrelicobservability/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/package.json b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..8d0bbbaca031 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-newrelicobservability-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/newrelicobservability/arm-newrelicobservability" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/newrelicobservability/arm-newrelicobservability", + "dependencies": { + "@azure/arm-newrelicobservability": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~4.8.0", + "rimraf": "latest" + } +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/sample.env b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/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/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/accountsListSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/accountsListSample.ts new file mode 100644 index 000000000000..208ad3ee9cae --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/accountsListSample.ts @@ -0,0 +1,62 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all the existing accounts + * + * @summary List all the existing accounts + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json + */ +async function accountsListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accounts.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List all the existing accounts + * + * @summary List all the existing accounts + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MinimumSet_Gen.json + */ +async function accountsListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accounts.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + accountsListMaximumSetGen(); + accountsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsCreateOrUpdateSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..7cce25718f33 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsCreateOrUpdateSample.ts @@ -0,0 +1,85 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + NewRelicMonitorResource, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create a NewRelicMonitorResource + * + * @summary Create a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json + */ +async function monitorsCreateOrUpdateMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const resource: NewRelicMonitorResource = { + accountCreationSource: "LIFTR", + identity: { type: "None", userAssignedIdentities: { key8903: {} } }, + liftrResourceCategory: "Unknown", + location: "k", + marketplaceSubscriptionStatus: "Active", + monitoringStatus: "Enabled", + newRelicAccountProperties: { + accountInfo: { + accountId: "xhqmg", + ingestionKey: "wltnimmhqt", + region: "ljcf" + }, + organizationInfo: { organizationId: "k" }, + singleSignOnProperties: { + enterpriseAppId: "kwiwfz", + provisioningState: "Accepted", + singleSignOnState: "Initial", + singleSignOnUrl: "kvseueuljsxmfwpqctz" + }, + userId: "vcscxlncofcuduadesd" + }, + orgCreationSource: "LIFTR", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG" + }, + provisioningState: "Accepted", + tags: { key6976: "oaxfhf" }, + userInfo: { + country: "hslqnwdanrconqyekwbnttaetv", + emailAddress: "%6%@4-g.N1.3F-kI1.Ue-.lJso", + firstName: "vdftzcggirefejajwahhwhyibutramdaotvnuf", + lastName: "bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc", + phoneNumber: "krf" + } + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + resource + ); + console.log(result); +} + +async function main() { + monitorsCreateOrUpdateMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsDeleteSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsDeleteSample.ts new file mode 100644 index 000000000000..283370cf6294 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsDeleteSample.ts @@ -0,0 +1,68 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a NewRelicMonitorResource + * + * @summary Delete a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json + */ +async function monitorsDeleteMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + userEmail, + monitorName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Delete a NewRelicMonitorResource + * + * @summary Delete a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MinimumSet_Gen.json + */ +async function monitorsDeleteMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.beginDeleteAndWait( + resourceGroupName, + userEmail, + monitorName + ); + console.log(result); +} + +async function main() { + monitorsDeleteMaximumSetGen(); + monitorsDeleteMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricRulesSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricRulesSample.ts new file mode 100644 index 000000000000..8e5d136c836d --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricRulesSample.ts @@ -0,0 +1,71 @@ +/* + * 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 { + MetricsRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get metric rules + * + * @summary Get metric rules + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json + */ +async function monitorsGetMetricRulesMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: MetricsRequest = { userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricRules( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get metric rules + * + * @summary Get metric rules + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MinimumSet_Gen.json + */ +async function monitorsGetMetricRulesMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: MetricsRequest = { userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricRules( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +async function main() { + monitorsGetMetricRulesMaximumSetGen(); + monitorsGetMetricRulesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricStatusSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricStatusSample.ts new file mode 100644 index 000000000000..b2fca29948a8 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetMetricStatusSample.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MetricsStatusRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get metric status + * + * @summary Get metric status + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json + */ +async function monitorsGetMetricStatusMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: MetricsStatusRequest = { + azureResourceIds: ["enfghpfw"], + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricStatus( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get metric status + * + * @summary Get metric status + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MinimumSet_Gen.json + */ +async function monitorsGetMetricStatusMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: MetricsStatusRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.getMetricStatus( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +async function main() { + monitorsGetMetricStatusMaximumSetGen(); + monitorsGetMetricStatusMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetSample.ts new file mode 100644 index 000000000000..68241b5669fb --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a NewRelicMonitorResource + * + * @summary Get a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json + */ +async function monitorsGetMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.get(resourceGroupName, monitorName); + console.log(result); +} + +async function main() { + monitorsGetMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListAppServicesSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListAppServicesSample.ts new file mode 100644 index 000000000000..411b40954e7f --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListAppServicesSample.ts @@ -0,0 +1,82 @@ +/* + * 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 { + AppServicesGetRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the app service resources currently being monitored by the NewRelic resource. + * + * @summary List the app service resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json + */ +async function monitorsListAppServicesMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: AppServicesGetRequest = { + azureResourceIds: ["pvzrksrmzowobuhxpwiotnpcvjbu"], + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listAppServices( + resourceGroupName, + monitorName, + request + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the app service resources currently being monitored by the NewRelic resource. + * + * @summary List the app service resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MinimumSet_Gen.json + */ +async function monitorsListAppServicesMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: AppServicesGetRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listAppServices( + resourceGroupName, + monitorName, + request + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListAppServicesMaximumSetGen(); + monitorsListAppServicesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListByResourceGroupSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListByResourceGroupSample.ts new file mode 100644 index 000000000000..e5032038b0cd --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List NewRelicMonitorResource resources by resource group + * + * @summary List NewRelicMonitorResource resources by resource group + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json + */ +async function monitorsListByResourceGroupMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListByResourceGroupMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListBySubscriptionSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListBySubscriptionSample.ts new file mode 100644 index 000000000000..c3c26e0d8239 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListBySubscriptionSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List NewRelicMonitorResource resources by subscription ID + * + * @summary List NewRelicMonitorResource resources by subscription ID + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json + */ +async function monitorsListBySubscriptionMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListBySubscriptionMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListHostsSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListHostsSample.ts new file mode 100644 index 000000000000..0b90e9833558 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListHostsSample.ts @@ -0,0 +1,83 @@ +/* + * 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 { + HostsGetRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the compute vm resources currently being monitored by the NewRelic resource. + * + * @summary List the compute vm resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json + */ +async function monitorsListHostsMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const request: HostsGetRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + vmIds: ["xzphvxvfmvjrnsgyns"] + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts( + resourceGroupName, + monitorName, + request + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the compute vm resources currently being monitored by the NewRelic resource. + * + * @summary List the compute vm resources currently being monitored by the NewRelic resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MinimumSet_Gen.json + */ +async function monitorsListHostsMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const request: HostsGetRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm", + vmIds: ["xzphvxvfmvjrnsgyns"] + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listHosts( + resourceGroupName, + monitorName, + request + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListHostsMaximumSetGen(); + monitorsListHostsMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListMonitoredResourcesSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListMonitoredResourcesSample.ts new file mode 100644 index 000000000000..eca9e7191e0a --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsListMonitoredResourcesSample.ts @@ -0,0 +1,70 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the resources currently being monitored by the NewRelic monitor resource. + * + * @summary List the resources currently being monitored by the NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json + */ +async function monitorsListMonitoredResourcesMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the resources currently being monitored by the NewRelic monitor resource. + * + * @summary List the resources currently being monitored by the NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MinimumSet_Gen.json + */ +async function monitorsListMonitoredResourcesMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.monitors.listMonitoredResources( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + monitorsListMonitoredResourcesMaximumSetGen(); + monitorsListMonitoredResourcesMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsSwitchBillingSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsSwitchBillingSample.ts new file mode 100644 index 000000000000..15b772d305aa --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsSwitchBillingSample.ts @@ -0,0 +1,83 @@ +/* + * 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 { + SwitchBillingRequest, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Switches the billing for NewRelic monitor resource. + * + * @summary Switches the billing for NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json + */ +async function monitorsSwitchBillingMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: SwitchBillingRequest = { + azureResourceId: "enfghpfw", + organizationId: "k", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG" + }, + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.switchBilling( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +/** + * This sample demonstrates how to Switches the billing for NewRelic monitor resource. + * + * @summary Switches the billing for NewRelic monitor resource. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MinimumSet_Gen.json + */ +async function monitorsSwitchBillingMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "fhcjxnxumkdlgpwanewtkdnyuz"; + const request: SwitchBillingRequest = { + userEmail: "ruxvg@xqkmdhrnoo.hlmbpm" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.switchBilling( + resourceGroupName, + monitorName, + request + ); + console.log(result); +} + +async function main() { + monitorsSwitchBillingMaximumSetGen(); + monitorsSwitchBillingMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsUpdateSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsUpdateSample.ts new file mode 100644 index 000000000000..7f7938b2f50f --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsUpdateSample.ts @@ -0,0 +1,80 @@ +/* + * 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 { + NewRelicMonitorResourceUpdate, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update a NewRelicMonitorResource + * + * @summary Update a NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json + */ +async function monitorsUpdateMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgNewRelic"; + const monitorName = "cdlymktqw"; + const properties: NewRelicMonitorResourceUpdate = { + accountCreationSource: "LIFTR", + identity: { type: "None", userAssignedIdentities: { key8903: {} } }, + newRelicAccountProperties: { + accountInfo: { + accountId: "xhqmg", + ingestionKey: "wltnimmhqt", + region: "ljcf" + }, + organizationInfo: { organizationId: "k" }, + singleSignOnProperties: { + enterpriseAppId: "kwiwfz", + provisioningState: "Accepted", + singleSignOnState: "Initial", + singleSignOnUrl: "kvseueuljsxmfwpqctz" + }, + userId: "vcscxlncofcuduadesd" + }, + orgCreationSource: "LIFTR", + planData: { + billingCycle: "YEARLY", + effectiveDate: new Date("2022-12-05T14:11:37.786Z"), + planDetails: "tbbiaga", + usageType: "PAYG" + }, + tags: { key164: "jqakdrrmmyzytqu" }, + userInfo: { + country: "hslqnwdanrconqyekwbnttaetv", + emailAddress: "%6%@4-g.N1.3F-kI1.Ue-.lJso", + firstName: "vdftzcggirefejajwahhwhyibutramdaotvnuf", + lastName: "bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc", + phoneNumber: "krf" + } + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.update( + resourceGroupName, + monitorName, + properties + ); + console.log(result); +} + +async function main() { + monitorsUpdateMaximumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsVMHostPayloadSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsVMHostPayloadSample.ts new file mode 100644 index 000000000000..7b89f18d1e36 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/monitorsVMHostPayloadSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @summary Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json + */ +async function monitorsVMHostPayloadMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.vmHostPayload( + resourceGroupName, + monitorName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @summary Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MinimumSet_Gen.json + */ +async function monitorsVMHostPayloadMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.monitors.vmHostPayload( + resourceGroupName, + monitorName + ); + console.log(result); +} + +async function main() { + monitorsVMHostPayloadMaximumSetGen(); + monitorsVMHostPayloadMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..7f1e5314d7a0 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,60 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json + */ +async function operationsListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MinimumSet_Gen.json + */ +async function operationsListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + operationsListMaximumSetGen(); + operationsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/organizationsListSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/organizationsListSample.ts new file mode 100644 index 000000000000..1ba01c2ab7e9 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/organizationsListSample.ts @@ -0,0 +1,62 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all the existing organizations + * + * @summary List all the existing organizations + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json + */ +async function organizationsListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.organizations.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List all the existing organizations + * + * @summary List all the existing organizations + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MinimumSet_Gen.json + */ +async function organizationsListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const userEmail = "ruxvg@xqkmdhrnoo.hlmbpm"; + const location = "egh"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.organizations.list(userEmail, location)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + organizationsListMaximumSetGen(); + organizationsListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/plansListSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/plansListSample.ts new file mode 100644 index 000000000000..20546217c608 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/plansListSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { + PlansListOptionalParams, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List plans data + * + * @summary List plans data + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json + */ +async function plansListMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "hfmjmpyqgezxkp"; + const accountId = "pwuxgvrmkk"; + const organizationId = "hilawwjz"; + const options: PlansListOptionalParams = { accountId, organizationId }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.plans.list(options)) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List plans data + * + * @summary List plans data + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MinimumSet_Gen.json + */ +async function plansListMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "nqmcgifgaqlf"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.plans.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + plansListMaximumSetGen(); + plansListMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesCreateOrUpdateSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..d6b7502a2589 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesCreateOrUpdateSample.ts @@ -0,0 +1,99 @@ +/* + * 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 { + TagRule, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create a TagRule + * + * @summary Create a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json + */ +async function tagRulesCreateOrUpdateMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const resource: TagRule = { + logRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb" + } + ], + sendAadLogs: "Enabled", + sendActivityLogs: "Enabled", + sendSubscriptionLogs: "Enabled" + }, + metricRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb" + } + ], + userEmail: "test@testing.com" + }, + provisioningState: "Accepted" + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + ruleSetName, + resource + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create a TagRule + * + * @summary Create a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MinimumSet_Gen.json + */ +async function tagRulesCreateOrUpdateMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const resource: TagRule = {}; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginCreateOrUpdateAndWait( + resourceGroupName, + monitorName, + ruleSetName, + resource + ); + console.log(result); +} + +async function main() { + tagRulesCreateOrUpdateMaximumSetGen(); + tagRulesCreateOrUpdateMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesDeleteSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesDeleteSample.ts new file mode 100644 index 000000000000..dae01463241d --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesDeleteSample.ts @@ -0,0 +1,68 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a TagRule + * + * @summary Delete a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json + */ +async function tagRulesDeleteMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginDeleteAndWait( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Delete a TagRule + * + * @summary Delete a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MinimumSet_Gen.json + */ +async function tagRulesDeleteMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.beginDeleteAndWait( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +async function main() { + tagRulesDeleteMaximumSetGen(); + tagRulesDeleteMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesGetSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesGetSample.ts new file mode 100644 index 000000000000..1b12978e2757 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesGetSample.ts @@ -0,0 +1,68 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a TagRule + * + * @summary Get a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json + */ +async function tagRulesGetMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.get( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +/** + * This sample demonstrates how to Get a TagRule + * + * @summary Get a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MinimumSet_Gen.json + */ +async function tagRulesGetMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.get( + resourceGroupName, + monitorName, + ruleSetName + ); + console.log(result); +} + +async function main() { + tagRulesGetMaximumSetGen(); + tagRulesGetMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesListByNewRelicMonitorResourceSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesListByNewRelicMonitorResourceSample.ts new file mode 100644 index 000000000000..4db5c4e70e0d --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesListByNewRelicMonitorResourceSample.ts @@ -0,0 +1,70 @@ +/* + * 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 { NewRelicObservability } from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List TagRule resources by NewRelicMonitorResource + * + * @summary List TagRule resources by NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json + */ +async function tagRulesListByNewRelicMonitorResourceMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.listByNewRelicMonitorResource( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +/** + * This sample demonstrates how to List TagRule resources by NewRelicMonitorResource + * + * @summary List TagRule resources by NewRelicMonitorResource + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen.json + */ +async function tagRulesListByNewRelicMonitorResourceMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tagRules.listByNewRelicMonitorResource( + resourceGroupName, + monitorName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + tagRulesListByNewRelicMonitorResourceMaximumSetGen(); + tagRulesListByNewRelicMonitorResourceMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesUpdateSample.ts b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesUpdateSample.ts new file mode 100644 index 000000000000..4b652335c660 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/src/tagRulesUpdateSample.ts @@ -0,0 +1,98 @@ +/* + * 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 { + TagRuleUpdate, + NewRelicObservability +} from "@azure/arm-newrelicobservability"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update a TagRule + * + * @summary Update a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json + */ +async function tagRulesUpdateMaximumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const properties: TagRuleUpdate = { + logRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb" + } + ], + sendAadLogs: "Enabled", + sendActivityLogs: "Enabled", + sendSubscriptionLogs: "Enabled" + }, + metricRules: { + filteringTags: [ + { + name: "saokgpjvdlorciqbjmjxazpee", + action: "Include", + value: "sarxrqsxouhdjwsrqqicbeirdb" + } + ], + userEmail: "test@testing.com" + } + }; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.update( + resourceGroupName, + monitorName, + ruleSetName, + properties + ); + console.log(result); +} + +/** + * This sample demonstrates how to Update a TagRule + * + * @summary Update a TagRule + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MinimumSet_Gen.json + */ +async function tagRulesUpdateMinimumSetGen() { + const subscriptionId = + process.env["NEWRELICOBSERVABILITY_SUBSCRIPTION_ID"] || "ddqonpqwjr"; + const resourceGroupName = + process.env["NEWRELICOBSERVABILITY_RESOURCE_GROUP"] || "rgopenapi"; + const monitorName = "ipxmlcbonyxtolzejcjshkmlron"; + const ruleSetName = "bxcantgzggsepbhqmedjqyrqeezmfb"; + const properties: TagRuleUpdate = {}; + const credential = new DefaultAzureCredential(); + const client = new NewRelicObservability(credential, subscriptionId); + const result = await client.tagRules.update( + resourceGroupName, + monitorName, + ruleSetName, + properties + ); + console.log(result); +} + +async function main() { + tagRulesUpdateMaximumSetGen(); + tagRulesUpdateMinimumSetGen(); +} + +main().catch(console.error); diff --git a/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/tsconfig.json b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/index.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/index.ts new file mode 100644 index 000000000000..56fd70b7e1b6 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/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 { NewRelicObservability } from "./newRelicObservability"; +export * from "./operationsInterfaces"; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/lroImpl.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/lroImpl.ts new file mode 100644 index 000000000000..dd803cd5e28c --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/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/newrelicobservability/arm-newrelicobservability/src/models/index.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/models/index.ts new file mode 100644 index 000000000000..e6e3b53a3e00 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/models/index.ts @@ -0,0 +1,1302 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** + * List of operations supported by the resource provider + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Operation[]; + /** + * URL to get the next set of operation list results (if there are any). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: Origin; + /** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionType?: ActionType; +} + +/** Localized display information for this particular operation. */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** Response of get all accounts Operation. */ +export interface AccountsListResponse { + /** The AccountResource items on this page */ + value: AccountResource[]; + /** The link to the next page of items */ + nextLink?: 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; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** The response of a NewRelicMonitorResource list operation. */ +export interface NewRelicMonitorResourceListResult { + /** The NewRelicMonitorResource items on this page */ + value: NewRelicMonitorResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Properties of the NewRelic account */ +export interface NewRelicAccountProperties { + /** User id */ + userId?: string; + /** NewRelic Account Information */ + accountInfo?: AccountInfo; + /** NewRelic Organization Information */ + organizationInfo?: OrganizationInfo; + /** date when plan was applied */ + singleSignOnProperties?: NewRelicSingleSignOnProperties; +} + +/** Account Info of the NewRelic account */ +export interface AccountInfo { + /** Account id */ + accountId?: string; + /** + * ingestion key of account + * This value contains a credential. Consider obscuring before showing to users + */ + ingestionKey?: string; + /** NewRelic account region */ + region?: string; +} + +/** Organization Info of the NewRelic account */ +export interface OrganizationInfo { + /** Organization id */ + organizationId?: string; +} + +/** Single sign on Info of the NewRelic account */ +export interface NewRelicSingleSignOnProperties { + /** Single sign-on state */ + singleSignOnState?: SingleSignOnStates; + /** The Id of the Enterprise App used for Single sign-on. */ + enterpriseAppId?: string; + /** The login URL specific to this NewRelic Organization */ + singleSignOnUrl?: string; + /** Provisioning state */ + provisioningState?: ProvisioningState; +} + +/** User Info of NewRelic Monitor resource */ +export interface UserInfo { + /** First name */ + firstName?: string; + /** Last name */ + lastName?: string; + /** User Email */ + emailAddress?: string; + /** Contact phone number */ + phoneNumber?: string; + /** country if user */ + country?: string; +} + +/** Plan data of NewRelic Monitor resource */ +export interface PlanData { + /** Different usage type like PAYG/COMMITTED. this could be enum */ + usageType?: UsageType; + /** Different billing cycles like MONTHLY/WEEKLY. this could be enum */ + billingCycle?: BillingCycle; + /** plan id as published by NewRelic */ + planDetails?: string; + /** date when plan was applied */ + effectiveDate?: Date; +} + +/** Managed service identity (system assigned and/or user assigned identities) */ +export interface ManagedServiceIdentity { + /** + * The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ + type: ManagedServiceIdentityType; + /** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. */ + userAssignedIdentities?: { [propertyName: string]: UserAssignedIdentity }; +} + +/** User assigned identity properties */ +export interface UserAssignedIdentity { + /** + * The principal ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The client ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + +/** Response of get all organizations Operation. */ +export interface OrganizationsListResponse { + /** The OrganizationResource items on this page */ + value: OrganizationResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Response of get all plan data Operation. */ +export interface PlanDataListResponse { + /** The PlanDataResource items on this page */ + value: PlanDataResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** The type used for update operations of the NewRelicMonitorResource. */ +export interface NewRelicMonitorResourceUpdate { + /** The managed service identities assigned to this resource. */ + identity?: ManagedServiceIdentity; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** MarketplaceSubscriptionStatus of the resource */ + newRelicAccountProperties?: NewRelicAccountProperties; + /** User Info */ + userInfo?: UserInfo; + /** Plan details */ + planData?: PlanData; + /** Source of org creation */ + orgCreationSource?: OrgCreationSource; + /** Source of account creation */ + accountCreationSource?: AccountCreationSource; +} + +/** Request of get metrics Operation. */ +export interface MetricsRequest { + /** User Email */ + userEmail: string; +} + +/** Set of rules for sending metrics for the Monitor resource. */ +export interface MetricRules { + /** Flag specifying if metrics should be sent for the Monitor resource. */ + sendMetrics?: SendMetricsStatus; + /** List of filtering tags to be used for capturing metrics. */ + filteringTags?: FilteringTag[]; + /** User Email */ + userEmail?: string; +} + +/** The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from being monitored. */ +export interface FilteringTag { + /** The name (also known as the key) of the tag. */ + name?: string; + /** The value of the tag. */ + value?: string; + /** Valid actions for a filtering tag. Exclusion takes priority over inclusion. */ + action?: TagAction; +} + +/** Request of get metrics status Operation. */ +export interface MetricsStatusRequest { + /** Azure resource IDs */ + azureResourceIds?: string[]; + /** User Email */ + userEmail: string; +} + +/** Response of get metrics status Operation. */ +export interface MetricsStatusResponse { + /** Azure resource IDs */ + azureResourceIds?: string[]; +} + +/** Request of a app services get Operation. */ +export interface AppServicesGetRequest { + /** Azure resource IDs */ + azureResourceIds?: string[]; + /** User Email */ + userEmail: string; +} + +/** Response of a list app services Operation. */ +export interface AppServicesListResponse { + /** The AppServiceInfo items on this page */ + value: AppServiceInfo[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Details of VM Resource having NewRelic OneAgent installed */ +export interface AppServiceInfo { + /** Azure App service resource ID */ + azureResourceId?: string; + /** Version of the NewRelic agent installed on the App service. */ + agentVersion?: string; + /** Status of the NewRelic agent installed on the App service. */ + agentStatus?: string; +} + +/** Request of a switch billing Operation. */ +export interface SwitchBillingRequest { + /** Azure resource Id */ + azureResourceId?: string; + /** Organization id */ + organizationId?: string; + /** Plan details */ + planData?: PlanData; + /** User Email */ + userEmail: string; +} + +/** Request of a Hosts get Operation. */ +export interface HostsGetRequest { + /** VM resource IDs */ + vmIds?: string[]; + /** User Email */ + userEmail: string; +} + +/** Response of a list VM Host Operation. */ +export interface VMHostsListResponse { + /** The VMInfo items on this page */ + value: VMInfo[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Details of VM Resource having NewRelic OneAgent installed */ +export interface VMInfo { + /** Azure VM resource ID */ + vmId?: string; + /** Version of the NewRelic agent installed on the VM. */ + agentVersion?: string; + /** Status of the NewRelic agent installed on the VM. */ + agentStatus?: string; +} + +/** List of all the resources being monitored by NewRelic monitor resource */ +export interface MonitoredResourceListResponse { + /** The MonitoredResource items on this page */ + value: MonitoredResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Details of resource being monitored by NewRelic monitor resource */ +export interface MonitoredResource { + /** The ARM id of the resource. */ + id?: string; + /** Flag indicating if resource is sending metrics to NewRelic. */ + sendingMetrics?: SendingMetricsStatus; + /** Reason for why the resource is sending metrics (or why it is not sending). */ + reasonForMetricsStatus?: string; + /** Flag indicating if resource is sending logs to NewRelic. */ + sendingLogs?: SendingLogsStatus; + /** Reason for why the resource is sending logs (or why it is not sending). */ + reasonForLogsStatus?: string; +} + +/** The response of a TagRule list operation. */ +export interface TagRuleListResult { + /** The TagRule items on this page */ + value: TagRule[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Set of rules for sending logs for the Monitor resource. */ +export interface LogRules { + /** Flag specifying if AAD logs should be sent for the Monitor resource. */ + sendAadLogs?: SendAadLogsStatus; + /** Flag specifying if subscription logs should be sent for the Monitor resource. */ + sendSubscriptionLogs?: SendSubscriptionLogsStatus; + /** Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. */ + sendActivityLogs?: SendActivityLogsStatus; + /** + * List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. + * If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. + */ + filteringTags?: FilteringTag[]; +} + +/** The type used for update operations of the TagRule. */ +export interface TagRuleUpdate { + /** Set of rules for sending logs for the Monitor resource. */ + logRules?: LogRules; + /** Set of rules for sending metrics for the Monitor resource. */ + metricRules?: MetricRules; +} + +/** Response of payload to be passed while installing VM agent. */ +export interface VMExtensionPayload { + /** Ingestion key of the account */ + ingestionKey?: string; +} + +/** App services Get Parameter specification. */ +export interface AppServicesGetParameter { + /** The details of the app services get request. */ + request: AppServicesGetRequest; +} + +/** Switch Billing Parameter specification. */ +export interface SwitchBillingParameter { + /** The details of the switch billing request. */ + request: SwitchBillingRequest; +} + +/** Host Get Parameter specification. */ +export interface HostsGetParameter { + /** The details of the Hosts get request. */ + request: HostsGetRequest; +} + +/** Get Metrics Status Parameter specification. */ +export interface MetricsRequestParameter { + /** The details of the get metrics status request. */ + request: MetricsRequest; +} + +/** Get Metrics Status Parameter specification. */ +export interface MetricsStatusRequestParameter { + /** The details of the get metrics status request. */ + request: MetricsStatusRequest; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +} + +/** The details of a account resource. */ +export interface AccountResource extends ProxyResource { + /** organization id */ + organizationId?: string; + /** account id */ + accountId?: string; + /** account name */ + accountName?: string; + /** region */ + region?: string; +} + +/** The details of a Organization resource. */ +export interface OrganizationResource extends ProxyResource { + /** organization id */ + organizationId?: string; + /** organization name */ + organizationName?: string; + /** Billing source */ + billingSource?: BillingSource; +} + +/** The details of a PlanData resource. */ +export interface PlanDataResource extends ProxyResource { + /** Plan details */ + planData?: PlanData; + /** Source of org creation */ + orgCreationSource?: OrgCreationSource; + /** Source of account creation */ + accountCreationSource?: AccountCreationSource; +} + +/** A tag rule belonging to NewRelic account */ +export interface TagRule extends ProxyResource { + /** + * Provisioning State of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Set of rules for sending logs for the Monitor resource. */ + logRules?: LogRules; + /** Set of rules for sending metrics for the Monitor resource. */ + metricRules?: MetricRules; +} + +/** A Monitor Resource by NewRelic */ +export interface NewRelicMonitorResource extends TrackedResource { + /** The managed service identities assigned to this resource. */ + identity?: ManagedServiceIdentity; + /** + * Provisioning State of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * MonitoringStatus of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly monitoringStatus?: MonitoringStatus; + /** + * NewRelic Organization properties of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly marketplaceSubscriptionStatus?: MarketplaceSubscriptionStatus; + /** + * Marketplace Subscription Id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly marketplaceSubscriptionId?: string; + /** MarketplaceSubscriptionStatus of the resource */ + newRelicAccountProperties?: NewRelicAccountProperties; + /** User Info */ + userInfo?: UserInfo; + /** Plan details */ + planData?: PlanData; + /** + * Liftr resource category + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly liftrResourceCategory?: LiftrResourceCategories; + /** + * Liftr resource preference. The priority of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly liftrResourcePreference?: number; + /** Source of org creation */ + orgCreationSource?: OrgCreationSource; + /** Source of account creation */ + accountCreationSource?: AccountCreationSource; +} + +/** Defines headers for Monitors_createOrUpdate operation. */ +export interface MonitorsCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Monitors_delete operation. */ +export interface MonitorsDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for TagRules_createOrUpdate operation. */ +export interface TagRulesCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for TagRules_delete operation. */ +export interface TagRulesDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** User */ + User = "user", + /** System */ + System = "system", + /** UserSystem */ + UserSystem = "user,system" +} + +/** + * Defines values for Origin. \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user** \ + * **system** \ + * **user,system** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + /** Internal */ + Internal = "Internal" +} + +/** + * Defines values for ActionType. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal** + */ +export type ActionType = string; + +/** Known values of {@link 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 ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** Monitor resource creation request accepted */ + Accepted = "Accepted", + /** Monitor resource creation started */ + Creating = "Creating", + /** Monitor resource is being updated */ + Updating = "Updating", + /** Monitor resource deletion started */ + Deleting = "Deleting", + /** Monitor resource creation successful */ + Succeeded = "Succeeded", + /** Monitor resource creation failed */ + Failed = "Failed", + /** Monitor resource creation canceled */ + Canceled = "Canceled", + /** Monitor resource is deleted */ + Deleted = "Deleted", + /** Monitor resource state is unknown */ + NotSpecified = "NotSpecified" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted**: Monitor resource creation request accepted \ + * **Creating**: Monitor resource creation started \ + * **Updating**: Monitor resource is being updated \ + * **Deleting**: Monitor resource deletion started \ + * **Succeeded**: Monitor resource creation successful \ + * **Failed**: Monitor resource creation failed \ + * **Canceled**: Monitor resource creation canceled \ + * **Deleted**: Monitor resource is deleted \ + * **NotSpecified**: Monitor resource state is unknown + */ +export type ProvisioningState = string; + +/** Known values of {@link MonitoringStatus} that the service accepts. */ +export enum KnownMonitoringStatus { + /** monitoring is enabled */ + Enabled = "Enabled", + /** monitoring is disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for MonitoringStatus. \ + * {@link KnownMonitoringStatus} can be used interchangeably with MonitoringStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: monitoring is enabled \ + * **Disabled**: monitoring is disabled + */ +export type MonitoringStatus = string; + +/** Known values of {@link MarketplaceSubscriptionStatus} that the service accepts. */ +export enum KnownMarketplaceSubscriptionStatus { + /** monitoring is enabled */ + Active = "Active", + /** monitoring is disabled */ + Suspended = "Suspended" +} + +/** + * Defines values for MarketplaceSubscriptionStatus. \ + * {@link KnownMarketplaceSubscriptionStatus} can be used interchangeably with MarketplaceSubscriptionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: monitoring is enabled \ + * **Suspended**: monitoring is disabled + */ +export type MarketplaceSubscriptionStatus = string; + +/** Known values of {@link SingleSignOnStates} that the service accepts. */ +export enum KnownSingleSignOnStates { + /** Initial */ + Initial = "Initial", + /** Enable */ + Enable = "Enable", + /** Disable */ + Disable = "Disable", + /** Existing */ + Existing = "Existing" +} + +/** + * Defines values for SingleSignOnStates. \ + * {@link KnownSingleSignOnStates} can be used interchangeably with SingleSignOnStates, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Initial** \ + * **Enable** \ + * **Disable** \ + * **Existing** + */ +export type SingleSignOnStates = string; + +/** Known values of {@link UsageType} that the service accepts. */ +export enum KnownUsageType { + /** Usage type is PAYG */ + Payg = "PAYG", + /** Usage type is COMMITTED */ + Committed = "COMMITTED" +} + +/** + * Defines values for UsageType. \ + * {@link KnownUsageType} can be used interchangeably with UsageType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **PAYG**: Usage type is PAYG \ + * **COMMITTED**: Usage type is COMMITTED + */ +export type UsageType = string; + +/** Known values of {@link BillingCycle} that the service accepts. */ +export enum KnownBillingCycle { + /** Billing cycle is YEARLY */ + Yearly = "YEARLY", + /** Billing cycle is MONTHLY */ + Monthly = "MONTHLY", + /** Billing cycle is WEEKLY */ + Weekly = "WEEKLY" +} + +/** + * Defines values for BillingCycle. \ + * {@link KnownBillingCycle} can be used interchangeably with BillingCycle, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **YEARLY**: Billing cycle is YEARLY \ + * **MONTHLY**: Billing cycle is MONTHLY \ + * **WEEKLY**: Billing cycle is WEEKLY + */ +export type BillingCycle = string; + +/** Known values of {@link LiftrResourceCategories} that the service accepts. */ +export enum KnownLiftrResourceCategories { + /** Unknown */ + Unknown = "Unknown", + /** MonitorLogs */ + MonitorLogs = "MonitorLogs" +} + +/** + * Defines values for LiftrResourceCategories. \ + * {@link KnownLiftrResourceCategories} can be used interchangeably with LiftrResourceCategories, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **MonitorLogs** + */ +export type LiftrResourceCategories = string; + +/** Known values of {@link OrgCreationSource} that the service accepts. */ +export enum KnownOrgCreationSource { + /** Org is created from LIFTR */ + Liftr = "LIFTR", + /** Org is created from NEWRELIC */ + Newrelic = "NEWRELIC" +} + +/** + * Defines values for OrgCreationSource. \ + * {@link KnownOrgCreationSource} can be used interchangeably with OrgCreationSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **LIFTR**: Org is created from LIFTR \ + * **NEWRELIC**: Org is created from NEWRELIC + */ +export type OrgCreationSource = string; + +/** Known values of {@link AccountCreationSource} that the service accepts. */ +export enum KnownAccountCreationSource { + /** Account is created from LIFTR */ + Liftr = "LIFTR", + /** Account is created from NEWRELIC */ + Newrelic = "NEWRELIC" +} + +/** + * Defines values for AccountCreationSource. \ + * {@link KnownAccountCreationSource} can be used interchangeably with AccountCreationSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **LIFTR**: Account is created from LIFTR \ + * **NEWRELIC**: Account is created from NEWRELIC + */ +export type AccountCreationSource = string; + +/** Known values of {@link ManagedServiceIdentityType} that the service accepts. */ +export enum KnownManagedServiceIdentityType { + /** None */ + None = "None", + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** UserAssigned */ + UserAssigned = "UserAssigned", + /** SystemAssignedUserAssigned */ + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned" +} + +/** + * Defines values for ManagedServiceIdentityType. \ + * {@link KnownManagedServiceIdentityType} can be used interchangeably with ManagedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** \ + * **UserAssigned** \ + * **SystemAssigned, UserAssigned** + */ +export type ManagedServiceIdentityType = string; + +/** Known values of {@link BillingSource} that the service accepts. */ +export enum KnownBillingSource { + /** Billing source is Azure */ + Azure = "AZURE", + /** Newrelic */ + Newrelic = "NEWRELIC" +} + +/** + * Defines values for BillingSource. \ + * {@link KnownBillingSource} can be used interchangeably with BillingSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AZURE**: Billing source is Azure \ + * **NEWRELIC** + */ +export type BillingSource = string; + +/** Known values of {@link SendMetricsStatus} that the service accepts. */ +export enum KnownSendMetricsStatus { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for SendMetricsStatus. \ + * {@link KnownSendMetricsStatus} can be used interchangeably with SendMetricsStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type SendMetricsStatus = string; + +/** Known values of {@link TagAction} that the service accepts. */ +export enum KnownTagAction { + /** Include */ + Include = "Include", + /** Exclude */ + Exclude = "Exclude" +} + +/** + * Defines values for TagAction. \ + * {@link KnownTagAction} can be used interchangeably with TagAction, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Include** \ + * **Exclude** + */ +export type TagAction = string; + +/** Known values of {@link SendingMetricsStatus} that the service accepts. */ +export enum KnownSendingMetricsStatus { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for SendingMetricsStatus. \ + * {@link KnownSendingMetricsStatus} can be used interchangeably with SendingMetricsStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type SendingMetricsStatus = string; + +/** Known values of {@link SendingLogsStatus} that the service accepts. */ +export enum KnownSendingLogsStatus { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for SendingLogsStatus. \ + * {@link KnownSendingLogsStatus} can be used interchangeably with SendingLogsStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type SendingLogsStatus = string; + +/** Known values of {@link SendAadLogsStatus} that the service accepts. */ +export enum KnownSendAadLogsStatus { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for SendAadLogsStatus. \ + * {@link KnownSendAadLogsStatus} can be used interchangeably with SendAadLogsStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type SendAadLogsStatus = string; + +/** Known values of {@link SendSubscriptionLogsStatus} that the service accepts. */ +export enum KnownSendSubscriptionLogsStatus { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for SendSubscriptionLogsStatus. \ + * {@link KnownSendSubscriptionLogsStatus} can be used interchangeably with SendSubscriptionLogsStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type SendSubscriptionLogsStatus = string; + +/** Known values of {@link SendActivityLogsStatus} that the service accepts. */ +export enum KnownSendActivityLogsStatus { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for SendActivityLogsStatus. \ + * {@link KnownSendActivityLogsStatus} can be used interchangeably with SendActivityLogsStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type SendActivityLogsStatus = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface AccountsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AccountsListOperationResponse = AccountsListResponse; + +/** Optional parameters. */ +export interface AccountsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AccountsListNextResponse = AccountsListResponse; + +/** Optional parameters. */ +export interface MonitorsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type MonitorsListBySubscriptionResponse = NewRelicMonitorResourceListResult; + +/** Optional parameters. */ +export interface MonitorsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type MonitorsListByResourceGroupResponse = NewRelicMonitorResourceListResult; + +/** Optional parameters. */ +export interface MonitorsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type MonitorsGetResponse = NewRelicMonitorResource; + +/** Optional parameters. */ +export interface MonitorsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type MonitorsCreateOrUpdateResponse = NewRelicMonitorResource; + +/** Optional parameters. */ +export interface MonitorsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type MonitorsUpdateResponse = NewRelicMonitorResource; + +/** Optional parameters. */ +export interface MonitorsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface MonitorsGetMetricRulesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getMetricRules operation. */ +export type MonitorsGetMetricRulesResponse = MetricRules; + +/** Optional parameters. */ +export interface MonitorsGetMetricStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getMetricStatus operation. */ +export type MonitorsGetMetricStatusResponse = MetricsStatusResponse; + +/** Optional parameters. */ +export interface MonitorsListAppServicesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listAppServices operation. */ +export type MonitorsListAppServicesResponse = AppServicesListResponse; + +/** Optional parameters. */ +export interface MonitorsSwitchBillingOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface MonitorsListHostsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listHosts operation. */ +export type MonitorsListHostsResponse = VMHostsListResponse; + +/** Optional parameters. */ +export interface MonitorsListMonitoredResourcesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listMonitoredResources operation. */ +export type MonitorsListMonitoredResourcesResponse = MonitoredResourceListResponse; + +/** Optional parameters. */ +export interface MonitorsVmHostPayloadOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the vmHostPayload operation. */ +export type MonitorsVmHostPayloadResponse = VMExtensionPayload; + +/** Optional parameters. */ +export interface MonitorsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type MonitorsListBySubscriptionNextResponse = NewRelicMonitorResourceListResult; + +/** Optional parameters. */ +export interface MonitorsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type MonitorsListByResourceGroupNextResponse = NewRelicMonitorResourceListResult; + +/** Optional parameters. */ +export interface MonitorsListAppServicesNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listAppServicesNext operation. */ +export type MonitorsListAppServicesNextResponse = AppServicesListResponse; + +/** Optional parameters. */ +export interface MonitorsListHostsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listHostsNext operation. */ +export type MonitorsListHostsNextResponse = VMHostsListResponse; + +/** Optional parameters. */ +export interface MonitorsListMonitoredResourcesNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listMonitoredResourcesNext operation. */ +export type MonitorsListMonitoredResourcesNextResponse = MonitoredResourceListResponse; + +/** Optional parameters. */ +export interface OrganizationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OrganizationsListOperationResponse = OrganizationsListResponse; + +/** Optional parameters. */ +export interface OrganizationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OrganizationsListNextResponse = OrganizationsListResponse; + +/** Optional parameters. */ +export interface PlansListOptionalParams extends coreClient.OperationOptions { + /** Account Id. */ + accountId?: string; + /** Organization Id. */ + organizationId?: string; +} + +/** Contains response data for the list operation. */ +export type PlansListResponse = PlanDataListResponse; + +/** Optional parameters. */ +export interface PlansListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type PlansListNextResponse = PlanDataListResponse; + +/** Optional parameters. */ +export interface TagRulesListByNewRelicMonitorResourceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByNewRelicMonitorResource operation. */ +export type TagRulesListByNewRelicMonitorResourceResponse = TagRuleListResult; + +/** Optional parameters. */ +export interface TagRulesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type TagRulesGetResponse = TagRule; + +/** Optional parameters. */ +export interface TagRulesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type TagRulesCreateOrUpdateResponse = TagRule; + +/** Optional parameters. */ +export interface TagRulesDeleteOptionalParams + 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 TagRulesUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type TagRulesUpdateResponse = TagRule; + +/** Optional parameters. */ +export interface TagRulesListByNewRelicMonitorResourceNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByNewRelicMonitorResourceNext operation. */ +export type TagRulesListByNewRelicMonitorResourceNextResponse = TagRuleListResult; + +/** Optional parameters. */ +export interface NewRelicObservabilityOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/models/mappers.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/models/mappers.ts new file mode 100644 index 000000000000..cec227d89979 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/models/mappers.ts @@ -0,0 +1,1636 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String" + } + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const AccountsListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccountsListResponse", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AccountResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const NewRelicMonitorResourceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NewRelicMonitorResourceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NewRelicMonitorResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const NewRelicAccountProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NewRelicAccountProperties", + modelProperties: { + userId: { + serializedName: "userId", + type: { + name: "String" + } + }, + accountInfo: { + serializedName: "accountInfo", + type: { + name: "Composite", + className: "AccountInfo" + } + }, + organizationInfo: { + serializedName: "organizationInfo", + type: { + name: "Composite", + className: "OrganizationInfo" + } + }, + singleSignOnProperties: { + serializedName: "singleSignOnProperties", + type: { + name: "Composite", + className: "NewRelicSingleSignOnProperties" + } + } + } + } +}; + +export const AccountInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccountInfo", + modelProperties: { + accountId: { + serializedName: "accountId", + type: { + name: "String" + } + }, + ingestionKey: { + serializedName: "ingestionKey", + type: { + name: "String" + } + }, + region: { + serializedName: "region", + type: { + name: "String" + } + } + } + } +}; + +export const OrganizationInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OrganizationInfo", + modelProperties: { + organizationId: { + serializedName: "organizationId", + type: { + name: "String" + } + } + } + } +}; + +export const NewRelicSingleSignOnProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NewRelicSingleSignOnProperties", + modelProperties: { + singleSignOnState: { + serializedName: "singleSignOnState", + type: { + name: "String" + } + }, + enterpriseAppId: { + serializedName: "enterpriseAppId", + type: { + name: "String" + } + }, + singleSignOnUrl: { + serializedName: "singleSignOnUrl", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + } + } + } +}; + +export const UserInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserInfo", + modelProperties: { + firstName: { + constraints: { + MaxLength: 50 + }, + serializedName: "firstName", + type: { + name: "String" + } + }, + lastName: { + constraints: { + MaxLength: 50 + }, + serializedName: "lastName", + type: { + name: "String" + } + }, + emailAddress: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" + ) + }, + serializedName: "emailAddress", + type: { + name: "String" + } + }, + phoneNumber: { + constraints: { + MaxLength: 40 + }, + serializedName: "phoneNumber", + type: { + name: "String" + } + }, + country: { + serializedName: "country", + type: { + name: "String" + } + } + } + } +}; + +export const PlanData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PlanData", + modelProperties: { + usageType: { + serializedName: "usageType", + type: { + name: "String" + } + }, + billingCycle: { + serializedName: "billingCycle", + type: { + name: "String" + } + }, + planDetails: { + serializedName: "planDetails", + type: { + name: "String" + } + }, + effectiveDate: { + serializedName: "effectiveDate", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ManagedServiceIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedServiceIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "Uuid" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { name: "Composite", className: "UserAssignedIdentity" } + } + } + } + } + } +}; + +export const UserAssignedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "Uuid" + } + } + } + } +}; + +export const OrganizationsListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OrganizationsListResponse", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OrganizationResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const PlanDataListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PlanDataListResponse", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PlanDataResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const NewRelicMonitorResourceUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NewRelicMonitorResourceUpdate", + modelProperties: { + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + newRelicAccountProperties: { + serializedName: "properties.newRelicAccountProperties", + type: { + name: "Composite", + className: "NewRelicAccountProperties" + } + }, + userInfo: { + serializedName: "properties.userInfo", + type: { + name: "Composite", + className: "UserInfo" + } + }, + planData: { + serializedName: "properties.planData", + type: { + name: "Composite", + className: "PlanData" + } + }, + orgCreationSource: { + serializedName: "properties.orgCreationSource", + type: { + name: "String" + } + }, + accountCreationSource: { + serializedName: "properties.accountCreationSource", + type: { + name: "String" + } + } + } + } +}; + +export const MetricsRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetricsRequest", + modelProperties: { + userEmail: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" + ) + }, + serializedName: "userEmail", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const MetricRules: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetricRules", + modelProperties: { + sendMetrics: { + serializedName: "sendMetrics", + type: { + name: "String" + } + }, + filteringTags: { + serializedName: "filteringTags", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FilteringTag" + } + } + } + }, + userEmail: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" + ) + }, + serializedName: "userEmail", + type: { + name: "String" + } + } + } + } +}; + +export const FilteringTag: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FilteringTag", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + }, + action: { + serializedName: "action", + type: { + name: "String" + } + } + } + } +}; + +export const MetricsStatusRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetricsStatusRequest", + modelProperties: { + azureResourceIds: { + serializedName: "azureResourceIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + userEmail: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" + ) + }, + serializedName: "userEmail", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const MetricsStatusResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetricsStatusResponse", + modelProperties: { + azureResourceIds: { + serializedName: "azureResourceIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const AppServicesGetRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppServicesGetRequest", + modelProperties: { + azureResourceIds: { + serializedName: "azureResourceIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + userEmail: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" + ) + }, + serializedName: "userEmail", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const AppServicesListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppServicesListResponse", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AppServiceInfo" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const AppServiceInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppServiceInfo", + modelProperties: { + azureResourceId: { + serializedName: "azureResourceId", + type: { + name: "String" + } + }, + agentVersion: { + serializedName: "agentVersion", + type: { + name: "String" + } + }, + agentStatus: { + serializedName: "agentStatus", + type: { + name: "String" + } + } + } + } +}; + +export const SwitchBillingRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SwitchBillingRequest", + modelProperties: { + azureResourceId: { + serializedName: "azureResourceId", + type: { + name: "String" + } + }, + organizationId: { + serializedName: "organizationId", + type: { + name: "String" + } + }, + planData: { + serializedName: "planData", + type: { + name: "Composite", + className: "PlanData" + } + }, + userEmail: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" + ) + }, + serializedName: "userEmail", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const HostsGetRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HostsGetRequest", + modelProperties: { + vmIds: { + serializedName: "vmIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + userEmail: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" + ) + }, + serializedName: "userEmail", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const VMHostsListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VMHostsListResponse", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "VMInfo" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const VMInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VMInfo", + modelProperties: { + vmId: { + serializedName: "vmId", + type: { + name: "String" + } + }, + agentVersion: { + serializedName: "agentVersion", + type: { + name: "String" + } + }, + agentStatus: { + serializedName: "agentStatus", + type: { + name: "String" + } + } + } + } +}; + +export const MonitoredResourceListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoredResourceListResponse", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MonitoredResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const MonitoredResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoredResource", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + sendingMetrics: { + serializedName: "sendingMetrics", + type: { + name: "String" + } + }, + reasonForMetricsStatus: { + serializedName: "reasonForMetricsStatus", + type: { + name: "String" + } + }, + sendingLogs: { + serializedName: "sendingLogs", + type: { + name: "String" + } + }, + reasonForLogsStatus: { + serializedName: "reasonForLogsStatus", + type: { + name: "String" + } + } + } + } +}; + +export const TagRuleListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TagRuleListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TagRule" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const LogRules: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LogRules", + modelProperties: { + sendAadLogs: { + serializedName: "sendAadLogs", + type: { + name: "String" + } + }, + sendSubscriptionLogs: { + serializedName: "sendSubscriptionLogs", + type: { + name: "String" + } + }, + sendActivityLogs: { + serializedName: "sendActivityLogs", + type: { + name: "String" + } + }, + filteringTags: { + serializedName: "filteringTags", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FilteringTag" + } + } + } + } + } + } +}; + +export const TagRuleUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TagRuleUpdate", + modelProperties: { + logRules: { + serializedName: "properties.logRules", + type: { + name: "Composite", + className: "LogRules" + } + }, + metricRules: { + serializedName: "properties.metricRules", + type: { + name: "Composite", + className: "MetricRules" + } + } + } + } +}; + +export const VMExtensionPayload: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VMExtensionPayload", + modelProperties: { + ingestionKey: { + serializedName: "ingestionKey", + type: { + name: "String" + } + } + } + } +}; + +export const AppServicesGetParameter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppServicesGetParameter", + modelProperties: { + request: { + serializedName: "request", + type: { + name: "Composite", + className: "AppServicesGetRequest" + } + } + } + } +}; + +export const SwitchBillingParameter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SwitchBillingParameter", + modelProperties: { + request: { + serializedName: "request", + type: { + name: "Composite", + className: "SwitchBillingRequest" + } + } + } + } +}; + +export const HostsGetParameter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HostsGetParameter", + modelProperties: { + request: { + serializedName: "request", + type: { + name: "Composite", + className: "HostsGetRequest" + } + } + } + } +}; + +export const MetricsRequestParameter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetricsRequestParameter", + modelProperties: { + request: { + serializedName: "request", + type: { + name: "Composite", + className: "MetricsRequest" + } + } + } + } +}; + +export const MetricsStatusRequestParameter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetricsStatusRequestParameter", + modelProperties: { + request: { + serializedName: "request", + type: { + name: "Composite", + className: "MetricsStatusRequest" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +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 AccountResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccountResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + organizationId: { + serializedName: "properties.organizationId", + type: { + name: "String" + } + }, + accountId: { + serializedName: "properties.accountId", + type: { + name: "String" + } + }, + accountName: { + serializedName: "properties.accountName", + type: { + name: "String" + } + }, + region: { + serializedName: "properties.region", + type: { + name: "String" + } + } + } + } +}; + +export const OrganizationResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OrganizationResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + organizationId: { + serializedName: "properties.organizationId", + type: { + name: "String" + } + }, + organizationName: { + serializedName: "properties.organizationName", + type: { + name: "String" + } + }, + billingSource: { + serializedName: "properties.billingSource", + type: { + name: "String" + } + } + } + } +}; + +export const PlanDataResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PlanDataResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + planData: { + serializedName: "properties.planData", + type: { + name: "Composite", + className: "PlanData" + } + }, + orgCreationSource: { + serializedName: "properties.orgCreationSource", + type: { + name: "String" + } + }, + accountCreationSource: { + serializedName: "properties.accountCreationSource", + type: { + name: "String" + } + } + } + } +}; + +export const TagRule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TagRule", + modelProperties: { + ...ProxyResource.type.modelProperties, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + logRules: { + serializedName: "properties.logRules", + type: { + name: "Composite", + className: "LogRules" + } + }, + metricRules: { + serializedName: "properties.metricRules", + type: { + name: "Composite", + className: "MetricRules" + } + } + } + } +}; + +export const NewRelicMonitorResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NewRelicMonitorResource", + modelProperties: { + ...TrackedResource.type.modelProperties, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + monitoringStatus: { + serializedName: "properties.monitoringStatus", + readOnly: true, + type: { + name: "String" + } + }, + marketplaceSubscriptionStatus: { + serializedName: "properties.marketplaceSubscriptionStatus", + readOnly: true, + type: { + name: "String" + } + }, + marketplaceSubscriptionId: { + serializedName: "properties.marketplaceSubscriptionId", + readOnly: true, + type: { + name: "String" + } + }, + newRelicAccountProperties: { + serializedName: "properties.newRelicAccountProperties", + type: { + name: "Composite", + className: "NewRelicAccountProperties" + } + }, + userInfo: { + serializedName: "properties.userInfo", + type: { + name: "Composite", + className: "UserInfo" + } + }, + planData: { + serializedName: "properties.planData", + type: { + name: "Composite", + className: "PlanData" + } + }, + liftrResourceCategory: { + serializedName: "properties.liftrResourceCategory", + readOnly: true, + type: { + name: "String" + } + }, + liftrResourcePreference: { + serializedName: "properties.liftrResourcePreference", + readOnly: true, + type: { + name: "Number" + } + }, + orgCreationSource: { + serializedName: "properties.orgCreationSource", + type: { + name: "String" + } + }, + accountCreationSource: { + serializedName: "properties.accountCreationSource", + type: { + name: "String" + } + } + } + } +}; + +export const MonitorsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitorsCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const MonitorsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitorsDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const TagRulesCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TagRulesCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const TagRulesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TagRulesDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/models/parameters.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/models/parameters.ts new file mode 100644 index 000000000000..195dd932ee18 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/models/parameters.ts @@ -0,0 +1,222 @@ +/* + * 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 { + NewRelicMonitorResource as NewRelicMonitorResourceMapper, + NewRelicMonitorResourceUpdate as NewRelicMonitorResourceUpdateMapper, + MetricsRequest as MetricsRequestMapper, + MetricsStatusRequest as MetricsStatusRequestMapper, + AppServicesGetRequest as AppServicesGetRequestMapper, + SwitchBillingRequest as SwitchBillingRequestMapper, + HostsGetRequest as HostsGetRequestMapper, + TagRule as TagRuleMapper, + TagRuleUpdate as TagRuleUpdateMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-07-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const userEmail: OperationQueryParameter = { + parameterPath: "userEmail", + mapper: { + serializedName: "userEmail", + required: true, + type: { + name: "String" + } + } +}; + +export const location: OperationQueryParameter = { + parameterPath: "location", + mapper: { + serializedName: "location", + 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 monitorName: OperationURLParameter = { + parameterPath: "monitorName", + mapper: { + serializedName: "monitorName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const resource: OperationParameter = { + parameterPath: "resource", + mapper: NewRelicMonitorResourceMapper +}; + +export const properties: OperationParameter = { + parameterPath: "properties", + mapper: NewRelicMonitorResourceUpdateMapper +}; + +export const request: OperationParameter = { + parameterPath: "request", + mapper: MetricsRequestMapper +}; + +export const request1: OperationParameter = { + parameterPath: "request", + mapper: MetricsStatusRequestMapper +}; + +export const request2: OperationParameter = { + parameterPath: "request", + mapper: AppServicesGetRequestMapper +}; + +export const request3: OperationParameter = { + parameterPath: "request", + mapper: SwitchBillingRequestMapper +}; + +export const request4: OperationParameter = { + parameterPath: "request", + mapper: HostsGetRequestMapper +}; + +export const accountId: OperationQueryParameter = { + parameterPath: ["options", "accountId"], + mapper: { + serializedName: "accountId", + type: { + name: "String" + } + } +}; + +export const organizationId: OperationQueryParameter = { + parameterPath: ["options", "organizationId"], + mapper: { + serializedName: "organizationId", + type: { + name: "String" + } + } +}; + +export const ruleSetName: OperationURLParameter = { + parameterPath: "ruleSetName", + mapper: { + serializedName: "ruleSetName", + required: true, + type: { + name: "String" + } + } +}; + +export const resource1: OperationParameter = { + parameterPath: "resource", + mapper: TagRuleMapper +}; + +export const properties1: OperationParameter = { + parameterPath: "properties", + mapper: TagRuleUpdateMapper +}; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/newRelicObservability.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/newRelicObservability.ts new file mode 100644 index 000000000000..945f5c562214 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/newRelicObservability.ts @@ -0,0 +1,164 @@ +/* + * 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, + AccountsImpl, + MonitorsImpl, + OrganizationsImpl, + PlansImpl, + TagRulesImpl +} from "./operations"; +import { + Operations, + Accounts, + Monitors, + Organizations, + Plans, + TagRules +} from "./operationsInterfaces"; +import { NewRelicObservabilityOptionalParams } from "./models"; + +export class NewRelicObservability extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the NewRelicObservability 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?: NewRelicObservabilityOptionalParams + ) { + 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: NewRelicObservabilityOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-newrelicobservability/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-07-01-preview"; + this.operations = new OperationsImpl(this); + this.accounts = new AccountsImpl(this); + this.monitors = new MonitorsImpl(this); + this.organizations = new OrganizationsImpl(this); + this.plans = new PlansImpl(this); + this.tagRules = new TagRulesImpl(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; + accounts: Accounts; + monitors: Monitors; + organizations: Organizations; + plans: Plans; + tagRules: TagRules; +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operations/accounts.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/accounts.ts new file mode 100644 index 000000000000..14fdeee6cbe7 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/accounts.ts @@ -0,0 +1,177 @@ +/* + * 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 { Accounts } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { NewRelicObservability } from "../newRelicObservability"; +import { + AccountResource, + AccountsListNextOptionalParams, + AccountsListOptionalParams, + AccountsListOperationResponse, + AccountsListNextResponse +} from "../models"; + +/// +/** Class containing Accounts operations. */ +export class AccountsImpl implements Accounts { + private readonly client: NewRelicObservability; + + /** + * Initialize a new instance of the class Accounts class. + * @param client Reference to the service client + */ + constructor(client: NewRelicObservability) { + this.client = client; + } + + /** + * List all the existing accounts + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param options The options parameters. + */ + public list( + userEmail: string, + location: string, + options?: AccountsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(userEmail, location, 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(userEmail, location, options, settings); + } + }; + } + + private async *listPagingPage( + userEmail: string, + location: string, + options?: AccountsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: AccountsListOperationResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(userEmail, location, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + userEmail: string, + location: string, + options?: AccountsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + userEmail, + location, + options + )) { + yield* page; + } + } + + /** + * List all the existing accounts + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param options The options parameters. + */ + private _list( + userEmail: string, + location: string, + options?: AccountsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { userEmail, location, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: AccountsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/NewRelic.Observability/accounts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AccountsListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.userEmail, + Parameters.location + ], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AccountsListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operations/index.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/index.ts new file mode 100644 index 000000000000..82c1c5ac8be6 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./accounts"; +export * from "./monitors"; +export * from "./organizations"; +export * from "./plans"; +export * from "./tagRules"; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operations/monitors.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/monitors.ts new file mode 100644 index 000000000000..5c82b1783810 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/monitors.ts @@ -0,0 +1,1354 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Monitors } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { NewRelicObservability } from "../newRelicObservability"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + NewRelicMonitorResource, + MonitorsListBySubscriptionNextOptionalParams, + MonitorsListBySubscriptionOptionalParams, + MonitorsListBySubscriptionResponse, + MonitorsListByResourceGroupNextOptionalParams, + MonitorsListByResourceGroupOptionalParams, + MonitorsListByResourceGroupResponse, + AppServiceInfo, + AppServicesGetRequest, + MonitorsListAppServicesNextOptionalParams, + MonitorsListAppServicesOptionalParams, + MonitorsListAppServicesResponse, + VMInfo, + HostsGetRequest, + MonitorsListHostsNextOptionalParams, + MonitorsListHostsOptionalParams, + MonitorsListHostsResponse, + MonitoredResource, + MonitorsListMonitoredResourcesNextOptionalParams, + MonitorsListMonitoredResourcesOptionalParams, + MonitorsListMonitoredResourcesResponse, + MonitorsGetOptionalParams, + MonitorsGetResponse, + MonitorsCreateOrUpdateOptionalParams, + MonitorsCreateOrUpdateResponse, + NewRelicMonitorResourceUpdate, + MonitorsUpdateOptionalParams, + MonitorsUpdateResponse, + MonitorsDeleteOptionalParams, + MetricsRequest, + MonitorsGetMetricRulesOptionalParams, + MonitorsGetMetricRulesResponse, + MetricsStatusRequest, + MonitorsGetMetricStatusOptionalParams, + MonitorsGetMetricStatusResponse, + SwitchBillingRequest, + MonitorsSwitchBillingOptionalParams, + MonitorsVmHostPayloadOptionalParams, + MonitorsVmHostPayloadResponse, + MonitorsListBySubscriptionNextResponse, + MonitorsListByResourceGroupNextResponse, + MonitorsListAppServicesNextResponse, + MonitorsListHostsNextResponse, + MonitorsListMonitoredResourcesNextResponse +} from "../models"; + +/// +/** Class containing Monitors operations. */ +export class MonitorsImpl implements Monitors { + private readonly client: NewRelicObservability; + + /** + * Initialize a new instance of the class Monitors class. + * @param client Reference to the service client + */ + constructor(client: NewRelicObservability) { + this.client = client; + } + + /** + * List NewRelicMonitorResource resources by subscription ID + * @param options The options parameters. + */ + public listBySubscription( + options?: MonitorsListBySubscriptionOptionalParams + ): 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?: MonitorsListBySubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: MonitorsListBySubscriptionResponse; + 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?: MonitorsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * List NewRelicMonitorResource resources by resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: MonitorsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the app services get request. + * @param options The options parameters. + */ + public listAppServices( + resourceGroupName: string, + monitorName: string, + request: AppServicesGetRequest, + options?: MonitorsListAppServicesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAppServicesPagingAll( + resourceGroupName, + monitorName, + request, + 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.listAppServicesPagingPage( + resourceGroupName, + monitorName, + request, + options, + settings + ); + } + }; + } + + private async *listAppServicesPagingPage( + resourceGroupName: string, + monitorName: string, + request: AppServicesGetRequest, + options?: MonitorsListAppServicesOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: MonitorsListAppServicesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listAppServices( + resourceGroupName, + monitorName, + request, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listAppServicesNext( + resourceGroupName, + monitorName, + request, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listAppServicesPagingAll( + resourceGroupName: string, + monitorName: string, + request: AppServicesGetRequest, + options?: MonitorsListAppServicesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAppServicesPagingPage( + resourceGroupName, + monitorName, + request, + options + )) { + yield* page; + } + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the Hosts get request. + * @param options The options parameters. + */ + public listHosts( + resourceGroupName: string, + monitorName: string, + request: HostsGetRequest, + options?: MonitorsListHostsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listHostsPagingAll( + resourceGroupName, + monitorName, + request, + 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.listHostsPagingPage( + resourceGroupName, + monitorName, + request, + options, + settings + ); + } + }; + } + + private async *listHostsPagingPage( + resourceGroupName: string, + monitorName: string, + request: HostsGetRequest, + options?: MonitorsListHostsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: MonitorsListHostsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listHosts( + resourceGroupName, + monitorName, + request, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listHostsNext( + resourceGroupName, + monitorName, + request, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listHostsPagingAll( + resourceGroupName: string, + monitorName: string, + request: HostsGetRequest, + options?: MonitorsListHostsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listHostsPagingPage( + resourceGroupName, + monitorName, + request, + options + )) { + yield* page; + } + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + public listMonitoredResources( + resourceGroupName: string, + monitorName: string, + options?: MonitorsListMonitoredResourcesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listMonitoredResourcesPagingAll( + resourceGroupName, + monitorName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listMonitoredResourcesPagingPage( + resourceGroupName, + monitorName, + options, + settings + ); + } + }; + } + + private async *listMonitoredResourcesPagingPage( + resourceGroupName: string, + monitorName: string, + options?: MonitorsListMonitoredResourcesOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: MonitorsListMonitoredResourcesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listMonitoredResources( + resourceGroupName, + monitorName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listMonitoredResourcesNext( + resourceGroupName, + monitorName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listMonitoredResourcesPagingAll( + resourceGroupName: string, + monitorName: string, + options?: MonitorsListMonitoredResourcesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listMonitoredResourcesPagingPage( + resourceGroupName, + monitorName, + options + )) { + yield* page; + } + } + + /** + * List NewRelicMonitorResource resources by subscription ID + * @param options The options parameters. + */ + private _listBySubscription( + options?: MonitorsListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * List NewRelicMonitorResource resources by resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Get a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + options?: MonitorsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + getOperationSpec + ); + } + + /** + * Create a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + monitorName: string, + resource: NewRelicMonitorResource, + options?: MonitorsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + MonitorsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, monitorName, resource, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + MonitorsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + monitorName: string, + resource: NewRelicMonitorResource, + options?: MonitorsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + monitorName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + monitorName: string, + properties: NewRelicMonitorResourceUpdate, + options?: MonitorsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, properties, options }, + updateOperationSpec + ); + } + + /** + * Delete a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + userEmail: string, + monitorName: string, + options?: MonitorsDeleteOptionalParams + ): 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, userEmail, monitorName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + userEmail: string, + monitorName: string, + options?: MonitorsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + userEmail, + monitorName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Get metric rules + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the get metrics status request. + * @param options The options parameters. + */ + getMetricRules( + resourceGroupName: string, + monitorName: string, + request: MetricsRequest, + options?: MonitorsGetMetricRulesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, request, options }, + getMetricRulesOperationSpec + ); + } + + /** + * Get metric status + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the get metrics status request. + * @param options The options parameters. + */ + getMetricStatus( + resourceGroupName: string, + monitorName: string, + request: MetricsStatusRequest, + options?: MonitorsGetMetricStatusOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, request, options }, + getMetricStatusOperationSpec + ); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the app services get request. + * @param options The options parameters. + */ + private _listAppServices( + resourceGroupName: string, + monitorName: string, + request: AppServicesGetRequest, + options?: MonitorsListAppServicesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, request, options }, + listAppServicesOperationSpec + ); + } + + /** + * Switches the billing for NewRelic monitor resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the switch billing request. + * @param options The options parameters. + */ + switchBilling( + resourceGroupName: string, + monitorName: string, + request: SwitchBillingRequest, + options?: MonitorsSwitchBillingOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, request, options }, + switchBillingOperationSpec + ); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the Hosts get request. + * @param options The options parameters. + */ + private _listHosts( + resourceGroupName: string, + monitorName: string, + request: HostsGetRequest, + options?: MonitorsListHostsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, request, options }, + listHostsOperationSpec + ); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + private _listMonitoredResources( + resourceGroupName: string, + monitorName: string, + options?: MonitorsListMonitoredResourcesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + listMonitoredResourcesOperationSpec + ); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a + * VM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + vmHostPayload( + resourceGroupName: string, + monitorName: string, + options?: MonitorsVmHostPayloadOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + vmHostPayloadOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: MonitorsListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: MonitorsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } + + /** + * ListAppServicesNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the app services get request. + * @param nextLink The nextLink from the previous successful call to the ListAppServices method. + * @param options The options parameters. + */ + private _listAppServicesNext( + resourceGroupName: string, + monitorName: string, + request: AppServicesGetRequest, + nextLink: string, + options?: MonitorsListAppServicesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, request, nextLink, options }, + listAppServicesNextOperationSpec + ); + } + + /** + * ListHostsNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the Hosts get request. + * @param nextLink The nextLink from the previous successful call to the ListHosts method. + * @param options The options parameters. + */ + private _listHostsNext( + resourceGroupName: string, + monitorName: string, + request: HostsGetRequest, + nextLink: string, + options?: MonitorsListHostsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, request, nextLink, options }, + listHostsNextOperationSpec + ); + } + + /** + * ListMonitoredResourcesNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param nextLink The nextLink from the previous successful call to the ListMonitoredResources method. + * @param options The options parameters. + */ + private _listMonitoredResourcesNext( + resourceGroupName: string, + monitorName: string, + nextLink: string, + options?: MonitorsListMonitoredResourcesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, nextLink, options }, + listMonitoredResourcesNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/NewRelic.Observability/monitors", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.NewRelicMonitorResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.NewRelicMonitorResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.NewRelicMonitorResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.NewRelicMonitorResource + }, + 201: { + bodyMapper: Mappers.NewRelicMonitorResource + }, + 202: { + bodyMapper: Mappers.NewRelicMonitorResource + }, + 204: { + bodyMapper: Mappers.NewRelicMonitorResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.NewRelicMonitorResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.properties, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.userEmail], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getMetricRulesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/getMetricRules", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.MetricRules + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.request, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getMetricStatusOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/getMetricStatus", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.MetricsStatusResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.request1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listAppServicesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/listAppServices", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AppServicesListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.request2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const switchBillingOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/switchBilling", + httpMethod: "POST", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.request3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listHostsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/listHosts", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.VMHostsListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.request4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listMonitoredResourcesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/monitoredResources", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.MonitoredResourceListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], + serializer +}; +const vmHostPayloadOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/vmHostPayloads", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.VMExtensionPayload + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.NewRelicMonitorResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.NewRelicMonitorResourceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listAppServicesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AppServicesListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listHostsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.VMHostsListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listMonitoredResourcesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MonitoredResourceListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operations/operations.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/operations.ts new file mode 100644 index 000000000000..248d2fbd5c8f --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { NewRelicObservability } from "../newRelicObservability"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: NewRelicObservability; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: NewRelicObservability) { + this.client = client; + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/NewRelic.Observability/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operations/organizations.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/organizations.ts new file mode 100644 index 000000000000..ecb2539117c4 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/organizations.ts @@ -0,0 +1,177 @@ +/* + * 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 { Organizations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { NewRelicObservability } from "../newRelicObservability"; +import { + OrganizationResource, + OrganizationsListNextOptionalParams, + OrganizationsListOptionalParams, + OrganizationsListOperationResponse, + OrganizationsListNextResponse +} from "../models"; + +/// +/** Class containing Organizations operations. */ +export class OrganizationsImpl implements Organizations { + private readonly client: NewRelicObservability; + + /** + * Initialize a new instance of the class Organizations class. + * @param client Reference to the service client + */ + constructor(client: NewRelicObservability) { + this.client = client; + } + + /** + * List all the existing organizations + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param options The options parameters. + */ + public list( + userEmail: string, + location: string, + options?: OrganizationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(userEmail, location, 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(userEmail, location, options, settings); + } + }; + } + + private async *listPagingPage( + userEmail: string, + location: string, + options?: OrganizationsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: OrganizationsListOperationResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(userEmail, location, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + userEmail: string, + location: string, + options?: OrganizationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + userEmail, + location, + options + )) { + yield* page; + } + } + + /** + * List all the existing organizations + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param options The options parameters. + */ + private _list( + userEmail: string, + location: string, + options?: OrganizationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { userEmail, location, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OrganizationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/NewRelic.Observability/organizations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OrganizationsListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.userEmail, + Parameters.location + ], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OrganizationsListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operations/plans.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/plans.ts new file mode 100644 index 000000000000..b37d9ba8f0c8 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/plans.ts @@ -0,0 +1,156 @@ +/* + * 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 { Plans } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { NewRelicObservability } from "../newRelicObservability"; +import { + PlanDataResource, + PlansListNextOptionalParams, + PlansListOptionalParams, + PlansListResponse, + PlansListNextResponse +} from "../models"; + +/// +/** Class containing Plans operations. */ +export class PlansImpl implements Plans { + private readonly client: NewRelicObservability; + + /** + * Initialize a new instance of the class Plans class. + * @param client Reference to the service client + */ + constructor(client: NewRelicObservability) { + this.client = client; + } + + /** + * List plans data + * @param options The options parameters. + */ + public list( + options?: PlansListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: PlansListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: PlansListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: PlansListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List plans data + * @param options The options parameters. + */ + private _list(options?: PlansListOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: PlansListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/NewRelic.Observability/plans", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PlanDataListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.accountId, + Parameters.organizationId + ], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PlanDataListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operations/tagRules.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/tagRules.ts new file mode 100644 index 000000000000..159bfd85a1f9 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operations/tagRules.ts @@ -0,0 +1,552 @@ +/* + * 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 { TagRules } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { NewRelicObservability } from "../newRelicObservability"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + TagRule, + TagRulesListByNewRelicMonitorResourceNextOptionalParams, + TagRulesListByNewRelicMonitorResourceOptionalParams, + TagRulesListByNewRelicMonitorResourceResponse, + TagRulesGetOptionalParams, + TagRulesGetResponse, + TagRulesCreateOrUpdateOptionalParams, + TagRulesCreateOrUpdateResponse, + TagRulesDeleteOptionalParams, + TagRuleUpdate, + TagRulesUpdateOptionalParams, + TagRulesUpdateResponse, + TagRulesListByNewRelicMonitorResourceNextResponse +} from "../models"; + +/// +/** Class containing TagRules operations. */ +export class TagRulesImpl implements TagRules { + private readonly client: NewRelicObservability; + + /** + * Initialize a new instance of the class TagRules class. + * @param client Reference to the service client + */ + constructor(client: NewRelicObservability) { + this.client = client; + } + + /** + * List TagRule resources by NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + public listByNewRelicMonitorResource( + resourceGroupName: string, + monitorName: string, + options?: TagRulesListByNewRelicMonitorResourceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByNewRelicMonitorResourcePagingAll( + resourceGroupName, + monitorName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByNewRelicMonitorResourcePagingPage( + resourceGroupName, + monitorName, + options, + settings + ); + } + }; + } + + private async *listByNewRelicMonitorResourcePagingPage( + resourceGroupName: string, + monitorName: string, + options?: TagRulesListByNewRelicMonitorResourceOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: TagRulesListByNewRelicMonitorResourceResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByNewRelicMonitorResource( + resourceGroupName, + monitorName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByNewRelicMonitorResourceNext( + resourceGroupName, + monitorName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByNewRelicMonitorResourcePagingAll( + resourceGroupName: string, + monitorName: string, + options?: TagRulesListByNewRelicMonitorResourceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByNewRelicMonitorResourcePagingPage( + resourceGroupName, + monitorName, + options + )) { + yield* page; + } + } + + /** + * List TagRule resources by NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + private _listByNewRelicMonitorResource( + resourceGroupName: string, + monitorName: string, + options?: TagRulesListByNewRelicMonitorResourceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + listByNewRelicMonitorResourceOperationSpec + ); + } + + /** + * Get a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, ruleSetName, options }, + getOperationSpec + ); + } + + /** + * Create a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + resource: TagRule, + options?: TagRulesCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + TagRulesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, monitorName, ruleSetName, resource, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + TagRulesCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + resource: TagRule, + options?: TagRulesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + monitorName, + ruleSetName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesDeleteOptionalParams + ): 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, monitorName, ruleSetName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + monitorName, + ruleSetName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + properties: TagRuleUpdate, + options?: TagRulesUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, ruleSetName, properties, options }, + updateOperationSpec + ); + } + + /** + * ListByNewRelicMonitorResourceNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param nextLink The nextLink from the previous successful call to the ListByNewRelicMonitorResource + * method. + * @param options The options parameters. + */ + private _listByNewRelicMonitorResourceNext( + resourceGroupName: string, + monitorName: string, + nextLink: string, + options?: TagRulesListByNewRelicMonitorResourceNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, nextLink, options }, + listByNewRelicMonitorResourceNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByNewRelicMonitorResourceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TagRuleListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TagRule + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.ruleSetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.TagRule + }, + 201: { + bodyMapper: Mappers.TagRule + }, + 202: { + bodyMapper: Mappers.TagRule + }, + 204: { + bodyMapper: Mappers.TagRule + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.ruleSetName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.ruleSetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.TagRule + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.properties1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.ruleSetName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listByNewRelicMonitorResourceNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TagRuleListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/accounts.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/accounts.ts new file mode 100644 index 000000000000..70751f9f51ac --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/accounts.ts @@ -0,0 +1,26 @@ +/* + * 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 { AccountResource, AccountsListOptionalParams } from "../models"; + +/// +/** Interface representing a Accounts. */ +export interface Accounts { + /** + * List all the existing accounts + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param options The options parameters. + */ + list( + userEmail: string, + location: string, + options?: AccountsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/index.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..82c1c5ac8be6 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./accounts"; +export * from "./monitors"; +export * from "./organizations"; +export * from "./plans"; +export * from "./tagRules"; diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/monitors.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/monitors.ts new file mode 100644 index 000000000000..1c551026fac3 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/monitors.ts @@ -0,0 +1,231 @@ +/* + * 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 { + NewRelicMonitorResource, + MonitorsListBySubscriptionOptionalParams, + MonitorsListByResourceGroupOptionalParams, + AppServiceInfo, + AppServicesGetRequest, + MonitorsListAppServicesOptionalParams, + VMInfo, + HostsGetRequest, + MonitorsListHostsOptionalParams, + MonitoredResource, + MonitorsListMonitoredResourcesOptionalParams, + MonitorsGetOptionalParams, + MonitorsGetResponse, + MonitorsCreateOrUpdateOptionalParams, + MonitorsCreateOrUpdateResponse, + NewRelicMonitorResourceUpdate, + MonitorsUpdateOptionalParams, + MonitorsUpdateResponse, + MonitorsDeleteOptionalParams, + MetricsRequest, + MonitorsGetMetricRulesOptionalParams, + MonitorsGetMetricRulesResponse, + MetricsStatusRequest, + MonitorsGetMetricStatusOptionalParams, + MonitorsGetMetricStatusResponse, + SwitchBillingRequest, + MonitorsSwitchBillingOptionalParams, + MonitorsVmHostPayloadOptionalParams, + MonitorsVmHostPayloadResponse +} from "../models"; + +/// +/** Interface representing a Monitors. */ +export interface Monitors { + /** + * List NewRelicMonitorResource resources by subscription ID + * @param options The options parameters. + */ + listBySubscription( + options?: MonitorsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * List NewRelicMonitorResource resources by resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * List the app service resources currently being monitored by the NewRelic resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the app services get request. + * @param options The options parameters. + */ + listAppServices( + resourceGroupName: string, + monitorName: string, + request: AppServicesGetRequest, + options?: MonitorsListAppServicesOptionalParams + ): PagedAsyncIterableIterator; + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the Hosts get request. + * @param options The options parameters. + */ + listHosts( + resourceGroupName: string, + monitorName: string, + request: HostsGetRequest, + options?: MonitorsListHostsOptionalParams + ): PagedAsyncIterableIterator; + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + listMonitoredResources( + resourceGroupName: string, + monitorName: string, + options?: MonitorsListMonitoredResourcesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + options?: MonitorsGetOptionalParams + ): Promise; + /** + * Create a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + monitorName: string, + resource: NewRelicMonitorResource, + options?: MonitorsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + MonitorsCreateOrUpdateResponse + > + >; + /** + * Create a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + monitorName: string, + resource: NewRelicMonitorResource, + options?: MonitorsCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + monitorName: string, + properties: NewRelicMonitorResourceUpdate, + options?: MonitorsUpdateOptionalParams + ): Promise; + /** + * Delete a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + userEmail: string, + monitorName: string, + options?: MonitorsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + userEmail: string, + monitorName: string, + options?: MonitorsDeleteOptionalParams + ): Promise; + /** + * Get metric rules + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the get metrics status request. + * @param options The options parameters. + */ + getMetricRules( + resourceGroupName: string, + monitorName: string, + request: MetricsRequest, + options?: MonitorsGetMetricRulesOptionalParams + ): Promise; + /** + * Get metric status + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the get metrics status request. + * @param options The options parameters. + */ + getMetricStatus( + resourceGroupName: string, + monitorName: string, + request: MetricsStatusRequest, + options?: MonitorsGetMetricStatusOptionalParams + ): Promise; + /** + * Switches the billing for NewRelic monitor resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param request The details of the switch billing request. + * @param options The options parameters. + */ + switchBilling( + resourceGroupName: string, + monitorName: string, + request: SwitchBillingRequest, + options?: MonitorsSwitchBillingOptionalParams + ): Promise; + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a + * VM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + vmHostPayload( + resourceGroupName: string, + monitorName: string, + options?: MonitorsVmHostPayloadOptionalParams + ): Promise; +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/operations.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..5cf5581845bd --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List the operations for the provider + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/organizations.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/organizations.ts new file mode 100644 index 000000000000..da210fc6ab19 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/organizations.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + OrganizationResource, + OrganizationsListOptionalParams +} from "../models"; + +/// +/** Interface representing a Organizations. */ +export interface Organizations { + /** + * List all the existing organizations + * @param userEmail User Email. + * @param location Location for NewRelic. + * @param options The options parameters. + */ + list( + userEmail: string, + location: string, + options?: OrganizationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/plans.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/plans.ts new file mode 100644 index 000000000000..1f56a95b79b8 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/plans.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PlanDataResource, PlansListOptionalParams } from "../models"; + +/// +/** Interface representing a Plans. */ +export interface Plans { + /** + * List plans data + * @param options The options parameters. + */ + list( + options?: PlansListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/tagRules.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/tagRules.ts new file mode 100644 index 000000000000..63c513ce60a4 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/src/operationsInterfaces/tagRules.ts @@ -0,0 +1,127 @@ +/* + * 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 { + TagRule, + TagRulesListByNewRelicMonitorResourceOptionalParams, + TagRulesGetOptionalParams, + TagRulesGetResponse, + TagRulesCreateOrUpdateOptionalParams, + TagRulesCreateOrUpdateResponse, + TagRulesDeleteOptionalParams, + TagRuleUpdate, + TagRulesUpdateOptionalParams, + TagRulesUpdateResponse +} from "../models"; + +/// +/** Interface representing a TagRules. */ +export interface TagRules { + /** + * List TagRule resources by NewRelicMonitorResource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param options The options parameters. + */ + listByNewRelicMonitorResource( + resourceGroupName: string, + monitorName: string, + options?: TagRulesListByNewRelicMonitorResourceOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param options The options parameters. + */ + get( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesGetOptionalParams + ): Promise; + /** + * Create a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + resource: TagRule, + options?: TagRulesCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + TagRulesCreateOrUpdateResponse + > + >; + /** + * Create a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + resource: TagRule, + options?: TagRulesCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesDeleteOptionalParams + ): Promise; + /** + * Update a TagRule + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource + * @param ruleSetName Name of the TagRule + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + properties: TagRuleUpdate, + options?: TagRulesUpdateOptionalParams + ): Promise; +} diff --git a/sdk/newrelicobservability/arm-newrelicobservability/src/pagingHelper.ts b/sdk/newrelicobservability/arm-newrelicobservability/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/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/newrelicobservability/arm-newrelicobservability/test/newrelicobservability_operations_test.spec.ts.ts b/sdk/newrelicobservability/arm-newrelicobservability/test/newrelicobservability_operations_test.spec.ts.ts new file mode 100644 index 000000000000..53d650efd0b1 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/test/newrelicobservability_operations_test.spec.ts.ts @@ -0,0 +1,68 @@ +/* + * 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 { + env, + Recorder, + RecorderStartOptions, + delay, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { NewRelicObservability } from "../src/newRelicObservability"; + +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 +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("NewRelicObservability test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: NewRelicObservability; + let location: string; + let resourceGroup: string; + let resourcename: string; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + subscriptionId = env.SUBSCRIPTION_ID || ''; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new NewRelicObservability(credential, subscriptionId, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + resourcename = "resourcetest"; + + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("operations list test", async function () { + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + }); + +}) diff --git a/sdk/newrelicobservability/arm-newrelicobservability/tsconfig.json b/sdk/newrelicobservability/arm-newrelicobservability/tsconfig.json new file mode 100644 index 000000000000..d5412a5206c2 --- /dev/null +++ b/sdk/newrelicobservability/arm-newrelicobservability/tsconfig.json @@ -0,0 +1,33 @@ +{ + "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, + "paths": { + "@azure/arm-newrelicobservability": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/newrelicobservability/ci.mgmt.yml b/sdk/newrelicobservability/ci.mgmt.yml new file mode 100644 index 000000000000..a4fce24ef766 --- /dev/null +++ b/sdk/newrelicobservability/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/newrelicobservability/arm-newrelicobservability + - sdk/newrelicobservability/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/newrelicobservability/arm-newrelicobservability + - sdk/newrelicobservability/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: newrelicobservability + Artifacts: + - name: azure-arm-newrelicobservability + safeName: azurearmnewrelicobservability + \ No newline at end of file