diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index effaa47f703e..7a26b93b06fb 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1021,9 +1021,6 @@ importers: '@rush-temp/iot-modelsrepository': specifier: file:./projects/iot-modelsrepository.tgz version: file:projects/iot-modelsrepository.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1) - '@rush-temp/mcp-server': - specifier: file:./projects/mcp-server.tgz - version: file:projects/mcp-server.tgz(@types/debug@4.1.12)(@vitest/browser@3.1.2)(yaml@2.7.1) '@rush-temp/keyvault-admin': specifier: file:./projects/keyvault-admin.tgz version: file:projects/keyvault-admin.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1) @@ -1063,6 +1060,9 @@ importers: '@rush-temp/maps-timezone': specifier: file:./projects/maps-timezone.tgz version: file:projects/maps-timezone.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1) + '@rush-temp/mcp-server': + specifier: file:./projects/mcp-server.tgz + version: file:projects/mcp-server.tgz(@types/debug@4.1.12)(@vitest/browser@3.1.2)(yaml@2.7.1) '@rush-temp/microsoft-playwright-testing': specifier: file:./projects/microsoft-playwright-testing.tgz version: file:projects/microsoft-playwright-testing.tgz(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1) @@ -2674,7 +2674,7 @@ packages: version: 0.0.0 '@rush-temp/arm-datadog@file:projects/arm-datadog.tgz': - resolution: {integrity: sha512-qqd19/CYmGm0+BMbiFosKxnx+V4fYfIW9Af0yay/64Ry6ud23dDT1dhynXYP/XTbWp4tQMHby9hOtaPt8k54eA==, tarball: file:projects/arm-datadog.tgz} + resolution: {integrity: sha512-AE5Pc0n++tDRq3/CxJBzKzsVQ0EKNs7eVg/0U/ub9qIE9jlMVzJAZ8TqZcT5vyIgQNefjI5RlgxMQWOy/Mmyhw==, tarball: file:projects/arm-datadog.tgz} version: 0.0.0 '@rush-temp/arm-datafactory@file:projects/arm-datafactory.tgz': @@ -3669,10 +3669,6 @@ packages: resolution: {integrity: sha512-nVEawKXIhltEp1Zvua0E46Gdg0Hs5JJDFD7WPgqFBycYtQjRVsw60x49ZTi8ZxYXPJGQBJC2xLvj1fg/A5uhyQ==, tarball: file:projects/iot-modelsrepository.tgz} version: 0.0.0 - '@rush-temp/mcp-server@file:projects/mcp-server.tgz': - resolution: {integrity: sha512-DuCikdWUz6hleAR8EjUp7JD4VAGR1YMfNRAshvzJ7W20qAMV10dscYCo2wq8Eqt5TtEwLOrJFFfnbHwGIhNTZQ==, tarball: file:projects/mcp-server.tgz} - version: 0.0.0 - '@rush-temp/keyvault-admin@file:projects/keyvault-admin.tgz': resolution: {integrity: sha512-+pLp6hMMbEHRNWIWBJHEb3ovy65MoQthJRuwfDYdXDDYMYgiazL7j3CLleRz+WpDlI5kJ8gyD24pIqCoVZvQqg==, tarball: file:projects/keyvault-admin.tgz} version: 0.0.0 @@ -3725,6 +3721,10 @@ packages: resolution: {integrity: sha512-LLoNu/hOKIZ5/eLQ0io6I6kDPrnkiI1C3rDtG0DEQlP097B9CoeeaQ2E+qbGYUAPvvyo6QththExkcmgUENgEg==, tarball: file:projects/maps-timezone.tgz} version: 0.0.0 + '@rush-temp/mcp-server@file:projects/mcp-server.tgz': + resolution: {integrity: sha512-xVj0UA/iOcFZso/cQiQ1Ug5juexp+mJOhFwNBANfNb0bzXo9BRrgR2/0DxaTIIS0lest23qzU0nMQUiZPPetpA==, tarball: file:projects/mcp-server.tgz} + version: 0.0.0 + '@rush-temp/microsoft-playwright-testing@file:projects/microsoft-playwright-testing.tgz': resolution: {integrity: sha512-sVU4AhYy8i4VhihEGOHMZLmUggC15w2JvBfGUC+i+q7nxmE3sIbO+EzicltK811tg0QQML6lAzKonojrK4FO6g==, tarball: file:projects/microsoft-playwright-testing.tgz} version: 0.0.0 @@ -11645,11 +11645,11 @@ snapshots: '@rush-temp/arm-datadog@file:projects/arm-datadog.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1)': dependencies: - '@azure/core-lro': 2.7.2 '@types/node': 18.19.87 '@vitest/browser': 3.1.2(playwright@1.52.0)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(vitest@3.1.2) '@vitest/coverage-istanbul': 3.1.2(vitest@3.1.2) dotenv: 16.5.0 + eslint: 9.26.0 playwright: 1.52.0 tslib: 2.8.1 typescript: 5.8.3 @@ -20462,37 +20462,6 @@ snapshots: - webdriverio - yaml - '@rush-temp/mcp-server@file:projects/mcp-server.tgz(@types/debug@4.1.12)(@vitest/browser@3.1.2)(yaml@2.7.1)': - dependencies: - '@modelcontextprotocol/sdk': 1.11.0 - '@types/node': 18.19.87 - '@vitest/coverage-istanbul': 3.1.2(vitest@3.1.2) - '@vitest/expect': 3.1.2 - dotenv: 16.5.0 - eslint: 9.26.0 - tsx: 4.19.3 - typescript: 5.8.3 - vitest: 3.1.2(@types/debug@4.1.12)(@types/node@18.19.87)(@vitest/browser@3.1.2)(tsx@4.19.3)(yaml@2.7.1) - zod: 3.24.4 - transitivePeerDependencies: - - '@edge-runtime/vm' - - '@types/debug' - - '@vitest/browser' - - '@vitest/ui' - - happy-dom - - jiti - - jsdom - - less - - lightningcss - - msw - - sass - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - - yaml - '@rush-temp/keyvault-admin@file:projects/keyvault-admin.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1)': dependencies: '@azure/keyvault-keys': 4.9.0 @@ -20962,6 +20931,37 @@ snapshots: - webdriverio - yaml + '@rush-temp/mcp-server@file:projects/mcp-server.tgz(@types/debug@4.1.12)(@vitest/browser@3.1.2)(yaml@2.7.1)': + dependencies: + '@modelcontextprotocol/sdk': 1.11.0 + '@types/node': 18.19.87 + '@vitest/coverage-istanbul': 3.1.2(vitest@3.1.2) + '@vitest/expect': 3.1.2 + dotenv: 16.5.0 + eslint: 9.26.0 + tsx: 4.19.3 + typescript: 5.8.3 + vitest: 3.1.2(@types/debug@4.1.12)(@types/node@18.19.87)(@vitest/browser@3.1.2)(tsx@4.19.3)(yaml@2.7.1) + zod: 3.24.4 + transitivePeerDependencies: + - '@edge-runtime/vm' + - '@types/debug' + - '@vitest/browser' + - '@vitest/ui' + - happy-dom + - jiti + - jsdom + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - yaml + '@rush-temp/microsoft-playwright-testing@file:projects/microsoft-playwright-testing.tgz(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1)': dependencies: '@playwright/test': 1.52.0 diff --git a/sdk/datadog/arm-datadog/CHANGELOG.md b/sdk/datadog/arm-datadog/CHANGELOG.md deleted file mode 100644 index d8e71f90bb33..000000000000 --- a/sdk/datadog/arm-datadog/CHANGELOG.md +++ /dev/null @@ -1,61 +0,0 @@ -# Release History - -## 3.1.0 (2023-10-09) - -### Features Added - - - Added operation group CreationSupported - - Added operation group MonitoredSubscriptions - - Added Interface CreateResourceSupportedProperties - - Added Interface CreateResourceSupportedResponse - - Added Interface CreateResourceSupportedResponseList - - Added Interface CreationSupportedGetOptionalParams - - Added Interface CreationSupportedListOptionalParams - - Added Interface MonitoredSubscription - - Added Interface MonitoredSubscriptionProperties - - Added Interface MonitoredSubscriptionPropertiesList - - Added Interface MonitoredSubscriptionsCreateorUpdateOptionalParams - - Added Interface MonitoredSubscriptionsDeleteOptionalParams - - Added Interface MonitoredSubscriptionsGetOptionalParams - - Added Interface MonitoredSubscriptionsListOptionalParams - - Added Interface MonitoredSubscriptionsUpdateOptionalParams - - Added Interface SubscriptionList - - Added Type Alias CreationSupportedGetResponse - - Added Type Alias CreationSupportedListResponse - - Added Type Alias MonitoredSubscriptionsCreateorUpdateResponse - - Added Type Alias MonitoredSubscriptionsGetResponse - - Added Type Alias MonitoredSubscriptionsListResponse - - Added Type Alias MonitoredSubscriptionsUpdateResponse - - Added Type Alias Operation - - Added Type Alias Status - - Interface DatadogOrganizationProperties has a new optional parameter cspm - - Interface MonitoringTagRulesProperties has a new optional parameter automuting - - Interface MonitorUpdateProperties has a new optional parameter cspm - - Added Enum KnownOperation - - Added Enum KnownStatus - -## 3.0.2 (2022-11-21) - -### Features Added - - - Exposes `getContinuationToken` helper function to extract continuation token - -### Bugs Fixed - - - A series of small bug fixs relevant to authentication and apiVersion policy - -## 3.0.1 (2022-04-18) - -### Features Added - - - bug fix - -## 3.0.0 (2022-01-12) - -The package of @azure/arm-datadog is using our next generation design principles since version 3.0.0, which contains breaking changes. - -To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). - -To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). - -To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/datadog/arm-datadog/LICENSE b/sdk/datadog/arm-datadog/LICENSE index b2f52a2bad4e..63447fd8bbbf 100644 --- a/sdk/datadog/arm-datadog/LICENSE +++ b/sdk/datadog/arm-datadog/LICENSE @@ -18,4 +18,4 @@ 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. +SOFTWARE. \ No newline at end of file diff --git a/sdk/datadog/arm-datadog/README.md b/sdk/datadog/arm-datadog/README.md index 7a634dd2761a..4284f7e6d7a3 100644 --- a/sdk/datadog/arm-datadog/README.md +++ b/sdk/datadog/arm-datadog/README.md @@ -1,11 +1,15 @@ -# Azure Microsoft Datadog client library for JavaScript +# Azure Datadog client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Microsoft Datadog client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Datadog client. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-datadog) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-datadog) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + + +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-datadog) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-datadog?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog/samples) ## Getting started @@ -22,16 +26,16 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/arm-datadog` package -Install the Azure Microsoft Datadog client library for JavaScript with `npm`: +Install the Azure Datadog client library for JavaScript with `npm`: ```bash npm install @azure/arm-datadog ``` -### Create and authenticate a `MicrosoftDatadogClient` +### Create and authenticate a `DatadogClient` -To create a client object to access the Azure Microsoft Datadog API, you will need the `endpoint` of your Azure Microsoft Datadog resource and a `credential`. The Azure Microsoft Datadog client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure Microsoft Datadog resource in the [Azure Portal][azure_portal]. +To create a client object to access the Azure Datadog API, you will need the `endpoint` of your Azure Datadog resource and a `credential`. The Azure Datadog client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Datadog 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). @@ -41,44 +45,42 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure Microsoft Datadog** 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`. +You will also need to **register a new AAD application and grant access to Azure Datadog** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client. ```ts snippet:ReadmeSampleCreateClient_Node -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; const subscriptionId = "00000000-0000-0000-0000-000000000000"; -const client = new MicrosoftDatadogClient(new DefaultAzureCredential(), subscriptionId); +const client = new DatadogClient(new DefaultAzureCredential(), subscriptionId); ``` For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate. ```ts snippet:ReadmeSampleCreateClient_Browser import { InteractiveBrowserCredential } from "@azure/identity"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +import { DatadogClient } from "@azure/arm-datadog"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", - clientId: "", -}); -const client = new MicrosoftDatadogClient(credential, subscriptionId); + clientId: "" + }); +const client = new DatadogClient(credential, subscriptionId); ``` -### JavaScript Bundle +### 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 -### MicrosoftDatadogClient +### DatadogClient -`MicrosoftDatadogClient` is the primary interface for developers using the Azure Microsoft Datadog client library. Explore the methods on this client object to understand the different features of the Azure Microsoft Datadog service that you can access. +`DatadogClient` is the primary interface for developers using the Azure Datadog client library. Explore the methods on this client object to understand the different features of the Azure Datadog service that you can access. ## Troubleshooting @@ -96,7 +98,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## 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. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog/samples) directory for detailed examples on how to use this library. ## Contributing @@ -106,10 +108,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - - -[azure_cli]: https://learn.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 diff --git a/sdk/datadog/arm-datadog/_meta.json b/sdk/datadog/arm-datadog/_meta.json deleted file mode 100644 index 92ed983d47d3..000000000000 --- a/sdk/datadog/arm-datadog/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "583e15ceb4cf23dc23b2300bd352f16d781e69ac", - "readme": "specification/datadog/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\datadog\\resource-manager\\readme.md --use=@autorest/typescript@6.0.12 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.4", - "use": "@autorest/typescript@6.0.12" -} diff --git a/sdk/datadog/arm-datadog/assets.json b/sdk/datadog/arm-datadog/assets.json deleted file mode 100644 index 2b255d479639..000000000000 --- a/sdk/datadog/arm-datadog/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/datadog/arm-datadog", - "Tag": "js/datadog/arm-datadog_2923beb389" -} diff --git a/sdk/datadog/arm-datadog/eslint.config.mjs b/sdk/datadog/arm-datadog/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/datadog/arm-datadog/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]); diff --git a/sdk/datadog/arm-datadog/package.json b/sdk/datadog/arm-datadog/package.json index 1d8084f24211..5dad6719d1ea 100644 --- a/sdk/datadog/arm-datadog/package.json +++ b/sdk/datadog/arm-datadog/package.json @@ -1,133 +1,130 @@ { "name": "@azure/arm-datadog", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for MicrosoftDatadogClient.", "version": "3.1.0", + "description": "A generated SDK for DatadogClient.", "engines": { "node": ">=18.0.0" }, - "dependencies": { - "@azure/abort-controller": "^2.1.2", - "@azure/core-auth": "^1.9.0", - "@azure/core-client": "^1.9.2", - "@azure/core-lro": "^2.5.4", - "@azure/core-paging": "^1.6.2", - "@azure/core-rest-pipeline": "^1.18.2", - "tslib": "^2.8.1" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/creationSupportedOperationGroup": "src/api/creationSupportedOperationGroup/index.ts", + "./api/marketplaceAgreementsOperationGroup": "src/api/marketplaceAgreementsOperationGroup/index.ts", + "./api/monitoredSubscriptions": "src/api/monitoredSubscriptions/index.ts", + "./api/datadogSingleSignOnResources": "src/api/datadogSingleSignOnResources/index.ts", + "./api/tagRules": "src/api/tagRules/index.ts", + "./api/datadogMonitorResources": "src/api/datadogMonitorResources/index.ts", + "./api/operations": "src/api/operations/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false, + "project": "./tsconfig.src.json" }, + "type": "module", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", - "isomorphic", - "cloud" + "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", + "files": [ + "dist/", + "README.md", + "LICENSE", + "review/", + "CHANGELOG.md" + ], + "sdk-type": "mgmt", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/datadogContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/core-util": "^1.12.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, "devDependencies": { "@azure-tools/test-credential": "^2.0.0", "@azure-tools/test-recorder": "^4.1.0", "@azure-tools/test-utils-vitest": "^1.0.0", "@azure/dev-tool": "^1.0.0", - "@azure/identity": "^4.6.0", - "@azure/logger": "^1.1.4", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^4.9.1", "@types/node": "^18.0.0", "@vitest/browser": "^3.0.9", "@vitest/coverage-istanbul": "^3.0.9", "dotenv": "^16.0.0", - "playwright": "^1.50.0", + "eslint": "^9.9.0", + "playwright": "^1.52.0", "typescript": "~5.8.2", "vitest": "^3.0.9" }, - "repository": "github:Azure/azure-sdk-for-js", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" - ], "scripts": { "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "echo skipped.", - "check-format": "echo skipped", + "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", + "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", + "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", - "lint": "echo skipped", + "execute:samples": "dev-tool samples run samples-dev", + "extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "lint": "eslint package.json api-extractor.json src test", + "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", + "minify": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "pack": "npm pack 2>&1", - "prepack": "npm run build", - "test": "npm run test:node && npm run test:browser", + "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", "test:browser": "echo skipped", "test:node": "dev-tool run test:vitest", - "test:node:esm": "dev-tool run test:vitest --esm", - "update-snippets": "dev-tool run update-snippets" - }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/microsoftDatadogClient.ts", - "prefix": "packageDetails" - } - ] + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", + "unit-test:node": "dev-tool run test:vitest", + "update-snippets": "dev-tool run update-snippets", + "test:node:esm": "dev-tool run test:vitest --esm" }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-datadog", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-datadog?view=azure-node-preview" }, - "type": "module", - "tshy": { - "project": "./tsconfig.src.json", - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false - }, "browser": "./dist/browser/index.js", - "react-native": "./dist/react-native/index.js", - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "react-native": { - "types": "./dist/react-native/index.d.ts", - "default": "./dist/react-native/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } - } + "react-native": "./dist/react-native/index.js" } diff --git a/sdk/datadog/arm-datadog/review/arm-datadog.api.md b/sdk/datadog/arm-datadog/review/arm-datadog.api.md deleted file mode 100644 index 046e8f38da18..000000000000 --- a/sdk/datadog/arm-datadog/review/arm-datadog.api.md +++ /dev/null @@ -1,867 +0,0 @@ -## API Report File for "@azure/arm-datadog" - -> 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 CreatedByType = string; - -// @public -export interface CreateResourceSupportedProperties { - readonly creationSupported?: boolean; - readonly name?: string; -} - -// @public -export interface CreateResourceSupportedResponse { - properties?: CreateResourceSupportedProperties; -} - -// @public (undocumented) -export interface CreateResourceSupportedResponseList { - // (undocumented) - value?: CreateResourceSupportedResponse[]; -} - -// @public -export interface CreationSupported { - get(datadogOrganizationId: string, options?: CreationSupportedGetOptionalParams): Promise; - list(datadogOrganizationId: string, options?: CreationSupportedListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface CreationSupportedGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CreationSupportedGetResponse = CreateResourceSupportedResponse; - -// @public -export interface CreationSupportedListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CreationSupportedListResponse = CreateResourceSupportedResponseList; - -// @public -export interface DatadogAgreementProperties { - accepted?: boolean; - licenseTextLink?: string; - plan?: string; - privacyPolicyLink?: string; - product?: string; - publisher?: string; - retrieveDatetime?: Date; - signature?: string; -} - -// @public (undocumented) -export interface DatadogAgreementResource { - readonly id?: string; - readonly name?: string; - properties?: DatadogAgreementProperties; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export interface DatadogAgreementResourceListResponse { - nextLink?: string; - value?: DatadogAgreementResource[]; -} - -// @public (undocumented) -export interface DatadogApiKey { - created?: string; - createdBy?: string; - key: string; - name?: string; -} - -// @public -export interface DatadogApiKeyListResponse { - nextLink?: string; - value?: DatadogApiKey[]; -} - -// @public (undocumented) -export interface DatadogHost { - aliases?: string[]; - apps?: string[]; - // (undocumented) - meta?: DatadogHostMetadata; - name?: string; -} - -// @public -export interface DatadogHostListResponse { - nextLink?: string; - value?: DatadogHost[]; -} - -// @public (undocumented) -export interface DatadogHostMetadata { - agentVersion?: string; - // (undocumented) - installMethod?: DatadogInstallMethod; - // (undocumented) - logsAgent?: DatadogLogsAgent; -} - -// @public (undocumented) -export interface DatadogInstallMethod { - installerVersion?: string; - tool?: string; - toolVersion?: string; -} - -// @public (undocumented) -export interface DatadogLogsAgent { - transport?: string; -} - -// @public (undocumented) -export interface DatadogMonitorResource { - readonly id?: string; - // (undocumented) - identity?: IdentityProperties; - // (undocumented) - location: string; - readonly name?: string; - properties?: MonitorProperties; - // (undocumented) - sku?: ResourceSku; - readonly systemData?: SystemData; - tags?: { - [propertyName: string]: string; - }; - readonly type?: string; -} - -// @public -export interface DatadogMonitorResourceListResponse { - nextLink?: string; - value?: DatadogMonitorResource[]; -} - -// @public -export interface DatadogMonitorResourceUpdateParameters { - properties?: MonitorUpdateProperties; - // (undocumented) - sku?: ResourceSku; - tags?: { - [propertyName: string]: string; - }; -} - -// @public -export interface DatadogOrganizationProperties { - apiKey?: string; - applicationKey?: string; - cspm?: boolean; - enterpriseAppId?: string; - id?: string; - linkingAuthCode?: string; - linkingClientId?: string; - name?: string; - redirectUri?: string; -} - -// @public (undocumented) -export interface DatadogSetPasswordLink { - // (undocumented) - setPasswordLink?: string; -} - -// @public (undocumented) -export interface DatadogSingleSignOnProperties { - enterpriseAppId?: string; - readonly provisioningState?: ProvisioningState; - singleSignOnState?: SingleSignOnStates; - readonly singleSignOnUrl?: string; -} - -// @public (undocumented) -export interface DatadogSingleSignOnResource { - readonly id?: string; - readonly name?: string; - // (undocumented) - properties?: DatadogSingleSignOnProperties; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export interface DatadogSingleSignOnResourceListResponse { - nextLink?: string; - value?: DatadogSingleSignOnResource[]; -} - -// @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 (undocumented) -export interface IdentityProperties { - readonly principalId?: string; - readonly tenantId?: string; - type?: ManagedIdentityTypes; -} - -// @public -export enum KnownCreatedByType { - Application = "Application", - Key = "Key", - ManagedIdentity = "ManagedIdentity", - User = "User" -} - -// @public -export enum KnownLiftrResourceCategories { - MonitorLogs = "MonitorLogs", - Unknown = "Unknown" -} - -// @public -export enum KnownManagedIdentityTypes { - SystemAssigned = "SystemAssigned", - UserAssigned = "UserAssigned" -} - -// @public -export enum KnownMarketplaceSubscriptionStatus { - Active = "Active", - Provisioning = "Provisioning", - Suspended = "Suspended", - Unsubscribed = "Unsubscribed" -} - -// @public -export enum KnownMonitoringStatus { - Disabled = "Disabled", - Enabled = "Enabled" -} - -// @public -export enum KnownOperation { - Active = "Active", - AddBegin = "AddBegin", - AddComplete = "AddComplete", - DeleteBegin = "DeleteBegin", - DeleteComplete = "DeleteComplete" -} - -// @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 KnownSingleSignOnStates { - Disable = "Disable", - Enable = "Enable", - Existing = "Existing", - Initial = "Initial" -} - -// @public -export enum KnownStatus { - Active = "Active", - Deleting = "Deleting", - Failed = "Failed", - InProgress = "InProgress" -} - -// @public -export enum KnownTagAction { - Exclude = "Exclude", - Include = "Include" -} - -// @public -export type LiftrResourceCategories = string; - -// @public -export interface LinkedResource { - id?: string; -} - -// @public -export interface LinkedResourceListResponse { - nextLink?: string; - value?: LinkedResource[]; -} - -// @public -export interface LogRules { - filteringTags?: FilteringTag[]; - sendAadLogs?: boolean; - sendResourceLogs?: boolean; - sendSubscriptionLogs?: boolean; -} - -// @public -export type ManagedIdentityTypes = string; - -// @public -export interface MarketplaceAgreements { - createOrUpdate(options?: MarketplaceAgreementsCreateOrUpdateOptionalParams): Promise; - list(options?: MarketplaceAgreementsListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface MarketplaceAgreementsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - // (undocumented) - body?: DatadogAgreementResource; -} - -// @public -export type MarketplaceAgreementsCreateOrUpdateResponse = DatadogAgreementResource; - -// @public -export interface MarketplaceAgreementsListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MarketplaceAgreementsListNextResponse = DatadogAgreementResourceListResponse; - -// @public -export interface MarketplaceAgreementsListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MarketplaceAgreementsListResponse = DatadogAgreementResourceListResponse; - -// @public -export type MarketplaceSubscriptionStatus = string; - -// @public -export interface MetricRules { - filteringTags?: FilteringTag[]; -} - -// @public (undocumented) -export class MicrosoftDatadogClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MicrosoftDatadogClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - creationSupported: CreationSupported; - // (undocumented) - marketplaceAgreements: MarketplaceAgreements; - // (undocumented) - monitoredSubscriptions: MonitoredSubscriptions; - // (undocumented) - monitors: Monitors; - // (undocumented) - operations: Operations; - // (undocumented) - singleSignOnConfigurations: SingleSignOnConfigurations; - // (undocumented) - subscriptionId: string; - // (undocumented) - tagRules: TagRules; -} - -// @public -export interface MicrosoftDatadogClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; - apiVersion?: string; - endpoint?: string; -} - -// @public -export interface MonitoredResource { - id?: string; - reasonForLogsStatus?: string; - reasonForMetricsStatus?: string; - sendingLogs?: boolean; - sendingMetrics?: boolean; -} - -// @public -export interface MonitoredResourceListResponse { - nextLink?: string; - value?: MonitoredResource[]; -} - -// @public -export interface MonitoredSubscription { - error?: string; - status?: Status; - subscriptionId?: string; - tagRules?: MonitoringTagRulesProperties; -} - -// @public -export interface MonitoredSubscriptionProperties { - readonly id?: string; - readonly name?: string; - properties?: SubscriptionList; - readonly type?: string; -} - -// @public (undocumented) -export interface MonitoredSubscriptionPropertiesList { - // (undocumented) - value?: MonitoredSubscriptionProperties[]; -} - -// @public -export interface MonitoredSubscriptions { - beginCreateorUpdate(resourceGroupName: string, monitorName: string, configurationName: string, options?: MonitoredSubscriptionsCreateorUpdateOptionalParams): Promise, MonitoredSubscriptionsCreateorUpdateResponse>>; - beginCreateorUpdateAndWait(resourceGroupName: string, monitorName: string, configurationName: string, options?: MonitoredSubscriptionsCreateorUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, monitorName: string, configurationName: string, options?: MonitoredSubscriptionsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, monitorName: string, configurationName: string, options?: MonitoredSubscriptionsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, monitorName: string, configurationName: string, options?: MonitoredSubscriptionsUpdateOptionalParams): Promise, MonitoredSubscriptionsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, monitorName: string, configurationName: string, options?: MonitoredSubscriptionsUpdateOptionalParams): Promise; - get(resourceGroupName: string, monitorName: string, configurationName: string, options?: MonitoredSubscriptionsGetOptionalParams): Promise; - list(resourceGroupName: string, monitorName: string, options?: MonitoredSubscriptionsListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface MonitoredSubscriptionsCreateorUpdateOptionalParams extends coreClient.OperationOptions { - body?: MonitoredSubscriptionProperties; - resumeFrom?: string; - updateIntervalInMs?: number; -} - -// @public -export type MonitoredSubscriptionsCreateorUpdateResponse = MonitoredSubscriptionProperties; - -// @public -export interface MonitoredSubscriptionsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; -} - -// @public -export interface MonitoredSubscriptionsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitoredSubscriptionsGetResponse = MonitoredSubscriptionProperties; - -// @public -export interface MonitoredSubscriptionsListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitoredSubscriptionsListResponse = MonitoredSubscriptionPropertiesList; - -// @public -export interface MonitoredSubscriptionsUpdateOptionalParams extends coreClient.OperationOptions { - body?: MonitoredSubscriptionProperties; - resumeFrom?: string; - updateIntervalInMs?: number; -} - -// @public -export type MonitoredSubscriptionsUpdateResponse = MonitoredSubscriptionProperties; - -// @public -export type MonitoringStatus = string; - -// @public -export interface MonitoringTagRules { - readonly id?: string; - readonly name?: string; - properties?: MonitoringTagRulesProperties; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export interface MonitoringTagRulesListResponse { - nextLink?: string; - value?: MonitoringTagRules[]; -} - -// @public -export interface MonitoringTagRulesProperties { - automuting?: boolean; - logRules?: LogRules; - metricRules?: MetricRules; - readonly provisioningState?: ProvisioningState; -} - -// @public -export interface MonitorProperties { - datadogOrganizationProperties?: DatadogOrganizationProperties; - readonly liftrResourceCategory?: LiftrResourceCategories; - readonly liftrResourcePreference?: number; - readonly marketplaceSubscriptionStatus?: MarketplaceSubscriptionStatus; - monitoringStatus?: MonitoringStatus; - readonly provisioningState?: ProvisioningState; - userInfo?: UserInfo; -} - -// @public -export interface Monitors { - beginCreate(resourceGroupName: string, monitorName: string, options?: MonitorsCreateOptionalParams): Promise, MonitorsCreateResponse>>; - beginCreateAndWait(resourceGroupName: string, monitorName: string, options?: MonitorsCreateOptionalParams): Promise; - beginDelete(resourceGroupName: string, monitorName: string, options?: MonitorsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, monitorName: string, options?: MonitorsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, monitorName: string, options?: MonitorsUpdateOptionalParams): Promise, MonitorsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, monitorName: string, options?: MonitorsUpdateOptionalParams): Promise; - get(resourceGroupName: string, monitorName: string, options?: MonitorsGetOptionalParams): Promise; - getDefaultKey(resourceGroupName: string, monitorName: string, options?: MonitorsGetDefaultKeyOptionalParams): Promise; - list(options?: MonitorsListOptionalParams): PagedAsyncIterableIterator; - listApiKeys(resourceGroupName: string, monitorName: string, options?: MonitorsListApiKeysOptionalParams): PagedAsyncIterableIterator; - listByResourceGroup(resourceGroupName: string, options?: MonitorsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listHosts(resourceGroupName: string, monitorName: string, options?: MonitorsListHostsOptionalParams): PagedAsyncIterableIterator; - listLinkedResources(resourceGroupName: string, monitorName: string, options?: MonitorsListLinkedResourcesOptionalParams): PagedAsyncIterableIterator; - listMonitoredResources(resourceGroupName: string, monitorName: string, options?: MonitorsListMonitoredResourcesOptionalParams): PagedAsyncIterableIterator; - refreshSetPasswordLink(resourceGroupName: string, monitorName: string, options?: MonitorsRefreshSetPasswordLinkOptionalParams): Promise; - setDefaultKey(resourceGroupName: string, monitorName: string, options?: MonitorsSetDefaultKeyOptionalParams): Promise; -} - -// @public -export interface MonitorsCreateOptionalParams extends coreClient.OperationOptions { - // (undocumented) - body?: DatadogMonitorResource; - resumeFrom?: string; - updateIntervalInMs?: number; -} - -// @public -export type MonitorsCreateResponse = DatadogMonitorResource; - -// @public -export interface MonitorsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; -} - -// @public -export interface MonitorsGetDefaultKeyOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsGetDefaultKeyResponse = DatadogApiKey; - -// @public -export interface MonitorsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsGetResponse = DatadogMonitorResource; - -// @public -export interface MonitorsListApiKeysNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListApiKeysNextResponse = DatadogApiKeyListResponse; - -// @public -export interface MonitorsListApiKeysOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListApiKeysResponse = DatadogApiKeyListResponse; - -// @public -export interface MonitorsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListByResourceGroupNextResponse = DatadogMonitorResourceListResponse; - -// @public -export interface MonitorsListByResourceGroupOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListByResourceGroupResponse = DatadogMonitorResourceListResponse; - -// @public -export interface MonitorsListHostsNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListHostsNextResponse = DatadogHostListResponse; - -// @public -export interface MonitorsListHostsOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListHostsResponse = DatadogHostListResponse; - -// @public -export interface MonitorsListLinkedResourcesNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListLinkedResourcesNextResponse = LinkedResourceListResponse; - -// @public -export interface MonitorsListLinkedResourcesOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListLinkedResourcesResponse = LinkedResourceListResponse; - -// @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 MonitorsListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListNextResponse = DatadogMonitorResourceListResponse; - -// @public -export interface MonitorsListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsListResponse = DatadogMonitorResourceListResponse; - -// @public -export interface MonitorsRefreshSetPasswordLinkOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MonitorsRefreshSetPasswordLinkResponse = DatadogSetPasswordLink; - -// @public -export interface MonitorsSetDefaultKeyOptionalParams extends coreClient.OperationOptions { - // (undocumented) - body?: DatadogApiKey; -} - -// @public -export interface MonitorsUpdateOptionalParams extends coreClient.OperationOptions { - body?: DatadogMonitorResourceUpdateParameters; - resumeFrom?: string; - updateIntervalInMs?: number; -} - -// @public -export type MonitorsUpdateResponse = DatadogMonitorResource; - -// @public -export interface MonitorUpdateProperties { - cspm?: boolean; - monitoringStatus?: MonitoringStatus; -} - -// @public -export type Operation = string; - -// @public -export interface OperationDisplay { - description?: string; - operation?: string; - provider?: string; - resource?: string; -} - -// @public -export interface OperationListResult { - nextLink?: string; - value?: OperationResult[]; -} - -// @public -export interface OperationResult { - display?: OperationDisplay; - isDataAction?: boolean; - name?: string; -} - -// @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type OperationsListNextResponse = OperationListResult; - -// @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type OperationsListResponse = OperationListResult; - -// @public -export type ProvisioningState = string; - -// @public (undocumented) -export interface ResourceSku { - name: string; -} - -// @public -export interface SingleSignOnConfigurations { - beginCreateOrUpdate(resourceGroupName: string, monitorName: string, configurationName: string, options?: SingleSignOnConfigurationsCreateOrUpdateOptionalParams): Promise, SingleSignOnConfigurationsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, monitorName: string, configurationName: string, options?: SingleSignOnConfigurationsCreateOrUpdateOptionalParams): Promise; - get(resourceGroupName: string, monitorName: string, configurationName: string, options?: SingleSignOnConfigurationsGetOptionalParams): Promise; - list(resourceGroupName: string, monitorName: string, options?: SingleSignOnConfigurationsListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface SingleSignOnConfigurationsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - // (undocumented) - body?: DatadogSingleSignOnResource; - resumeFrom?: string; - updateIntervalInMs?: number; -} - -// @public -export type SingleSignOnConfigurationsCreateOrUpdateResponse = DatadogSingleSignOnResource; - -// @public -export interface SingleSignOnConfigurationsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type SingleSignOnConfigurationsGetResponse = DatadogSingleSignOnResource; - -// @public -export interface SingleSignOnConfigurationsListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type SingleSignOnConfigurationsListNextResponse = DatadogSingleSignOnResourceListResponse; - -// @public -export interface SingleSignOnConfigurationsListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type SingleSignOnConfigurationsListResponse = DatadogSingleSignOnResourceListResponse; - -// @public -export type SingleSignOnStates = string; - -// @public -export type Status = string; - -// @public -export interface SubscriptionList { - monitoredSubscriptionList?: MonitoredSubscription[]; - operation?: Operation; -} - -// @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; -} - -// @public -export type TagAction = string; - -// @public -export interface TagRules { - createOrUpdate(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: TagRulesCreateOrUpdateOptionalParams): Promise; - get(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: TagRulesGetOptionalParams): Promise; - list(resourceGroupName: string, monitorName: string, options?: TagRulesListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface TagRulesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - body?: MonitoringTagRules; -} - -// @public -export type TagRulesCreateOrUpdateResponse = MonitoringTagRules; - -// @public -export interface TagRulesGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type TagRulesGetResponse = MonitoringTagRules; - -// @public -export interface TagRulesListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type TagRulesListNextResponse = MonitoringTagRulesListResponse; - -// @public -export interface TagRulesListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type TagRulesListResponse = MonitoringTagRulesListResponse; - -// @public -export interface UserInfo { - emailAddress?: string; - name?: string; - phoneNumber?: string; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/datadog/arm-datadog/sample.env b/sdk/datadog/arm-datadog/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/datadog/arm-datadog/sample.env +++ b/sdk/datadog/arm-datadog/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/datadog/arm-datadog/samples-dev/creationSupportedGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/creationSupportedGetSample.ts deleted file mode 100644 index 57687a08b402..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/creationSupportedGetSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Informs if the current subscription is being already monitored for selected Datadog organization. - * - * @summary Informs if the current subscription is being already monitored for selected Datadog organization. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_Get.json - */ -async function creationSupportedGet(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const datadogOrganizationId = "00000000-0000-0000-0000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.creationSupported.get(datadogOrganizationId); - console.log(result); -} - -async function main(): Promise { - await creationSupportedGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/creationSupportedListSample.ts b/sdk/datadog/arm-datadog/samples-dev/creationSupportedListSample.ts deleted file mode 100644 index afebbca66b13..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/creationSupportedListSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Informs if the current subscription is being already monitored for selected Datadog organization. - * - * @summary Informs if the current subscription is being already monitored for selected Datadog organization. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_List.json - */ -async function creationSupportedList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const datadogOrganizationId = "00000000-0000-0000-0000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.creationSupported.list(datadogOrganizationId)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await creationSupportedList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/creationSupportedOperationGroupGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/creationSupportedOperationGroupGetSample.ts new file mode 100644 index 000000000000..1ede35718b93 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/creationSupportedOperationGroupGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to informs if the current subscription is being already monitored for selected Datadog organization. + * + * @summary informs if the current subscription is being already monitored for selected Datadog organization. + * x-ms-original-file: 2023-10-20/CreationSupported_Get.json + */ +async function creationSupportedGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.creationSupportedOperationGroup.get("00000000-0000-0000-0000"); + console.log(result); +} + +async function main(): Promise { + await creationSupportedGet(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/creationSupportedOperationGroupListSample.ts b/sdk/datadog/arm-datadog/samples-dev/creationSupportedOperationGroupListSample.ts new file mode 100644 index 000000000000..6f3e661b91ed --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/creationSupportedOperationGroupListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to informs if the current subscription is being already monitored for selected Datadog organization. + * + * @summary informs if the current subscription is being already monitored for selected Datadog organization. + * x-ms-original-file: 2023-10-20/CreationSupported_List.json + */ +async function creationSupportedList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.creationSupportedOperationGroup.list("00000000-0000-0000-0000")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await creationSupportedList(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesBillingInfoGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesBillingInfoGetSample.ts new file mode 100644 index 000000000000..8eecddfa5b17 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesBillingInfoGetSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get marketplace and organization info mapped to the given monitor. + * + * @summary get marketplace and organization info mapped to the given monitor. + * x-ms-original-file: 2023-10-20/BillingInfo_Get.json + */ +async function billingInfoGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.datadogMonitorResources.billingInfoGet( + "myResourceGroup", + "myMonitor", + ); + console.log(result); +} + +async function main(): Promise { + await billingInfoGet(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesCreateSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesCreateSample.ts new file mode 100644 index 000000000000..5068b3fbf85a --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesCreateSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a monitor resource. + * + * @summary create a monitor resource. + * x-ms-original-file: 2023-10-20/Monitors_Create.json + */ +async function monitorsCreate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.datadogMonitorResources.create("myResourceGroup", "myMonitor"); + console.log(result); +} + +async function main(): Promise { + await monitorsCreate(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesDeleteSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesDeleteSample.ts new file mode 100644 index 000000000000..1fa2d4be5688 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a monitor resource. + * + * @summary delete a monitor resource. + * x-ms-original-file: 2023-10-20/Monitors_Delete.json + */ +async function monitorsDelete(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + await client.datadogMonitorResources.delete("myResourceGroup", "myMonitor"); +} + +async function main(): Promise { + await monitorsDelete(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesGetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesGetDefaultKeySample.ts new file mode 100644 index 000000000000..7eefa172c34b --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesGetDefaultKeySample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the default api key. + * + * @summary get the default api key. + * x-ms-original-file: 2023-10-20/ApiKeys_GetDefaultKey.json + */ +async function monitorsGetDefaultKey(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.datadogMonitorResources.getDefaultKey("myResourceGroup", "myMonitor"); + console.log(result); +} + +async function main(): Promise { + await monitorsGetDefaultKey(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesGetSample.ts new file mode 100644 index 000000000000..7cd7b548dc52 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the properties of a specific monitor resource. + * + * @summary get the properties of a specific monitor resource. + * x-ms-original-file: 2023-10-20/Monitors_Get.json + */ +async function monitorsGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.datadogMonitorResources.get("myResourceGroup", "myMonitor"); + console.log(result); +} + +async function main(): Promise { + await monitorsGet(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListApiKeysSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListApiKeysSample.ts new file mode 100644 index 000000000000..08812e736b0a --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListApiKeysSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the api keys for a given monitor resource. + * + * @summary list the api keys for a given monitor resource. + * x-ms-original-file: 2023-10-20/ApiKeys_List.json + */ +async function monitorsListApiKeys(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.datadogMonitorResources.listApiKeys( + "myResourceGroup", + "myMonitor", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await monitorsListApiKeys(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListByResourceGroupSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListByResourceGroupSample.ts new file mode 100644 index 000000000000..7cd02fe589c5 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list all monitors under the specified resource group. + * + * @summary list all monitors under the specified resource group. + * x-ms-original-file: 2023-10-20/Monitors_ListByResourceGroup.json + */ +async function monitorsListByResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.datadogMonitorResources.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await monitorsListByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListHostsSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListHostsSample.ts new file mode 100644 index 000000000000..4f7019c8575b --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListHostsSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the hosts for a given monitor resource. + * + * @summary list the hosts for a given monitor resource. + * x-ms-original-file: 2023-10-20/Hosts_List.json + */ +async function monitorsListHosts(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.datadogMonitorResources.listHosts( + "myResourceGroup", + "myMonitor", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await monitorsListHosts(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListLinkedResourcesSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListLinkedResourcesSample.ts new file mode 100644 index 000000000000..54caed45ab4f --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListLinkedResourcesSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list all Azure resources associated to the same Datadog organization as the target resource. + * + * @summary list all Azure resources associated to the same Datadog organization as the target resource. + * x-ms-original-file: 2023-10-20/LinkedResources_List.json + */ +async function monitorsListLinkedResources(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.datadogMonitorResources.listLinkedResources( + "myResourceGroup", + "myMonitor", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await monitorsListLinkedResources(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListMonitoredResourcesSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListMonitoredResourcesSample.ts new file mode 100644 index 000000000000..76aac8f77dcf --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListMonitoredResourcesSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the resources currently being monitored by the Datadog monitor resource. + * + * @summary list the resources currently being monitored by the Datadog monitor resource. + * x-ms-original-file: 2023-10-20/MonitoredResources_List.json + */ +async function monitorsListMonitoredResources(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.datadogMonitorResources.listMonitoredResources( + "myResourceGroup", + "myMonitor", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await monitorsListMonitoredResources(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListSample.ts new file mode 100644 index 000000000000..b865fb66f4ea --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list all monitors under the specified subscription. + * + * @summary list all monitors under the specified subscription. + * x-ms-original-file: 2023-10-20/Monitors_List.json + */ +async function monitorsList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.datadogMonitorResources.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await monitorsList(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesRefreshSetPasswordLinkSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesRefreshSetPasswordLinkSample.ts new file mode 100644 index 000000000000..61d28158b8ba --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesRefreshSetPasswordLinkSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to refresh the set password link and return a latest one. + * + * @summary refresh the set password link and return a latest one. + * x-ms-original-file: 2023-10-20/RefreshSetPassword_Get.json + */ +async function monitorsRefreshSetPasswordLink(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.datadogMonitorResources.refreshSetPasswordLink( + "myResourceGroup", + "myMonitor", + ); + console.log(result); +} + +async function main(): Promise { + await monitorsRefreshSetPasswordLink(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesSetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesSetDefaultKeySample.ts new file mode 100644 index 000000000000..995d84938200 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesSetDefaultKeySample.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to set the default api key. + * + * @summary set the default api key. + * x-ms-original-file: 2023-10-20/ApiKeys_SetDefaultKey.json + */ +async function monitorsSetDefaultKey(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + await client.datadogMonitorResources.setDefaultKey("myResourceGroup", "myMonitor", { + body: { key: "1111111111111111aaaaaaaaaaaaaaaa" }, + }); +} + +async function main(): Promise { + await monitorsSetDefaultKey(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesUpdateSample.ts new file mode 100644 index 000000000000..40874307ed82 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogMonitorResourcesUpdateSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a monitor resource. + * + * @summary update a monitor resource. + * x-ms-original-file: 2023-10-20/Monitors_Update.json + */ +async function monitorsUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + await client.datadogMonitorResources.update("myResourceGroup", "myMonitor"); +} + +async function main(): Promise { + await monitorsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..721850d583e3 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesCreateOrUpdateSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to configures single-sign-on for this resource. + * + * @summary configures single-sign-on for this resource. + * x-ms-original-file: 2023-10-20/SingleSignOnConfigurations_CreateOrUpdate.json + */ +async function singleSignOnConfigurationsCreateOrUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.datadogSingleSignOnResources.createOrUpdate( + "myResourceGroup", + "myMonitor", + "default", + ); + console.log(result); +} + +async function main(): Promise { + await singleSignOnConfigurationsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesGetSample.ts new file mode 100644 index 000000000000..de4c6c50cb66 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the datadog single sign-on resource for the given Monitor. + * + * @summary gets the datadog single sign-on resource for the given Monitor. + * x-ms-original-file: 2023-10-20/SingleSignOnConfigurations_Get.json + */ +async function singleSignOnConfigurationsGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.datadogSingleSignOnResources.get( + "myResourceGroup", + "myMonitor", + "default", + ); + console.log(result); +} + +async function main(): Promise { + await singleSignOnConfigurationsGet(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesListSample.ts b/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesListSample.ts new file mode 100644 index 000000000000..f1fe4e370ec3 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/datadogSingleSignOnResourcesListSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the single sign-on configurations for a given monitor resource. + * + * @summary list the single sign-on configurations for a given monitor resource. + * x-ms-original-file: 2023-10-20/SingleSignOnConfigurations_List.json + */ +async function singleSignOnConfigurationsList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.datadogSingleSignOnResources.list( + "myResourceGroup", + "myMonitor", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await singleSignOnConfigurationsList(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsCreateOrUpdateSample.ts deleted file mode 100644 index abe0b956a528..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsCreateOrUpdateSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 type { - DatadogAgreementResource, - MarketplaceAgreementsCreateOrUpdateOptionalParams, -} from "@azure/arm-datadog"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create Datadog marketplace agreement in the subscription. - * - * @summary Create Datadog marketplace agreement in the subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_Create.json - */ -async function marketplaceAgreementsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const body: DatadogAgreementResource = { properties: { accepted: true } }; - const options: MarketplaceAgreementsCreateOrUpdateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.marketplaceAgreements.createOrUpdate(options); - console.log(result); -} - -async function main(): Promise { - await marketplaceAgreementsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsListSample.ts deleted file mode 100644 index 3435abcd280d..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsListSample.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Datadog marketplace agreements in the subscription. - * - * @summary List Datadog marketplace agreements in the subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_List.json - */ -async function marketplaceAgreementsList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.marketplaceAgreements.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await marketplaceAgreementsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsOperationGroupCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsOperationGroupCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ae4cc0c01627 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsOperationGroupCreateOrUpdateSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create Datadog marketplace agreement in the subscription. + * + * @summary create Datadog marketplace agreement in the subscription. + * x-ms-original-file: 2023-10-20/MarketplaceAgreements_Create.json + */ +async function marketplaceAgreementsCreateOrUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.marketplaceAgreementsOperationGroup.createOrUpdate({ + properties: { accepted: true }, + }); + console.log(result); +} + +async function main(): Promise { + await marketplaceAgreementsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsOperationGroupListSample.ts b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsOperationGroupListSample.ts new file mode 100644 index 000000000000..c4c16ec4ee25 --- /dev/null +++ b/sdk/datadog/arm-datadog/samples-dev/marketplaceAgreementsOperationGroupListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Datadog marketplace agreements in the subscription. + * + * @summary list Datadog marketplace agreements in the subscription. + * x-ms-original-file: 2023-10-20/MarketplaceAgreements_List.json + */ +async function marketplaceAgreementsList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.marketplaceAgreementsOperationGroup.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await marketplaceAgreementsList(); +} + +main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsCreateorUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsCreateorUpdateSample.ts index 99260df7cbb0..70ea6d312cc6 100644 --- a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsCreateorUpdateSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsCreateorUpdateSample.ts @@ -1,81 +1,20 @@ -/* - * 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 type { - MonitoredSubscriptionProperties, - MonitoredSubscriptionsCreateorUpdateOptionalParams, -} from "@azure/arm-datadog"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Add the subscriptions that should be monitored by the Datadog monitor resource. + * This sample demonstrates how to add the subscriptions that should be monitored by the Datadog monitor resource. * - * @summary Add the subscriptions that should be monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_CreateorUpdate.json + * @summary add the subscriptions that should be monitored by the Datadog monitor resource. + * x-ms-original-file: 2023-10-20/MonitoredSubscriptions_CreateorUpdate.json */ async function monitorsAddMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body: MonitoredSubscriptionProperties = { - properties: { - monitoredSubscriptionList: [ - { - status: "Active", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000000", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }, - { - status: "Failed", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000001", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }, - ], - operation: "AddBegin", - }, - }; - const options: MonitoredSubscriptionsCreateorUpdateOptionalParams = { body }; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginCreateorUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options, - ); - console.log(result); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + await client.monitoredSubscriptions.createorUpdate("myResourceGroup", "myMonitor", "default"); } async function main(): Promise { diff --git a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsDeleteSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsDeleteSample.ts index 7e9708ac8450..648fca652516 100644 --- a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsDeleteSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsDeleteSample.ts @@ -1,34 +1,20 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Updates the subscriptions that are being monitored by the Datadog monitor resource + * This sample demonstrates how to updates the subscriptions that are being monitored by the Datadog monitor resource * - * @summary Updates the subscriptions that are being monitored by the Datadog monitor resource - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Delete.json + * @summary updates the subscriptions that are being monitored by the Datadog monitor resource + * x-ms-original-file: 2023-10-20/MonitoredSubscriptions_Delete.json */ async function monitorsDeleteMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginDeleteAndWait( - resourceGroupName, - monitorName, - configurationName, - ); - console.log(result); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + await client.monitoredSubscriptions.delete("myResourceGroup", "myMonitor", "default"); } async function main(): Promise { diff --git a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsGetSample.ts index 9d508726ffe5..6bbb5c3dc643 100644 --- a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsGetSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsGetSample.ts @@ -1,33 +1,20 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List the subscriptions currently being monitored by the Datadog monitor resource. + * This sample demonstrates how to list the subscriptions currently being monitored by the Datadog monitor resource. * - * @summary List the subscriptions currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Get.json + * @summary list the subscriptions currently being monitored by the Datadog monitor resource. + * x-ms-original-file: 2023-10-20/MonitoredSubscriptions_Get.json */ async function monitorsGetMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.get( - resourceGroupName, - monitorName, - configurationName, - ); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.monitoredSubscriptions.get("myResourceGroup", "myMonitor", "default"); console.log(result); } diff --git a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsListSample.ts index 55417894c92b..b7a722a47be7 100644 --- a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsListSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsListSample.ts @@ -1,31 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List the subscriptions currently being monitored by the Datadog monitor resource. + * This sample demonstrates how to list the subscriptions currently being monitored by the Datadog monitor resource. * - * @summary List the subscriptions currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_List.json + * @summary list the subscriptions currently being monitored by the Datadog monitor resource. + * x-ms-original-file: 2023-10-20/MonitoredSubscriptions_List.json */ async function monitorsGetMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.monitoredSubscriptions.list(resourceGroupName, monitorName)) { + for await (const item of client.monitoredSubscriptions.list("myResourceGroup", "myMonitor")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsUpdateSample.ts index b42ee0782260..d1c5b7ac3785 100644 --- a/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsUpdateSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/monitoredSubscriptionsUpdateSample.ts @@ -1,79 +1,23 @@ -/* - * 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 type { - MonitoredSubscriptionProperties, - MonitoredSubscriptionsUpdateOptionalParams, -} from "@azure/arm-datadog"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Updates the subscriptions that are being monitored by the Datadog monitor resource + * This sample demonstrates how to updates the subscriptions that are being monitored by the Datadog monitor resource * - * @summary Updates the subscriptions that are being monitored by the Datadog monitor resource - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Update.json + * @summary updates the subscriptions that are being monitored by the Datadog monitor resource + * x-ms-original-file: 2023-10-20/MonitoredSubscriptions_Update.json */ async function monitorsUpdateMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body: MonitoredSubscriptionProperties = { - properties: { - monitoredSubscriptionList: [ - { - status: "Active", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000000", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }, - { - status: "Failed", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000001", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }, - ], - operation: "AddComplete", - }, - }; - const options: MonitoredSubscriptionsUpdateOptionalParams = { body }; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.monitoredSubscriptions.update( + "myResourceGroup", + "myMonitor", + "default", ); console.log(result); } diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsCreateSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsCreateSample.ts deleted file mode 100644 index f1b24ffc4dfd..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsCreateSample.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 type { DatadogMonitorResource, MonitorsCreateOptionalParams } from "@azure/arm-datadog"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create a monitor resource. - * - * @summary Create a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Create.json - */ -async function monitorsCreate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body: DatadogMonitorResource = { - name: "myMonitor", - location: "West US", - properties: { - datadogOrganizationProperties: { - name: "myOrg", - cspm: false, - enterpriseAppId: "00000000-0000-0000-0000-000000000000", - id: "myOrg123", - linkingAuthCode: "someAuthCode", - linkingClientId: "00000000-0000-0000-0000-000000000000", - }, - monitoringStatus: "Enabled", - userInfo: { - name: "Alice", - emailAddress: "alice@microsoft.com", - phoneNumber: "123-456-7890", - }, - }, - sku: { name: "free_Monthly" }, - tags: { environment: "Dev" }, - }; - const options: MonitorsCreateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginCreateAndWait(resourceGroupName, monitorName, options); - console.log(result); -} - -async function main(): Promise { - await monitorsCreate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsDeleteSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsDeleteSample.ts deleted file mode 100644 index 608989da01e8..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsDeleteSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a monitor resource. - * - * @summary Delete a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Delete.json - */ -async function monitorsDelete(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginDeleteAndWait(resourceGroupName, monitorName); - console.log(result); -} - -async function main(): Promise { - await monitorsDelete(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsGetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsGetDefaultKeySample.ts deleted file mode 100644 index 14491ba85190..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsGetDefaultKeySample.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the default api key. - * - * @summary Get the default api key. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_GetDefaultKey.json - */ -async function monitorsGetDefaultKey(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.getDefaultKey(resourceGroupName, monitorName); - console.log(result); -} - -async function main(): Promise { - await monitorsGetDefaultKey(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsGetSample.ts deleted file mode 100644 index 3092b77687c6..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsGetSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the properties of a specific monitor resource. - * - * @summary Get the properties of a specific monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Get.json - */ -async function monitorsGet(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.get(resourceGroupName, monitorName); - console.log(result); -} - -async function main(): Promise { - await monitorsGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListApiKeysSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListApiKeysSample.ts deleted file mode 100644 index 47c234914c18..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsListApiKeysSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the api keys for a given monitor resource. - * - * @summary List the api keys for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_List.json - */ -async function monitorsListApiKeys(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.monitors.listApiKeys(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await monitorsListApiKeys(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListByResourceGroupSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListByResourceGroupSample.ts deleted file mode 100644 index d3c7d2397071..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsListByResourceGroupSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List all monitors under the specified resource group. - * - * @summary List all monitors under the specified resource group. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_ListByResourceGroup.json - */ -async function monitorsListByResourceGroup(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.monitors.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await monitorsListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListHostsSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListHostsSample.ts deleted file mode 100644 index e65c763debbc..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsListHostsSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the hosts for a given monitor resource. - * - * @summary List the hosts for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Hosts_List.json - */ -async function monitorsListHosts(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.monitors.listHosts(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await monitorsListHosts(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListLinkedResourcesSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListLinkedResourcesSample.ts deleted file mode 100644 index e1468ad0496e..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsListLinkedResourcesSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List all Azure resources associated to the same Datadog organization as the target resource. - * - * @summary List all Azure resources associated to the same Datadog organization as the target resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/LinkedResources_List.json - */ -async function monitorsListLinkedResources(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.monitors.listLinkedResources(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await monitorsListLinkedResources(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListMonitoredResourcesSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListMonitoredResourcesSample.ts deleted file mode 100644 index c5f7b8477080..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsListMonitoredResourcesSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the resources currently being monitored by the Datadog monitor resource. - * - * @summary List the resources currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json - */ -async function monitorsListMonitoredResources(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.monitors.listMonitoredResources(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await monitorsListMonitoredResources(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsListSample.ts deleted file mode 100644 index f661ec160a62..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsListSample.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List all monitors under the specified subscription. - * - * @summary List all monitors under the specified subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_List.json - */ -async function monitorsList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.monitors.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await monitorsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsRefreshSetPasswordLinkSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsRefreshSetPasswordLinkSample.ts deleted file mode 100644 index 1c865b0b83ab..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsRefreshSetPasswordLinkSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Refresh the set password link and return a latest one. - * - * @summary Refresh the set password link and return a latest one. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/RefreshSetPassword_Get.json - */ -async function monitorsRefreshSetPasswordLink(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.refreshSetPasswordLink(resourceGroupName, monitorName); - console.log(result); -} - -async function main(): Promise { - await monitorsRefreshSetPasswordLink(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsSetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsSetDefaultKeySample.ts deleted file mode 100644 index 7b8937be587a..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsSetDefaultKeySample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 type { DatadogApiKey, MonitorsSetDefaultKeyOptionalParams } from "@azure/arm-datadog"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Set the default api key. - * - * @summary Set the default api key. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_SetDefaultKey.json - */ -async function monitorsSetDefaultKey(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body: DatadogApiKey = { key: "1111111111111111aaaaaaaaaaaaaaaa" }; - const options: MonitorsSetDefaultKeyOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.setDefaultKey(resourceGroupName, monitorName, options); - console.log(result); -} - -async function main(): Promise { - await monitorsSetDefaultKey(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/monitorsUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/monitorsUpdateSample.ts deleted file mode 100644 index 71242c601eae..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/monitorsUpdateSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 type { - DatadogMonitorResourceUpdateParameters, - MonitorsUpdateOptionalParams, -} from "@azure/arm-datadog"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Update a monitor resource. - * - * @summary Update a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Update.json - */ -async function monitorsUpdate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body: DatadogMonitorResourceUpdateParameters = { - properties: { monitoringStatus: "Enabled" }, - tags: { environment: "Dev" }, - }; - const options: MonitorsUpdateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginUpdateAndWait(resourceGroupName, monitorName, options); - console.log(result); -} - -async function main(): Promise { - await monitorsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/operationsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/operationsListSample.ts index 67786e35935e..b9d39c22271b 100644 --- a/sdk/datadog/arm-datadog/samples-dev/operationsListSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/operationsListSample.ts @@ -1,29 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. + * This sample demonstrates how to list the operations for the provider * - * @summary List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Operations_List.json + * @summary list the operations for the provider + * x-ms-original-file: 2023-10-20/Operations_List.json */ async function operationsList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new DatadogClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsCreateOrUpdateSample.ts deleted file mode 100644 index 876a3a392a81..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsCreateOrUpdateSample.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 type { - DatadogSingleSignOnResource, - SingleSignOnConfigurationsCreateOrUpdateOptionalParams, -} from "@azure/arm-datadog"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Configures single-sign-on for this resource. - * - * @summary Configures single-sign-on for this resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json - */ -async function singleSignOnConfigurationsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body: DatadogSingleSignOnResource = { - properties: { - enterpriseAppId: "00000000-0000-0000-0000-000000000000", - singleSignOnState: "Enable", - }, - }; - const options: SingleSignOnConfigurationsCreateOrUpdateOptionalParams = { - body, - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.singleSignOnConfigurations.beginCreateOrUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options, - ); - console.log(result); -} - -async function main(): Promise { - await singleSignOnConfigurationsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsGetSample.ts deleted file mode 100644 index ded267ba5173..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsGetSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the datadog single sign-on resource for the given Monitor. - * - * @summary Gets the datadog single sign-on resource for the given Monitor. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_Get.json - */ -async function singleSignOnConfigurationsGet(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.singleSignOnConfigurations.get( - resourceGroupName, - monitorName, - configurationName, - ); - console.log(result); -} - -async function main(): Promise { - await singleSignOnConfigurationsGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsListSample.ts b/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsListSample.ts deleted file mode 100644 index 7a992ac7965a..000000000000 --- a/sdk/datadog/arm-datadog/samples-dev/singleSignOnConfigurationsListSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the single sign-on configurations for a given monitor resource. - * - * @summary List the single sign-on configurations for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_List.json - */ -async function singleSignOnConfigurationsList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.singleSignOnConfigurations.list(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await singleSignOnConfigurationsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples-dev/tagRulesCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples-dev/tagRulesCreateOrUpdateSample.ts index cb62f6319b76..07f94bc4a22e 100644 --- a/sdk/datadog/arm-datadog/samples-dev/tagRulesCreateOrUpdateSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/tagRulesCreateOrUpdateSample.ts @@ -1,51 +1,20 @@ -/* - * 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 type { MonitoringTagRules, TagRulesCreateOrUpdateOptionalParams } from "@azure/arm-datadog"; -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create or update a tag rule set for a given monitor resource. + * This sample demonstrates how to create or update a tag rule set for a given monitor resource. * - * @summary Create or update a tag rule set for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_CreateOrUpdate.json + * @summary create or update a tag rule set for a given monitor resource. + * x-ms-original-file: 2023-10-20/TagRules_CreateOrUpdate.json */ async function tagRulesCreateOrUpdate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const ruleSetName = "default"; - const body: MonitoringTagRules = { - properties: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }; - const options: TagRulesCreateOrUpdateOptionalParams = { body }; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.tagRules.createOrUpdate( - resourceGroupName, - monitorName, - ruleSetName, - options, - ); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.tagRules.createOrUpdate("myResourceGroup", "myMonitor", "default"); console.log(result); } diff --git a/sdk/datadog/arm-datadog/samples-dev/tagRulesGetSample.ts b/sdk/datadog/arm-datadog/samples-dev/tagRulesGetSample.ts index 1861d3b595cd..ba20cddd2465 100644 --- a/sdk/datadog/arm-datadog/samples-dev/tagRulesGetSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/tagRulesGetSample.ts @@ -1,29 +1,20 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a tag rule set for a given monitor resource. + * This sample demonstrates how to get a tag rule set for a given monitor resource. * - * @summary Get a tag rule set for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_Get.json + * @summary get a tag rule set for a given monitor resource. + * x-ms-original-file: 2023-10-20/TagRules_Get.json */ async function tagRulesGet(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const ruleSetName = "default"; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.tagRules.get(resourceGroupName, monitorName, ruleSetName); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); + const result = await client.tagRules.get("myResourceGroup", "myMonitor", "default"); console.log(result); } diff --git a/sdk/datadog/arm-datadog/samples-dev/tagRulesListSample.ts b/sdk/datadog/arm-datadog/samples-dev/tagRulesListSample.ts index bda57097d002..2e25962a91a1 100644 --- a/sdk/datadog/arm-datadog/samples-dev/tagRulesListSample.ts +++ b/sdk/datadog/arm-datadog/samples-dev/tagRulesListSample.ts @@ -1,31 +1,24 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -import { MicrosoftDatadogClient } from "@azure/arm-datadog"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "@azure/arm-datadog"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List the tag rules for a given monitor resource. + * This sample demonstrates how to list the tag rules for a given monitor resource. * - * @summary List the tag rules for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_List.json + * @summary list the tag rules for a given monitor resource. + * x-ms-original-file: 2023-10-20/TagRules_List.json */ async function tagRulesList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DatadogClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.tagRules.list(resourceGroupName, monitorName)) { + for await (const item of client.tagRules.list("myResourceGroup", "myMonitor")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/README.md b/sdk/datadog/arm-datadog/samples/v3/javascript/README.md deleted file mode 100644 index 077879157bd1..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [creationSupportedGetSample.js][creationsupportedgetsample] | Informs if the current subscription is being already monitored for selected Datadog organization. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_Get.json | -| [creationSupportedListSample.js][creationsupportedlistsample] | Informs if the current subscription is being already monitored for selected Datadog organization. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_List.json | -| [marketplaceAgreementsCreateOrUpdateSample.js][marketplaceagreementscreateorupdatesample] | Create Datadog marketplace agreement in the subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_Create.json | -| [marketplaceAgreementsListSample.js][marketplaceagreementslistsample] | List Datadog marketplace agreements in the subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_List.json | -| [monitoredSubscriptionsCreateorUpdateSample.js][monitoredsubscriptionscreateorupdatesample] | Add the subscriptions that should be monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_CreateorUpdate.json | -| [monitoredSubscriptionsDeleteSample.js][monitoredsubscriptionsdeletesample] | Updates the subscriptions that are being monitored by the Datadog monitor resource x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Delete.json | -| [monitoredSubscriptionsGetSample.js][monitoredsubscriptionsgetsample] | List the subscriptions currently being monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Get.json | -| [monitoredSubscriptionsListSample.js][monitoredsubscriptionslistsample] | List the subscriptions currently being monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_List.json | -| [monitoredSubscriptionsUpdateSample.js][monitoredsubscriptionsupdatesample] | Updates the subscriptions that are being monitored by the Datadog monitor resource x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Update.json | -| [monitorsCreateSample.js][monitorscreatesample] | Create a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Create.json | -| [monitorsDeleteSample.js][monitorsdeletesample] | Delete a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Delete.json | -| [monitorsGetDefaultKeySample.js][monitorsgetdefaultkeysample] | Get the default api key. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_GetDefaultKey.json | -| [monitorsGetSample.js][monitorsgetsample] | Get the properties of a specific monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Get.json | -| [monitorsListApiKeysSample.js][monitorslistapikeyssample] | List the api keys for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_List.json | -| [monitorsListByResourceGroupSample.js][monitorslistbyresourcegroupsample] | List all monitors under the specified resource group. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_ListByResourceGroup.json | -| [monitorsListHostsSample.js][monitorslisthostssample] | List the hosts for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Hosts_List.json | -| [monitorsListLinkedResourcesSample.js][monitorslistlinkedresourcessample] | List all Azure resources associated to the same Datadog organization as the target resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/LinkedResources_List.json | -| [monitorsListMonitoredResourcesSample.js][monitorslistmonitoredresourcessample] | List the resources currently being monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json | -| [monitorsListSample.js][monitorslistsample] | List all monitors under the specified subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_List.json | -| [monitorsRefreshSetPasswordLinkSample.js][monitorsrefreshsetpasswordlinksample] | Refresh the set password link and return a latest one. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/RefreshSetPassword_Get.json | -| [monitorsSetDefaultKeySample.js][monitorssetdefaultkeysample] | Set the default api key. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_SetDefaultKey.json | -| [monitorsUpdateSample.js][monitorsupdatesample] | Update a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Update.json | -| [operationsListSample.js][operationslistsample] | List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Operations_List.json | -| [singleSignOnConfigurationsCreateOrUpdateSample.js][singlesignonconfigurationscreateorupdatesample] | Configures single-sign-on for this resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json | -| [singleSignOnConfigurationsGetSample.js][singlesignonconfigurationsgetsample] | Gets the datadog single sign-on resource for the given Monitor. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_Get.json | -| [singleSignOnConfigurationsListSample.js][singlesignonconfigurationslistsample] | List the single sign-on configurations for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_List.json | -| [tagRulesCreateOrUpdateSample.js][tagrulescreateorupdatesample] | Create or update a tag rule set for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_CreateOrUpdate.json | -| [tagRulesGetSample.js][tagrulesgetsample] | Get a tag rule set for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_Get.json | -| [tagRulesListSample.js][tagruleslistsample] | List the tag rules for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_List.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 creationSupportedGetSample.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 dev-tool run vendored cross-env DATADOG_SUBSCRIPTION_ID="" node creationSupportedGetSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[creationsupportedgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/creationSupportedGetSample.js -[creationsupportedlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/creationSupportedListSample.js -[marketplaceagreementscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsCreateOrUpdateSample.js -[marketplaceagreementslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsListSample.js -[monitoredsubscriptionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsCreateorUpdateSample.js -[monitoredsubscriptionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsDeleteSample.js -[monitoredsubscriptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsGetSample.js -[monitoredsubscriptionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsListSample.js -[monitoredsubscriptionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsUpdateSample.js -[monitorscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsCreateSample.js -[monitorsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsDeleteSample.js -[monitorsgetdefaultkeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetDefaultKeySample.js -[monitorsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetSample.js -[monitorslistapikeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListApiKeysSample.js -[monitorslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListByResourceGroupSample.js -[monitorslisthostssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListHostsSample.js -[monitorslistlinkedresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListLinkedResourcesSample.js -[monitorslistmonitoredresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListMonitoredResourcesSample.js -[monitorslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListSample.js -[monitorsrefreshsetpasswordlinksample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsRefreshSetPasswordLinkSample.js -[monitorssetdefaultkeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsSetDefaultKeySample.js -[monitorsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsUpdateSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/operationsListSample.js -[singlesignonconfigurationscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsCreateOrUpdateSample.js -[singlesignonconfigurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsGetSample.js -[singlesignonconfigurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsListSample.js -[tagrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesCreateOrUpdateSample.js -[tagrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesGetSample.js -[tagruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesListSample.js -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-datadog?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog/README.md diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/creationSupportedGetSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/creationSupportedGetSample.js deleted file mode 100644 index 373f3777fe19..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/creationSupportedGetSample.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Informs if the current subscription is being already monitored for selected Datadog organization. - * - * @summary Informs if the current subscription is being already monitored for selected Datadog organization. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_Get.json - */ -async function creationSupportedGet() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const datadogOrganizationId = "00000000-0000-0000-0000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.creationSupported.get(datadogOrganizationId); - console.log(result); -} - -async function main() { - creationSupportedGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/creationSupportedListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/creationSupportedListSample.js deleted file mode 100644 index 5c88b6f3acd8..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/creationSupportedListSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Informs if the current subscription is being already monitored for selected Datadog organization. - * - * @summary Informs if the current subscription is being already monitored for selected Datadog organization. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_List.json - */ -async function creationSupportedList() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const datadogOrganizationId = "00000000-0000-0000-0000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.creationSupported.list(datadogOrganizationId)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - creationSupportedList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsCreateOrUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsCreateOrUpdateSample.js deleted file mode 100644 index d17a22207741..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsCreateOrUpdateSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create Datadog marketplace agreement in the subscription. - * - * @summary Create Datadog marketplace agreement in the subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_Create.json - */ -async function marketplaceAgreementsCreateOrUpdate() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const body = { properties: { accepted: true } }; - const options = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.marketplaceAgreements.createOrUpdate(options); - console.log(result); -} - -async function main() { - marketplaceAgreementsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsListSample.js deleted file mode 100644 index f0f21afaa489..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/marketplaceAgreementsListSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Datadog marketplace agreements in the subscription. - * - * @summary List Datadog marketplace agreements in the subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_List.json - */ -async function marketplaceAgreementsList() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.marketplaceAgreements.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - marketplaceAgreementsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsCreateorUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsCreateorUpdateSample.js deleted file mode 100644 index 5effea16140c..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsCreateorUpdateSample.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Add the subscriptions that should be monitored by the Datadog monitor resource. - * - * @summary Add the subscriptions that should be monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_CreateorUpdate.json - */ -async function monitorsAddMonitoredSubscriptions() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body = { - properties: { - monitoredSubscriptionList: [ - { - status: "Active", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000000", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }, - { - status: "Failed", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000001", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }, - ], - operation: "AddBegin", - }, - }; - const options = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginCreateorUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options, - ); - console.log(result); -} - -async function main() { - monitorsAddMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsDeleteSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsDeleteSample.js deleted file mode 100644 index 247f6d0e551d..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsDeleteSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Updates the subscriptions that are being monitored by the Datadog monitor resource - * - * @summary Updates the subscriptions that are being monitored by the Datadog monitor resource - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Delete.json - */ -async function monitorsDeleteMonitoredSubscriptions() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginDeleteAndWait( - resourceGroupName, - monitorName, - configurationName, - ); - console.log(result); -} - -async function main() { - monitorsDeleteMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsGetSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsGetSample.js deleted file mode 100644 index 78064a3841e6..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsGetSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the subscriptions currently being monitored by the Datadog monitor resource. - * - * @summary List the subscriptions currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Get.json - */ -async function monitorsGetMonitoredSubscriptions() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.get( - resourceGroupName, - monitorName, - configurationName, - ); - console.log(result); -} - -async function main() { - monitorsGetMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsListSample.js deleted file mode 100644 index cc746e1d1cc6..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsListSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the subscriptions currently being monitored by the Datadog monitor resource. - * - * @summary List the subscriptions currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_List.json - */ -async function monitorsGetMonitoredSubscriptions() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitoredSubscriptions.list(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - monitorsGetMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsUpdateSample.js deleted file mode 100644 index 4349c8baaa43..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitoredSubscriptionsUpdateSample.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Updates the subscriptions that are being monitored by the Datadog monitor resource - * - * @summary Updates the subscriptions that are being monitored by the Datadog monitor resource - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Update.json - */ -async function monitorsUpdateMonitoredSubscriptions() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body = { - properties: { - monitoredSubscriptionList: [ - { - status: "Active", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000000", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }, - { - status: "Failed", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000001", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }, - ], - operation: "AddComplete", - }, - }; - const options = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options, - ); - console.log(result); -} - -async function main() { - monitorsUpdateMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsCreateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsCreateSample.js deleted file mode 100644 index ac3a41d36068..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsCreateSample.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a monitor resource. - * - * @summary Create a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Create.json - */ -async function monitorsCreate() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body = { - name: "myMonitor", - location: "West US", - properties: { - datadogOrganizationProperties: { - name: "myOrg", - cspm: false, - enterpriseAppId: "00000000-0000-0000-0000-000000000000", - id: "myOrg123", - linkingAuthCode: "someAuthCode", - linkingClientId: "00000000-0000-0000-0000-000000000000", - }, - monitoringStatus: "Enabled", - userInfo: { - name: "Alice", - emailAddress: "alice@microsoft.com", - phoneNumber: "123-456-7890", - }, - }, - sku: { name: "free_Monthly" }, - tags: { environment: "Dev" }, - }; - const options = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginCreateAndWait(resourceGroupName, monitorName, options); - console.log(result); -} - -async function main() { - monitorsCreate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsDeleteSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsDeleteSample.js deleted file mode 100644 index 8f4c1ca8b727..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsDeleteSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a monitor resource. - * - * @summary Delete a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Delete.json - */ -async function monitorsDelete() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginDeleteAndWait(resourceGroupName, monitorName); - console.log(result); -} - -async function main() { - monitorsDelete(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetDefaultKeySample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetDefaultKeySample.js deleted file mode 100644 index 8da16656881a..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetDefaultKeySample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the default api key. - * - * @summary Get the default api key. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_GetDefaultKey.json - */ -async function monitorsGetDefaultKey() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.getDefaultKey(resourceGroupName, monitorName); - console.log(result); -} - -async function main() { - monitorsGetDefaultKey(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetSample.js deleted file mode 100644 index 0ae6a84bdcd4..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsGetSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the properties of a specific monitor resource. - * - * @summary Get the properties of a specific monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Get.json - */ -async function monitorsGet() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.get(resourceGroupName, monitorName); - console.log(result); -} - -async function main() { - monitorsGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListApiKeysSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListApiKeysSample.js deleted file mode 100644 index b0328d928970..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListApiKeysSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the api keys for a given monitor resource. - * - * @summary List the api keys for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_List.json - */ -async function monitorsListApiKeys() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.listApiKeys(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - monitorsListApiKeys(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListByResourceGroupSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListByResourceGroupSample.js deleted file mode 100644 index 5ca9b3c99efa..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListByResourceGroupSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List all monitors under the specified resource group. - * - * @summary List all monitors under the specified resource group. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_ListByResourceGroup.json - */ -async function monitorsListByResourceGroup() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - monitorsListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListHostsSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListHostsSample.js deleted file mode 100644 index 792cbae09885..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListHostsSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the hosts for a given monitor resource. - * - * @summary List the hosts for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Hosts_List.json - */ -async function monitorsListHosts() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.listHosts(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - monitorsListHosts(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListLinkedResourcesSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListLinkedResourcesSample.js deleted file mode 100644 index dc464e5cb37c..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListLinkedResourcesSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List all Azure resources associated to the same Datadog organization as the target resource. - * - * @summary List all Azure resources associated to the same Datadog organization as the target resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/LinkedResources_List.json - */ -async function monitorsListLinkedResources() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.listLinkedResources(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - monitorsListLinkedResources(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListMonitoredResourcesSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListMonitoredResourcesSample.js deleted file mode 100644 index aed6b61f3357..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListMonitoredResourcesSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the resources currently being monitored by the Datadog monitor resource. - * - * @summary List the resources currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json - */ -async function monitorsListMonitoredResources() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(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() { - monitorsListMonitoredResources(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListSample.js deleted file mode 100644 index a646e4fdbd88..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsListSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List all monitors under the specified subscription. - * - * @summary List all monitors under the specified subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_List.json - */ -async function monitorsList() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - monitorsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsRefreshSetPasswordLinkSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsRefreshSetPasswordLinkSample.js deleted file mode 100644 index df9a62a9dfc2..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsRefreshSetPasswordLinkSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Refresh the set password link and return a latest one. - * - * @summary Refresh the set password link and return a latest one. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/RefreshSetPassword_Get.json - */ -async function monitorsRefreshSetPasswordLink() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.refreshSetPasswordLink(resourceGroupName, monitorName); - console.log(result); -} - -async function main() { - monitorsRefreshSetPasswordLink(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsSetDefaultKeySample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsSetDefaultKeySample.js deleted file mode 100644 index de7ee1cd4edd..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsSetDefaultKeySample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Set the default api key. - * - * @summary Set the default api key. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_SetDefaultKey.json - */ -async function monitorsSetDefaultKey() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body = { key: "1111111111111111aaaaaaaaaaaaaaaa" }; - const options = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.setDefaultKey(resourceGroupName, monitorName, options); - console.log(result); -} - -async function main() { - monitorsSetDefaultKey(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsUpdateSample.js deleted file mode 100644 index 2937fbbad8cd..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/monitorsUpdateSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update a monitor resource. - * - * @summary Update a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Update.json - */ -async function monitorsUpdate() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body = { - properties: { monitoringStatus: "Enabled" }, - tags: { environment: "Dev" }, - }; - const options = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginUpdateAndWait(resourceGroupName, monitorName, options); - console.log(result); -} - -async function main() { - monitorsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/operationsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/operationsListSample.js deleted file mode 100644 index df8308b7cfb4..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/operationsListSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - * - * @summary List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/package.json b/sdk/datadog/arm-datadog/samples/v3/javascript/package.json deleted file mode 100644 index 04568af65b20..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@azure-samples/arm-datadog-js", - "private": true, - "version": "1.0.0", - "description": " client library samples for JavaScript", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/datadog/arm-datadog" - }, - "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/datadog/arm-datadog", - "dependencies": { - "@azure/arm-datadog": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - } -} diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/sample.env b/sdk/datadog/arm-datadog/samples/v3/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# 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/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsCreateOrUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsCreateOrUpdateSample.js deleted file mode 100644 index b7744cb02851..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsCreateOrUpdateSample.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Configures single-sign-on for this resource. - * - * @summary Configures single-sign-on for this resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json - */ -async function singleSignOnConfigurationsCreateOrUpdate() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body = { - properties: { - enterpriseAppId: "00000000-0000-0000-0000-000000000000", - singleSignOnState: "Enable", - }, - }; - const options = { - body, - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.singleSignOnConfigurations.beginCreateOrUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options, - ); - console.log(result); -} - -async function main() { - singleSignOnConfigurationsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsGetSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsGetSample.js deleted file mode 100644 index e41e661da0c7..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsGetSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets the datadog single sign-on resource for the given Monitor. - * - * @summary Gets the datadog single sign-on resource for the given Monitor. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_Get.json - */ -async function singleSignOnConfigurationsGet() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.singleSignOnConfigurations.get( - resourceGroupName, - monitorName, - configurationName, - ); - console.log(result); -} - -async function main() { - singleSignOnConfigurationsGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsListSample.js deleted file mode 100644 index 1760e60d29fe..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/singleSignOnConfigurationsListSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the single sign-on configurations for a given monitor resource. - * - * @summary List the single sign-on configurations for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_List.json - */ -async function singleSignOnConfigurationsList() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.singleSignOnConfigurations.list(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - singleSignOnConfigurationsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesCreateOrUpdateSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesCreateOrUpdateSample.js deleted file mode 100644 index 539c2d527218..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesCreateOrUpdateSample.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create or update a tag rule set for a given monitor resource. - * - * @summary Create or update a tag rule set for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_CreateOrUpdate.json - */ -async function tagRulesCreateOrUpdate() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const ruleSetName = "default"; - const body = { - properties: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" }, - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true, - }, - metricRules: { filteringTags: [] }, - }, - }; - const options = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.tagRules.createOrUpdate( - resourceGroupName, - monitorName, - ruleSetName, - options, - ); - console.log(result); -} - -async function main() { - tagRulesCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesGetSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesGetSample.js deleted file mode 100644 index bfa82073383d..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesGetSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a tag rule set for a given monitor resource. - * - * @summary Get a tag rule set for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_Get.json - */ -async function tagRulesGet() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const ruleSetName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.tagRules.get(resourceGroupName, monitorName, ruleSetName); - console.log(result); -} - -async function main() { - tagRulesGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesListSample.js b/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesListSample.js deleted file mode 100644 index 83f29cebefab..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/javascript/tagRulesListSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the tag rules for a given monitor resource. - * - * @summary List the tag rules for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_List.json - */ -async function tagRulesList() { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.tagRules.list(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - tagRulesList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/README.md b/sdk/datadog/arm-datadog/samples/v3/typescript/README.md deleted file mode 100644 index b9bd5542812c..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [creationSupportedGetSample.ts][creationsupportedgetsample] | Informs if the current subscription is being already monitored for selected Datadog organization. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_Get.json | -| [creationSupportedListSample.ts][creationsupportedlistsample] | Informs if the current subscription is being already monitored for selected Datadog organization. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_List.json | -| [marketplaceAgreementsCreateOrUpdateSample.ts][marketplaceagreementscreateorupdatesample] | Create Datadog marketplace agreement in the subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_Create.json | -| [marketplaceAgreementsListSample.ts][marketplaceagreementslistsample] | List Datadog marketplace agreements in the subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_List.json | -| [monitoredSubscriptionsCreateorUpdateSample.ts][monitoredsubscriptionscreateorupdatesample] | Add the subscriptions that should be monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_CreateorUpdate.json | -| [monitoredSubscriptionsDeleteSample.ts][monitoredsubscriptionsdeletesample] | Updates the subscriptions that are being monitored by the Datadog monitor resource x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Delete.json | -| [monitoredSubscriptionsGetSample.ts][monitoredsubscriptionsgetsample] | List the subscriptions currently being monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Get.json | -| [monitoredSubscriptionsListSample.ts][monitoredsubscriptionslistsample] | List the subscriptions currently being monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_List.json | -| [monitoredSubscriptionsUpdateSample.ts][monitoredsubscriptionsupdatesample] | Updates the subscriptions that are being monitored by the Datadog monitor resource x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Update.json | -| [monitorsCreateSample.ts][monitorscreatesample] | Create a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Create.json | -| [monitorsDeleteSample.ts][monitorsdeletesample] | Delete a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Delete.json | -| [monitorsGetDefaultKeySample.ts][monitorsgetdefaultkeysample] | Get the default api key. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_GetDefaultKey.json | -| [monitorsGetSample.ts][monitorsgetsample] | Get the properties of a specific monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Get.json | -| [monitorsListApiKeysSample.ts][monitorslistapikeyssample] | List the api keys for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_List.json | -| [monitorsListByResourceGroupSample.ts][monitorslistbyresourcegroupsample] | List all monitors under the specified resource group. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_ListByResourceGroup.json | -| [monitorsListHostsSample.ts][monitorslisthostssample] | List the hosts for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Hosts_List.json | -| [monitorsListLinkedResourcesSample.ts][monitorslistlinkedresourcessample] | List all Azure resources associated to the same Datadog organization as the target resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/LinkedResources_List.json | -| [monitorsListMonitoredResourcesSample.ts][monitorslistmonitoredresourcessample] | List the resources currently being monitored by the Datadog monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json | -| [monitorsListSample.ts][monitorslistsample] | List all monitors under the specified subscription. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_List.json | -| [monitorsRefreshSetPasswordLinkSample.ts][monitorsrefreshsetpasswordlinksample] | Refresh the set password link and return a latest one. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/RefreshSetPassword_Get.json | -| [monitorsSetDefaultKeySample.ts][monitorssetdefaultkeysample] | Set the default api key. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_SetDefaultKey.json | -| [monitorsUpdateSample.ts][monitorsupdatesample] | Update a monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Update.json | -| [operationsListSample.ts][operationslistsample] | List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Operations_List.json | -| [singleSignOnConfigurationsCreateOrUpdateSample.ts][singlesignonconfigurationscreateorupdatesample] | Configures single-sign-on for this resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json | -| [singleSignOnConfigurationsGetSample.ts][singlesignonconfigurationsgetsample] | Gets the datadog single sign-on resource for the given Monitor. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_Get.json | -| [singleSignOnConfigurationsListSample.ts][singlesignonconfigurationslistsample] | List the single sign-on configurations for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_List.json | -| [tagRulesCreateOrUpdateSample.ts][tagrulescreateorupdatesample] | Create or update a tag rule set for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_CreateOrUpdate.json | -| [tagRulesGetSample.ts][tagrulesgetsample] | Get a tag rule set for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_Get.json | -| [tagRulesListSample.ts][tagruleslistsample] | List the tag rules for a given monitor resource. x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_List.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/creationSupportedGetSample.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 dev-tool run vendored cross-env DATADOG_SUBSCRIPTION_ID="" node dist/creationSupportedGetSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[creationsupportedgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/creationSupportedGetSample.ts -[creationsupportedlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/creationSupportedListSample.ts -[marketplaceagreementscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsCreateOrUpdateSample.ts -[marketplaceagreementslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsListSample.ts -[monitoredsubscriptionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsCreateorUpdateSample.ts -[monitoredsubscriptionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsDeleteSample.ts -[monitoredsubscriptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsGetSample.ts -[monitoredsubscriptionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsListSample.ts -[monitoredsubscriptionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsUpdateSample.ts -[monitorscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsCreateSample.ts -[monitorsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsDeleteSample.ts -[monitorsgetdefaultkeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetDefaultKeySample.ts -[monitorsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetSample.ts -[monitorslistapikeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListApiKeysSample.ts -[monitorslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListByResourceGroupSample.ts -[monitorslisthostssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListHostsSample.ts -[monitorslistlinkedresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListLinkedResourcesSample.ts -[monitorslistmonitoredresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListMonitoredResourcesSample.ts -[monitorslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListSample.ts -[monitorsrefreshsetpasswordlinksample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsRefreshSetPasswordLinkSample.ts -[monitorssetdefaultkeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsSetDefaultKeySample.ts -[monitorsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsUpdateSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/operationsListSample.ts -[singlesignonconfigurationscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsCreateOrUpdateSample.ts -[singlesignonconfigurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsGetSample.ts -[singlesignonconfigurationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsListSample.ts -[tagrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesCreateOrUpdateSample.ts -[tagrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesGetSample.ts -[tagruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesListSample.ts -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-datadog?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/package.json b/sdk/datadog/arm-datadog/samples/v3/typescript/package.json deleted file mode 100644 index 0edb4eaa07b8..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@azure-samples/arm-datadog-ts", - "private": true, - "version": "1.0.0", - "description": " client library samples for TypeScript", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/datadog/arm-datadog" - }, - "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/datadog/arm-datadog", - "dependencies": { - "@azure/arm-datadog": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" - } -} diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/sample.env b/sdk/datadog/arm-datadog/samples/v3/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# 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/datadog/arm-datadog/samples/v3/typescript/src/creationSupportedGetSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/creationSupportedGetSample.ts deleted file mode 100644 index 325de5fb335c..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/creationSupportedGetSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Informs if the current subscription is being already monitored for selected Datadog organization. - * - * @summary Informs if the current subscription is being already monitored for selected Datadog organization. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_Get.json - */ -async function creationSupportedGet(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const datadogOrganizationId = "00000000-0000-0000-0000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.creationSupported.get(datadogOrganizationId); - console.log(result); -} - -async function main(): Promise { - creationSupportedGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/creationSupportedListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/creationSupportedListSample.ts deleted file mode 100644 index 80cc3f6e62da..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/creationSupportedListSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Informs if the current subscription is being already monitored for selected Datadog organization. - * - * @summary Informs if the current subscription is being already monitored for selected Datadog organization. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/CreationSupported_List.json - */ -async function creationSupportedList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const datadogOrganizationId = "00000000-0000-0000-0000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.creationSupported.list(datadogOrganizationId)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - creationSupportedList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsCreateOrUpdateSample.ts deleted file mode 100644 index e2d118afa116..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsCreateOrUpdateSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { - DatadogAgreementResource, - MarketplaceAgreementsCreateOrUpdateOptionalParams, - MicrosoftDatadogClient -} from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create Datadog marketplace agreement in the subscription. - * - * @summary Create Datadog marketplace agreement in the subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_Create.json - */ -async function marketplaceAgreementsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const body: DatadogAgreementResource = { properties: { accepted: true } }; - const options: MarketplaceAgreementsCreateOrUpdateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.marketplaceAgreements.createOrUpdate(options); - console.log(result); -} - -async function main(): Promise { - marketplaceAgreementsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsListSample.ts deleted file mode 100644 index b1dfdd7e3c8f..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/marketplaceAgreementsListSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Datadog marketplace agreements in the subscription. - * - * @summary List Datadog marketplace agreements in the subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MarketplaceAgreements_List.json - */ -async function marketplaceAgreementsList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.marketplaceAgreements.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - marketplaceAgreementsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsCreateorUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsCreateorUpdateSample.ts deleted file mode 100644 index 68f91021105d..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsCreateorUpdateSample.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 { - MonitoredSubscriptionProperties, - MonitoredSubscriptionsCreateorUpdateOptionalParams, - MicrosoftDatadogClient -} from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Add the subscriptions that should be monitored by the Datadog monitor resource. - * - * @summary Add the subscriptions that should be monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_CreateorUpdate.json - */ -async function monitorsAddMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body: MonitoredSubscriptionProperties = { - properties: { - monitoredSubscriptionList: [ - { - status: "Active", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000000", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" } - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true - }, - metricRules: { filteringTags: [] } - } - }, - { - status: "Failed", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000001", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" } - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true - }, - metricRules: { filteringTags: [] } - } - } - ], - operation: "AddBegin" - } - }; - const options: MonitoredSubscriptionsCreateorUpdateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginCreateorUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options - ); - console.log(result); -} - -async function main(): Promise { - monitorsAddMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsDeleteSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsDeleteSample.ts deleted file mode 100644 index 6f144c2b4d1a..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsDeleteSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Updates the subscriptions that are being monitored by the Datadog monitor resource - * - * @summary Updates the subscriptions that are being monitored by the Datadog monitor resource - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Delete.json - */ -async function monitorsDeleteMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginDeleteAndWait( - resourceGroupName, - monitorName, - configurationName - ); - console.log(result); -} - -async function main(): Promise { - monitorsDeleteMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsGetSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsGetSample.ts deleted file mode 100644 index a66d8f1fafd8..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsGetSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the subscriptions currently being monitored by the Datadog monitor resource. - * - * @summary List the subscriptions currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Get.json - */ -async function monitorsGetMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.get( - resourceGroupName, - monitorName, - configurationName - ); - console.log(result); -} - -async function main(): Promise { - monitorsGetMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsListSample.ts deleted file mode 100644 index 6892dfc4b4c1..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsListSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the subscriptions currently being monitored by the Datadog monitor resource. - * - * @summary List the subscriptions currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_List.json - */ -async function monitorsGetMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitoredSubscriptions.list( - resourceGroupName, - monitorName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - monitorsGetMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsUpdateSample.ts deleted file mode 100644 index e4821568c0ae..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitoredSubscriptionsUpdateSample.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 { - MonitoredSubscriptionProperties, - MonitoredSubscriptionsUpdateOptionalParams, - MicrosoftDatadogClient -} from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Updates the subscriptions that are being monitored by the Datadog monitor resource - * - * @summary Updates the subscriptions that are being monitored by the Datadog monitor resource - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredSubscriptions_Update.json - */ -async function monitorsUpdateMonitoredSubscriptions(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body: MonitoredSubscriptionProperties = { - properties: { - monitoredSubscriptionList: [ - { - status: "Active", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000000", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" } - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true - }, - metricRules: { filteringTags: [] } - } - }, - { - status: "Failed", - subscriptionId: "/subscriptions/00000000-0000-0000-0000-000000000001", - tagRules: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" } - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true - }, - metricRules: { filteringTags: [] } - } - } - ], - operation: "AddComplete" - } - }; - const options: MonitoredSubscriptionsUpdateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitoredSubscriptions.beginUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options - ); - console.log(result); -} - -async function main(): Promise { - monitorsUpdateMonitoredSubscriptions(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsCreateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsCreateSample.ts deleted file mode 100644 index 4740e21dcc21..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsCreateSample.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 { - DatadogMonitorResource, - MonitorsCreateOptionalParams, - MicrosoftDatadogClient -} from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create a monitor resource. - * - * @summary Create a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Create.json - */ -async function monitorsCreate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body: DatadogMonitorResource = { - name: "myMonitor", - location: "West US", - properties: { - datadogOrganizationProperties: { - name: "myOrg", - cspm: false, - enterpriseAppId: "00000000-0000-0000-0000-000000000000", - id: "myOrg123", - linkingAuthCode: "someAuthCode", - linkingClientId: "00000000-0000-0000-0000-000000000000" - }, - monitoringStatus: "Enabled", - userInfo: { - name: "Alice", - emailAddress: "alice@microsoft.com", - phoneNumber: "123-456-7890" - } - }, - sku: { name: "free_Monthly" }, - tags: { environment: "Dev" } - }; - const options: MonitorsCreateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginCreateAndWait( - resourceGroupName, - monitorName, - options - ); - console.log(result); -} - -async function main(): Promise { - monitorsCreate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsDeleteSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsDeleteSample.ts deleted file mode 100644 index c8c719d6eaf1..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsDeleteSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a monitor resource. - * - * @summary Delete a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Delete.json - */ -async function monitorsDelete(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginDeleteAndWait( - resourceGroupName, - monitorName - ); - console.log(result); -} - -async function main(): Promise { - monitorsDelete(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetDefaultKeySample.ts deleted file mode 100644 index a5d873cbb16f..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetDefaultKeySample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the default api key. - * - * @summary Get the default api key. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_GetDefaultKey.json - */ -async function monitorsGetDefaultKey(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.getDefaultKey( - resourceGroupName, - monitorName - ); - console.log(result); -} - -async function main(): Promise { - monitorsGetDefaultKey(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetSample.ts deleted file mode 100644 index bfd7131093ac..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsGetSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the properties of a specific monitor resource. - * - * @summary Get the properties of a specific monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Get.json - */ -async function monitorsGet(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.get(resourceGroupName, monitorName); - console.log(result); -} - -async function main(): Promise { - monitorsGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListApiKeysSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListApiKeysSample.ts deleted file mode 100644 index 290660c8e0a8..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListApiKeysSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the api keys for a given monitor resource. - * - * @summary List the api keys for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_List.json - */ -async function monitorsListApiKeys(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.listApiKeys( - resourceGroupName, - monitorName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - monitorsListApiKeys(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListByResourceGroupSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListByResourceGroupSample.ts deleted file mode 100644 index a55f3938d381..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListByResourceGroupSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List all monitors under the specified resource group. - * - * @summary List all monitors under the specified resource group. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_ListByResourceGroup.json - */ -async function monitorsListByResourceGroup(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - monitorsListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListHostsSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListHostsSample.ts deleted file mode 100644 index b55e423371e4..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListHostsSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the hosts for a given monitor resource. - * - * @summary List the hosts for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Hosts_List.json - */ -async function monitorsListHosts(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.listHosts( - resourceGroupName, - monitorName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - monitorsListHosts(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListLinkedResourcesSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListLinkedResourcesSample.ts deleted file mode 100644 index 87f7202294db..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListLinkedResourcesSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List all Azure resources associated to the same Datadog organization as the target resource. - * - * @summary List all Azure resources associated to the same Datadog organization as the target resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/LinkedResources_List.json - */ -async function monitorsListLinkedResources(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.listLinkedResources( - resourceGroupName, - monitorName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - monitorsListLinkedResources(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListMonitoredResourcesSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListMonitoredResourcesSample.ts deleted file mode 100644 index 57fe085b022b..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListMonitoredResourcesSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the resources currently being monitored by the Datadog monitor resource. - * - * @summary List the resources currently being monitored by the Datadog monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json - */ -async function monitorsListMonitoredResources(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(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(): Promise { - monitorsListMonitoredResources(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListSample.ts deleted file mode 100644 index f01912a3efd0..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsListSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List all monitors under the specified subscription. - * - * @summary List all monitors under the specified subscription. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_List.json - */ -async function monitorsList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.monitors.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - monitorsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsRefreshSetPasswordLinkSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsRefreshSetPasswordLinkSample.ts deleted file mode 100644 index ee213e02f3f6..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsRefreshSetPasswordLinkSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Refresh the set password link and return a latest one. - * - * @summary Refresh the set password link and return a latest one. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/RefreshSetPassword_Get.json - */ -async function monitorsRefreshSetPasswordLink(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.refreshSetPasswordLink( - resourceGroupName, - monitorName - ); - console.log(result); -} - -async function main(): Promise { - monitorsRefreshSetPasswordLink(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsSetDefaultKeySample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsSetDefaultKeySample.ts deleted file mode 100644 index 83f37a85cbb6..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsSetDefaultKeySample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 { - DatadogApiKey, - MonitorsSetDefaultKeyOptionalParams, - MicrosoftDatadogClient -} from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Set the default api key. - * - * @summary Set the default api key. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/ApiKeys_SetDefaultKey.json - */ -async function monitorsSetDefaultKey(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body: DatadogApiKey = { key: "1111111111111111aaaaaaaaaaaaaaaa" }; - const options: MonitorsSetDefaultKeyOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.setDefaultKey( - resourceGroupName, - monitorName, - options - ); - console.log(result); -} - -async function main(): Promise { - monitorsSetDefaultKey(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsUpdateSample.ts deleted file mode 100644 index b522e4426d87..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/monitorsUpdateSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 { - DatadogMonitorResourceUpdateParameters, - MonitorsUpdateOptionalParams, - MicrosoftDatadogClient -} from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Update a monitor resource. - * - * @summary Update a monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Monitors_Update.json - */ -async function monitorsUpdate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const body: DatadogMonitorResourceUpdateParameters = { - properties: { monitoringStatus: "Enabled" }, - tags: { environment: "Dev" } - }; - const options: MonitorsUpdateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.monitors.beginUpdateAndWait( - resourceGroupName, - monitorName, - options - ); - console.log(result); -} - -async function main(): Promise { - monitorsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/operationsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/operationsListSample.ts deleted file mode 100644 index fcf54cc76fe6..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - * - * @summary List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/Operations_List.json - */ -async function operationsList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsCreateOrUpdateSample.ts deleted file mode 100644 index 286cfb3f2c67..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsCreateOrUpdateSample.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 { - DatadogSingleSignOnResource, - SingleSignOnConfigurationsCreateOrUpdateOptionalParams, - MicrosoftDatadogClient -} from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Configures single-sign-on for this resource. - * - * @summary Configures single-sign-on for this resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_CreateOrUpdate.json - */ -async function singleSignOnConfigurationsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const body: DatadogSingleSignOnResource = { - properties: { - enterpriseAppId: "00000000-0000-0000-0000-000000000000", - singleSignOnState: "Enable" - } - }; - const options: SingleSignOnConfigurationsCreateOrUpdateOptionalParams = { - body - }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.singleSignOnConfigurations.beginCreateOrUpdateAndWait( - resourceGroupName, - monitorName, - configurationName, - options - ); - console.log(result); -} - -async function main(): Promise { - singleSignOnConfigurationsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsGetSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsGetSample.ts deleted file mode 100644 index 36ed4f3dddbd..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsGetSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the datadog single sign-on resource for the given Monitor. - * - * @summary Gets the datadog single sign-on resource for the given Monitor. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_Get.json - */ -async function singleSignOnConfigurationsGet(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const configurationName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.singleSignOnConfigurations.get( - resourceGroupName, - monitorName, - configurationName - ); - console.log(result); -} - -async function main(): Promise { - singleSignOnConfigurationsGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsListSample.ts deleted file mode 100644 index 37353a532dc4..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/singleSignOnConfigurationsListSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the single sign-on configurations for a given monitor resource. - * - * @summary List the single sign-on configurations for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/SingleSignOnConfigurations_List.json - */ -async function singleSignOnConfigurationsList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.singleSignOnConfigurations.list( - resourceGroupName, - monitorName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - singleSignOnConfigurationsList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesCreateOrUpdateSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesCreateOrUpdateSample.ts deleted file mode 100644 index 4a9978ee8ff4..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesCreateOrUpdateSample.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 { - MonitoringTagRules, - TagRulesCreateOrUpdateOptionalParams, - MicrosoftDatadogClient -} from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create or update a tag rule set for a given monitor resource. - * - * @summary Create or update a tag rule set for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_CreateOrUpdate.json - */ -async function tagRulesCreateOrUpdate(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const ruleSetName = "default"; - const body: MonitoringTagRules = { - properties: { - automuting: true, - logRules: { - filteringTags: [ - { name: "Environment", action: "Include", value: "Prod" }, - { name: "Environment", action: "Exclude", value: "Dev" } - ], - sendAadLogs: false, - sendResourceLogs: true, - sendSubscriptionLogs: true - }, - metricRules: { filteringTags: [] } - } - }; - const options: TagRulesCreateOrUpdateOptionalParams = { body }; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.tagRules.createOrUpdate( - resourceGroupName, - monitorName, - ruleSetName, - options - ); - console.log(result); -} - -async function main(): Promise { - tagRulesCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesGetSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesGetSample.ts deleted file mode 100644 index 6790d114a3e9..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesGetSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a tag rule set for a given monitor resource. - * - * @summary Get a tag rule set for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_Get.json - */ -async function tagRulesGet(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const ruleSetName = "default"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const result = await client.tagRules.get( - resourceGroupName, - monitorName, - ruleSetName - ); - console.log(result); -} - -async function main(): Promise { - tagRulesGet(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesListSample.ts b/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesListSample.ts deleted file mode 100644 index b5fa28371706..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/src/tagRulesListSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { MicrosoftDatadogClient } from "@azure/arm-datadog"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the tag rules for a given monitor resource. - * - * @summary List the tag rules for a given monitor resource. - * x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/TagRules_List.json - */ -async function tagRulesList(): Promise { - const subscriptionId = - process.env["DATADOG_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup"; - const monitorName = "myMonitor"; - const credential = new DefaultAzureCredential(); - const client = new MicrosoftDatadogClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.tagRules.list(resourceGroupName, monitorName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - tagRulesList(); -} - -main().catch(console.error); diff --git a/sdk/datadog/arm-datadog/samples/v3/typescript/tsconfig.json b/sdk/datadog/arm-datadog/samples/v3/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/datadog/arm-datadog/samples/v3/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "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/datadog/arm-datadog/src/api/creationSupportedOperationGroup/index.ts b/sdk/datadog/arm-datadog/src/api/creationSupportedOperationGroup/index.ts new file mode 100644 index 000000000000..432d0823e73f --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/creationSupportedOperationGroup/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { get, list } from "./operations.js"; +export { + CreationSupportedOperationGroupGetOptionalParams, + CreationSupportedOperationGroupListOptionalParams, +} from "./options.js"; diff --git a/sdk/datadog/arm-datadog/src/api/creationSupportedOperationGroup/operations.ts b/sdk/datadog/arm-datadog/src/api/creationSupportedOperationGroup/operations.ts new file mode 100644 index 000000000000..77c33b6da57c --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/creationSupportedOperationGroup/operations.ts @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + _CreateResourceSupportedResponseList, + _createResourceSupportedResponseListDeserializer, + CreateResourceSupportedResponse, + createResourceSupportedResponseDeserializer, +} from "../../models/models.js"; +import { + CreationSupportedOperationGroupGetOptionalParams, + CreationSupportedOperationGroupListOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _getSend( + context: Client, + datadogOrganizationId: string, + options: CreationSupportedOperationGroupGetOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses/default{?api%2Dversion,datadogOrganizationId}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + datadogOrganizationId: datadogOrganizationId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return createResourceSupportedResponseDeserializer(result.body); +} + +/** Informs if the current subscription is being already monitored for selected Datadog organization. */ +export async function get( + context: Client, + datadogOrganizationId: string, + options: CreationSupportedOperationGroupGetOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getSend(context, datadogOrganizationId, options); + return _getDeserialize(result); +} + +export function _listSend( + context: Client, + datadogOrganizationId: string, + options: CreationSupportedOperationGroupListOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses{?api%2Dversion,datadogOrganizationId}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + datadogOrganizationId: datadogOrganizationId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_CreateResourceSupportedResponseList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _createResourceSupportedResponseListDeserializer(result.body); +} + +/** Informs if the current subscription is being already monitored for selected Datadog organization. */ +export function list( + context: Client, + datadogOrganizationId: string, + options: CreationSupportedOperationGroupListOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, datadogOrganizationId, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/datadog/arm-datadog/src/api/creationSupportedOperationGroup/options.ts b/sdk/datadog/arm-datadog/src/api/creationSupportedOperationGroup/options.ts new file mode 100644 index 000000000000..521a122801e2 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/creationSupportedOperationGroup/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CreationSupportedOperationGroupGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CreationSupportedOperationGroupListOptionalParams extends OperationOptions {} diff --git a/sdk/datadog/arm-datadog/src/api/datadogContext.ts b/sdk/datadog/arm-datadog/src/api/datadogContext.ts new file mode 100644 index 000000000000..0d506adba9e9 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/datadogContext.ts @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +export interface DatadogContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; +} + +/** Optional parameters for the client. */ +export interface DatadogClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +export function createDatadog( + credential: TokenCredential, + subscriptionId: string, + options: DatadogClientOptionalParams = {}, +): DatadogContext { + const endpointUrl = options.endpoint ?? options.baseUrl ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-datadog/1.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2023-10-20"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return { ...clientContext, apiVersion, subscriptionId } as DatadogContext; +} diff --git a/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/index.ts b/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/index.ts new file mode 100644 index 000000000000..846062fce3fb --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/index.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + billingInfoGet, + refreshSetPasswordLink, + listMonitoredResources, + listLinkedResources, + listHosts, + setDefaultKey, + getDefaultKey, + listApiKeys, + list, + listByResourceGroup, + $delete, + update, + create, + get, +} from "./operations.js"; +export { + DatadogMonitorResourcesBillingInfoGetOptionalParams, + DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams, + DatadogMonitorResourcesListMonitoredResourcesOptionalParams, + DatadogMonitorResourcesListLinkedResourcesOptionalParams, + DatadogMonitorResourcesListHostsOptionalParams, + DatadogMonitorResourcesSetDefaultKeyOptionalParams, + DatadogMonitorResourcesGetDefaultKeyOptionalParams, + DatadogMonitorResourcesListApiKeysOptionalParams, + DatadogMonitorResourcesListOptionalParams, + DatadogMonitorResourcesListByResourceGroupOptionalParams, + DatadogMonitorResourcesDeleteOptionalParams, + DatadogMonitorResourcesUpdateOptionalParams, + DatadogMonitorResourcesCreateOptionalParams, + DatadogMonitorResourcesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/operations.ts b/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/operations.ts new file mode 100644 index 000000000000..a43543842319 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/operations.ts @@ -0,0 +1,864 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + DatadogMonitorResource, + datadogMonitorResourceSerializer, + datadogMonitorResourceDeserializer, + DatadogMonitorResourceUpdateParameters, + datadogMonitorResourceUpdateParametersSerializer, + _DatadogMonitorResourceListResponse, + _datadogMonitorResourceListResponseDeserializer, + _DatadogApiKeyListResponse, + _datadogApiKeyListResponseDeserializer, + DatadogApiKey, + datadogApiKeySerializer, + datadogApiKeyDeserializer, + _DatadogHostListResponse, + _datadogHostListResponseDeserializer, + DatadogHost, + _LinkedResourceListResponse, + _linkedResourceListResponseDeserializer, + LinkedResource, + _MonitoredResourceListResponse, + _monitoredResourceListResponseDeserializer, + MonitoredResource, + DatadogSetPasswordLink, + datadogSetPasswordLinkDeserializer, + BillingInfoResponse, + billingInfoResponseDeserializer, +} from "../../models/models.js"; +import { + DatadogMonitorResourcesBillingInfoGetOptionalParams, + DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams, + DatadogMonitorResourcesListMonitoredResourcesOptionalParams, + DatadogMonitorResourcesListLinkedResourcesOptionalParams, + DatadogMonitorResourcesListHostsOptionalParams, + DatadogMonitorResourcesSetDefaultKeyOptionalParams, + DatadogMonitorResourcesGetDefaultKeyOptionalParams, + DatadogMonitorResourcesListApiKeysOptionalParams, + DatadogMonitorResourcesListOptionalParams, + DatadogMonitorResourcesListByResourceGroupOptionalParams, + DatadogMonitorResourcesDeleteOptionalParams, + DatadogMonitorResourcesUpdateOptionalParams, + DatadogMonitorResourcesCreateOptionalParams, + DatadogMonitorResourcesGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _billingInfoGetSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesBillingInfoGetOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getBillingInfo{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _billingInfoGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return billingInfoResponseDeserializer(result.body); +} + +/** Get marketplace and organization info mapped to the given monitor. */ +export async function billingInfoGet( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesBillingInfoGetOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _billingInfoGetSend(context, resourceGroupName, monitorName, options); + return _billingInfoGetDeserialize(result); +} + +export function _refreshSetPasswordLinkSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _refreshSetPasswordLinkDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return datadogSetPasswordLinkDeserializer(result.body); +} + +/** Refresh the set password link and return a latest one. */ +export async function refreshSetPasswordLink( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _refreshSetPasswordLinkSend( + context, + resourceGroupName, + monitorName, + options, + ); + return _refreshSetPasswordLinkDeserialize(result); +} + +export function _listMonitoredResourcesSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesListMonitoredResourcesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listMonitoredResourcesDeserialize( + result: PathUncheckedResponse, +): Promise<_MonitoredResourceListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _monitoredResourceListResponseDeserializer(result.body); +} + +/** List the resources currently being monitored by the Datadog monitor resource. */ +export function listMonitoredResources( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesListMonitoredResourcesOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listMonitoredResourcesSend(context, resourceGroupName, monitorName, options), + _listMonitoredResourcesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listLinkedResourcesSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesListLinkedResourcesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listLinkedResourcesDeserialize( + result: PathUncheckedResponse, +): Promise<_LinkedResourceListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _linkedResourceListResponseDeserializer(result.body); +} + +/** List all Azure resources associated to the same Datadog organization as the target resource. */ +export function listLinkedResources( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesListLinkedResourcesOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listLinkedResourcesSend(context, resourceGroupName, monitorName, options), + _listLinkedResourcesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listHostsSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesListHostsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listHostsDeserialize( + result: PathUncheckedResponse, +): Promise<_DatadogHostListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _datadogHostListResponseDeserializer(result.body); +} + +/** List the hosts for a given monitor resource. */ +export function listHosts( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesListHostsOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listHostsSend(context, resourceGroupName, monitorName, options), + _listHostsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _setDefaultKeySend( + context: Client, + resourceGroupName: string, + monitorName: string, + body: { + body?: DatadogApiKey; + }, + options: DatadogMonitorResourcesSetDefaultKeyOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: !options["body"] ? options["body"] : datadogApiKeySerializer(options["body"]), + }); +} + +export async function _setDefaultKeyDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Set the default api key. */ +export async function setDefaultKey( + context: Client, + resourceGroupName: string, + monitorName: string, + body: { + body?: DatadogApiKey; + }, + options: DatadogMonitorResourcesSetDefaultKeyOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _setDefaultKeySend(context, resourceGroupName, monitorName, body, options); + return _setDefaultKeyDeserialize(result); +} + +export function _getDefaultKeySend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesGetDefaultKeyOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDefaultKeyDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return datadogApiKeyDeserializer(result.body); +} + +/** Get the default api key. */ +export async function getDefaultKey( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesGetDefaultKeyOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getDefaultKeySend(context, resourceGroupName, monitorName, options); + return _getDefaultKeyDeserialize(result); +} + +export function _listApiKeysSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesListApiKeysOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listApiKeysDeserialize( + result: PathUncheckedResponse, +): Promise<_DatadogApiKeyListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _datadogApiKeyListResponseDeserializer(result.body); +} + +/** List the api keys for a given monitor resource. */ +export function listApiKeys( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesListApiKeysOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listApiKeysSend(context, resourceGroupName, monitorName, options), + _listApiKeysDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listSend( + context: Client, + options: DatadogMonitorResourcesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_DatadogMonitorResourceListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _datadogMonitorResourceListResponseDeserializer(result.body); +} + +/** List all monitors under the specified subscription. */ +export function list( + context: Client, + options: DatadogMonitorResourcesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: DatadogMonitorResourcesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_DatadogMonitorResourceListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _datadogMonitorResourceListResponseDeserializer(result.body); +} + +/** List all monitors under the specified resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: DatadogMonitorResourcesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a monitor resource. */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _$deleteSend(context, resourceGroupName, monitorName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + monitorName: string, + body: DatadogMonitorResourceUpdateParameters, + options: DatadogMonitorResourcesUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: datadogMonitorResourceUpdateParametersSerializer(body), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Update a monitor resource. */ +export function update( + context: Client, + resourceGroupName: string, + monitorName: string, + body: DatadogMonitorResourceUpdateParameters, + options: DatadogMonitorResourcesUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _updateSend(context, resourceGroupName, monitorName, body, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + monitorName: string, + body: DatadogMonitorResource, + options: DatadogMonitorResourcesCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: datadogMonitorResourceSerializer(body), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return datadogMonitorResourceDeserializer(result.body); +} + +/** Create a monitor resource. */ +export function create( + context: Client, + resourceGroupName: string, + monitorName: string, + body: DatadogMonitorResource, + options: DatadogMonitorResourcesCreateOptionalParams = { requestOptions: {} }, +): PollerLike, DatadogMonitorResource> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _createSend(context, resourceGroupName, monitorName, body, options), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, DatadogMonitorResource>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return datadogMonitorResourceDeserializer(result.body); +} + +/** Get the properties of a specific monitor resource. */ +export async function get( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogMonitorResourcesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, monitorName, options); + return _getDeserialize(result); +} diff --git a/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/options.ts b/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/options.ts new file mode 100644 index 000000000000..c7f23fcace68 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/datadogMonitorResources/options.ts @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DatadogMonitorResourcesBillingInfoGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesListMonitoredResourcesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesListLinkedResourcesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesListHostsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesSetDefaultKeyOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesGetDefaultKeyOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesListApiKeysOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DatadogMonitorResourcesGetOptionalParams extends OperationOptions {} diff --git a/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/index.ts b/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/index.ts new file mode 100644 index 000000000000..f2cb6196a973 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, createOrUpdate, get } from "./operations.js"; +export { + DatadogSingleSignOnResourcesListOptionalParams, + DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams, + DatadogSingleSignOnResourcesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/operations.ts b/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/operations.ts new file mode 100644 index 000000000000..c82e1ec25c61 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/operations.ts @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + DatadogSingleSignOnResource, + datadogSingleSignOnResourceSerializer, + datadogSingleSignOnResourceDeserializer, + _DatadogSingleSignOnResourceListResponse, + _datadogSingleSignOnResourceListResponseDeserializer, +} from "../../models/models.js"; +import { + DatadogSingleSignOnResourcesListOptionalParams, + DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams, + DatadogSingleSignOnResourcesGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogSingleSignOnResourcesListOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_DatadogSingleSignOnResourceListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _datadogSingleSignOnResourceListResponseDeserializer(result.body); +} + +/** List the single sign-on configurations for a given monitor resource. */ +export function list( + context: Client, + resourceGroupName: string, + monitorName: string, + options: DatadogSingleSignOnResourcesListOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, resourceGroupName, monitorName, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: DatadogSingleSignOnResource, + options: DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: datadogSingleSignOnResourceSerializer(body), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return datadogSingleSignOnResourceDeserializer(result.body); +} + +/** Configures single-sign-on for this resource. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: DatadogSingleSignOnResource, + options: DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, DatadogSingleSignOnResource> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + monitorName, + configurationName, + body, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, DatadogSingleSignOnResource>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + options: DatadogSingleSignOnResourcesGetOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return datadogSingleSignOnResourceDeserializer(result.body); +} + +/** Gets the datadog single sign-on resource for the given Monitor. */ +export async function get( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + options: DatadogSingleSignOnResourcesGetOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + monitorName, + configurationName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/options.ts b/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/options.ts new file mode 100644 index 000000000000..bc8080135570 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/datadogSingleSignOnResources/options.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DatadogSingleSignOnResourcesListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DatadogSingleSignOnResourcesGetOptionalParams extends OperationOptions {} diff --git a/sdk/datadog/arm-datadog/src/api/index.ts b/sdk/datadog/arm-datadog/src/api/index.ts new file mode 100644 index 000000000000..805fd9ecaba9 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/index.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { createDatadog, DatadogContext, DatadogClientOptionalParams } from "./datadogContext.js"; diff --git a/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/index.ts b/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/index.ts new file mode 100644 index 000000000000..0649607c1be1 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { createOrUpdate, list } from "./operations.js"; +export { + MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams, + MarketplaceAgreementsOperationGroupListOptionalParams, +} from "./options.js"; diff --git a/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/operations.ts b/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/operations.ts new file mode 100644 index 000000000000..549b301f4d63 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/operations.ts @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + _DatadogAgreementResourceListResponse, + _datadogAgreementResourceListResponseDeserializer, + DatadogAgreementResource, + datadogAgreementResourceSerializer, + datadogAgreementResourceDeserializer, +} from "../../models/models.js"; +import { + MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams, + MarketplaceAgreementsOperationGroupListOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _createOrUpdateSend( + context: Client, + body: DatadogAgreementResource, + options: MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: datadogAgreementResourceSerializer(body), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return datadogAgreementResourceDeserializer(result.body); +} + +/** Create Datadog marketplace agreement in the subscription. */ +export async function createOrUpdate( + context: Client, + body: DatadogAgreementResource, + options: MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _createOrUpdateSend(context, body, options); + return _createOrUpdateDeserialize(result); +} + +export function _listSend( + context: Client, + options: MarketplaceAgreementsOperationGroupListOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_DatadogAgreementResourceListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _datadogAgreementResourceListResponseDeserializer(result.body); +} + +/** List Datadog marketplace agreements in the subscription. */ +export function list( + context: Client, + options: MarketplaceAgreementsOperationGroupListOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/options.ts b/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/options.ts new file mode 100644 index 000000000000..95cfa21b632f --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/marketplaceAgreementsOperationGroup/options.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface MarketplaceAgreementsOperationGroupListOptionalParams extends OperationOptions {} diff --git a/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/index.ts b/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/index.ts new file mode 100644 index 000000000000..445b59befa2a --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, $delete, update, createorUpdate, get } from "./operations.js"; +export { + MonitoredSubscriptionsListOptionalParams, + MonitoredSubscriptionsDeleteOptionalParams, + MonitoredSubscriptionsUpdateOptionalParams, + MonitoredSubscriptionsCreateorUpdateOptionalParams, + MonitoredSubscriptionsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/operations.ts b/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/operations.ts new file mode 100644 index 000000000000..682263351cbe --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/operations.ts @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + MonitoredSubscriptionProperties, + monitoredSubscriptionPropertiesSerializer, + monitoredSubscriptionPropertiesDeserializer, + _MonitoredSubscriptionPropertiesList, + _monitoredSubscriptionPropertiesListDeserializer, +} from "../../models/models.js"; +import { + MonitoredSubscriptionsListOptionalParams, + MonitoredSubscriptionsDeleteOptionalParams, + MonitoredSubscriptionsUpdateOptionalParams, + MonitoredSubscriptionsCreateorUpdateOptionalParams, + MonitoredSubscriptionsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: MonitoredSubscriptionsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_MonitoredSubscriptionPropertiesList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _monitoredSubscriptionPropertiesListDeserializer(result.body); +} + +/** List the subscriptions currently being monitored by the Datadog monitor resource. */ +export function list( + context: Client, + resourceGroupName: string, + monitorName: string, + options: MonitoredSubscriptionsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, resourceGroupName, monitorName, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + options: MonitoredSubscriptionsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Updates the subscriptions that are being monitored by the Datadog monitor resource */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + options: MonitoredSubscriptionsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, monitorName, configurationName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: MonitoredSubscriptionProperties, + options: MonitoredSubscriptionsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: monitoredSubscriptionPropertiesSerializer(body), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return monitoredSubscriptionPropertiesDeserializer(result.body); +} + +/** Updates the subscriptions that are being monitored by the Datadog monitor resource */ +export function update( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: MonitoredSubscriptionProperties, + options: MonitoredSubscriptionsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, MonitoredSubscriptionProperties> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend(context, resourceGroupName, monitorName, configurationName, body, options), + resourceLocationConfig: "location", + }) as PollerLike< + OperationState, + MonitoredSubscriptionProperties + >; +} + +export function _createorUpdateSend( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: MonitoredSubscriptionProperties, + options: MonitoredSubscriptionsCreateorUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: monitoredSubscriptionPropertiesSerializer(body), + }); +} + +export async function _createorUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Add the subscriptions that should be monitored by the Datadog monitor resource. */ +export function createorUpdate( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: MonitoredSubscriptionProperties, + options: MonitoredSubscriptionsCreateorUpdateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, void> { + return getLongRunningPoller(context, _createorUpdateDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createorUpdateSend( + context, + resourceGroupName, + monitorName, + configurationName, + body, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + options: MonitoredSubscriptionsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return monitoredSubscriptionPropertiesDeserializer(result.body); +} + +/** List the subscriptions currently being monitored by the Datadog monitor resource. */ +export async function get( + context: Client, + resourceGroupName: string, + monitorName: string, + configurationName: string, + options: MonitoredSubscriptionsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + monitorName, + configurationName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/options.ts b/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/options.ts new file mode 100644 index 000000000000..307ccb172527 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/monitoredSubscriptions/options.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface MonitoredSubscriptionsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface MonitoredSubscriptionsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface MonitoredSubscriptionsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface MonitoredSubscriptionsCreateorUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface MonitoredSubscriptionsGetOptionalParams extends OperationOptions {} diff --git a/sdk/datadog/arm-datadog/src/api/operations/index.ts b/sdk/datadog/arm-datadog/src/api/operations/index.ts new file mode 100644 index 000000000000..24a804d14fcf --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/datadog/arm-datadog/src/api/operations/operations.ts b/sdk/datadog/arm-datadog/src/api/operations/operations.ts new file mode 100644 index 000000000000..2d145172b759 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/operations/operations.ts @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext as Client } from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + OperationResult, + errorResponseDeserializer, +} from "../../models/models.js"; +import { OperationsListOptionalParams } from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Datadog/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/datadog/arm-datadog/src/api/operations/options.ts b/sdk/datadog/arm-datadog/src/api/operations/options.ts new file mode 100644 index 000000000000..c461016ad1c5 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/datadog/arm-datadog/src/api/tagRules/index.ts b/sdk/datadog/arm-datadog/src/api/tagRules/index.ts new file mode 100644 index 000000000000..e212284f939a --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/tagRules/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, createOrUpdate, get } from "./operations.js"; +export { + TagRulesListOptionalParams, + TagRulesCreateOrUpdateOptionalParams, + TagRulesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/datadog/arm-datadog/src/api/tagRules/operations.ts b/sdk/datadog/arm-datadog/src/api/tagRules/operations.ts new file mode 100644 index 000000000000..5781da7ce02f --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/tagRules/operations.ts @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + MonitoringTagRules, + monitoringTagRulesSerializer, + monitoringTagRulesDeserializer, + _MonitoringTagRulesListResponse, + _monitoringTagRulesListResponseDeserializer, +} from "../../models/models.js"; +import { + TagRulesListOptionalParams, + TagRulesCreateOrUpdateOptionalParams, + TagRulesGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + resourceGroupName: string, + monitorName: string, + options: TagRulesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_MonitoringTagRulesListResponse> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _monitoringTagRulesListResponseDeserializer(result.body); +} + +/** List the tag rules for a given monitor resource. */ +export function list( + context: Client, + resourceGroupName: string, + monitorName: string, + options: TagRulesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, resourceGroupName, monitorName, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + body: MonitoringTagRules, + options: TagRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + ruleSetName: ruleSetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: monitoringTagRulesSerializer(body), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return monitoringTagRulesDeserializer(result.body); +} + +/** Create or update a tag rule set for a given monitor resource. */ +export async function createOrUpdate( + context: Client, + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + body: MonitoringTagRules, + options: TagRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + resourceGroupName, + monitorName, + ruleSetName, + body, + options, + ); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options: TagRulesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + monitorName: monitorName, + ruleSetName: ruleSetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return monitoringTagRulesDeserializer(result.body); +} + +/** Get a tag rule set for a given monitor resource. */ +export async function get( + context: Client, + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options: TagRulesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, monitorName, ruleSetName, options); + return _getDeserialize(result); +} diff --git a/sdk/datadog/arm-datadog/src/api/tagRules/options.ts b/sdk/datadog/arm-datadog/src/api/tagRules/options.ts new file mode 100644 index 000000000000..ac68f0179ab4 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/api/tagRules/options.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface TagRulesListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TagRulesCreateOrUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TagRulesGetOptionalParams extends OperationOptions {} diff --git a/sdk/datadog/arm-datadog/src/classic/creationSupportedOperationGroup/index.ts b/sdk/datadog/arm-datadog/src/classic/creationSupportedOperationGroup/index.ts new file mode 100644 index 000000000000..be9ba1490a12 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/classic/creationSupportedOperationGroup/index.ts @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext } from "../../api/datadogContext.js"; +import { CreateResourceSupportedResponse } from "../../models/models.js"; +import { + CreationSupportedOperationGroupGetOptionalParams, + CreationSupportedOperationGroupListOptionalParams, +} from "../../api/creationSupportedOperationGroup/options.js"; +import { get, list } from "../../api/creationSupportedOperationGroup/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a CreationSupportedOperationGroup operations. */ +export interface CreationSupportedOperationGroupOperations { + /** Informs if the current subscription is being already monitored for selected Datadog organization. */ + get: ( + datadogOrganizationId: string, + options?: CreationSupportedOperationGroupGetOptionalParams, + ) => Promise; + /** Informs if the current subscription is being already monitored for selected Datadog organization. */ + list: ( + datadogOrganizationId: string, + options?: CreationSupportedOperationGroupListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getCreationSupportedOperationGroup(context: DatadogContext) { + return { + get: ( + datadogOrganizationId: string, + options?: CreationSupportedOperationGroupGetOptionalParams, + ) => get(context, datadogOrganizationId, options), + list: ( + datadogOrganizationId: string, + options?: CreationSupportedOperationGroupListOptionalParams, + ) => list(context, datadogOrganizationId, options), + }; +} + +export function _getCreationSupportedOperationGroupOperations( + context: DatadogContext, +): CreationSupportedOperationGroupOperations { + return { + ..._getCreationSupportedOperationGroup(context), + }; +} diff --git a/sdk/datadog/arm-datadog/src/classic/datadogMonitorResources/index.ts b/sdk/datadog/arm-datadog/src/classic/datadogMonitorResources/index.ts new file mode 100644 index 000000000000..2f4adacd9581 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/classic/datadogMonitorResources/index.ts @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext } from "../../api/datadogContext.js"; +import { + DatadogMonitorResource, + DatadogMonitorResourceUpdateParameters, + DatadogApiKey, + DatadogHost, + LinkedResource, + MonitoredResource, + DatadogSetPasswordLink, + BillingInfoResponse, +} from "../../models/models.js"; +import { + DatadogMonitorResourcesBillingInfoGetOptionalParams, + DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams, + DatadogMonitorResourcesListMonitoredResourcesOptionalParams, + DatadogMonitorResourcesListLinkedResourcesOptionalParams, + DatadogMonitorResourcesListHostsOptionalParams, + DatadogMonitorResourcesSetDefaultKeyOptionalParams, + DatadogMonitorResourcesGetDefaultKeyOptionalParams, + DatadogMonitorResourcesListApiKeysOptionalParams, + DatadogMonitorResourcesListOptionalParams, + DatadogMonitorResourcesListByResourceGroupOptionalParams, + DatadogMonitorResourcesDeleteOptionalParams, + DatadogMonitorResourcesUpdateOptionalParams, + DatadogMonitorResourcesCreateOptionalParams, + DatadogMonitorResourcesGetOptionalParams, +} from "../../api/datadogMonitorResources/options.js"; +import { + billingInfoGet, + refreshSetPasswordLink, + listMonitoredResources, + listLinkedResources, + listHosts, + setDefaultKey, + getDefaultKey, + listApiKeys, + list, + listByResourceGroup, + $delete, + update, + create, + get, +} from "../../api/datadogMonitorResources/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a DatadogMonitorResources operations. */ +export interface DatadogMonitorResourcesOperations { + /** Get marketplace and organization info mapped to the given monitor. */ + billingInfoGet: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesBillingInfoGetOptionalParams, + ) => Promise; + /** Refresh the set password link and return a latest one. */ + refreshSetPasswordLink: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams, + ) => Promise; + /** List the resources currently being monitored by the Datadog monitor resource. */ + listMonitoredResources: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesListMonitoredResourcesOptionalParams, + ) => PagedAsyncIterableIterator; + /** List all Azure resources associated to the same Datadog organization as the target resource. */ + listLinkedResources: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesListLinkedResourcesOptionalParams, + ) => PagedAsyncIterableIterator; + /** List the hosts for a given monitor resource. */ + listHosts: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesListHostsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Set the default api key. */ + setDefaultKey: ( + resourceGroupName: string, + monitorName: string, + body: { + body?: DatadogApiKey; + }, + options?: DatadogMonitorResourcesSetDefaultKeyOptionalParams, + ) => Promise; + /** Get the default api key. */ + getDefaultKey: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesGetDefaultKeyOptionalParams, + ) => Promise; + /** List the api keys for a given monitor resource. */ + listApiKeys: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesListApiKeysOptionalParams, + ) => PagedAsyncIterableIterator; + /** List all monitors under the specified subscription. */ + list: ( + options?: DatadogMonitorResourcesListOptionalParams, + ) => PagedAsyncIterableIterator; + /** List all monitors under the specified resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: DatadogMonitorResourcesListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a monitor resource. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a monitor resource. */ + update: ( + resourceGroupName: string, + monitorName: string, + body: DatadogMonitorResourceUpdateParameters, + options?: DatadogMonitorResourcesUpdateOptionalParams, + ) => PollerLike, void>; + /** Create a monitor resource. */ + create: ( + resourceGroupName: string, + monitorName: string, + body: DatadogMonitorResource, + options?: DatadogMonitorResourcesCreateOptionalParams, + ) => PollerLike, DatadogMonitorResource>; + /** Get the properties of a specific monitor resource. */ + get: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesGetOptionalParams, + ) => Promise; +} + +function _getDatadogMonitorResources(context: DatadogContext) { + return { + billingInfoGet: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesBillingInfoGetOptionalParams, + ) => billingInfoGet(context, resourceGroupName, monitorName, options), + refreshSetPasswordLink: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams, + ) => refreshSetPasswordLink(context, resourceGroupName, monitorName, options), + listMonitoredResources: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesListMonitoredResourcesOptionalParams, + ) => listMonitoredResources(context, resourceGroupName, monitorName, options), + listLinkedResources: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesListLinkedResourcesOptionalParams, + ) => listLinkedResources(context, resourceGroupName, monitorName, options), + listHosts: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesListHostsOptionalParams, + ) => listHosts(context, resourceGroupName, monitorName, options), + setDefaultKey: ( + resourceGroupName: string, + monitorName: string, + body: { + body?: DatadogApiKey; + }, + options?: DatadogMonitorResourcesSetDefaultKeyOptionalParams, + ) => setDefaultKey(context, resourceGroupName, monitorName, body, options), + getDefaultKey: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesGetDefaultKeyOptionalParams, + ) => getDefaultKey(context, resourceGroupName, monitorName, options), + listApiKeys: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesListApiKeysOptionalParams, + ) => listApiKeys(context, resourceGroupName, monitorName, options), + list: (options?: DatadogMonitorResourcesListOptionalParams) => list(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: DatadogMonitorResourcesListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, monitorName, options), + update: ( + resourceGroupName: string, + monitorName: string, + body: DatadogMonitorResourceUpdateParameters, + options?: DatadogMonitorResourcesUpdateOptionalParams, + ) => update(context, resourceGroupName, monitorName, body, options), + create: ( + resourceGroupName: string, + monitorName: string, + body: DatadogMonitorResource, + options?: DatadogMonitorResourcesCreateOptionalParams, + ) => create(context, resourceGroupName, monitorName, body, options), + get: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogMonitorResourcesGetOptionalParams, + ) => get(context, resourceGroupName, monitorName, options), + }; +} + +export function _getDatadogMonitorResourcesOperations( + context: DatadogContext, +): DatadogMonitorResourcesOperations { + return { + ..._getDatadogMonitorResources(context), + }; +} diff --git a/sdk/datadog/arm-datadog/src/classic/datadogSingleSignOnResources/index.ts b/sdk/datadog/arm-datadog/src/classic/datadogSingleSignOnResources/index.ts new file mode 100644 index 000000000000..708ad11c928e --- /dev/null +++ b/sdk/datadog/arm-datadog/src/classic/datadogSingleSignOnResources/index.ts @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext } from "../../api/datadogContext.js"; +import { DatadogSingleSignOnResource } from "../../models/models.js"; +import { + DatadogSingleSignOnResourcesListOptionalParams, + DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams, + DatadogSingleSignOnResourcesGetOptionalParams, +} from "../../api/datadogSingleSignOnResources/options.js"; +import { list, createOrUpdate, get } from "../../api/datadogSingleSignOnResources/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a DatadogSingleSignOnResources operations. */ +export interface DatadogSingleSignOnResourcesOperations { + /** List the single sign-on configurations for a given monitor resource. */ + list: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogSingleSignOnResourcesListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Configures single-sign-on for this resource. */ + createOrUpdate: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: DatadogSingleSignOnResource, + options?: DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams, + ) => PollerLike, DatadogSingleSignOnResource>; + /** Gets the datadog single sign-on resource for the given Monitor. */ + get: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + options?: DatadogSingleSignOnResourcesGetOptionalParams, + ) => Promise; +} + +function _getDatadogSingleSignOnResources(context: DatadogContext) { + return { + list: ( + resourceGroupName: string, + monitorName: string, + options?: DatadogSingleSignOnResourcesListOptionalParams, + ) => list(context, resourceGroupName, monitorName, options), + createOrUpdate: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: DatadogSingleSignOnResource, + options?: DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, monitorName, configurationName, body, options), + get: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + options?: DatadogSingleSignOnResourcesGetOptionalParams, + ) => get(context, resourceGroupName, monitorName, configurationName, options), + }; +} + +export function _getDatadogSingleSignOnResourcesOperations( + context: DatadogContext, +): DatadogSingleSignOnResourcesOperations { + return { + ..._getDatadogSingleSignOnResources(context), + }; +} diff --git a/sdk/datadog/arm-datadog/src/classic/index.ts b/sdk/datadog/arm-datadog/src/classic/index.ts new file mode 100644 index 000000000000..5f0d978910d5 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/classic/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { CreationSupportedOperationGroupOperations } from "./creationSupportedOperationGroup/index.js"; +export { DatadogMonitorResourcesOperations } from "./datadogMonitorResources/index.js"; +export { DatadogSingleSignOnResourcesOperations } from "./datadogSingleSignOnResources/index.js"; +export { MarketplaceAgreementsOperationGroupOperations } from "./marketplaceAgreementsOperationGroup/index.js"; +export { MonitoredSubscriptionsOperations } from "./monitoredSubscriptions/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { TagRulesOperations } from "./tagRules/index.js"; diff --git a/sdk/datadog/arm-datadog/src/classic/marketplaceAgreementsOperationGroup/index.ts b/sdk/datadog/arm-datadog/src/classic/marketplaceAgreementsOperationGroup/index.ts new file mode 100644 index 000000000000..43df8c43436e --- /dev/null +++ b/sdk/datadog/arm-datadog/src/classic/marketplaceAgreementsOperationGroup/index.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext } from "../../api/datadogContext.js"; +import { DatadogAgreementResource } from "../../models/models.js"; +import { + MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams, + MarketplaceAgreementsOperationGroupListOptionalParams, +} from "../../api/marketplaceAgreementsOperationGroup/options.js"; +import { createOrUpdate, list } from "../../api/marketplaceAgreementsOperationGroup/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a MarketplaceAgreementsOperationGroup operations. */ +export interface MarketplaceAgreementsOperationGroupOperations { + /** Create Datadog marketplace agreement in the subscription. */ + createOrUpdate: ( + body: DatadogAgreementResource, + options?: MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams, + ) => Promise; + /** List Datadog marketplace agreements in the subscription. */ + list: ( + options?: MarketplaceAgreementsOperationGroupListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getMarketplaceAgreementsOperationGroup(context: DatadogContext) { + return { + createOrUpdate: ( + body: DatadogAgreementResource, + options?: MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, body, options), + list: (options?: MarketplaceAgreementsOperationGroupListOptionalParams) => + list(context, options), + }; +} + +export function _getMarketplaceAgreementsOperationGroupOperations( + context: DatadogContext, +): MarketplaceAgreementsOperationGroupOperations { + return { + ..._getMarketplaceAgreementsOperationGroup(context), + }; +} diff --git a/sdk/datadog/arm-datadog/src/classic/monitoredSubscriptions/index.ts b/sdk/datadog/arm-datadog/src/classic/monitoredSubscriptions/index.ts new file mode 100644 index 000000000000..d4342ad85ef2 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/classic/monitoredSubscriptions/index.ts @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext } from "../../api/datadogContext.js"; +import { MonitoredSubscriptionProperties } from "../../models/models.js"; +import { + MonitoredSubscriptionsListOptionalParams, + MonitoredSubscriptionsDeleteOptionalParams, + MonitoredSubscriptionsUpdateOptionalParams, + MonitoredSubscriptionsCreateorUpdateOptionalParams, + MonitoredSubscriptionsGetOptionalParams, +} from "../../api/monitoredSubscriptions/options.js"; +import { + list, + $delete, + update, + createorUpdate, + get, +} from "../../api/monitoredSubscriptions/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a MonitoredSubscriptions operations. */ +export interface MonitoredSubscriptionsOperations { + /** List the subscriptions currently being monitored by the Datadog monitor resource. */ + list: ( + resourceGroupName: string, + monitorName: string, + options?: MonitoredSubscriptionsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Updates the subscriptions that are being monitored by the Datadog monitor resource */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + options?: MonitoredSubscriptionsDeleteOptionalParams, + ) => PollerLike, void>; + /** Updates the subscriptions that are being monitored by the Datadog monitor resource */ + update: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: MonitoredSubscriptionProperties, + options?: MonitoredSubscriptionsUpdateOptionalParams, + ) => PollerLike, MonitoredSubscriptionProperties>; + /** Add the subscriptions that should be monitored by the Datadog monitor resource. */ + createorUpdate: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: MonitoredSubscriptionProperties, + options?: MonitoredSubscriptionsCreateorUpdateOptionalParams, + ) => PollerLike, void>; + /** List the subscriptions currently being monitored by the Datadog monitor resource. */ + get: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + options?: MonitoredSubscriptionsGetOptionalParams, + ) => Promise; +} + +function _getMonitoredSubscriptions(context: DatadogContext) { + return { + list: ( + resourceGroupName: string, + monitorName: string, + options?: MonitoredSubscriptionsListOptionalParams, + ) => list(context, resourceGroupName, monitorName, options), + delete: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + options?: MonitoredSubscriptionsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, monitorName, configurationName, options), + update: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: MonitoredSubscriptionProperties, + options?: MonitoredSubscriptionsUpdateOptionalParams, + ) => update(context, resourceGroupName, monitorName, configurationName, body, options), + createorUpdate: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + body: MonitoredSubscriptionProperties, + options?: MonitoredSubscriptionsCreateorUpdateOptionalParams, + ) => createorUpdate(context, resourceGroupName, monitorName, configurationName, body, options), + get: ( + resourceGroupName: string, + monitorName: string, + configurationName: string, + options?: MonitoredSubscriptionsGetOptionalParams, + ) => get(context, resourceGroupName, monitorName, configurationName, options), + }; +} + +export function _getMonitoredSubscriptionsOperations( + context: DatadogContext, +): MonitoredSubscriptionsOperations { + return { + ..._getMonitoredSubscriptions(context), + }; +} diff --git a/sdk/datadog/arm-datadog/src/classic/operations/index.ts b/sdk/datadog/arm-datadog/src/classic/operations/index.ts new file mode 100644 index 000000000000..484bc6a0ee63 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/classic/operations/index.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext } from "../../api/datadogContext.js"; +import { OperationResult } from "../../models/models.js"; +import { OperationsListOptionalParams } from "../../api/operations/options.js"; +import { list } from "../../api/operations/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +function _getOperations(context: DatadogContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations(context: DatadogContext): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/datadog/arm-datadog/src/classic/tagRules/index.ts b/sdk/datadog/arm-datadog/src/classic/tagRules/index.ts new file mode 100644 index 000000000000..b5ad5b93c687 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/classic/tagRules/index.ts @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogContext } from "../../api/datadogContext.js"; +import { MonitoringTagRules } from "../../models/models.js"; +import { + TagRulesListOptionalParams, + TagRulesCreateOrUpdateOptionalParams, + TagRulesGetOptionalParams, +} from "../../api/tagRules/options.js"; +import { list, createOrUpdate, get } from "../../api/tagRules/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a TagRules operations. */ +export interface TagRulesOperations { + /** List the tag rules for a given monitor resource. */ + list: ( + resourceGroupName: string, + monitorName: string, + options?: TagRulesListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Create or update a tag rule set for a given monitor resource. */ + createOrUpdate: ( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + body: MonitoringTagRules, + options?: TagRulesCreateOrUpdateOptionalParams, + ) => Promise; + /** Get a tag rule set for a given monitor resource. */ + get: ( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesGetOptionalParams, + ) => Promise; +} + +function _getTagRules(context: DatadogContext) { + return { + list: (resourceGroupName: string, monitorName: string, options?: TagRulesListOptionalParams) => + list(context, resourceGroupName, monitorName, options), + createOrUpdate: ( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + body: MonitoringTagRules, + options?: TagRulesCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, monitorName, ruleSetName, body, options), + get: ( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesGetOptionalParams, + ) => get(context, resourceGroupName, monitorName, ruleSetName, options), + }; +} + +export function _getTagRulesOperations(context: DatadogContext): TagRulesOperations { + return { + ..._getTagRules(context), + }; +} diff --git a/sdk/datadog/arm-datadog/src/datadogClient.ts b/sdk/datadog/arm-datadog/src/datadogClient.ts new file mode 100644 index 000000000000..b6ad9f5234e9 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/datadogClient.ts @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createDatadog, DatadogContext, DatadogClientOptionalParams } from "./api/index.js"; +import { + CreationSupportedOperationGroupOperations, + _getCreationSupportedOperationGroupOperations, +} from "./classic/creationSupportedOperationGroup/index.js"; +import { + MarketplaceAgreementsOperationGroupOperations, + _getMarketplaceAgreementsOperationGroupOperations, +} from "./classic/marketplaceAgreementsOperationGroup/index.js"; +import { + MonitoredSubscriptionsOperations, + _getMonitoredSubscriptionsOperations, +} from "./classic/monitoredSubscriptions/index.js"; +import { + DatadogSingleSignOnResourcesOperations, + _getDatadogSingleSignOnResourcesOperations, +} from "./classic/datadogSingleSignOnResources/index.js"; +import { TagRulesOperations, _getTagRulesOperations } from "./classic/tagRules/index.js"; +import { + DatadogMonitorResourcesOperations, + _getDatadogMonitorResourcesOperations, +} from "./classic/datadogMonitorResources/index.js"; +import { OperationsOperations, _getOperationsOperations } from "./classic/operations/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; + +export { DatadogClientOptionalParams } from "./api/datadogContext.js"; + +export class DatadogClient { + private _client: DatadogContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + constructor( + credential: TokenCredential, + subscriptionId: string, + options: DatadogClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createDatadog(credential, subscriptionId, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.creationSupportedOperationGroup = _getCreationSupportedOperationGroupOperations( + this._client, + ); + this.marketplaceAgreementsOperationGroup = _getMarketplaceAgreementsOperationGroupOperations( + this._client, + ); + this.monitoredSubscriptions = _getMonitoredSubscriptionsOperations(this._client); + this.datadogSingleSignOnResources = _getDatadogSingleSignOnResourcesOperations(this._client); + this.tagRules = _getTagRulesOperations(this._client); + this.datadogMonitorResources = _getDatadogMonitorResourcesOperations(this._client); + this.operations = _getOperationsOperations(this._client); + } + + /** The operation groups for creationSupportedOperationGroup */ + public readonly creationSupportedOperationGroup: CreationSupportedOperationGroupOperations; + /** The operation groups for marketplaceAgreementsOperationGroup */ + public readonly marketplaceAgreementsOperationGroup: MarketplaceAgreementsOperationGroupOperations; + /** The operation groups for monitoredSubscriptions */ + public readonly monitoredSubscriptions: MonitoredSubscriptionsOperations; + /** The operation groups for datadogSingleSignOnResources */ + public readonly datadogSingleSignOnResources: DatadogSingleSignOnResourcesOperations; + /** The operation groups for tagRules */ + public readonly tagRules: TagRulesOperations; + /** The operation groups for datadogMonitorResources */ + public readonly datadogMonitorResources: DatadogMonitorResourcesOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; +} diff --git a/sdk/datadog/arm-datadog/src/index.ts b/sdk/datadog/arm-datadog/src/index.ts index 23bd4434c69f..d451b47fc73b 100644 --- a/sdk/datadog/arm-datadog/src/index.ts +++ b/sdk/datadog/arm-datadog/src/index.ts @@ -1,13 +1,129 @@ -/* - * 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. -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; -export { MicrosoftDatadogClient } from "./microsoftDatadogClient.js"; -export * from "./operationsInterfaces/index.js"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { DatadogClient } from "./datadogClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + OperationResult, + OperationDisplay, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + DatadogMonitorResource, + ResourceSku, + MonitorProperties, + KnownProvisioningState, + ProvisioningState, + KnownMonitoringStatus, + MonitoringStatus, + KnownMarketplaceSubscriptionStatus, + MarketplaceSubscriptionStatus, + DatadogOrganizationProperties, + UserInfo, + KnownLiftrResourceCategories, + LiftrResourceCategories, + IdentityProperties, + KnownManagedIdentityTypes, + ManagedIdentityTypes, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + DatadogMonitorResourceUpdateParameters, + MonitorUpdateProperties, + DatadogApiKey, + DatadogHost, + DatadogHostMetadata, + DatadogInstallMethod, + DatadogLogsAgent, + LinkedResource, + MonitoredResource, + DatadogSetPasswordLink, + BillingInfoResponse, + MarketplaceSaaSInfo, + PartnerBillingEntity, + MonitoringTagRules, + MonitoringTagRulesProperties, + LogRules, + FilteringTag, + KnownTagAction, + TagAction, + MetricRules, + ProxyResource, + DatadogSingleSignOnResource, + DatadogSingleSignOnProperties, + KnownSingleSignOnStates, + SingleSignOnStates, + MonitoredSubscriptionProperties, + SubscriptionList, + KnownOperation, + Operation, + MonitoredSubscription, + KnownStatus, + Status, + DatadogAgreementResource, + DatadogAgreementProperties, + CreateResourceSupportedResponse, + CreateResourceSupportedProperties, + KnownVersions, +} from "./models/index.js"; +export { DatadogClientOptionalParams } from "./api/index.js"; +export { + CreationSupportedOperationGroupGetOptionalParams, + CreationSupportedOperationGroupListOptionalParams, +} from "./api/creationSupportedOperationGroup/index.js"; +export { + DatadogMonitorResourcesBillingInfoGetOptionalParams, + DatadogMonitorResourcesRefreshSetPasswordLinkOptionalParams, + DatadogMonitorResourcesListMonitoredResourcesOptionalParams, + DatadogMonitorResourcesListLinkedResourcesOptionalParams, + DatadogMonitorResourcesListHostsOptionalParams, + DatadogMonitorResourcesSetDefaultKeyOptionalParams, + DatadogMonitorResourcesGetDefaultKeyOptionalParams, + DatadogMonitorResourcesListApiKeysOptionalParams, + DatadogMonitorResourcesListOptionalParams, + DatadogMonitorResourcesListByResourceGroupOptionalParams, + DatadogMonitorResourcesDeleteOptionalParams, + DatadogMonitorResourcesUpdateOptionalParams, + DatadogMonitorResourcesCreateOptionalParams, + DatadogMonitorResourcesGetOptionalParams, +} from "./api/datadogMonitorResources/index.js"; +export { + DatadogSingleSignOnResourcesListOptionalParams, + DatadogSingleSignOnResourcesCreateOrUpdateOptionalParams, + DatadogSingleSignOnResourcesGetOptionalParams, +} from "./api/datadogSingleSignOnResources/index.js"; +export { + MarketplaceAgreementsOperationGroupCreateOrUpdateOptionalParams, + MarketplaceAgreementsOperationGroupListOptionalParams, +} from "./api/marketplaceAgreementsOperationGroup/index.js"; +export { + MonitoredSubscriptionsListOptionalParams, + MonitoredSubscriptionsDeleteOptionalParams, + MonitoredSubscriptionsUpdateOptionalParams, + MonitoredSubscriptionsCreateorUpdateOptionalParams, + MonitoredSubscriptionsGetOptionalParams, +} from "./api/monitoredSubscriptions/index.js"; +export { OperationsListOptionalParams } from "./api/operations/index.js"; +export { + TagRulesListOptionalParams, + TagRulesCreateOrUpdateOptionalParams, + TagRulesGetOptionalParams, +} from "./api/tagRules/index.js"; +export { + CreationSupportedOperationGroupOperations, + DatadogMonitorResourcesOperations, + DatadogSingleSignOnResourcesOperations, + MarketplaceAgreementsOperationGroupOperations, + MonitoredSubscriptionsOperations, + OperationsOperations, + TagRulesOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/datadog/arm-datadog/src/logger.ts b/sdk/datadog/arm-datadog/src/logger.ts new file mode 100644 index 000000000000..338c9ea08232 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-datadog"); diff --git a/sdk/datadog/arm-datadog/src/lroImpl.ts b/sdk/datadog/arm-datadog/src/lroImpl.ts deleted file mode 100644 index a1dab276a1b7..000000000000 --- a/sdk/datadog/arm-datadog/src/lroImpl.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { 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/datadog/arm-datadog/src/microsoftDatadogClient.ts b/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts deleted file mode 100644 index 08e2e7de78df..000000000000 --- a/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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 { - MarketplaceAgreementsImpl, - CreationSupportedImpl, - MonitorsImpl, - OperationsImpl, - TagRulesImpl, - SingleSignOnConfigurationsImpl, - MonitoredSubscriptionsImpl -} from "./operations/index.js"; -import { - MarketplaceAgreements, - CreationSupported, - Monitors, - Operations, - TagRules, - SingleSignOnConfigurations, - MonitoredSubscriptions -} from "./operationsInterfaces/index.js"; -import { MicrosoftDatadogClientOptionalParams } from "./models/index.js"; - -export class MicrosoftDatadogClient extends coreClient.ServiceClient { - $host: string; - subscriptionId: string; - apiVersion: string; - - /** - * Initializes a new instance of the MicrosoftDatadogClient 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?: MicrosoftDatadogClientOptionalParams - ) { - 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: MicrosoftDatadogClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials - }; - - const packageDetails = `azsdk-js-arm-datadog/3.1.0`; - 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 || "2023-01-01"; - this.marketplaceAgreements = new MarketplaceAgreementsImpl(this); - this.creationSupported = new CreationSupportedImpl(this); - this.monitors = new MonitorsImpl(this); - this.operations = new OperationsImpl(this); - this.tagRules = new TagRulesImpl(this); - this.singleSignOnConfigurations = new SingleSignOnConfigurationsImpl(this); - this.monitoredSubscriptions = new MonitoredSubscriptionsImpl(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); - } - - marketplaceAgreements: MarketplaceAgreements; - creationSupported: CreationSupported; - monitors: Monitors; - operations: Operations; - tagRules: TagRules; - singleSignOnConfigurations: SingleSignOnConfigurations; - monitoredSubscriptions: MonitoredSubscriptions; -} diff --git a/sdk/datadog/arm-datadog/src/models/index.ts b/sdk/datadog/arm-datadog/src/models/index.ts index b0a8c7189c3b..0abb9922d906 100644 --- a/sdk/datadog/arm-datadog/src/models/index.ts +++ b/sdk/datadog/arm-datadog/src/models/index.ts @@ -1,1134 +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 * as coreClient from "@azure/core-client"; - -/** Response of a list operation. */ -export interface DatadogAgreementResourceListResponse { - /** Results of a list operation. */ - value?: DatadogAgreementResource[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -export interface DatadogAgreementResource { - /** - * ARM id of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * Name of the agreement. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** Represents the properties of the resource. */ - properties?: DatadogAgreementProperties; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** Terms properties. */ -export interface DatadogAgreementProperties { - /** Publisher identifier string. */ - publisher?: string; - /** Product identifier string. */ - product?: string; - /** Plan identifier string. */ - plan?: string; - /** Link to HTML with Microsoft and Publisher terms. */ - licenseTextLink?: string; - /** Link to the privacy policy of the publisher. */ - privacyPolicyLink?: string; - /** Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. */ - retrieveDatetime?: Date; - /** Terms signature. */ - signature?: string; - /** If any version of the terms have been accepted, otherwise false. */ - accepted?: boolean; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -/** 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; -} - -export interface CreateResourceSupportedResponseList { - value?: CreateResourceSupportedResponse[]; -} - -/** Datadog resource can be created or not. */ -export interface CreateResourceSupportedResponse { - /** Represents the properties of the resource. */ - properties?: CreateResourceSupportedProperties; -} - -/** Datadog resource can be created or not properties. */ -export interface CreateResourceSupportedProperties { - /** - * The ARM id of the subscription. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Indicates if selected subscription supports Datadog resource creation, if not it is already being monitored for the selected organization via multi subscription feature. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly creationSupported?: boolean; -} - -/** Response of a list operation. */ -export interface DatadogApiKeyListResponse { - /** Results of a list operation. */ - value?: DatadogApiKey[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -export interface DatadogApiKey { - /** The user that created the API key. */ - createdBy?: string; - /** The name of the API key. */ - name?: string; - /** The value of the API key. */ - key: string; - /** The time of creation of the API key. */ - created?: string; -} - -/** Response of a list operation. */ -export interface DatadogHostListResponse { - /** Results of a list operation. */ - value?: DatadogHost[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -export interface DatadogHost { - /** The name of the host. */ - name?: string; - /** The aliases for the host installed via the Datadog agent. */ - aliases?: string[]; - /** The Datadog integrations reporting metrics for the host. */ - apps?: string[]; - meta?: DatadogHostMetadata; -} - -export interface DatadogHostMetadata { - /** The agent version. */ - agentVersion?: string; - installMethod?: DatadogInstallMethod; - logsAgent?: DatadogLogsAgent; -} - -export interface DatadogInstallMethod { - /** The tool. */ - tool?: string; - /** The tool version. */ - toolVersion?: string; - /** The installer version. */ - installerVersion?: string; -} - -export interface DatadogLogsAgent { - /** The transport. */ - transport?: string; -} - -/** Response of a list operation. */ -export interface LinkedResourceListResponse { - /** Results of a list operation. */ - value?: LinkedResource[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -/** The definition of a linked resource. */ -export interface LinkedResource { - /** The ARM id of the linked resource. */ - id?: string; -} - -/** Response of a list operation. */ -export interface MonitoredResourceListResponse { - /** Results of a list operation. */ - value?: MonitoredResource[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -/** The properties of a resource currently being monitored by the Datadog monitor resource. */ -export interface MonitoredResource { - /** The ARM id of the resource. */ - id?: string; - /** Flag indicating if resource is sending metrics to Datadog. */ - sendingMetrics?: boolean; - /** Reason for why the resource is sending metrics (or why it is not sending). */ - reasonForMetricsStatus?: string; - /** Flag indicating if resource is sending logs to Datadog. */ - sendingLogs?: boolean; - /** Reason for why the resource is sending logs (or why it is not sending). */ - reasonForLogsStatus?: string; -} - -/** Result of GET request to list the Microsoft.Datadog operations. */ -export interface OperationListResult { - /** List of operations supported by the Microsoft.Datadog provider. */ - value?: OperationResult[]; - /** URL to get the next set of operation list results if there are any. */ - nextLink?: string; -} - -/** A Microsoft.Datadog REST API operation. */ -export interface OperationResult { - /** Operation name, i.e., {provider}/{resource}/{operation}. */ - name?: string; - /** The object that represents the operation. */ - display?: OperationDisplay; - /** Indicates whether the operation is a data action */ - isDataAction?: boolean; -} - -/** The object that represents the operation. */ -export interface OperationDisplay { - /** Service provider, i.e., Microsoft.Datadog. */ - provider?: string; - /** Type on which the operation is performed, e.g., 'monitors'. */ - resource?: string; - /** Operation type, e.g., read, write, delete, etc. */ - operation?: string; - /** Description of the operation, e.g., 'Write monitors'. */ - description?: string; -} - -/** Response of a list operation. */ -export interface DatadogMonitorResourceListResponse { - /** Results of a list operation. */ - value?: DatadogMonitorResource[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -export interface DatadogMonitorResource { - /** - * ARM id of the monitor resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * Name of the monitor resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the monitor resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - sku?: ResourceSku; - /** Properties specific to the monitor resource. */ - properties?: MonitorProperties; - identity?: IdentityProperties; - /** Dictionary of */ - tags?: { [propertyName: string]: string }; - location: string; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -export interface ResourceSku { - /** Name of the SKU in {PlanId} format. For Terraform, the only allowed value is 'linking'. */ - name: string; -} - -/** Properties specific to the monitor resource. */ -export interface MonitorProperties { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provisioningState?: ProvisioningState; - /** Flag specifying if the resource monitoring is enabled or disabled. */ - monitoringStatus?: MonitoringStatus; - /** - * Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly marketplaceSubscriptionStatus?: MarketplaceSubscriptionStatus; - /** Specify the Datadog organization name. In the case of linking to existing organizations, Id, ApiKey, and Applicationkey is required as well. */ - datadogOrganizationProperties?: DatadogOrganizationProperties; - /** Includes name, email and optionally, phone number. User Information can't be null. */ - userInfo?: UserInfo; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly liftrResourceCategory?: LiftrResourceCategories; - /** - * The priority of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly liftrResourcePreference?: number; -} - -/** Specify the Datadog organization name. In the case of linking to existing organizations, Id, ApiKey, and Applicationkey is required as well. */ -export interface DatadogOrganizationProperties { - /** Name of the Datadog organization. */ - name?: string; - /** Id of the Datadog organization. */ - id?: string; - /** The auth code used to linking to an existing Datadog organization. */ - linkingAuthCode?: string; - /** The client_id from an existing in exchange for an auth token to link organization. */ - linkingClientId?: string; - /** The redirect URI for linking. */ - redirectUri?: string; - /** Api key associated to the Datadog organization. */ - apiKey?: string; - /** Application key associated to the Datadog organization. */ - applicationKey?: string; - /** The Id of the Enterprise App used for Single sign on. */ - enterpriseAppId?: string; - /** The configuration which describes the state of cloud security posture management. This collects configuration information for all resources in a subscription and track conformance to industry benchmarks. */ - cspm?: boolean; -} - -/** Includes name, email and optionally, phone number. User Information can't be null. */ -export interface UserInfo { - /** Name of the user */ - name?: string; - /** Email of the user used by Datadog for contacting them if needed */ - emailAddress?: string; - /** Phone number of the user used by Datadog for contacting them if needed */ - phoneNumber?: string; -} - -export interface IdentityProperties { - /** - * The identity ID. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly principalId?: string; - /** - * The tenant ID of resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly tenantId?: string; - /** Specifies the identity type of the Datadog Monitor. At this time the only allowed value is 'SystemAssigned'. */ - type?: ManagedIdentityTypes; -} - -/** The parameters for a PATCH request to a monitor resource. */ -export interface DatadogMonitorResourceUpdateParameters { - /** The set of properties that can be update in a PATCH request to a monitor resource. */ - properties?: MonitorUpdateProperties; - /** The new tags of the monitor resource. */ - tags?: { [propertyName: string]: string }; - sku?: ResourceSku; -} - -/** The set of properties that can be update in a PATCH request to a monitor resource. */ -export interface MonitorUpdateProperties { - /** Flag specifying if the resource monitoring is enabled or disabled. */ - monitoringStatus?: MonitoringStatus; - /** The new cloud security posture management value of the monitor resource. This collects configuration information for all resources in a subscription and track conformance to industry benchmarks. */ - cspm?: boolean; -} - -export interface DatadogSetPasswordLink { - setPasswordLink?: string; -} - -/** Response of a list operation. */ -export interface MonitoringTagRulesListResponse { - /** Results of a list operation. */ - value?: MonitoringTagRules[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -/** Capture logs and metrics of Azure resources based on ARM tags. */ -export interface MonitoringTagRules { - /** - * Name of the rule set. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The id of the rule set. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The type of the rule set. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** Definition of the properties for a TagRules resource. */ - properties?: MonitoringTagRulesProperties; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** Definition of the properties for a TagRules resource. */ -export interface MonitoringTagRulesProperties { - /** 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; - /** Configuration to enable/disable auto-muting flag */ - automuting?: boolean; -} - -/** 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?: boolean; - /** Flag specifying if Azure subscription logs should be sent for the Monitor resource. */ - sendSubscriptionLogs?: boolean; - /** Flag specifying if Azure resource logs should be sent for the Monitor resource. */ - sendResourceLogs?: boolean; - /** List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs 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 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; -} - -/** Set of rules for sending metrics for the Monitor resource. */ -export interface MetricRules { - /** List of filtering tags to be used for capturing metrics. 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[]; -} - -/** Response of a list operation. */ -export interface DatadogSingleSignOnResourceListResponse { - /** Results of a list operation. */ - value?: DatadogSingleSignOnResource[]; - /** Link to the next set of results, if any. */ - nextLink?: string; -} - -export interface DatadogSingleSignOnResource { - /** - * ARM id of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * Name of the configuration. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - properties?: DatadogSingleSignOnProperties; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -export interface DatadogSingleSignOnProperties { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provisioningState?: ProvisioningState; - /** Various states of the SSO resource */ - singleSignOnState?: SingleSignOnStates; - /** The Id of the Enterprise App used for Single sign-on. */ - enterpriseAppId?: string; - /** - * The login URL specific to this Datadog Organization. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly singleSignOnUrl?: string; -} - -export interface MonitoredSubscriptionPropertiesList { - value?: MonitoredSubscriptionProperties[]; -} - -/** The request to update subscriptions needed to be monitored by the Datadog monitor resource. */ -export interface MonitoredSubscriptionProperties { - /** - * Name of the monitored subscription resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The id of the monitored subscription resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The type of the monitored subscription resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** The request to update subscriptions needed to be monitored by the Datadog monitor resource. */ - properties?: SubscriptionList; -} - -/** The request to update subscriptions needed to be monitored by the Datadog monitor resource. */ -export interface SubscriptionList { - /** The operation for the patch on the resource. */ - operation?: Operation; - /** List of subscriptions and the state of the monitoring. */ - monitoredSubscriptionList?: MonitoredSubscription[]; -} - -/** The list of subscriptions and it's monitoring status by current Datadog monitor. */ -export interface MonitoredSubscription { - /** The subscriptionId to be monitored. */ - subscriptionId?: string; - /** The state of monitoring. */ - status?: Status; - /** The reason of not monitoring the subscription. */ - error?: string; - /** Definition of the properties for a TagRules resource. */ - tagRules?: MonitoringTagRulesProperties; -} - -/** 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 { - /** Accepted */ - Accepted = "Accepted", - /** Creating */ - Creating = "Creating", - /** Updating */ - Updating = "Updating", - /** Deleting */ - Deleting = "Deleting", - /** Succeeded */ - Succeeded = "Succeeded", - /** Failed */ - Failed = "Failed", - /** Canceled */ - Canceled = "Canceled", - /** Deleted */ - Deleted = "Deleted", - /** NotSpecified */ - 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** \ - * **Creating** \ - * **Updating** \ - * **Deleting** \ - * **Succeeded** \ - * **Failed** \ - * **Canceled** \ - * **Deleted** \ - * **NotSpecified** - */ -export type ProvisioningState = string; - -/** Known values of {@link MonitoringStatus} that the service accepts. */ -export enum KnownMonitoringStatus { - /** Enabled */ - Enabled = "Enabled", - /** 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** \ - * **Disabled** - */ -export type MonitoringStatus = string; - -/** Known values of {@link MarketplaceSubscriptionStatus} that the service accepts. */ -export enum KnownMarketplaceSubscriptionStatus { - /** Provisioning */ - Provisioning = "Provisioning", - /** Active */ - Active = "Active", - /** Suspended */ - Suspended = "Suspended", - /** Unsubscribed */ - Unsubscribed = "Unsubscribed" -} - -/** - * 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 - * **Provisioning** \ - * **Active** \ - * **Suspended** \ - * **Unsubscribed** - */ -export type MarketplaceSubscriptionStatus = 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 ManagedIdentityTypes} that the service accepts. */ -export enum KnownManagedIdentityTypes { - /** SystemAssigned */ - SystemAssigned = "SystemAssigned", - /** UserAssigned */ - UserAssigned = "UserAssigned" -} - -/** - * Defines values for ManagedIdentityTypes. \ - * {@link KnownManagedIdentityTypes} can be used interchangeably with ManagedIdentityTypes, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **SystemAssigned** \ - * **UserAssigned** - */ -export type ManagedIdentityTypes = 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 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 Operation} that the service accepts. */ -export enum KnownOperation { - /** AddBegin */ - AddBegin = "AddBegin", - /** AddComplete */ - AddComplete = "AddComplete", - /** DeleteBegin */ - DeleteBegin = "DeleteBegin", - /** DeleteComplete */ - DeleteComplete = "DeleteComplete", - /** Active */ - Active = "Active" -} - -/** - * Defines values for Operation. \ - * {@link KnownOperation} can be used interchangeably with Operation, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **AddBegin** \ - * **AddComplete** \ - * **DeleteBegin** \ - * **DeleteComplete** \ - * **Active** - */ -export type Operation = string; - -/** Known values of {@link Status} that the service accepts. */ -export enum KnownStatus { - /** InProgress */ - InProgress = "InProgress", - /** Active */ - Active = "Active", - /** Failed */ - Failed = "Failed", - /** Deleting */ - Deleting = "Deleting" -} - -/** - * Defines values for Status. \ - * {@link KnownStatus} can be used interchangeably with Status, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **InProgress** \ - * **Active** \ - * **Failed** \ - * **Deleting** - */ -export type Status = string; - -/** Optional parameters. */ -export interface MarketplaceAgreementsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type MarketplaceAgreementsListResponse = DatadogAgreementResourceListResponse; - -/** Optional parameters. */ -export interface MarketplaceAgreementsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - body?: DatadogAgreementResource; -} - -/** Contains response data for the createOrUpdate operation. */ -export type MarketplaceAgreementsCreateOrUpdateResponse = DatadogAgreementResource; - -/** Optional parameters. */ -export interface MarketplaceAgreementsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type MarketplaceAgreementsListNextResponse = DatadogAgreementResourceListResponse; - -/** Optional parameters. */ -export interface CreationSupportedListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type CreationSupportedListResponse = CreateResourceSupportedResponseList; - -/** Optional parameters. */ -export interface CreationSupportedGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type CreationSupportedGetResponse = CreateResourceSupportedResponse; - -/** Optional parameters. */ -export interface MonitorsListApiKeysOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listApiKeys operation. */ -export type MonitorsListApiKeysResponse = DatadogApiKeyListResponse; - -/** Optional parameters. */ -export interface MonitorsGetDefaultKeyOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getDefaultKey operation. */ -export type MonitorsGetDefaultKeyResponse = DatadogApiKey; - -/** Optional parameters. */ -export interface MonitorsSetDefaultKeyOptionalParams - extends coreClient.OperationOptions { - body?: DatadogApiKey; -} - -/** Optional parameters. */ -export interface MonitorsListHostsOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listHosts operation. */ -export type MonitorsListHostsResponse = DatadogHostListResponse; - -/** Optional parameters. */ -export interface MonitorsListLinkedResourcesOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listLinkedResources operation. */ -export type MonitorsListLinkedResourcesResponse = LinkedResourceListResponse; - -/** Optional parameters. */ -export interface MonitorsListMonitoredResourcesOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listMonitoredResources operation. */ -export type MonitorsListMonitoredResourcesResponse = MonitoredResourceListResponse; - -/** Optional parameters. */ -export interface MonitorsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type MonitorsListResponse = DatadogMonitorResourceListResponse; - -/** Optional parameters. */ -export interface MonitorsListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type MonitorsListByResourceGroupResponse = DatadogMonitorResourceListResponse; - -/** Optional parameters. */ -export interface MonitorsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type MonitorsGetResponse = DatadogMonitorResource; - -/** Optional parameters. */ -export interface MonitorsCreateOptionalParams - extends coreClient.OperationOptions { - body?: DatadogMonitorResource; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the create operation. */ -export type MonitorsCreateResponse = DatadogMonitorResource; - -/** Optional parameters. */ -export interface MonitorsUpdateOptionalParams - extends coreClient.OperationOptions { - /** The parameters for a PATCH request to a monitor resource. */ - body?: DatadogMonitorResourceUpdateParameters; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type MonitorsUpdateResponse = DatadogMonitorResource; - -/** 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 MonitorsRefreshSetPasswordLinkOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the refreshSetPasswordLink operation. */ -export type MonitorsRefreshSetPasswordLinkResponse = DatadogSetPasswordLink; - -/** Optional parameters. */ -export interface MonitorsListApiKeysNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listApiKeysNext operation. */ -export type MonitorsListApiKeysNextResponse = DatadogApiKeyListResponse; - -/** Optional parameters. */ -export interface MonitorsListHostsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listHostsNext operation. */ -export type MonitorsListHostsNextResponse = DatadogHostListResponse; - -/** Optional parameters. */ -export interface MonitorsListLinkedResourcesNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listLinkedResourcesNext operation. */ -export type MonitorsListLinkedResourcesNextResponse = LinkedResourceListResponse; - -/** Optional parameters. */ -export interface MonitorsListMonitoredResourcesNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listMonitoredResourcesNext operation. */ -export type MonitorsListMonitoredResourcesNextResponse = MonitoredResourceListResponse; - -/** Optional parameters. */ -export interface MonitorsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type MonitorsListNextResponse = DatadogMonitorResourceListResponse; - -/** Optional parameters. */ -export interface MonitorsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type MonitorsListByResourceGroupNextResponse = DatadogMonitorResourceListResponse; - -/** 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 TagRulesListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type TagRulesListResponse = MonitoringTagRulesListResponse; - -/** Optional parameters. */ -export interface TagRulesCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Capture logs and metrics of Azure resources based on ARM tags. */ - body?: MonitoringTagRules; -} - -/** Contains response data for the createOrUpdate operation. */ -export type TagRulesCreateOrUpdateResponse = MonitoringTagRules; - -/** Optional parameters. */ -export interface TagRulesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type TagRulesGetResponse = MonitoringTagRules; - -/** Optional parameters. */ -export interface TagRulesListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type TagRulesListNextResponse = MonitoringTagRulesListResponse; - -/** Optional parameters. */ -export interface SingleSignOnConfigurationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type SingleSignOnConfigurationsListResponse = DatadogSingleSignOnResourceListResponse; - -/** Optional parameters. */ -export interface SingleSignOnConfigurationsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - body?: DatadogSingleSignOnResource; - /** 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 SingleSignOnConfigurationsCreateOrUpdateResponse = DatadogSingleSignOnResource; - -/** Optional parameters. */ -export interface SingleSignOnConfigurationsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type SingleSignOnConfigurationsGetResponse = DatadogSingleSignOnResource; - -/** Optional parameters. */ -export interface SingleSignOnConfigurationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type SingleSignOnConfigurationsListNextResponse = DatadogSingleSignOnResourceListResponse; - -/** Optional parameters. */ -export interface MonitoredSubscriptionsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type MonitoredSubscriptionsListResponse = MonitoredSubscriptionPropertiesList; - -/** Optional parameters. */ -export interface MonitoredSubscriptionsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type MonitoredSubscriptionsGetResponse = MonitoredSubscriptionProperties; - -/** Optional parameters. */ -export interface MonitoredSubscriptionsCreateorUpdateOptionalParams - extends coreClient.OperationOptions { - /** The request to update subscriptions needed to be monitored by the Datadog monitor resource. */ - body?: MonitoredSubscriptionProperties; - /** 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 MonitoredSubscriptionsCreateorUpdateResponse = MonitoredSubscriptionProperties; - -/** Optional parameters. */ -export interface MonitoredSubscriptionsUpdateOptionalParams - extends coreClient.OperationOptions { - /** The request to update subscriptions needed to be monitored by the Datadog monitor resource. */ - body?: MonitoredSubscriptionProperties; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type MonitoredSubscriptionsUpdateResponse = MonitoredSubscriptionProperties; - -/** Optional parameters. */ -export interface MonitoredSubscriptionsDeleteOptionalParams - 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 MicrosoftDatadogClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + OperationResult, + OperationDisplay, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + DatadogMonitorResource, + ResourceSku, + MonitorProperties, + KnownProvisioningState, + ProvisioningState, + KnownMonitoringStatus, + MonitoringStatus, + KnownMarketplaceSubscriptionStatus, + MarketplaceSubscriptionStatus, + DatadogOrganizationProperties, + UserInfo, + KnownLiftrResourceCategories, + LiftrResourceCategories, + IdentityProperties, + KnownManagedIdentityTypes, + ManagedIdentityTypes, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + DatadogMonitorResourceUpdateParameters, + MonitorUpdateProperties, + DatadogApiKey, + DatadogHost, + DatadogHostMetadata, + DatadogInstallMethod, + DatadogLogsAgent, + LinkedResource, + MonitoredResource, + DatadogSetPasswordLink, + BillingInfoResponse, + MarketplaceSaaSInfo, + PartnerBillingEntity, + MonitoringTagRules, + MonitoringTagRulesProperties, + LogRules, + FilteringTag, + KnownTagAction, + TagAction, + MetricRules, + ProxyResource, + DatadogSingleSignOnResource, + DatadogSingleSignOnProperties, + KnownSingleSignOnStates, + SingleSignOnStates, + MonitoredSubscriptionProperties, + SubscriptionList, + KnownOperation, + Operation, + MonitoredSubscription, + KnownStatus, + Status, + DatadogAgreementResource, + DatadogAgreementProperties, + CreateResourceSupportedResponse, + CreateResourceSupportedProperties, + KnownVersions, +} from "./models.js"; diff --git a/sdk/datadog/arm-datadog/src/models/mappers.ts b/sdk/datadog/arm-datadog/src/models/mappers.ts deleted file mode 100644 index 51ca3fc79573..000000000000 --- a/sdk/datadog/arm-datadog/src/models/mappers.ts +++ /dev/null @@ -1,1526 +0,0 @@ -/* - * 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 DatadogAgreementResourceListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogAgreementResourceListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DatadogAgreementResource" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogAgreementResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogAgreementResource", - 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" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "DatadogAgreementProperties" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const DatadogAgreementProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogAgreementProperties", - modelProperties: { - publisher: { - serializedName: "publisher", - type: { - name: "String" - } - }, - product: { - serializedName: "product", - type: { - name: "String" - } - }, - plan: { - serializedName: "plan", - type: { - name: "String" - } - }, - licenseTextLink: { - serializedName: "licenseTextLink", - type: { - name: "String" - } - }, - privacyPolicyLink: { - serializedName: "privacyPolicyLink", - type: { - name: "String" - } - }, - retrieveDatetime: { - serializedName: "retrieveDatetime", - type: { - name: "DateTime" - } - }, - signature: { - serializedName: "signature", - type: { - name: "String" - } - }, - accepted: { - serializedName: "accepted", - type: { - name: "Boolean" - } - } - } - } -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime" - } - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String" - } - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String" - } - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime" - } - } - } - } -}; - -export const ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail" - } - } - } - } -}; - -export const 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 CreateResourceSupportedResponseList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CreateResourceSupportedResponseList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CreateResourceSupportedResponse" - } - } - } - } - } - } -}; - -export const CreateResourceSupportedResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CreateResourceSupportedResponse", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "CreateResourceSupportedProperties" - } - } - } - } -}; - -export const CreateResourceSupportedProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CreateResourceSupportedProperties", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - creationSupported: { - serializedName: "creationSupported", - readOnly: true, - type: { - name: "Boolean" - } - } - } - } -}; - -export const DatadogApiKeyListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogApiKeyListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DatadogApiKey" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogApiKey: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogApiKey", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - key: { - serializedName: "key", - required: true, - type: { - name: "String" - } - }, - created: { - serializedName: "created", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogHostListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogHostListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DatadogHost" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogHost: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogHost", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - aliases: { - serializedName: "aliases", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - apps: { - serializedName: "apps", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - meta: { - serializedName: "meta", - type: { - name: "Composite", - className: "DatadogHostMetadata" - } - } - } - } -}; - -export const DatadogHostMetadata: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogHostMetadata", - modelProperties: { - agentVersion: { - serializedName: "agentVersion", - type: { - name: "String" - } - }, - installMethod: { - serializedName: "installMethod", - type: { - name: "Composite", - className: "DatadogInstallMethod" - } - }, - logsAgent: { - serializedName: "logsAgent", - type: { - name: "Composite", - className: "DatadogLogsAgent" - } - } - } - } -}; - -export const DatadogInstallMethod: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogInstallMethod", - modelProperties: { - tool: { - serializedName: "tool", - type: { - name: "String" - } - }, - toolVersion: { - serializedName: "toolVersion", - type: { - name: "String" - } - }, - installerVersion: { - serializedName: "installerVersion", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogLogsAgent: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogLogsAgent", - modelProperties: { - transport: { - serializedName: "transport", - type: { - name: "String" - } - } - } - } -}; - -export const LinkedResourceListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LinkedResourceListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "LinkedResource" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const LinkedResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LinkedResource", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - } - } - } -}; - -export const MonitoredResourceListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitoredResourceListResponse", - modelProperties: { - value: { - serializedName: "value", - 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: "Boolean" - } - }, - reasonForMetricsStatus: { - serializedName: "reasonForMetricsStatus", - type: { - name: "String" - } - }, - sendingLogs: { - serializedName: "sendingLogs", - type: { - name: "Boolean" - } - }, - reasonForLogsStatus: { - serializedName: "reasonForLogsStatus", - type: { - name: "String" - } - } - } - } -}; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationResult" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const OperationResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationResult", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - isDataAction: { - serializedName: "isDataAction", - type: { - name: "Boolean" - } - } - } - } -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - type: { - name: "String" - } - }, - description: { - serializedName: "description", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogMonitorResourceListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogMonitorResourceListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DatadogMonitorResource" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogMonitorResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogMonitorResource", - 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" - } - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "ResourceSku" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "MonitorProperties" - } - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "IdentityProperties" - } - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - }, - location: { - serializedName: "location", - required: true, - type: { - name: "String" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const ResourceSku: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ResourceSku", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const MonitorProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitorProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String" - } - }, - monitoringStatus: { - defaultValue: "Enabled", - serializedName: "monitoringStatus", - type: { - name: "String" - } - }, - marketplaceSubscriptionStatus: { - serializedName: "marketplaceSubscriptionStatus", - readOnly: true, - type: { - name: "String" - } - }, - datadogOrganizationProperties: { - serializedName: "datadogOrganizationProperties", - type: { - name: "Composite", - className: "DatadogOrganizationProperties" - } - }, - userInfo: { - serializedName: "userInfo", - type: { - name: "Composite", - className: "UserInfo" - } - }, - liftrResourceCategory: { - serializedName: "liftrResourceCategory", - readOnly: true, - type: { - name: "String" - } - }, - liftrResourcePreference: { - serializedName: "liftrResourcePreference", - readOnly: true, - type: { - name: "Number" - } - } - } - } -}; - -export const DatadogOrganizationProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogOrganizationProperties", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - id: { - serializedName: "id", - type: { - name: "String" - } - }, - linkingAuthCode: { - serializedName: "linkingAuthCode", - type: { - name: "String" - } - }, - linkingClientId: { - serializedName: "linkingClientId", - type: { - name: "String" - } - }, - redirectUri: { - serializedName: "redirectUri", - type: { - name: "String" - } - }, - apiKey: { - serializedName: "apiKey", - type: { - name: "String" - } - }, - applicationKey: { - serializedName: "applicationKey", - type: { - name: "String" - } - }, - enterpriseAppId: { - serializedName: "enterpriseAppId", - type: { - name: "String" - } - }, - cspm: { - serializedName: "cspm", - type: { - name: "Boolean" - } - } - } - } -}; - -export const UserInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserInfo", - modelProperties: { - name: { - constraints: { - MaxLength: 50 - }, - serializedName: "name", - 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" - } - } - } - } -}; - -export const IdentityProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IdentityProperties", - modelProperties: { - principalId: { - serializedName: "principalId", - readOnly: true, - type: { - name: "String" - } - }, - tenantId: { - serializedName: "tenantId", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogMonitorResourceUpdateParameters: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogMonitorResourceUpdateParameters", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "MonitorUpdateProperties" - } - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "ResourceSku" - } - } - } - } -}; - -export const MonitorUpdateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitorUpdateProperties", - modelProperties: { - monitoringStatus: { - defaultValue: "Enabled", - serializedName: "monitoringStatus", - type: { - name: "String" - } - }, - cspm: { - serializedName: "cspm", - type: { - name: "Boolean" - } - } - } - } -}; - -export const DatadogSetPasswordLink: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogSetPasswordLink", - modelProperties: { - setPasswordLink: { - serializedName: "setPasswordLink", - type: { - name: "String" - } - } - } - } -}; - -export const MonitoringTagRulesListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitoringTagRulesListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MonitoringTagRules" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const MonitoringTagRules: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitoringTagRules", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "MonitoringTagRulesProperties" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const MonitoringTagRulesProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitoringTagRulesProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String" - } - }, - logRules: { - serializedName: "logRules", - type: { - name: "Composite", - className: "LogRules" - } - }, - metricRules: { - serializedName: "metricRules", - type: { - name: "Composite", - className: "MetricRules" - } - }, - automuting: { - serializedName: "automuting", - type: { - name: "Boolean" - } - } - } - } -}; - -export const LogRules: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LogRules", - modelProperties: { - sendAadLogs: { - serializedName: "sendAadLogs", - type: { - name: "Boolean" - } - }, - sendSubscriptionLogs: { - serializedName: "sendSubscriptionLogs", - type: { - name: "Boolean" - } - }, - sendResourceLogs: { - serializedName: "sendResourceLogs", - type: { - name: "Boolean" - } - }, - filteringTags: { - serializedName: "filteringTags", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FilteringTag" - } - } - } - } - } - } -}; - -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 MetricRules: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MetricRules", - modelProperties: { - filteringTags: { - serializedName: "filteringTags", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FilteringTag" - } - } - } - } - } - } -}; - -export const DatadogSingleSignOnResourceListResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogSingleSignOnResourceListResponse", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DatadogSingleSignOnResource" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const DatadogSingleSignOnResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogSingleSignOnResource", - 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" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "DatadogSingleSignOnProperties" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const DatadogSingleSignOnProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatadogSingleSignOnProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String" - } - }, - singleSignOnState: { - serializedName: "singleSignOnState", - type: { - name: "String" - } - }, - enterpriseAppId: { - serializedName: "enterpriseAppId", - type: { - name: "String" - } - }, - singleSignOnUrl: { - serializedName: "singleSignOnUrl", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const MonitoredSubscriptionPropertiesList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitoredSubscriptionPropertiesList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MonitoredSubscriptionProperties" - } - } - } - } - } - } -}; - -export const MonitoredSubscriptionProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitoredSubscriptionProperties", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "SubscriptionList" - } - } - } - } -}; - -export const SubscriptionList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SubscriptionList", - modelProperties: { - operation: { - serializedName: "operation", - type: { - name: "String" - } - }, - monitoredSubscriptionList: { - serializedName: "monitoredSubscriptionList", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MonitoredSubscription" - } - } - } - } - } - } -}; - -export const MonitoredSubscription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MonitoredSubscription", - modelProperties: { - subscriptionId: { - serializedName: "subscriptionId", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - error: { - serializedName: "error", - type: { - name: "String" - } - }, - tagRules: { - serializedName: "tagRules", - type: { - name: "Composite", - className: "MonitoringTagRulesProperties" - } - } - } - } -}; diff --git a/sdk/datadog/arm-datadog/src/models/models.ts b/sdk/datadog/arm-datadog/src/models/models.ts new file mode 100644 index 000000000000..605becd226aa --- /dev/null +++ b/sdk/datadog/arm-datadog/src/models/models.ts @@ -0,0 +1,1590 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** Represents a paginated list of operation results. */ +export interface _OperationListResult { + /** The list of operations. */ + value: OperationResult[]; + /** The URL to get the next set of results, if any. */ + nextLink?: string; +} + +export function _operationListResultDeserializer(item: any): _OperationListResult { + return { + value: operationResultArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationResultArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationResultDeserializer(item); + }); +} + +/** A Microsoft.Datadog REST API operation. */ +export interface OperationResult { + /** Operation name, i.e., {provider}/{resource}/{operation}. */ + name?: string; + /** The object that represents the operation. */ + display?: OperationDisplay; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; +} + +export function operationResultDeserializer(item: any): OperationResult { + return { + name: item["name"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + isDataAction: item["isDataAction"], + }; +} + +/** Represents the display information for an operation. */ +export interface OperationDisplay { + /** The service provider: Microsoft.Datadog. */ + provider?: string; + /** The resource on which the operation is performed. */ + resource?: string; + /** The type of operation: create, update, delete, etc. */ + operation?: string; + /** A localized description of the operation. */ + description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: Record; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: !item["info"] ? item["info"] : _errorAdditionalInfoInfoDeserializer(item["info"]), + }; +} + +/** model interface _ErrorAdditionalInfoInfo */ +export interface _ErrorAdditionalInfoInfo {} + +export function _errorAdditionalInfoInfoDeserializer(item: any): _ErrorAdditionalInfoInfo { + return item; +} + +/** model interface DatadogMonitorResource */ +export interface DatadogMonitorResource extends TrackedResource { + sku?: ResourceSku; + /** Properties specific to the monitor resource. */ + properties?: MonitorProperties; + identity?: IdentityProperties; +} + +export function datadogMonitorResourceSerializer(item: DatadogMonitorResource): any { + return { + tags: item["tags"], + location: item["location"], + sku: !item["sku"] ? item["sku"] : resourceSkuSerializer(item["sku"]), + properties: !item["properties"] + ? item["properties"] + : monitorPropertiesSerializer(item["properties"]), + identity: !item["identity"] ? item["identity"] : identityPropertiesSerializer(item["identity"]), + }; +} + +export function datadogMonitorResourceDeserializer(item: any): DatadogMonitorResource { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + sku: !item["sku"] ? item["sku"] : resourceSkuDeserializer(item["sku"]), + properties: !item["properties"] + ? item["properties"] + : monitorPropertiesDeserializer(item["properties"]), + identity: !item["identity"] + ? item["identity"] + : identityPropertiesDeserializer(item["identity"]), + }; +} + +/** Represents the SKU of a resource. */ +export interface ResourceSku { + /** The name of the SKU. */ + name: string; +} + +export function resourceSkuSerializer(item: ResourceSku): any { + return { name: item["name"] }; +} + +export function resourceSkuDeserializer(item: any): ResourceSku { + return { + name: item["name"], + }; +} + +/** Properties specific to the monitor resource. */ +export interface MonitorProperties { + readonly provisioningState?: ProvisioningState; + /** Flag specifying if the resource monitoring is enabled or disabled. */ + monitoringStatus?: MonitoringStatus; + /** Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. */ + readonly marketplaceSubscriptionStatus?: MarketplaceSubscriptionStatus; + /** Specify the Datadog organization name. In the case of linking to existing organizations, Id, ApiKey, and Applicationkey is required as well. */ + datadogOrganizationProperties?: DatadogOrganizationProperties; + /** Includes name, email and optionally, phone number. User Information can't be null. */ + userInfo?: UserInfo; + readonly liftrResourceCategory?: LiftrResourceCategories; + /** The priority of the resource. */ + readonly liftrResourcePreference?: number; +} + +export function monitorPropertiesSerializer(item: MonitorProperties): any { + return { + monitoringStatus: item["monitoringStatus"], + datadogOrganizationProperties: !item["datadogOrganizationProperties"] + ? item["datadogOrganizationProperties"] + : datadogOrganizationPropertiesSerializer(item["datadogOrganizationProperties"]), + userInfo: !item["userInfo"] ? item["userInfo"] : userInfoSerializer(item["userInfo"]), + }; +} + +export function monitorPropertiesDeserializer(item: any): MonitorProperties { + return { + provisioningState: item["provisioningState"], + monitoringStatus: item["monitoringStatus"], + marketplaceSubscriptionStatus: item["marketplaceSubscriptionStatus"], + datadogOrganizationProperties: !item["datadogOrganizationProperties"] + ? item["datadogOrganizationProperties"] + : datadogOrganizationPropertiesDeserializer(item["datadogOrganizationProperties"]), + userInfo: !item["userInfo"] ? item["userInfo"] : userInfoDeserializer(item["userInfo"]), + liftrResourceCategory: item["liftrResourceCategory"], + liftrResourcePreference: item["liftrResourcePreference"], + }; +} + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Accepted = "Accepted", + Creating = "Creating", + Updating = "Updating", + Deleting = "Deleting", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Deleted = "Deleted", + NotSpecified = "NotSpecified", +} + +/** Type of ProvisioningState */ +export type ProvisioningState = string; + +/** Flag specifying if the resource monitoring is enabled or disabled. */ +export enum KnownMonitoringStatus { + Enabled = "Enabled", + Disabled = "Disabled", +} + +/** + * Flag specifying if the resource monitoring is enabled or disabled. \ + * {@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** \ + * **Disabled** + */ +export type MonitoringStatus = string; + +/** Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. */ +export enum KnownMarketplaceSubscriptionStatus { + Provisioning = "Provisioning", + Active = "Active", + Suspended = "Suspended", + Unsubscribed = "Unsubscribed", +} + +/** + * Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. \ + * {@link KnownMarketplaceSubscriptionStatus} can be used interchangeably with MarketplaceSubscriptionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Provisioning** \ + * **Active** \ + * **Suspended** \ + * **Unsubscribed** + */ +export type MarketplaceSubscriptionStatus = string; + +/** Specify the Datadog organization name. In the case of linking to existing organizations, Id, ApiKey, and Applicationkey is required as well. */ +export interface DatadogOrganizationProperties { + /** Name of the Datadog organization. */ + name?: string; + /** Id of the Datadog organization. */ + id?: string; + /** The auth code used to linking to an existing Datadog organization. */ + linkingAuthCode?: string; + /** The client_id from an existing in exchange for an auth token to link organization. */ + linkingClientId?: string; + /** The redirect URI for linking. */ + redirectUri?: string; + /** Api key associated to the Datadog organization. */ + apiKey?: string; + /** Application key associated to the Datadog organization. */ + applicationKey?: string; + /** The Id of the Enterprise App used for Single sign on. */ + enterpriseAppId?: string; + /** The configuration which describes the state of cloud security posture management. This collects configuration information for all resources in a subscription and track conformance to industry benchmarks. */ + cspm?: boolean; +} + +export function datadogOrganizationPropertiesSerializer(item: DatadogOrganizationProperties): any { + return { + name: item["name"], + id: item["id"], + linkingAuthCode: item["linkingAuthCode"], + linkingClientId: item["linkingClientId"], + redirectUri: item["redirectUri"], + apiKey: item["apiKey"], + applicationKey: item["applicationKey"], + enterpriseAppId: item["enterpriseAppId"], + cspm: item["cspm"], + }; +} + +export function datadogOrganizationPropertiesDeserializer( + item: any, +): DatadogOrganizationProperties { + return { + name: item["name"], + id: item["id"], + linkingAuthCode: item["linkingAuthCode"], + linkingClientId: item["linkingClientId"], + redirectUri: item["redirectUri"], + apiKey: item["apiKey"], + applicationKey: item["applicationKey"], + enterpriseAppId: item["enterpriseAppId"], + cspm: item["cspm"], + }; +} + +/** Includes name, email and optionally, phone number. User Information can't be null. */ +export interface UserInfo { + /** Name of the user */ + name?: string; + /** Email of the user used by Datadog for contacting them if needed */ + emailAddress?: string; + /** Phone number of the user used by Datadog for contacting them if needed */ + phoneNumber?: string; +} + +export function userInfoSerializer(item: UserInfo): any { + return { + name: item["name"], + emailAddress: item["emailAddress"], + phoneNumber: item["phoneNumber"], + }; +} + +export function userInfoDeserializer(item: any): UserInfo { + return { + name: item["name"], + emailAddress: item["emailAddress"], + phoneNumber: item["phoneNumber"], + }; +} + +/** Known values of {@link LiftrResourceCategories} that the service accepts. */ +export enum KnownLiftrResourceCategories { + Unknown = "Unknown", + MonitorLogs = "MonitorLogs", +} + +/** Type of LiftrResourceCategories */ +export type LiftrResourceCategories = string; + +/** model interface IdentityProperties */ +export interface IdentityProperties { + /** The identity ID. */ + readonly principalId?: string; + /** The tenant ID of resource. */ + readonly tenantId?: string; + /** Specifies the identity type of the Datadog Monitor. At this time the only allowed value is 'SystemAssigned'. */ + type?: ManagedIdentityTypes; +} + +export function identityPropertiesSerializer(item: IdentityProperties): any { + return { type: item["type"] }; +} + +export function identityPropertiesDeserializer(item: any): IdentityProperties { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + }; +} + +/** Specifies the identity type of the Datadog Monitor. At this time the only allowed value is 'SystemAssigned'. */ +export enum KnownManagedIdentityTypes { + SystemAssigned = "SystemAssigned", + UserAssigned = "UserAssigned", +} + +/** + * Specifies the identity type of the Datadog Monitor. At this time the only allowed value is 'SystemAssigned'. \ + * {@link KnownManagedIdentityTypes} can be used interchangeably with ManagedIdentityTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SystemAssigned** \ + * **UserAssigned** + */ +export type ManagedIdentityTypes = string; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** 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} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["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; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@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**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** The parameters for a PATCH request to a monitor resource. */ +export interface DatadogMonitorResourceUpdateParameters { + /** The set of properties that can be update in a PATCH request to a monitor resource. */ + properties?: MonitorUpdateProperties; + /** The new tags of the monitor resource. */ + tags?: Record; + sku?: ResourceSku; +} + +export function datadogMonitorResourceUpdateParametersSerializer( + item: DatadogMonitorResourceUpdateParameters, +): any { + return { + properties: !item["properties"] + ? item["properties"] + : monitorUpdatePropertiesSerializer(item["properties"]), + tags: item["tags"], + sku: !item["sku"] ? item["sku"] : resourceSkuSerializer(item["sku"]), + }; +} + +/** The set of properties that can be update in a PATCH request to a monitor resource. */ +export interface MonitorUpdateProperties { + /** Flag specifying if the resource monitoring is enabled or disabled. */ + monitoringStatus?: MonitoringStatus; + /** The new cloud security posture management value of the monitor resource. This collects configuration information for all resources in a subscription and track conformance to industry benchmarks. */ + cspm?: boolean; +} + +export function monitorUpdatePropertiesSerializer(item: MonitorUpdateProperties): any { + return { monitoringStatus: item["monitoringStatus"], cspm: item["cspm"] }; +} + +/** Response of a list operation. */ +export interface _DatadogMonitorResourceListResponse { + /** The DatadogMonitorResource items on this page */ + value: DatadogMonitorResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _datadogMonitorResourceListResponseDeserializer( + item: any, +): _DatadogMonitorResourceListResponse { + return { + value: datadogMonitorResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function datadogMonitorResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return datadogMonitorResourceSerializer(item); + }); +} + +export function datadogMonitorResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return datadogMonitorResourceDeserializer(item); + }); +} + +/** Response of a list operation. */ +export interface _DatadogApiKeyListResponse { + /** The DatadogApiKey items on this page */ + value: DatadogApiKey[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _datadogApiKeyListResponseDeserializer(item: any): _DatadogApiKeyListResponse { + return { + value: datadogApiKeyArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function datadogApiKeyArraySerializer(result: Array): any[] { + return result.map((item) => { + return datadogApiKeySerializer(item); + }); +} + +export function datadogApiKeyArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return datadogApiKeyDeserializer(item); + }); +} + +/** model interface DatadogApiKey */ +export interface DatadogApiKey { + /** The user that created the API key. */ + createdBy?: string; + /** The name of the API key. */ + name?: string; + /** The value of the API key. */ + key: string; + /** The time of creation of the API key. */ + created?: string; +} + +export function datadogApiKeySerializer(item: DatadogApiKey): any { + return { + createdBy: item["createdBy"], + name: item["name"], + key: item["key"], + created: item["created"], + }; +} + +export function datadogApiKeyDeserializer(item: any): DatadogApiKey { + return { + createdBy: item["createdBy"], + name: item["name"], + key: item["key"], + created: item["created"], + }; +} + +/** model interface _SetDefaultKeyParameterBody */ +export interface _SetDefaultKeyParameterBody { + body?: DatadogApiKey; +} + +export function _setDefaultKeyParameterBodySerializer(item: _SetDefaultKeyParameterBody): any { + return { + body: !item["body"] ? item["body"] : datadogApiKeySerializer(item["body"]), + }; +} + +/** Response of a list operation. */ +export interface _DatadogHostListResponse { + /** The DatadogHost items on this page */ + value: DatadogHost[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _datadogHostListResponseDeserializer(item: any): _DatadogHostListResponse { + return { + value: datadogHostArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function datadogHostArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return datadogHostDeserializer(item); + }); +} + +/** model interface DatadogHost */ +export interface DatadogHost { + /** The name of the host. */ + name?: string; + /** The aliases for the host installed via the Datadog agent. */ + aliases?: string[]; + /** The Datadog integrations reporting metrics for the host. */ + apps?: string[]; + meta?: DatadogHostMetadata; +} + +export function datadogHostDeserializer(item: any): DatadogHost { + return { + name: item["name"], + aliases: !item["aliases"] + ? item["aliases"] + : item["aliases"].map((p: any) => { + return p; + }), + apps: !item["apps"] + ? item["apps"] + : item["apps"].map((p: any) => { + return p; + }), + meta: !item["meta"] ? item["meta"] : datadogHostMetadataDeserializer(item["meta"]), + }; +} + +/** model interface DatadogHostMetadata */ +export interface DatadogHostMetadata { + /** The agent version. */ + agentVersion?: string; + installMethod?: DatadogInstallMethod; + logsAgent?: DatadogLogsAgent; +} + +export function datadogHostMetadataDeserializer(item: any): DatadogHostMetadata { + return { + agentVersion: item["agentVersion"], + installMethod: !item["installMethod"] + ? item["installMethod"] + : datadogInstallMethodDeserializer(item["installMethod"]), + logsAgent: !item["logsAgent"] + ? item["logsAgent"] + : datadogLogsAgentDeserializer(item["logsAgent"]), + }; +} + +/** model interface DatadogInstallMethod */ +export interface DatadogInstallMethod { + /** The tool. */ + tool?: string; + /** The tool version. */ + toolVersion?: string; + /** The installer version. */ + installerVersion?: string; +} + +export function datadogInstallMethodDeserializer(item: any): DatadogInstallMethod { + return { + tool: item["tool"], + toolVersion: item["toolVersion"], + installerVersion: item["installerVersion"], + }; +} + +/** model interface DatadogLogsAgent */ +export interface DatadogLogsAgent { + /** The transport. */ + transport?: string; +} + +export function datadogLogsAgentDeserializer(item: any): DatadogLogsAgent { + return { + transport: item["transport"], + }; +} + +/** Response of a list operation. */ +export interface _LinkedResourceListResponse { + /** The LinkedResource items on this page */ + value: LinkedResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _linkedResourceListResponseDeserializer(item: any): _LinkedResourceListResponse { + return { + value: linkedResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function linkedResourceArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return linkedResourceDeserializer(item); + }); +} + +/** The definition of a linked resource. */ +export interface LinkedResource { + /** The ARM id of the linked resource. */ + id?: string; + /** The location of the linked resource. */ + location?: string; +} + +export function linkedResourceDeserializer(item: any): LinkedResource { + return { + id: item["id"], + location: item["location"], + }; +} + +/** Response of a list operation. */ +export interface _MonitoredResourceListResponse { + /** The MonitoredResource items on this page */ + value: MonitoredResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _monitoredResourceListResponseDeserializer( + item: any, +): _MonitoredResourceListResponse { + return { + value: monitoredResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function monitoredResourceArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return monitoredResourceDeserializer(item); + }); +} + +/** The properties of a resource currently being monitored by the Datadog monitor resource. */ +export interface MonitoredResource { + /** The ARM id of the resource. */ + id?: string; + /** Flag indicating if resource is sending metrics to Datadog. */ + sendingMetrics?: boolean; + /** Reason for why the resource is sending metrics (or why it is not sending). */ + reasonForMetricsStatus?: string; + /** Flag indicating if resource is sending logs to Datadog. */ + sendingLogs?: boolean; + /** Reason for why the resource is sending logs (or why it is not sending). */ + reasonForLogsStatus?: string; +} + +export function monitoredResourceDeserializer(item: any): MonitoredResource { + return { + id: item["id"], + sendingMetrics: item["sendingMetrics"], + reasonForMetricsStatus: item["reasonForMetricsStatus"], + sendingLogs: item["sendingLogs"], + reasonForLogsStatus: item["reasonForLogsStatus"], + }; +} + +/** model interface DatadogSetPasswordLink */ +export interface DatadogSetPasswordLink { + setPasswordLink?: string; +} + +export function datadogSetPasswordLinkDeserializer(item: any): DatadogSetPasswordLink { + return { + setPasswordLink: item["setPasswordLink"], + }; +} + +/** Marketplace Subscription and Organization details to which resource gets billed into. */ +export interface BillingInfoResponse { + /** Marketplace Subscription details */ + marketplaceSaasInfo?: MarketplaceSaaSInfo; + /** Partner Billing Entity details: Organization Info */ + partnerBillingEntity?: PartnerBillingEntity; +} + +export function billingInfoResponseDeserializer(item: any): BillingInfoResponse { + return { + marketplaceSaasInfo: !item["marketplaceSaasInfo"] + ? item["marketplaceSaasInfo"] + : marketplaceSaaSInfoDeserializer(item["marketplaceSaasInfo"]), + partnerBillingEntity: !item["partnerBillingEntity"] + ? item["partnerBillingEntity"] + : partnerBillingEntityDeserializer(item["partnerBillingEntity"]), + }; +} + +/** Marketplace SAAS Info of the resource. */ +export interface MarketplaceSaaSInfo { + /** Marketplace Subscription Id. This is a GUID-formatted string. */ + marketplaceSubscriptionId?: string; + /** Marketplace Subscription Details: SAAS Name */ + marketplaceName?: string; + /** Marketplace Subscription Details: SaaS Subscription Status */ + marketplaceStatus?: string; + /** The Azure Subscription ID to which the Marketplace Subscription belongs and gets billed into. */ + billedAzureSubscriptionId?: string; + /** Flag specifying if the Marketplace status is subscribed or not. */ + subscribed?: boolean; +} + +export function marketplaceSaaSInfoDeserializer(item: any): MarketplaceSaaSInfo { + return { + marketplaceSubscriptionId: item["marketplaceSubscriptionId"], + marketplaceName: item["marketplaceName"], + marketplaceStatus: item["marketplaceStatus"], + billedAzureSubscriptionId: item["billedAzureSubscriptionId"], + subscribed: item["subscribed"], + }; +} + +/** Partner Billing details associated with the resource. */ +export interface PartnerBillingEntity { + /** The Datadog Organization Id. */ + id?: string; + /** The Datadog Organization Name. */ + name?: string; + /** Link to the datadog organization page */ + partnerEntityUri?: string; +} + +export function partnerBillingEntityDeserializer(item: any): PartnerBillingEntity { + return { + id: item["id"], + name: item["name"], + partnerEntityUri: item["partnerEntityUri"], + }; +} + +/** Capture logs and metrics of Azure resources based on ARM tags. */ +export interface MonitoringTagRules extends ProxyResource { + /** Definition of the properties for a TagRules resource. */ + properties?: MonitoringTagRulesProperties; +} + +export function monitoringTagRulesSerializer(item: MonitoringTagRules): any { + return { + properties: !item["properties"] + ? item["properties"] + : monitoringTagRulesPropertiesSerializer(item["properties"]), + }; +} + +export function monitoringTagRulesDeserializer(item: any): MonitoringTagRules { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : monitoringTagRulesPropertiesDeserializer(item["properties"]), + }; +} + +/** Definition of the properties for a TagRules resource. */ +export interface MonitoringTagRulesProperties { + 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; + /** Configuration to enable/disable auto-muting flag */ + automuting?: boolean; + /** Configuration to enable/disable custom metrics. If enabled, custom metrics from app insights will be sent. */ + customMetrics?: boolean; +} + +export function monitoringTagRulesPropertiesSerializer(item: MonitoringTagRulesProperties): any { + return { + logRules: !item["logRules"] ? item["logRules"] : logRulesSerializer(item["logRules"]), + metricRules: !item["metricRules"] + ? item["metricRules"] + : metricRulesSerializer(item["metricRules"]), + automuting: item["automuting"], + customMetrics: item["customMetrics"], + }; +} + +export function monitoringTagRulesPropertiesDeserializer(item: any): MonitoringTagRulesProperties { + return { + provisioningState: item["provisioningState"], + logRules: !item["logRules"] ? item["logRules"] : logRulesDeserializer(item["logRules"]), + metricRules: !item["metricRules"] + ? item["metricRules"] + : metricRulesDeserializer(item["metricRules"]), + automuting: item["automuting"], + customMetrics: item["customMetrics"], + }; +} + +/** 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?: boolean; + /** Flag specifying if Azure subscription logs should be sent for the Monitor resource. */ + sendSubscriptionLogs?: boolean; + /** Flag specifying if Azure resource logs should be sent for the Monitor resource. */ + sendResourceLogs?: boolean; + /** List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs 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[]; +} + +export function logRulesSerializer(item: LogRules): any { + return { + sendAadLogs: item["sendAadLogs"], + sendSubscriptionLogs: item["sendSubscriptionLogs"], + sendResourceLogs: item["sendResourceLogs"], + filteringTags: !item["filteringTags"] + ? item["filteringTags"] + : filteringTagArraySerializer(item["filteringTags"]), + }; +} + +export function logRulesDeserializer(item: any): LogRules { + return { + sendAadLogs: item["sendAadLogs"], + sendSubscriptionLogs: item["sendSubscriptionLogs"], + sendResourceLogs: item["sendResourceLogs"], + filteringTags: !item["filteringTags"] + ? item["filteringTags"] + : filteringTagArrayDeserializer(item["filteringTags"]), + }; +} + +export function filteringTagArraySerializer(result: Array): any[] { + return result.map((item) => { + return filteringTagSerializer(item); + }); +} + +export function filteringTagArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return filteringTagDeserializer(item); + }); +} + +/** 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; +} + +export function filteringTagSerializer(item: FilteringTag): any { + return { name: item["name"], value: item["value"], action: item["action"] }; +} + +export function filteringTagDeserializer(item: any): FilteringTag { + return { + name: item["name"], + value: item["value"], + action: item["action"], + }; +} + +/** Valid actions for a filtering tag. Exclusion takes priority over inclusion. */ +export enum KnownTagAction { + Include = "Include", + Exclude = "Exclude", +} + +/** + * Valid actions for a filtering tag. Exclusion takes priority over inclusion. \ + * {@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; + +/** Set of rules for sending metrics for the Monitor resource. */ +export interface MetricRules { + /** List of filtering tags to be used for capturing metrics. 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[]; +} + +export function metricRulesSerializer(item: MetricRules): any { + return { + filteringTags: !item["filteringTags"] + ? item["filteringTags"] + : filteringTagArraySerializer(item["filteringTags"]), + }; +} + +export function metricRulesDeserializer(item: any): MetricRules { + return { + filteringTags: !item["filteringTags"] + ? item["filteringTags"] + : filteringTagArrayDeserializer(item["filteringTags"]), + }; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Response of a list operation. */ +export interface _MonitoringTagRulesListResponse { + /** The MonitoringTagRules items on this page */ + value: MonitoringTagRules[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _monitoringTagRulesListResponseDeserializer( + item: any, +): _MonitoringTagRulesListResponse { + return { + value: monitoringTagRulesArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function monitoringTagRulesArraySerializer(result: Array): any[] { + return result.map((item) => { + return monitoringTagRulesSerializer(item); + }); +} + +export function monitoringTagRulesArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return monitoringTagRulesDeserializer(item); + }); +} + +/** Concrete proxy resource types can be created by aliasing this type using a specific property type. */ +export interface DatadogSingleSignOnResource extends ProxyResource { + properties?: DatadogSingleSignOnProperties; +} + +export function datadogSingleSignOnResourceSerializer(item: DatadogSingleSignOnResource): any { + return { + properties: !item["properties"] + ? item["properties"] + : datadogSingleSignOnPropertiesSerializer(item["properties"]), + }; +} + +export function datadogSingleSignOnResourceDeserializer(item: any): DatadogSingleSignOnResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : datadogSingleSignOnPropertiesDeserializer(item["properties"]), + }; +} + +/** model interface DatadogSingleSignOnProperties */ +export interface DatadogSingleSignOnProperties { + readonly provisioningState?: ProvisioningState; + /** Various states of the SSO resource */ + singleSignOnState?: SingleSignOnStates; + /** The Id of the Enterprise App used for Single sign-on. */ + enterpriseAppId?: string; + /** The login URL specific to this Datadog Organization. */ + readonly singleSignOnUrl?: string; +} + +export function datadogSingleSignOnPropertiesSerializer(item: DatadogSingleSignOnProperties): any { + return { + singleSignOnState: item["singleSignOnState"], + enterpriseAppId: item["enterpriseAppId"], + }; +} + +export function datadogSingleSignOnPropertiesDeserializer( + item: any, +): DatadogSingleSignOnProperties { + return { + provisioningState: item["provisioningState"], + singleSignOnState: item["singleSignOnState"], + enterpriseAppId: item["enterpriseAppId"], + singleSignOnUrl: item["singleSignOnUrl"], + }; +} + +/** Various states of the SSO resource */ +export enum KnownSingleSignOnStates { + Initial = "Initial", + Enable = "Enable", + Disable = "Disable", + Existing = "Existing", +} + +/** + * Various states of the SSO resource \ + * {@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; + +/** Response of a list operation. */ +export interface _DatadogSingleSignOnResourceListResponse { + /** The DatadogSingleSignOnResource items on this page */ + value: DatadogSingleSignOnResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _datadogSingleSignOnResourceListResponseDeserializer( + item: any, +): _DatadogSingleSignOnResourceListResponse { + return { + value: datadogSingleSignOnResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function datadogSingleSignOnResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return datadogSingleSignOnResourceSerializer(item); + }); +} + +export function datadogSingleSignOnResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return datadogSingleSignOnResourceDeserializer(item); + }); +} + +/** The request to update subscriptions needed to be monitored by the Datadog monitor resource. */ +export interface MonitoredSubscriptionProperties extends ProxyResource { + /** The request to update subscriptions needed to be monitored by the Datadog monitor resource. */ + properties?: SubscriptionList; +} + +export function monitoredSubscriptionPropertiesSerializer( + item: MonitoredSubscriptionProperties, +): any { + return { + properties: !item["properties"] + ? item["properties"] + : subscriptionListSerializer(item["properties"]), + }; +} + +export function monitoredSubscriptionPropertiesDeserializer( + item: any, +): MonitoredSubscriptionProperties { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : subscriptionListDeserializer(item["properties"]), + }; +} + +/** The request to update subscriptions needed to be monitored by the Datadog monitor resource. */ +export interface SubscriptionList { + /** The operation for the patch on the resource. */ + operation?: Operation; + /** List of subscriptions and the state of the monitoring. */ + monitoredSubscriptionList?: MonitoredSubscription[]; +} + +export function subscriptionListSerializer(item: SubscriptionList): any { + return { + operation: item["operation"], + monitoredSubscriptionList: !item["monitoredSubscriptionList"] + ? item["monitoredSubscriptionList"] + : monitoredSubscriptionArraySerializer(item["monitoredSubscriptionList"]), + }; +} + +export function subscriptionListDeserializer(item: any): SubscriptionList { + return { + operation: item["operation"], + monitoredSubscriptionList: !item["monitoredSubscriptionList"] + ? item["monitoredSubscriptionList"] + : monitoredSubscriptionArrayDeserializer(item["monitoredSubscriptionList"]), + }; +} + +/** The operation for the patch on the resource. */ +export enum KnownOperation { + AddBegin = "AddBegin", + AddComplete = "AddComplete", + DeleteBegin = "DeleteBegin", + DeleteComplete = "DeleteComplete", + Active = "Active", +} + +/** + * The operation for the patch on the resource. \ + * {@link KnownOperation} can be used interchangeably with Operation, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AddBegin** \ + * **AddComplete** \ + * **DeleteBegin** \ + * **DeleteComplete** \ + * **Active** + */ +export type Operation = string; + +export function monitoredSubscriptionArraySerializer(result: Array): any[] { + return result.map((item) => { + return monitoredSubscriptionSerializer(item); + }); +} + +export function monitoredSubscriptionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return monitoredSubscriptionDeserializer(item); + }); +} + +/** The list of subscriptions and it's monitoring status by current Datadog monitor. */ +export interface MonitoredSubscription { + /** The subscriptionId to be monitored. */ + subscriptionId: string; + /** The state of monitoring. */ + status?: Status; + /** The reason of not monitoring the subscription. */ + error?: string; + /** Definition of the properties for a TagRules resource. */ + tagRules?: MonitoringTagRulesProperties; +} + +export function monitoredSubscriptionSerializer(item: MonitoredSubscription): any { + return { + subscriptionId: item["subscriptionId"], + status: item["status"], + error: item["error"], + tagRules: !item["tagRules"] + ? item["tagRules"] + : monitoringTagRulesPropertiesSerializer(item["tagRules"]), + }; +} + +export function monitoredSubscriptionDeserializer(item: any): MonitoredSubscription { + return { + subscriptionId: item["subscriptionId"], + status: item["status"], + error: item["error"], + tagRules: !item["tagRules"] + ? item["tagRules"] + : monitoringTagRulesPropertiesDeserializer(item["tagRules"]), + }; +} + +/** The state of monitoring. */ +export enum KnownStatus { + InProgress = "InProgress", + Active = "Active", + Failed = "Failed", + Deleting = "Deleting", +} + +/** + * The state of monitoring. \ + * {@link KnownStatus} can be used interchangeably with Status, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InProgress** \ + * **Active** \ + * **Failed** \ + * **Deleting** + */ +export type Status = string; + +/** Paged collection of MonitoredSubscriptionProperties items */ +export interface _MonitoredSubscriptionPropertiesList { + /** The MonitoredSubscriptionProperties items on this page */ + value: MonitoredSubscriptionProperties[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _monitoredSubscriptionPropertiesListDeserializer( + item: any, +): _MonitoredSubscriptionPropertiesList { + return { + value: monitoredSubscriptionPropertiesArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function monitoredSubscriptionPropertiesArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return monitoredSubscriptionPropertiesSerializer(item); + }); +} + +export function monitoredSubscriptionPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return monitoredSubscriptionPropertiesDeserializer(item); + }); +} + +/** Response of a list operation. */ +export interface _DatadogAgreementResourceListResponse { + /** The DatadogAgreementResource items on this page */ + value: DatadogAgreementResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _datadogAgreementResourceListResponseDeserializer( + item: any, +): _DatadogAgreementResourceListResponse { + return { + value: datadogAgreementResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function datadogAgreementResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return datadogAgreementResourceSerializer(item); + }); +} + +export function datadogAgreementResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return datadogAgreementResourceDeserializer(item); + }); +} + +/** model interface DatadogAgreementResource */ +export interface DatadogAgreementResource { + /** ARM id of the resource. */ + readonly id?: string; + /** Name of the agreement. */ + readonly name?: string; + /** The type of the resource. */ + readonly type?: string; + /** Represents the properties of the resource. */ + properties?: DatadogAgreementProperties; + /** Metadata pertaining to creation and last modification of the resource. */ + readonly systemData?: SystemData; +} + +export function datadogAgreementResourceSerializer(item: DatadogAgreementResource): any { + return { + properties: !item["properties"] + ? item["properties"] + : datadogAgreementPropertiesSerializer(item["properties"]), + }; +} + +export function datadogAgreementResourceDeserializer(item: any): DatadogAgreementResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + properties: !item["properties"] + ? item["properties"] + : datadogAgreementPropertiesDeserializer(item["properties"]), + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Terms properties. */ +export interface DatadogAgreementProperties { + /** Publisher identifier string. */ + publisher?: string; + /** Product identifier string. */ + product?: string; + /** Plan identifier string. */ + plan?: string; + /** Link to HTML with Microsoft and Publisher terms. */ + licenseTextLink?: string; + /** Link to the privacy policy of the publisher. */ + privacyPolicyLink?: string; + /** Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. */ + retrieveDatetime?: Date; + /** Terms signature. */ + signature?: string; + /** If any version of the terms have been accepted, otherwise false. */ + accepted?: boolean; +} + +export function datadogAgreementPropertiesSerializer(item: DatadogAgreementProperties): any { + return { + publisher: item["publisher"], + product: item["product"], + plan: item["plan"], + licenseTextLink: item["licenseTextLink"], + privacyPolicyLink: item["privacyPolicyLink"], + retrieveDatetime: !item["retrieveDatetime"] + ? item["retrieveDatetime"] + : item["retrieveDatetime"].toISOString(), + signature: item["signature"], + accepted: item["accepted"], + }; +} + +export function datadogAgreementPropertiesDeserializer(item: any): DatadogAgreementProperties { + return { + publisher: item["publisher"], + product: item["product"], + plan: item["plan"], + licenseTextLink: item["licenseTextLink"], + privacyPolicyLink: item["privacyPolicyLink"], + retrieveDatetime: !item["retrieveDatetime"] + ? item["retrieveDatetime"] + : new Date(item["retrieveDatetime"]), + signature: item["signature"], + accepted: item["accepted"], + }; +} + +/** Paged collection of CreateResourceSupportedResponse items */ +export interface _CreateResourceSupportedResponseList { + /** The CreateResourceSupportedResponse items on this page */ + value: CreateResourceSupportedResponse[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _createResourceSupportedResponseListDeserializer( + item: any, +): _CreateResourceSupportedResponseList { + return { + value: createResourceSupportedResponseArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function createResourceSupportedResponseArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return createResourceSupportedResponseDeserializer(item); + }); +} + +/** Datadog resource can be created or not. */ +export interface CreateResourceSupportedResponse { + /** Represents the properties of the resource. */ + properties?: CreateResourceSupportedProperties; +} + +export function createResourceSupportedResponseDeserializer( + item: any, +): CreateResourceSupportedResponse { + return { + properties: !item["properties"] + ? item["properties"] + : createResourceSupportedPropertiesDeserializer(item["properties"]), + }; +} + +/** Datadog resource can be created or not properties. */ +export interface CreateResourceSupportedProperties { + /** The ARM id of the subscription. */ + readonly name?: string; + /** Indicates if selected subscription supports Datadog resource creation, if not it is already being monitored for the selected organization via multi subscription feature. */ + readonly creationSupported?: boolean; +} + +export function createResourceSupportedPropertiesDeserializer( + item: any, +): CreateResourceSupportedProperties { + return { + name: item["name"], + creationSupported: item["creationSupported"], + }; +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2023-10-20 API version. */ + V20231020 = "2023-10-20", +} diff --git a/sdk/datadog/arm-datadog/src/models/parameters.ts b/sdk/datadog/arm-datadog/src/models/parameters.ts deleted file mode 100644 index 6e74d6b1bfa2..000000000000 --- a/sdk/datadog/arm-datadog/src/models/parameters.ts +++ /dev/null @@ -1,190 +0,0 @@ -/* - * 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 { - DatadogAgreementResource as DatadogAgreementResourceMapper, - DatadogApiKey as DatadogApiKeyMapper, - DatadogMonitorResource as DatadogMonitorResourceMapper, - DatadogMonitorResourceUpdateParameters as DatadogMonitorResourceUpdateParametersMapper, - MonitoringTagRules as MonitoringTagRulesMapper, - DatadogSingleSignOnResource as DatadogSingleSignOnResourceMapper, - MonitoredSubscriptionProperties as MonitoredSubscriptionPropertiesMapper -} from "../models/mappers.js"; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String" - } - } -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - constraints: { - MinLength: 1 - }, - serializedName: "subscriptionId", - required: true, - type: { - name: "String" - } - } -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2023-01-01", - isConstant: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String" - } - } -}; - -export const body: OperationParameter = { - parameterPath: ["options", "body"], - mapper: DatadogAgreementResourceMapper -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const datadogOrganizationId: OperationQueryParameter = { - parameterPath: "datadogOrganizationId", - mapper: { - serializedName: "datadogOrganizationId", - 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 body1: OperationParameter = { - parameterPath: ["options", "body"], - mapper: DatadogApiKeyMapper -}; - -export const body2: OperationParameter = { - parameterPath: ["options", "body"], - mapper: DatadogMonitorResourceMapper -}; - -export const body3: OperationParameter = { - parameterPath: ["options", "body"], - mapper: DatadogMonitorResourceUpdateParametersMapper -}; - -export const body4: OperationParameter = { - parameterPath: ["options", "body"], - mapper: MonitoringTagRulesMapper -}; - -export const ruleSetName: OperationURLParameter = { - parameterPath: "ruleSetName", - mapper: { - serializedName: "ruleSetName", - required: true, - type: { - name: "String" - } - } -}; - -export const body5: OperationParameter = { - parameterPath: ["options", "body"], - mapper: DatadogSingleSignOnResourceMapper -}; - -export const configurationName: OperationURLParameter = { - parameterPath: "configurationName", - mapper: { - serializedName: "configurationName", - required: true, - type: { - name: "String" - } - } -}; - -export const body6: OperationParameter = { - parameterPath: ["options", "body"], - mapper: MonitoredSubscriptionPropertiesMapper -}; diff --git a/sdk/datadog/arm-datadog/src/operations/creationSupported.ts b/sdk/datadog/arm-datadog/src/operations/creationSupported.ts deleted file mode 100644 index 92322ae8e810..000000000000 --- a/sdk/datadog/arm-datadog/src/operations/creationSupported.ts +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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 { CreationSupported } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { MicrosoftDatadogClient } from "../microsoftDatadogClient.js"; -import { - CreateResourceSupportedResponse, - CreationSupportedListOptionalParams, - CreationSupportedListResponse, - CreationSupportedGetOptionalParams, - CreationSupportedGetResponse -} from "../models/index.js"; - -/// -/** Class containing CreationSupported operations. */ -export class CreationSupportedImpl implements CreationSupported { - private readonly client: MicrosoftDatadogClient; - - /** - * Initialize a new instance of the class CreationSupported class. - * @param client Reference to the service client - */ - constructor(client: MicrosoftDatadogClient) { - this.client = client; - } - - /** - * Informs if the current subscription is being already monitored for selected Datadog organization. - * @param datadogOrganizationId Datadog Organization Id - * @param options The options parameters. - */ - public list( - datadogOrganizationId: string, - options?: CreationSupportedListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(datadogOrganizationId, 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(datadogOrganizationId, options, settings); - } - }; - } - - private async *listPagingPage( - datadogOrganizationId: string, - options?: CreationSupportedListOptionalParams, - _settings?: PageSettings - ): AsyncIterableIterator { - let result: CreationSupportedListResponse; - result = await this._list(datadogOrganizationId, options); - yield result.value || []; - } - - private async *listPagingAll( - datadogOrganizationId: string, - options?: CreationSupportedListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - datadogOrganizationId, - options - )) { - yield* page; - } - } - - /** - * Informs if the current subscription is being already monitored for selected Datadog organization. - * @param datadogOrganizationId Datadog Organization Id - * @param options The options parameters. - */ - private _list( - datadogOrganizationId: string, - options?: CreationSupportedListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { datadogOrganizationId, options }, - listOperationSpec - ); - } - - /** - * Informs if the current subscription is being already monitored for selected Datadog organization. - * @param datadogOrganizationId Datadog Organization Id - * @param options The options parameters. - */ - get( - datadogOrganizationId: string, - options?: CreationSupportedGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { datadogOrganizationId, options }, - getOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CreateResourceSupportedResponseList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion, Parameters.datadogOrganizationId], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/subscriptionStatuses/default", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CreateResourceSupportedResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion, Parameters.datadogOrganizationId], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/datadog/arm-datadog/src/operations/index.ts b/sdk/datadog/arm-datadog/src/operations/index.ts deleted file mode 100644 index 8b30e403c8fb..000000000000 --- a/sdk/datadog/arm-datadog/src/operations/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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 "./marketplaceAgreements.js"; -export * from "./creationSupported.js"; -export * from "./monitors.js"; -export * from "./operations.js"; -export * from "./tagRules.js"; -export * from "./singleSignOnConfigurations.js"; -export * from "./monitoredSubscriptions.js"; diff --git a/sdk/datadog/arm-datadog/src/operations/marketplaceAgreements.ts b/sdk/datadog/arm-datadog/src/operations/marketplaceAgreements.ts deleted file mode 100644 index c4c4cb2ff040..000000000000 --- a/sdk/datadog/arm-datadog/src/operations/marketplaceAgreements.ts +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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.js"; -import { MarketplaceAgreements } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { MicrosoftDatadogClient } from "../microsoftDatadogClient.js"; -import { - DatadogAgreementResource, - MarketplaceAgreementsListNextOptionalParams, - MarketplaceAgreementsListOptionalParams, - MarketplaceAgreementsListResponse, - MarketplaceAgreementsCreateOrUpdateOptionalParams, - MarketplaceAgreementsCreateOrUpdateResponse, - MarketplaceAgreementsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing MarketplaceAgreements operations. */ -export class MarketplaceAgreementsImpl implements MarketplaceAgreements { - private readonly client: MicrosoftDatadogClient; - - /** - * Initialize a new instance of the class MarketplaceAgreements class. - * @param client Reference to the service client - */ - constructor(client: MicrosoftDatadogClient) { - this.client = client; - } - - /** - * List Datadog marketplace agreements in the subscription. - * @param options The options parameters. - */ - public list( - options?: MarketplaceAgreementsListOptionalParams - ): 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?: MarketplaceAgreementsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: MarketplaceAgreementsListResponse; - 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?: MarketplaceAgreementsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List Datadog marketplace agreements in the subscription. - * @param options The options parameters. - */ - private _list( - options?: MarketplaceAgreementsListOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * Create Datadog marketplace agreement in the subscription. - * @param options The options parameters. - */ - createOrUpdate( - options?: MarketplaceAgreementsCreateOrUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { options }, - createOrUpdateOperationSpec - ); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: MarketplaceAgreementsListNextOptionalParams - ): 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/Microsoft.Datadog/agreements", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogAgreementResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.DatadogAgreementResource - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.body, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogAgreementResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/datadog/arm-datadog/src/operations/monitoredSubscriptions.ts b/sdk/datadog/arm-datadog/src/operations/monitoredSubscriptions.ts deleted file mode 100644 index 260800f80bfb..000000000000 --- a/sdk/datadog/arm-datadog/src/operations/monitoredSubscriptions.ts +++ /dev/null @@ -1,557 +0,0 @@ -/* - * 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 { MonitoredSubscriptions } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { MicrosoftDatadogClient } from "../microsoftDatadogClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - MonitoredSubscriptionProperties, - MonitoredSubscriptionsListOptionalParams, - MonitoredSubscriptionsListResponse, - MonitoredSubscriptionsGetOptionalParams, - MonitoredSubscriptionsGetResponse, - MonitoredSubscriptionsCreateorUpdateOptionalParams, - MonitoredSubscriptionsCreateorUpdateResponse, - MonitoredSubscriptionsUpdateOptionalParams, - MonitoredSubscriptionsUpdateResponse, - MonitoredSubscriptionsDeleteOptionalParams -} from "../models/index.js"; - -/// -/** Class containing MonitoredSubscriptions operations. */ -export class MonitoredSubscriptionsImpl implements MonitoredSubscriptions { - private readonly client: MicrosoftDatadogClient; - - /** - * Initialize a new instance of the class MonitoredSubscriptions class. - * @param client Reference to the service client - */ - constructor(client: MicrosoftDatadogClient) { - this.client = client; - } - - /** - * List the subscriptions currently being monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - monitorName: string, - options?: MonitoredSubscriptionsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(resourceGroupName, monitorName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - resourceGroupName, - monitorName, - options, - settings - ); - } - }; - } - - private async *listPagingPage( - resourceGroupName: string, - monitorName: string, - options?: MonitoredSubscriptionsListOptionalParams, - _settings?: PageSettings - ): AsyncIterableIterator { - let result: MonitoredSubscriptionsListResponse; - result = await this._list(resourceGroupName, monitorName, options); - yield result.value || []; - } - - private async *listPagingAll( - resourceGroupName: string, - monitorName: string, - options?: MonitoredSubscriptionsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - resourceGroupName, - monitorName, - options - )) { - yield* page; - } - } - - /** - * List the subscriptions currently being monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - monitorName: string, - options?: MonitoredSubscriptionsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - listOperationSpec - ); - } - - /** - * List the subscriptions currently being monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, configurationName, options }, - getOperationSpec - ); - } - - /** - * Add the subscriptions that should be monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - async beginCreateorUpdate( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsCreateorUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - MonitoredSubscriptionsCreateorUpdateResponse - > - > { - 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, configurationName, options }, - spec: createorUpdateOperationSpec - }); - const poller = await createHttpPoller< - MonitoredSubscriptionsCreateorUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs - }); - await poller.poll(); - return poller; - } - - /** - * Add the subscriptions that should be monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - async beginCreateorUpdateAndWait( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsCreateorUpdateOptionalParams - ): Promise { - const poller = await this.beginCreateorUpdate( - resourceGroupName, - monitorName, - configurationName, - options - ); - return poller.pollUntilDone(); - } - - /** - * Updates the subscriptions that are being monitored by the Datadog monitor resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - MonitoredSubscriptionsUpdateResponse - > - > { - 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, configurationName, options }, - spec: updateOperationSpec - }); - const poller = await createHttpPoller< - MonitoredSubscriptionsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs - }); - await poller.poll(); - return poller; - } - - /** - * Updates the subscriptions that are being monitored by the Datadog monitor resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsUpdateOptionalParams - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - monitorName, - configurationName, - options - ); - return poller.pollUntilDone(); - } - - /** - * Updates the subscriptions that are being monitored by the Datadog monitor resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsDeleteOptionalParams - ): 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, configurationName, options }, - spec: deleteOperationSpec - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs - }); - await poller.poll(); - return poller; - } - - /** - * Updates the subscriptions that are being monitored by the Datadog monitor resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsDeleteOptionalParams - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - monitorName, - configurationName, - options - ); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MonitoredSubscriptionPropertiesList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.configurationName - ], - headerParameters: [Parameters.accept], - serializer -}; -const createorUpdateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - 201: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - 202: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - 204: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.body6, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.configurationName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - 201: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - 202: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - 204: { - bodyMapper: Mappers.MonitoredSubscriptionProperties - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.body6, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.configurationName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.configurationName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/datadog/arm-datadog/src/operations/monitors.ts b/sdk/datadog/arm-datadog/src/operations/monitors.ts deleted file mode 100644 index 5e8e8313c13d..000000000000 --- a/sdk/datadog/arm-datadog/src/operations/monitors.ts +++ /dev/null @@ -1,1489 +0,0 @@ -/* - * 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.js"; -import { Monitors } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { MicrosoftDatadogClient } from "../microsoftDatadogClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - DatadogApiKey, - MonitorsListApiKeysNextOptionalParams, - MonitorsListApiKeysOptionalParams, - MonitorsListApiKeysResponse, - DatadogHost, - MonitorsListHostsNextOptionalParams, - MonitorsListHostsOptionalParams, - MonitorsListHostsResponse, - LinkedResource, - MonitorsListLinkedResourcesNextOptionalParams, - MonitorsListLinkedResourcesOptionalParams, - MonitorsListLinkedResourcesResponse, - MonitoredResource, - MonitorsListMonitoredResourcesNextOptionalParams, - MonitorsListMonitoredResourcesOptionalParams, - MonitorsListMonitoredResourcesResponse, - DatadogMonitorResource, - MonitorsListNextOptionalParams, - MonitorsListOptionalParams, - MonitorsListResponse, - MonitorsListByResourceGroupNextOptionalParams, - MonitorsListByResourceGroupOptionalParams, - MonitorsListByResourceGroupResponse, - MonitorsGetDefaultKeyOptionalParams, - MonitorsGetDefaultKeyResponse, - MonitorsSetDefaultKeyOptionalParams, - MonitorsGetOptionalParams, - MonitorsGetResponse, - MonitorsCreateOptionalParams, - MonitorsCreateResponse, - MonitorsUpdateOptionalParams, - MonitorsUpdateResponse, - MonitorsDeleteOptionalParams, - MonitorsRefreshSetPasswordLinkOptionalParams, - MonitorsRefreshSetPasswordLinkResponse, - MonitorsListApiKeysNextResponse, - MonitorsListHostsNextResponse, - MonitorsListLinkedResourcesNextResponse, - MonitorsListMonitoredResourcesNextResponse, - MonitorsListNextResponse, - MonitorsListByResourceGroupNextResponse -} from "../models/index.js"; - -/// -/** Class containing Monitors operations. */ -export class MonitorsImpl implements Monitors { - private readonly client: MicrosoftDatadogClient; - - /** - * Initialize a new instance of the class Monitors class. - * @param client Reference to the service client - */ - constructor(client: MicrosoftDatadogClient) { - this.client = client; - } - - /** - * List the api keys for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - public listApiKeys( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListApiKeysOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listApiKeysPagingAll( - 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.listApiKeysPagingPage( - resourceGroupName, - monitorName, - options, - settings - ); - } - }; - } - - private async *listApiKeysPagingPage( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListApiKeysOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: MonitorsListApiKeysResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listApiKeys(resourceGroupName, monitorName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listApiKeysNext( - resourceGroupName, - monitorName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listApiKeysPagingAll( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListApiKeysOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listApiKeysPagingPage( - resourceGroupName, - monitorName, - options - )) { - yield* page; - } - } - - /** - * List the hosts for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - public listHosts( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListHostsOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listHostsPagingAll( - 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.listHostsPagingPage( - resourceGroupName, - monitorName, - options, - settings - ); - } - }; - } - - private async *listHostsPagingPage( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListHostsOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: MonitorsListHostsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listHosts(resourceGroupName, monitorName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listHostsNext( - resourceGroupName, - monitorName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listHostsPagingAll( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListHostsOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listHostsPagingPage( - resourceGroupName, - monitorName, - options - )) { - yield* page; - } - } - - /** - * List all Azure resources associated to the same Datadog organization as the target resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - public listLinkedResources( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListLinkedResourcesOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listLinkedResourcesPagingAll( - 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.listLinkedResourcesPagingPage( - resourceGroupName, - monitorName, - options, - settings - ); - } - }; - } - - private async *listLinkedResourcesPagingPage( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListLinkedResourcesOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: MonitorsListLinkedResourcesResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listLinkedResources( - resourceGroupName, - monitorName, - options - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listLinkedResourcesNext( - resourceGroupName, - monitorName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listLinkedResourcesPagingAll( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListLinkedResourcesOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listLinkedResourcesPagingPage( - resourceGroupName, - monitorName, - options - )) { - yield* page; - } - } - - /** - * List the resources currently being monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @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 all monitors under the specified subscription. - * @param options The options parameters. - */ - public list( - options?: MonitorsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - } - }; - } - - private async *listPagingPage( - options?: MonitorsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: MonitorsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: MonitorsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List all monitors under the specified resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroupName: string, - options?: MonitorsListByResourceGroupOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage( - resourceGroupName, - options, - settings - ); - } - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: MonitorsListByResourceGroupOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: MonitorsListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext( - resourceGroupName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroupName: string, - options?: MonitorsListByResourceGroupOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroupName, - options - )) { - yield* page; - } - } - - /** - * List the api keys for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - private _listApiKeys( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListApiKeysOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - listApiKeysOperationSpec - ); - } - - /** - * Get the default api key. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - getDefaultKey( - resourceGroupName: string, - monitorName: string, - options?: MonitorsGetDefaultKeyOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - getDefaultKeyOperationSpec - ); - } - - /** - * Set the default api key. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - setDefaultKey( - resourceGroupName: string, - monitorName: string, - options?: MonitorsSetDefaultKeyOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - setDefaultKeyOperationSpec - ); - } - - /** - * List the hosts for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - private _listHosts( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListHostsOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - listHostsOperationSpec - ); - } - - /** - * List all Azure resources associated to the same Datadog organization as the target resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - private _listLinkedResources( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListLinkedResourcesOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - listLinkedResourcesOperationSpec - ); - } - - /** - * List the resources currently being monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - private _listMonitoredResources( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListMonitoredResourcesOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - listMonitoredResourcesOperationSpec - ); - } - - /** - * List all monitors under the specified subscription. - * @param options The options parameters. - */ - private _list( - options?: MonitorsListOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * List all monitors under the specified resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroupName: string, - options?: MonitorsListByResourceGroupOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec - ); - } - - /** - * Get the properties of a specific monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - get( - resourceGroupName: string, - monitorName: string, - options?: MonitorsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - getOperationSpec - ); - } - - /** - * Create a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - async beginCreate( - resourceGroupName: string, - monitorName: string, - options?: MonitorsCreateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - MonitorsCreateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, monitorName, options }, - spec: createOperationSpec - }); - const poller = await createHttpPoller< - MonitorsCreateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation" - }); - await poller.poll(); - return poller; - } - - /** - * Create a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - async beginCreateAndWait( - resourceGroupName: string, - monitorName: string, - options?: MonitorsCreateOptionalParams - ): Promise { - const poller = await this.beginCreate( - resourceGroupName, - monitorName, - options - ); - return poller.pollUntilDone(); - } - - /** - * Update a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - monitorName: string, - options?: MonitorsUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - MonitorsUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, monitorName, options }, - spec: updateOperationSpec - }); - const poller = await createHttpPoller< - MonitorsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs - }); - await poller.poll(); - return poller; - } - - /** - * Update a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - monitorName: string, - options?: MonitorsUpdateOptionalParams - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - monitorName, - options - ); - return poller.pollUntilDone(); - } - - /** - * Delete a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: 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, monitorName, options }, - spec: deleteOperationSpec - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs - }); - await poller.poll(); - return poller; - } - - /** - * Delete a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - monitorName: string, - options?: MonitorsDeleteOptionalParams - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - monitorName, - options - ); - return poller.pollUntilDone(); - } - - /** - * Refresh the set password link and return a latest one. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - refreshSetPasswordLink( - resourceGroupName: string, - monitorName: string, - options?: MonitorsRefreshSetPasswordLinkOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - refreshSetPasswordLinkOperationSpec - ); - } - - /** - * ListApiKeysNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param nextLink The nextLink from the previous successful call to the ListApiKeys method. - * @param options The options parameters. - */ - private _listApiKeysNext( - resourceGroupName: string, - monitorName: string, - nextLink: string, - options?: MonitorsListApiKeysNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, nextLink, options }, - listApiKeysNextOperationSpec - ); - } - - /** - * ListHostsNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param nextLink The nextLink from the previous successful call to the ListHosts method. - * @param options The options parameters. - */ - private _listHostsNext( - resourceGroupName: string, - monitorName: string, - nextLink: string, - options?: MonitorsListHostsNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, nextLink, options }, - listHostsNextOperationSpec - ); - } - - /** - * ListLinkedResourcesNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param nextLink The nextLink from the previous successful call to the ListLinkedResources method. - * @param options The options parameters. - */ - private _listLinkedResourcesNext( - resourceGroupName: string, - monitorName: string, - nextLink: string, - options?: MonitorsListLinkedResourcesNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, nextLink, options }, - listLinkedResourcesNextOperationSpec - ); - } - - /** - * ListMonitoredResourcesNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @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 - ); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: MonitorsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec - ); - } - - /** - * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroupName: string, - nextLink: string, - options?: MonitorsListByResourceGroupNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listApiKeysOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DatadogApiKeyListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getDefaultKeyOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DatadogApiKey - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const setDefaultKeyOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey", - httpMethod: "POST", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.body1, - 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/Microsoft.Datadog/monitors/{monitorName}/listHosts", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DatadogHostListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listLinkedResourcesOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.LinkedResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listMonitoredResourcesOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources", - 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 listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogMonitorResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer -}; -const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogMonitorResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogMonitorResource - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const createOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.DatadogMonitorResource - }, - 201: { - bodyMapper: Mappers.DatadogMonitorResource - }, - 202: { - bodyMapper: Mappers.DatadogMonitorResource - }, - 204: { - bodyMapper: Mappers.DatadogMonitorResource - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.body2, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.DatadogMonitorResource - }, - 201: { - bodyMapper: Mappers.DatadogMonitorResource - }, - 202: { - bodyMapper: Mappers.DatadogMonitorResource - }, - 204: { - bodyMapper: Mappers.DatadogMonitorResource - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.body3, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const refreshSetPasswordLinkOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DatadogSetPasswordLink - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listApiKeysNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogApiKeyListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listHostsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogHostListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listLinkedResourcesNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LinkedResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listMonitoredResourcesNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MonitoredResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogMonitorResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink - ], - headerParameters: [Parameters.accept], - serializer -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogMonitorResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.resourceGroupName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/datadog/arm-datadog/src/operations/operations.ts b/sdk/datadog/arm-datadog/src/operations/operations.ts deleted file mode 100644 index 68a17687b08f..000000000000 --- a/sdk/datadog/arm-datadog/src/operations/operations.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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.js"; -import { Operations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { MicrosoftDatadogClient } from "../microsoftDatadogClient.js"; -import { - OperationResult, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: MicrosoftDatadogClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: MicrosoftDatadogClient) { - this.client = client; - } - - /** - * List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - * @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 all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - * @param options The options parameters. - */ - private _list( - options?: OperationsListOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.Datadog/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/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts b/sdk/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts deleted file mode 100644 index 63a849c389a0..000000000000 --- a/sdk/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts +++ /dev/null @@ -1,377 +0,0 @@ -/* - * 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.js"; -import { SingleSignOnConfigurations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { MicrosoftDatadogClient } from "../microsoftDatadogClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - DatadogSingleSignOnResource, - SingleSignOnConfigurationsListNextOptionalParams, - SingleSignOnConfigurationsListOptionalParams, - SingleSignOnConfigurationsListResponse, - SingleSignOnConfigurationsCreateOrUpdateOptionalParams, - SingleSignOnConfigurationsCreateOrUpdateResponse, - SingleSignOnConfigurationsGetOptionalParams, - SingleSignOnConfigurationsGetResponse, - SingleSignOnConfigurationsListNextResponse -} from "../models/index.js"; - -/// -/** Class containing SingleSignOnConfigurations operations. */ -export class SingleSignOnConfigurationsImpl - implements SingleSignOnConfigurations { - private readonly client: MicrosoftDatadogClient; - - /** - * Initialize a new instance of the class SingleSignOnConfigurations class. - * @param client Reference to the service client - */ - constructor(client: MicrosoftDatadogClient) { - this.client = client; - } - - /** - * List the single sign-on configurations for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - monitorName: string, - options?: SingleSignOnConfigurationsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(resourceGroupName, monitorName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - resourceGroupName, - monitorName, - options, - settings - ); - } - }; - } - - private async *listPagingPage( - resourceGroupName: string, - monitorName: string, - options?: SingleSignOnConfigurationsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: SingleSignOnConfigurationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(resourceGroupName, monitorName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - resourceGroupName, - monitorName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - monitorName: string, - options?: SingleSignOnConfigurationsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - resourceGroupName, - monitorName, - options - )) { - yield* page; - } - } - - /** - * List the single sign-on configurations for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - monitorName: string, - options?: SingleSignOnConfigurationsListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - listOperationSpec - ); - } - - /** - * Configures single-sign-on for this resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: SingleSignOnConfigurationsCreateOrUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - SingleSignOnConfigurationsCreateOrUpdateResponse - > - > { - 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, configurationName, options }, - spec: createOrUpdateOperationSpec - }); - const poller = await createHttpPoller< - SingleSignOnConfigurationsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation" - }); - await poller.poll(); - return poller; - } - - /** - * Configures single-sign-on for this resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: SingleSignOnConfigurationsCreateOrUpdateOptionalParams - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - monitorName, - configurationName, - options - ); - return poller.pollUntilDone(); - } - - /** - * Gets the datadog single sign-on resource for the given Monitor. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - get( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: SingleSignOnConfigurationsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, configurationName, options }, - getOperationSpec - ); - } - - /** - * ListNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - monitorName: string, - nextLink: string, - options?: SingleSignOnConfigurationsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogSingleSignOnResourceListResponse - }, - 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/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.DatadogSingleSignOnResource - }, - 201: { - bodyMapper: Mappers.DatadogSingleSignOnResource - }, - 202: { - bodyMapper: Mappers.DatadogSingleSignOnResource - }, - 204: { - bodyMapper: Mappers.DatadogSingleSignOnResource - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.body5, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.configurationName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogSingleSignOnResource - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.configurationName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatadogSingleSignOnResourceListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/datadog/arm-datadog/src/operations/tagRules.ts b/sdk/datadog/arm-datadog/src/operations/tagRules.ts deleted file mode 100644 index 63fc1171118f..000000000000 --- a/sdk/datadog/arm-datadog/src/operations/tagRules.ts +++ /dev/null @@ -1,284 +0,0 @@ -/* - * 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.js"; -import { TagRules } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { MicrosoftDatadogClient } from "../microsoftDatadogClient.js"; -import { - MonitoringTagRules, - TagRulesListNextOptionalParams, - TagRulesListOptionalParams, - TagRulesListResponse, - TagRulesCreateOrUpdateOptionalParams, - TagRulesCreateOrUpdateResponse, - TagRulesGetOptionalParams, - TagRulesGetResponse, - TagRulesListNextResponse -} from "../models/index.js"; - -/// -/** Class containing TagRules operations. */ -export class TagRulesImpl implements TagRules { - private readonly client: MicrosoftDatadogClient; - - /** - * Initialize a new instance of the class TagRules class. - * @param client Reference to the service client - */ - constructor(client: MicrosoftDatadogClient) { - this.client = client; - } - - /** - * List the tag rules for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - monitorName: string, - options?: TagRulesListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(resourceGroupName, monitorName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage( - resourceGroupName, - monitorName, - options, - settings - ); - } - }; - } - - private async *listPagingPage( - resourceGroupName: string, - monitorName: string, - options?: TagRulesListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: TagRulesListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(resourceGroupName, monitorName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext( - resourceGroupName, - monitorName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - monitorName: string, - options?: TagRulesListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage( - resourceGroupName, - monitorName, - options - )) { - yield* page; - } - } - - /** - * List the tag rules for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - monitorName: string, - options?: TagRulesListOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, options }, - listOperationSpec - ); - } - - /** - * Create or update a tag rule set for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param ruleSetName Rule set name - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - monitorName: string, - ruleSetName: string, - options?: TagRulesCreateOrUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, ruleSetName, options }, - createOrUpdateOperationSpec - ); - } - - /** - * Get a tag rule set for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param ruleSetName Rule set name - * @param options The options parameters. - */ - get( - resourceGroupName: string, - monitorName: string, - ruleSetName: string, - options?: TagRulesGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, ruleSetName, options }, - getOperationSpec - ); - } - - /** - * ListNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - monitorName: string, - nextLink: string, - options?: TagRulesListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, monitorName, nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MonitoringTagRulesListResponse - }, - 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/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.MonitoringTagRules - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.body4, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.ruleSetName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MonitoringTagRules - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.ruleSetName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MonitoringTagRulesListResponse - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.resourceGroupName, - Parameters.monitorName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/creationSupported.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/creationSupported.ts deleted file mode 100644 index e32a2cf2fea7..000000000000 --- a/sdk/datadog/arm-datadog/src/operationsInterfaces/creationSupported.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { - CreateResourceSupportedResponse, - CreationSupportedListOptionalParams, - CreationSupportedGetOptionalParams, - CreationSupportedGetResponse -} from "../models/index.js"; - -/// -/** Interface representing a CreationSupported. */ -export interface CreationSupported { - /** - * Informs if the current subscription is being already monitored for selected Datadog organization. - * @param datadogOrganizationId Datadog Organization Id - * @param options The options parameters. - */ - list( - datadogOrganizationId: string, - options?: CreationSupportedListOptionalParams - ): PagedAsyncIterableIterator; - /** - * Informs if the current subscription is being already monitored for selected Datadog organization. - * @param datadogOrganizationId Datadog Organization Id - * @param options The options parameters. - */ - get( - datadogOrganizationId: string, - options?: CreationSupportedGetOptionalParams - ): Promise; -} diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/index.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/index.ts deleted file mode 100644 index 8b30e403c8fb..000000000000 --- a/sdk/datadog/arm-datadog/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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 "./marketplaceAgreements.js"; -export * from "./creationSupported.js"; -export * from "./monitors.js"; -export * from "./operations.js"; -export * from "./tagRules.js"; -export * from "./singleSignOnConfigurations.js"; -export * from "./monitoredSubscriptions.js"; diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/marketplaceAgreements.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/marketplaceAgreements.ts deleted file mode 100644 index 54ebf44ae013..000000000000 --- a/sdk/datadog/arm-datadog/src/operationsInterfaces/marketplaceAgreements.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 { - DatadogAgreementResource, - MarketplaceAgreementsListOptionalParams, - MarketplaceAgreementsCreateOrUpdateOptionalParams, - MarketplaceAgreementsCreateOrUpdateResponse -} from "../models/index.js"; - -/// -/** Interface representing a MarketplaceAgreements. */ -export interface MarketplaceAgreements { - /** - * List Datadog marketplace agreements in the subscription. - * @param options The options parameters. - */ - list( - options?: MarketplaceAgreementsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * Create Datadog marketplace agreement in the subscription. - * @param options The options parameters. - */ - createOrUpdate( - options?: MarketplaceAgreementsCreateOrUpdateOptionalParams - ): Promise; -} diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/monitoredSubscriptions.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/monitoredSubscriptions.ts deleted file mode 100644 index 072ce7a227ed..000000000000 --- a/sdk/datadog/arm-datadog/src/operationsInterfaces/monitoredSubscriptions.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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 { - MonitoredSubscriptionProperties, - MonitoredSubscriptionsListOptionalParams, - MonitoredSubscriptionsGetOptionalParams, - MonitoredSubscriptionsGetResponse, - MonitoredSubscriptionsCreateorUpdateOptionalParams, - MonitoredSubscriptionsCreateorUpdateResponse, - MonitoredSubscriptionsUpdateOptionalParams, - MonitoredSubscriptionsUpdateResponse, - MonitoredSubscriptionsDeleteOptionalParams -} from "../models/index.js"; - -/// -/** Interface representing a MonitoredSubscriptions. */ -export interface MonitoredSubscriptions { - /** - * List the subscriptions currently being monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - list( - resourceGroupName: string, - monitorName: string, - options?: MonitoredSubscriptionsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * List the subscriptions currently being monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsGetOptionalParams - ): Promise; - /** - * Add the subscriptions that should be monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - beginCreateorUpdate( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsCreateorUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - MonitoredSubscriptionsCreateorUpdateResponse - > - >; - /** - * Add the subscriptions that should be monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - beginCreateorUpdateAndWait( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsCreateorUpdateOptionalParams - ): Promise; - /** - * Updates the subscriptions that are being monitored by the Datadog monitor resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - MonitoredSubscriptionsUpdateResponse - > - >; - /** - * Updates the subscriptions that are being monitored by the Datadog monitor resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName The configuration name. Only 'default' value is supported. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsUpdateOptionalParams - ): Promise; - /** - * Updates the subscriptions that are being monitored by the Datadog monitor resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsDeleteOptionalParams - ): Promise, void>>; - /** - * Updates the subscriptions that are being monitored by the Datadog monitor resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: MonitoredSubscriptionsDeleteOptionalParams - ): Promise; -} diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/monitors.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/monitors.ts deleted file mode 100644 index a22091fbf495..000000000000 --- a/sdk/datadog/arm-datadog/src/operationsInterfaces/monitors.ts +++ /dev/null @@ -1,220 +0,0 @@ -/* - * 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 { - DatadogApiKey, - MonitorsListApiKeysOptionalParams, - DatadogHost, - MonitorsListHostsOptionalParams, - LinkedResource, - MonitorsListLinkedResourcesOptionalParams, - MonitoredResource, - MonitorsListMonitoredResourcesOptionalParams, - DatadogMonitorResource, - MonitorsListOptionalParams, - MonitorsListByResourceGroupOptionalParams, - MonitorsGetDefaultKeyOptionalParams, - MonitorsGetDefaultKeyResponse, - MonitorsSetDefaultKeyOptionalParams, - MonitorsGetOptionalParams, - MonitorsGetResponse, - MonitorsCreateOptionalParams, - MonitorsCreateResponse, - MonitorsUpdateOptionalParams, - MonitorsUpdateResponse, - MonitorsDeleteOptionalParams, - MonitorsRefreshSetPasswordLinkOptionalParams, - MonitorsRefreshSetPasswordLinkResponse -} from "../models/index.js"; - -/// -/** Interface representing a Monitors. */ -export interface Monitors { - /** - * List the api keys for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - listApiKeys( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListApiKeysOptionalParams - ): PagedAsyncIterableIterator; - /** - * List the hosts for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - listHosts( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListHostsOptionalParams - ): PagedAsyncIterableIterator; - /** - * List all Azure resources associated to the same Datadog organization as the target resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - listLinkedResources( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListLinkedResourcesOptionalParams - ): PagedAsyncIterableIterator; - /** - * List the resources currently being monitored by the Datadog monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - listMonitoredResources( - resourceGroupName: string, - monitorName: string, - options?: MonitorsListMonitoredResourcesOptionalParams - ): PagedAsyncIterableIterator; - /** - * List all monitors under the specified subscription. - * @param options The options parameters. - */ - list( - options?: MonitorsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * List all monitors under the specified resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroupName: string, - options?: MonitorsListByResourceGroupOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get the default api key. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - getDefaultKey( - resourceGroupName: string, - monitorName: string, - options?: MonitorsGetDefaultKeyOptionalParams - ): Promise; - /** - * Set the default api key. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - setDefaultKey( - resourceGroupName: string, - monitorName: string, - options?: MonitorsSetDefaultKeyOptionalParams - ): Promise; - /** - * Get the properties of a specific monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - get( - resourceGroupName: string, - monitorName: string, - options?: MonitorsGetOptionalParams - ): Promise; - /** - * Create a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - beginCreate( - resourceGroupName: string, - monitorName: string, - options?: MonitorsCreateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - MonitorsCreateResponse - > - >; - /** - * Create a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - beginCreateAndWait( - resourceGroupName: string, - monitorName: string, - options?: MonitorsCreateOptionalParams - ): Promise; - /** - * Update a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - monitorName: string, - options?: MonitorsUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - MonitorsUpdateResponse - > - >; - /** - * Update a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - monitorName: string, - options?: MonitorsUpdateOptionalParams - ): Promise; - /** - * Delete a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - monitorName: string, - options?: MonitorsDeleteOptionalParams - ): Promise, void>>; - /** - * Delete a monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - monitorName: string, - options?: MonitorsDeleteOptionalParams - ): Promise; - /** - * Refresh the set password link and return a latest one. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - refreshSetPasswordLink( - resourceGroupName: string, - monitorName: string, - options?: MonitorsRefreshSetPasswordLinkOptionalParams - ): Promise; -} diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/operations.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/operations.ts deleted file mode 100644 index 780d923d2604..000000000000 --- a/sdk/datadog/arm-datadog/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 { OperationResult, OperationsListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * List all operations provided by Microsoft.Datadog for the 2023-01-01 api version. - * @param options The options parameters. - */ - list( - options?: OperationsListOptionalParams - ): PagedAsyncIterableIterator; -} diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/singleSignOnConfigurations.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/singleSignOnConfigurations.ts deleted file mode 100644 index 0a4e3ec1b18a..000000000000 --- a/sdk/datadog/arm-datadog/src/operationsInterfaces/singleSignOnConfigurations.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 { - DatadogSingleSignOnResource, - SingleSignOnConfigurationsListOptionalParams, - SingleSignOnConfigurationsCreateOrUpdateOptionalParams, - SingleSignOnConfigurationsCreateOrUpdateResponse, - SingleSignOnConfigurationsGetOptionalParams, - SingleSignOnConfigurationsGetResponse -} from "../models/index.js"; - -/// -/** Interface representing a SingleSignOnConfigurations. */ -export interface SingleSignOnConfigurations { - /** - * List the single sign-on configurations for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - list( - resourceGroupName: string, - monitorName: string, - options?: SingleSignOnConfigurationsListOptionalParams - ): PagedAsyncIterableIterator; - /** - * Configures single-sign-on for this resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: SingleSignOnConfigurationsCreateOrUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - SingleSignOnConfigurationsCreateOrUpdateResponse - > - >; - /** - * Configures single-sign-on for this resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: SingleSignOnConfigurationsCreateOrUpdateOptionalParams - ): Promise; - /** - * Gets the datadog single sign-on resource for the given Monitor. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param configurationName Configuration name - * @param options The options parameters. - */ - get( - resourceGroupName: string, - monitorName: string, - configurationName: string, - options?: SingleSignOnConfigurationsGetOptionalParams - ): Promise; -} diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/tagRules.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/tagRules.ts deleted file mode 100644 index aa28db1f50de..000000000000 --- a/sdk/datadog/arm-datadog/src/operationsInterfaces/tagRules.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 { - MonitoringTagRules, - TagRulesListOptionalParams, - TagRulesCreateOrUpdateOptionalParams, - TagRulesCreateOrUpdateResponse, - TagRulesGetOptionalParams, - TagRulesGetResponse -} from "../models/index.js"; - -/// -/** Interface representing a TagRules. */ -export interface TagRules { - /** - * List the tag rules for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The options parameters. - */ - list( - resourceGroupName: string, - monitorName: string, - options?: TagRulesListOptionalParams - ): PagedAsyncIterableIterator; - /** - * Create or update a tag rule set for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param ruleSetName Rule set name - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - monitorName: string, - ruleSetName: string, - options?: TagRulesCreateOrUpdateOptionalParams - ): Promise; - /** - * Get a tag rule set for a given monitor resource. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param ruleSetName Rule set name - * @param options The options parameters. - */ - get( - resourceGroupName: string, - monitorName: string, - ruleSetName: string, - options?: TagRulesGetOptionalParams - ): Promise; -} diff --git a/sdk/datadog/arm-datadog/src/pagingHelper.ts b/sdk/datadog/arm-datadog/src/pagingHelper.ts deleted file mode 100644 index 269a2b9814b5..000000000000 --- a/sdk/datadog/arm-datadog/src/pagingHelper.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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/datadog/arm-datadog/src/restorePollerHelpers.ts b/sdk/datadog/arm-datadog/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..974f08459f6b --- /dev/null +++ b/sdk/datadog/arm-datadog/src/restorePollerHelpers.ts @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DatadogClient } from "./datadogClient.js"; +import { + _$deleteDeserialize, + _updateDeserialize, + _createorUpdateDeserialize, +} from "./api/monitoredSubscriptions/operations.js"; +import { _createOrUpdateDeserialize } from "./api/datadogSingleSignOnResources/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeDatadogMonitorResources, + _updateDeserialize as _updateDeserializeDatadogMonitorResources, + _createDeserialize, +} from "./api/datadogMonitorResources/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: DatadogClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}": + { + deserializer: _$deleteDeserialize, + expectedStatuses: ["200", "202", "204"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}": + { deserializer: _updateDeserialize, expectedStatuses: ["200", "202"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}": + { + deserializer: _createorUpdateDeserialize, + expectedStatuses: ["200", "201", "202"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}": + { + deserializer: _createOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}": + { + deserializer: _$deleteDeserializeDatadogMonitorResources, + expectedStatuses: ["200", "202", "204"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}": + { + deserializer: _updateDeserializeDatadogMonitorResources, + expectedStatuses: ["200", "201"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}": + { deserializer: _createDeserialize, expectedStatuses: ["200", "201"] }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/datadog/arm-datadog/src/static-helpers/pagingHelpers.ts b/sdk/datadog/arm-datadog/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..ce33af5f4178 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/datadog/arm-datadog/src/static-helpers/pollingHelpers.ts b/sdk/datadog/arm-datadog/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..f01c41bab69d --- /dev/null +++ b/sdk/datadog/arm-datadog/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/sdk/datadog/arm-datadog/src/static-helpers/urlTemplate.ts b/sdk/datadog/arm-datadog/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..cd03319fda35 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/static-helpers/urlTemplate.ts @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +//--------------------- +// interfaces +//--------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string) { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string) { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string) { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any) { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false) { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions) { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + named && val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions) { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + (op = expr[0]), (expr = expr.slice(1)); + } + const varList = expr.split(/,/g); + const result = []; + for (const varSpec of varList) { + const varMatch = /([^:\*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: result.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + result.push(varValue); + } + } + return result.join(""); + }); +} diff --git a/sdk/datadog/arm-datadog/test/datadog_operations_test.spec.ts b/sdk/datadog/arm-datadog/test/datadog_operations_test.spec.ts deleted file mode 100644 index 1b38c70c0e09..000000000000 --- a/sdk/datadog/arm-datadog/test/datadog_operations_test.spec.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 type { RecorderStartOptions } from "@azure-tools/test-recorder"; -import { env, Recorder, isPlaybackMode } from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { MicrosoftDatadogClient } from "../src/microsoftDatadogClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -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, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - "AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section - ], -}; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("Datadog test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: MicrosoftDatadogClient; - - beforeEach(async (ctx) => { - recorder = new Recorder(ctx); - await recorder.start(recorderOptions); - subscriptionId = env.SUBSCRIPTION_ID || ""; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new MicrosoftDatadogClient( - credential, - subscriptionId, - recorder.configureClientOptions({}), - ); - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("operation list test", async function () { - const resArray = new Array(); - for await (const item of client.operations.list()) { - resArray.push(item); - } - assert.notEqual(resArray.length, 0); - }); -}); diff --git a/sdk/datadog/arm-datadog/test/public/sampleTest.spec.ts b/sdk/datadog/arm-datadog/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..e4591bbad342 --- /dev/null +++ b/sdk/datadog/arm-datadog/test/public/sampleTest.spec.ts @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async () => { + // recorder = await createRecorder(this); + }); + + afterEach(async () => { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/datadog/arm-datadog/test/public/utils/recordedClient.ts b/sdk/datadog/arm-datadog/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..14dcd9fa397c --- /dev/null +++ b/sdk/datadog/arm-datadog/test/public/utils/recordedClient.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder(context: VitestTestContext): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/sdk/datadog/arm-datadog/test/snippets.spec.ts b/sdk/datadog/arm-datadog/test/snippets.spec.ts index c17082b5b3a9..07f65a2f14eb 100644 --- a/sdk/datadog/arm-datadog/test/snippets.spec.ts +++ b/sdk/datadog/arm-datadog/test/snippets.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { MicrosoftDatadogClient } from "../src/index.js"; +import { DatadogClient } from "../src/index.js"; import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity"; import { setLogLevel } from "@azure/logger"; import { describe, it } from "vitest"; @@ -9,7 +9,7 @@ import { describe, it } from "vitest"; describe("snippets", () => { it("ReadmeSampleCreateClient_Node", async () => { const subscriptionId = "00000000-0000-0000-0000-000000000000"; - const client = new MicrosoftDatadogClient(new DefaultAzureCredential(), subscriptionId); + const client = new DatadogClient(new DefaultAzureCredential(), subscriptionId); }); it("ReadmeSampleCreateClient_Browser", async () => { @@ -18,7 +18,7 @@ describe("snippets", () => { tenantId: "", clientId: "", }); - const client = new MicrosoftDatadogClient(credential, subscriptionId); + const client = new DatadogClient(credential, subscriptionId); }); it("SetLogLevel", async () => { diff --git a/sdk/datadog/arm-datadog/tsp-location.yaml b/sdk/datadog/arm-datadog/tsp-location.yaml new file mode 100644 index 000000000000..666422bdc569 --- /dev/null +++ b/sdk/datadog/arm-datadog/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/datadog/Datadog.Management +commit: 2ff3228b987ab59dff3d5df9a3192ed7c5567e3e +repo: ../azure-rest-api-specs +additionalDirectories: