diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index aed591ffa9d7..3379c2d2e754 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -24,6 +24,7 @@ specifiers: '@rush-temp/arm-containerservice': file:./projects/arm-containerservice.tgz '@rush-temp/arm-cosmosdb': file:./projects/arm-cosmosdb.tgz '@rush-temp/arm-databricks': file:./projects/arm-databricks.tgz + '@rush-temp/arm-datadog': file:./projects/arm-datadog.tgz '@rush-temp/arm-datafactory': file:./projects/arm-datafactory.tgz '@rush-temp/arm-datalake-analytics': file:./projects/arm-datalake-analytics.tgz '@rush-temp/arm-desktopvirtualization': file:./projects/arm-desktopvirtualization.tgz @@ -193,6 +194,7 @@ dependencies: '@rush-temp/arm-containerservice': file:projects/arm-containerservice.tgz '@rush-temp/arm-cosmosdb': file:projects/arm-cosmosdb.tgz '@rush-temp/arm-databricks': file:projects/arm-databricks.tgz + '@rush-temp/arm-datadog': file:projects/arm-datadog.tgz '@rush-temp/arm-datafactory': file:projects/arm-datafactory.tgz '@rush-temp/arm-datalake-analytics': file:projects/arm-datalake-analytics.tgz '@rush-temp/arm-desktopvirtualization': file:projects/arm-desktopvirtualization.tgz @@ -1568,6 +1570,7 @@ packages: /@opentelemetry/node/0.22.0_@opentelemetry+api@1.0.3: resolution: {integrity: sha512-+HhGbDruQ7cwejVOIYyxRa28uosnG8W95NiQZ6qE8PXXPsDSyGeftAPbtYpGit0H2f5hrVcMlwmWHeAo9xkSLA==} engines: {node: '>=8.0.0'} + deprecated: Package renamed to @opentelemetry/sdk-trace-node peerDependencies: '@opentelemetry/api': ^1.0.0 dependencies: @@ -8491,6 +8494,27 @@ packages: uglify-js: 3.14.3 dev: false + file:projects/arm-datadog.tgz: + resolution: {integrity: sha512-ZCNlU3J5D1cwtcM8skzZi9ZMmRSN+wK2s48soGZ4Gu9+BT2HhqREfc7wkN6UM6hTmZVmxenolB7FWHBUo5phdg==, tarball: file:projects/arm-datadog.tgz} + name: '@rush-temp/arm-datadog' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.18.19 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.3 + dev: false + file:projects/arm-datafactory.tgz: resolution: {integrity: sha512-wm2n/Ns8vlhtEN0s+6Dp62FqXTpObLqUM/gtWBopBYVv45/1htEURor+8vevFUbYVOMwLXrqqtk11/5qnu34RQ==, tarball: file:projects/arm-datafactory.tgz} name: '@rush-temp/arm-datafactory' diff --git a/rush.json b/rush.json index 0bdf615ba0d5..64774c286c85 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -1155,6 +1155,11 @@ "packageName": "@azure/arm-relay", "projectFolder": "sdk/relay/arm-relay", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-datadog", + "projectFolder": "sdk/datadog/arm-datadog", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/datadog/arm-datadog/CHANGELOG.md b/sdk/datadog/arm-datadog/CHANGELOG.md new file mode 100644 index 000000000000..141af6a37eba --- /dev/null +++ b/sdk/datadog/arm-datadog/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 3.0.0 (2021-12-16) + +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/js-track2-quickstart). diff --git a/sdk/datadog/arm-datadog/LICENSE.txt b/sdk/datadog/arm-datadog/LICENSE similarity index 99% rename from sdk/datadog/arm-datadog/LICENSE.txt rename to sdk/datadog/arm-datadog/LICENSE index 2d3163745319..ccb63b166732 100644 --- a/sdk/datadog/arm-datadog/LICENSE.txt +++ 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 3896344cab4d..39b1ed5a8ecd 100644 --- a/sdk/datadog/arm-datadog/README.md +++ b/sdk/datadog/arm-datadog/README.md @@ -1,109 +1,98 @@ -## Azure MicrosoftDatadogClient SDK for JavaScript +# Azure Microsoft Datadog client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for MicrosoftDatadogClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Microsoft 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://docs.microsoft.com/javascript/api/@azure/arm-datadog) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. ### Prerequisites -You must have an [Azure subscription](https://azure.microsoft.com/free/). +- An [Azure subscription][azure_sub]. -### How to install +### Install the `@azure/arm-datadog` package -To use this SDK in your project, you will need to install two packages. -- `@azure/arm-datadog` that contains the client. -- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory. +Install the Azure Microsoft Datadog client library for JavaScript with `npm`: -Install both packages using the below command: ```bash -npm install --save @azure/arm-datadog @azure/identity +npm install @azure/arm-datadog ``` -> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. -If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. +### Create and authenticate a `MicrosoftDatadogClient` + +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]. -### How to use +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). -- If you are writing a client side browser application, - - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions. - - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below. -- If you are writing a server side application, - - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples) - - Complete the set up steps required by the credential if any. - - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below. +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: -In the below samples, we pass the credential and the Azure subscription id to instantiate the client. -Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. +```bash +npm install @azure/identity +``` -#### nodejs - Authentication, client creation, and list marketplaceAgreements as an example written in JavaScript. +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`. -##### Sample code +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript -const { DefaultAzureCredential } = require("@azure/identity"); const { MicrosoftDatadogClient } = require("@azure/arm-datadog"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples -// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead. -const creds = new DefaultAzureCredential(); -const client = new MicrosoftDatadogClient(creds, subscriptionId); - -client.marketplaceAgreements.list().then((result) => { - console.log("The result is:"); - console.log(result); -}).catch((err) => { - console.log("An error occurred:"); - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new MicrosoftDatadogClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation, and list marketplaceAgreements as an example written in JavaScript. - -In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser. - - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser. - - Note down the client Id from the previous step and use it in the browser sample below. - -##### Sample code - -- index.html - -```html - - - - @azure/arm-datadog sample - - - - - - - + +### 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 + +`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. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); ``` +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fdatadog%2Farm-datadog%2FREADME.png) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/datadog/arm-datadog/README.png) +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/datadog/arm-datadog/_meta.json b/sdk/datadog/arm-datadog/_meta.json new file mode 100644 index 000000000000..8fda1918c95a --- /dev/null +++ b/sdk/datadog/arm-datadog/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "df2d8df906b4807729a88c44c6ece62925811b80", + "readme": "specification/datadog/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/datadog/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" +} \ No newline at end of file diff --git a/sdk/datadog/arm-datadog/api-extractor.json b/sdk/datadog/arm-datadog/api-extractor.json new file mode 100644 index 000000000000..902b76208aba --- /dev/null +++ b/sdk/datadog/arm-datadog/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-datadog.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/datadog/arm-datadog/package.json b/sdk/datadog/arm-datadog/package.json index 8ba72f35e2a9..0702d403ccef 100644 --- a/sdk/datadog/arm-datadog/package.json +++ b/sdk/datadog/arm-datadog/package.json @@ -1,58 +1,91 @@ { "name": "@azure/arm-datadog", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "MicrosoftDatadogClient Library with typescript type definitions for node.js and browser.", - "version": "2.1.0", + "description": "A generated SDK for MicrosoftDatadogClient.", + "version": "3.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.1.0", - "@azure/ms-rest-js": "^2.2.0", - "@azure/core-auth": "^1.1.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-datadog.js", - "module": "./esm/microsoftDatadogClient.js", - "types": "./esm/microsoftDatadogClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-datadog.d.ts", "devDependencies": { - "typescript": "^3.6.0", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/datadog/arm-datadog", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-datadog.js.map'\" -o ./dist/arm-datadog.min.js ./dist/arm-datadog.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, "autoPublish": true diff --git a/sdk/datadog/arm-datadog/review/arm-datadog.api.md b/sdk/datadog/arm-datadog/review/arm-datadog.api.md new file mode 100644 index 000000000000..47ceb477acb2 --- /dev/null +++ b/sdk/datadog/arm-datadog/review/arm-datadog.api.md @@ -0,0 +1,746 @@ +## 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 { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export type CreatedByType = string; + +// @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; + enterpriseAppId?: string; + readonly id?: string; + linkingAuthCode?: string; + linkingClientId?: string; + readonly 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 (undocumented) +export interface IdentityProperties { + readonly principalId?: string; + readonly tenantId?: string; + type?: ManagedIdentityTypes; +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownLiftrResourceCategories { + // (undocumented) + MonitorLogs = "MonitorLogs", + // (undocumented) + Unknown = "Unknown" +} + +// @public +export enum KnownManagedIdentityTypes { + // (undocumented) + SystemAssigned = "SystemAssigned", + // (undocumented) + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownMarketplaceSubscriptionStatus { + // (undocumented) + Active = "Active", + // (undocumented) + Provisioning = "Provisioning", + // (undocumented) + Suspended = "Suspended", + // (undocumented) + Unsubscribed = "Unsubscribed" +} + +// @public +export enum KnownMonitoringStatus { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Accepted = "Accepted", + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + NotSpecified = "NotSpecified", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownSingleSignOnStates { + // (undocumented) + Disable = "Disable", + // (undocumented) + Enable = "Enable", + // (undocumented) + Existing = "Existing", + // (undocumented) + Initial = "Initial" +} + +// @public +export enum KnownTagAction { + // (undocumented) + Exclude = "Exclude", + // (undocumented) + 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) + marketplaceAgreements: MarketplaceAgreements; + // (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 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 { + 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 { + monitoringStatus?: MonitoringStatus; +} + +// @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 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/rollup.config.js b/sdk/datadog/arm-datadog/rollup.config.js index 90be5982c5c6..9be1955eb7f1 100644 --- a/sdk/datadog/arm-datadog/rollup.config.js +++ b/sdk/datadog/arm-datadog/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/microsoftDatadogClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-datadog.js", - format: "umd", - name: "Azure.ArmDatadog", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false }; -export default config; +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/datadog/arm-datadog/src/index.ts b/sdk/datadog/arm-datadog/src/index.ts new file mode 100644 index 000000000000..316630b5fd51 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 "./models"; +export { MicrosoftDatadogClient } from "./microsoftDatadogClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/datadog/arm-datadog/src/lroImpl.ts b/sdk/datadog/arm-datadog/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/datadog/arm-datadog/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts b/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts index 2bf92969c7a8..6127d1be83fd 100644 --- a/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts +++ b/sdk/datadog/arm-datadog/src/microsoftDatadogClient.ts @@ -3,53 +3,93 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import { TokenCredential } from "@azure/core-auth"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { MicrosoftDatadogClientContext } from "./microsoftDatadogClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + MarketplaceAgreementsImpl, + MonitorsImpl, + OperationsImpl, + TagRulesImpl, + SingleSignOnConfigurationsImpl +} from "./operations"; +import { + MarketplaceAgreements, + Monitors, + Operations, + TagRules, + SingleSignOnConfigurations +} from "./operationsInterfaces"; +import { MicrosoftDatadogClientOptionalParams } from "./models"; - -class MicrosoftDatadogClient extends MicrosoftDatadogClientContext { - // Operation groups - marketplaceAgreements: operations.MarketplaceAgreements; - monitors: operations.Monitors; - operations: operations.Operations; - tagRules: operations.TagRules; - singleSignOnConfigurations: operations.SingleSignOnConfigurations; +export class MicrosoftDatadogClient extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; /** * Initializes a new instance of the MicrosoftDatadogClient class. - * @param credentials Credentials needed for the client to connect to Azure. Credentials - * implementing the TokenCredential interface from the @azure/identity package are recommended. For - * more information about these credentials, see - * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the - * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and - * @azure/ms-rest-browserauth are also supported. + * @param credentials Subscription credentials which uniquely identify client subscription. * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.MicrosoftDatadogClientOptions) { - super(credentials, subscriptionId, options); - this.marketplaceAgreements = new operations.MarketplaceAgreements(this); - this.monitors = new operations.Monitors(this); - this.operations = new operations.Operations(this); - this.tagRules = new operations.TagRules(this); - this.singleSignOnConfigurations = new operations.SingleSignOnConfigurations(this); - } -} + 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 + }; -// Operation Specifications + const packageDetails = `azsdk-js-arm-datadog/3.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; -export { - MicrosoftDatadogClient, - MicrosoftDatadogClientContext, - Models as MicrosoftDatadogModels, - Mappers as MicrosoftDatadogMappers -}; -export * from "./operations"; + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2021-03-01"; + this.marketplaceAgreements = new MarketplaceAgreementsImpl(this); + this.monitors = new MonitorsImpl(this); + this.operations = new OperationsImpl(this); + this.tagRules = new TagRulesImpl(this); + this.singleSignOnConfigurations = new SingleSignOnConfigurationsImpl(this); + } + + marketplaceAgreements: MarketplaceAgreements; + monitors: Monitors; + operations: Operations; + tagRules: TagRules; + singleSignOnConfigurations: SingleSignOnConfigurations; +} diff --git a/sdk/datadog/arm-datadog/src/microsoftDatadogClientContext.ts b/sdk/datadog/arm-datadog/src/microsoftDatadogClientContext.ts deleted file mode 100644 index 098cb8df85c7..000000000000 --- a/sdk/datadog/arm-datadog/src/microsoftDatadogClientContext.ts +++ /dev/null @@ -1,74 +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 Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import { TokenCredential } from "@azure/core-auth"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-datadog"; -const packageVersion = "2.1.0"; - -export class MicrosoftDatadogClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials | TokenCredential; - apiVersion?: string; - subscriptionId: string; - - /** - * Initializes a new instance of the MicrosoftDatadogClient class. - * @param credentials Credentials needed for the client to connect to Azure. Credentials - * implementing the TokenCredential interface from the @azure/identity package are recommended. For - * more information about these credentials, see - * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the - * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and - * @azure/ms-rest-browserauth are also supported. - * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options - */ - constructor( - credentials: msRest.ServiceClientCredentials | TokenCredential, - subscriptionId: string, - options?: Models.MicrosoftDatadogClientOptions - ) { - if (credentials == undefined) { - throw new Error("'credentials' cannot be null."); - } - if (subscriptionId == undefined) { - throw new Error("'subscriptionId' cannot be null."); - } - - if (!options) { - options = {}; - } - if (!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = "2021-03-01"; - this.acceptLanguage = "en-US"; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if ( - options.longRunningOperationRetryTimeout !== null && - options.longRunningOperationRetryTimeout !== undefined - ) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/datadog/arm-datadog/src/models/index.ts b/sdk/datadog/arm-datadog/src/models/index.ts index 552753f5eb23..4382d9c5c8b5 100644 --- a/sdk/datadog/arm-datadog/src/models/index.ts +++ b/sdk/datadog/arm-datadog/src/models/index.ts @@ -6,1562 +6,915 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +/** 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; +} -/** - * Terms properties. - */ -export interface DatadogAgreementProperties { +export interface DatadogAgreementResource { /** - * Publisher identifier string. + * ARM id of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - publisher?: string; + readonly id?: string; /** - * Product identifier string. + * Name of the agreement. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - product?: string; + readonly name?: string; /** - * Plan identifier string. + * The type of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - plan?: string; + readonly type?: string; + /** Represents the properties of the resource. */ + properties?: DatadogAgreementProperties; /** - * Link to HTML with Microsoft and Publisher terms. + * 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. - */ + /** 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. - */ + /** Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. */ retrieveDatetime?: Date; - /** - * Terms signature. - */ + /** Terms signature. */ signature?: string; - /** - * If any version of the terms have been accepted, otherwise false. - */ + /** If any version of the terms have been accepted, otherwise false. */ accepted?: boolean; } -/** - * Metadata pertaining to creation and last modification of the resource. - */ +/** Metadata pertaining to creation and last modification of the resource. */ export interface SystemData { - /** - * The identity that created the resource. - */ + /** The identity that created the resource. */ createdBy?: string; - /** - * The type of identity that created the resource. Possible values include: 'User', - * 'Application', 'ManagedIdentity', 'Key' - */ + /** The type of identity that created the resource. */ createdByType?: CreatedByType; - /** - * The timestamp of resource creation (UTC). - */ + /** The timestamp of resource creation (UTC). */ createdAt?: Date; - /** - * The identity that last modified the resource. - */ + /** The identity that last modified the resource. */ lastModifiedBy?: string; - /** - * The type of identity that last modified the resource. Possible values include: 'User', - * 'Application', 'ManagedIdentity', 'Key' - */ + /** The type of identity that last modified the resource. */ lastModifiedByType?: CreatedByType; - /** - * The timestamp of resource last modification (UTC) - */ + /** The timestamp of resource last modification (UTC) */ lastModifiedAt?: Date; } -/** - * An interface representing DatadogAgreementResource. - */ -export interface DatadogAgreementResource extends BaseResource { +/** 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 { /** - * ARM id of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly id?: string; + readonly code?: string; /** - * Name of the agreement. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly name?: string; + readonly message?: string; /** - * The type of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly type?: string; + readonly target?: string; /** - * Represents the properties of the resource. + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - properties?: DatadogAgreementProperties; + readonly details?: ErrorDetail[]; /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly systemData?: SystemData; + readonly additionalInfo?: ErrorAdditionalInfo[]; } -/** - * An interface representing DatadogApiKey. - */ -export interface DatadogApiKey { +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { /** - * The user that created the API key. + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - createdBy?: string; + readonly type?: string; /** - * The name of the API key. + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly info?: Record; +} + +/** 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. - */ + /** The value of the API key. */ key: string; - /** - * The time of creation of the API key. - */ + /** The time of creation of the API key. */ created?: string; } -/** - * An interface representing DatadogInstallMethod. - */ -export interface DatadogInstallMethod { - /** - * The tool. - */ - tool?: string; - /** - * The tool version. - */ - toolVersion?: string; - /** - * The installer version. - */ - installerVersion?: 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; } -/** - * An interface representing DatadogLogsAgent. - */ -export interface DatadogLogsAgent { - /** - * The transport. - */ - transport?: string; +export interface DatadogHost { + /** The name of the host. */ + name?: string; + /** The aliases for the host. */ + aliases?: string[]; + /** The Datadog integrations reporting metrics for the host. */ + apps?: string[]; + meta?: DatadogHostMetadata; } -/** - * An interface representing DatadogHostMetadata. - */ export interface DatadogHostMetadata { - /** - * The agent version. - */ + /** The agent version. */ agentVersion?: string; installMethod?: DatadogInstallMethod; logsAgent?: DatadogLogsAgent; } -/** - * An interface representing DatadogHost. - */ -export interface DatadogHost { - /** - * The name of the host. - */ - name?: string; - /** - * The aliases for the host. - */ - aliases?: string[]; - /** - * The Datadog integrations reporting metrics for the host. - */ - apps?: string[]; - meta?: DatadogHostMetadata; +export interface DatadogInstallMethod { + /** The tool. */ + tool?: string; + /** The tool version. */ + toolVersion?: string; + /** The installer version. */ + installerVersion?: string; } -/** - * The definition of a linked resource. - */ +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. - */ + /** The ARM id of the linked resource. */ id?: string; } -/** - * The properties of a resource currently being monitored by the Datadog monitor resource. - */ +/** 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. - */ + /** The ARM id of the resource. */ id?: string; - /** - * Flag indicating if resource is sending metrics to Datadog. - */ + /** 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). - */ + /** 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. - */ + /** 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). - */ + /** Reason for why the resource is sending logs (or why it is not sending). */ reasonForLogsStatus?: string; } -/** - * The object that represents the operation. - */ +/** 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. - */ + /** Service provider, i.e., Microsoft.Datadog. */ provider?: string; - /** - * Type on which the operation is performed, e.g., 'monitors'. - */ + /** Type on which the operation is performed, e.g., 'monitors'. */ resource?: string; - /** - * Operation type, e.g., read, write, delete, etc. - */ + /** Operation type, e.g., read, write, delete, etc. */ operation?: string; - /** - * Description of the operation, e.g., 'Write monitors'. - */ + /** Description of the operation, e.g., 'Write monitors'. */ description?: string; } -/** - * A Microsoft.Datadog REST API operation. - */ -export interface OperationResult { +/** 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 { /** - * Operation name, i.e., {provider}/{resource}/{operation}. + * ARM id of the monitor resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - name?: string; - display?: OperationDisplay; + readonly id?: string; /** - * Indicates whether the operation is a data action + * Name of the monitor resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - isDataAction?: boolean; + 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; } -/** - * An interface representing ResourceSku. - */ export interface ResourceSku { + /** Name of the SKU. */ + 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; /** - * Name of the SKU. + * 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. */ - name: string; + readonly marketplaceSubscriptionStatus?: MarketplaceSubscriptionStatus; + /** Datadog organization properties */ + datadogOrganizationProperties?: DatadogOrganizationProperties; + /** User info */ + 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; } -/** - * Datadog organization properties - */ +/** Datadog organization properties */ export interface DatadogOrganizationProperties { /** * Name of the Datadog organization. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * Id of the Datadog organization. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; - /** - * The auth code used to linking to an existing datadog organization. - */ + /** 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. - */ + /** The client_id from an existing in exchange for an auth token to link organization. */ linkingClientId?: string; - /** - * The redirect uri for linking. - */ + /** The redirect uri for linking. */ redirectUri?: string; - /** - * Api key associated to the Datadog organization. - */ + /** Api key associated to the Datadog organization. */ apiKey?: string; - /** - * Application key associated to the Datadog organization. - */ + /** Application key associated to the Datadog organization. */ applicationKey?: string; - /** - * The Id of the Enterprise App used for Single sign on. - */ + /** The Id of the Enterprise App used for Single sign on. */ enterpriseAppId?: string; } -/** - * User info - */ +/** User info */ export interface UserInfo { - /** - * Name of the user - */ + /** Name of the user */ name?: string; - /** - * Email of the user used by Datadog for contacting them if needed - */ + /** 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 - */ + /** Phone number of the user used by Datadog for contacting them if needed */ phoneNumber?: string; } -/** - * Properties specific to the monitor resource. - */ -export interface MonitorProperties { - /** - * Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', - * 'Failed', 'Canceled', 'Deleted', 'NotSpecified' - */ - provisioningState?: ProvisioningState; - /** - * Possible values include: 'Enabled', 'Disabled'. Default value: 'Enabled'. - */ - monitoringStatus?: MonitoringStatus; - /** - * Possible values include: 'Provisioning', 'Active', 'Suspended', 'Unsubscribed' - */ - marketplaceSubscriptionStatus?: MarketplaceSubscriptionStatus; - datadogOrganizationProperties?: DatadogOrganizationProperties; - userInfo?: UserInfo; +export interface IdentityProperties { /** - * Possible values include: 'Unknown', 'MonitorLogs' + * The identity ID. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - liftrResourceCategory?: LiftrResourceCategories; + readonly principalId?: string; /** - * The priority of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly liftrResourcePreference?: number; -} - -/** - * An interface representing IdentityProperties. - */ -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.** + * The tenant ID of resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly tenantId?: string; - /** - * Possible values include: 'SystemAssigned', 'UserAssigned' - */ + /** Identity type */ type?: ManagedIdentityTypes; } -/** - * An interface representing DatadogMonitorResource. - */ -export interface DatadogMonitorResource extends BaseResource { - /** - * 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?: MonitorProperties; - identity?: IdentityProperties; +/** 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 }; - location: string; - /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly systemData?: SystemData; + sku?: ResourceSku; } -/** - * The set of properties that can be update in a PATCH request to a monitor resource. - */ +/** The set of properties that can be update in a PATCH request to a monitor resource. */ export interface MonitorUpdateProperties { - /** - * Possible values include: 'Enabled', 'Disabled'. Default value: 'Enabled'. - */ + /** Flag specifying if the resource monitoring is enabled or disabled. */ monitoringStatus?: MonitoringStatus; } -/** - * The parameters for a PATCH request to a monitor resource. - */ -export interface DatadogMonitorResourceUpdateParameters { - properties?: MonitorUpdateProperties; - /** - * The new tags of the monitor resource. - */ - tags?: { [propertyName: string]: string }; - sku?: ResourceSku; -} - -/** - * An interface representing DatadogSetPasswordLink. - */ export interface DatadogSetPasswordLink { setPasswordLink?: string; } -/** - * The definition of a filtering tag. Filtering tags are used for capturing resources and - * include/exclude them from being monitored. - */ -export interface FilteringTag { - /** - * The name (also known as the key) of the tag. - */ - name?: string; - /** - * The value of the tag. - */ - value?: string; - /** - * Possible values include: 'Include', 'Exclude' - */ - action?: TagAction; -} - -/** - * 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[]; -} - -/** - * 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[]; -} - -/** - * Definition of the properties for a TagRules resource. - */ -export interface MonitoringTagRulesProperties { - /** - * Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', - * 'Failed', 'Canceled', 'Deleted', 'NotSpecified' - */ - provisioningState?: ProvisioningState; - logRules?: LogRules; - metricRules?: MetricRules; +/** 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 extends BaseResource { +/** 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.** + * 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.** + * 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.** + * 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; /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * 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; } -/** - * An interface representing DatadogSingleSignOnProperties. - */ -export interface DatadogSingleSignOnProperties { - /** - * Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', - * 'Failed', 'Canceled', 'Deleted', 'NotSpecified' - */ - provisioningState?: ProvisioningState; - /** - * Possible values include: 'Initial', 'Enable', 'Disable', 'Existing' - */ - 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; +/** 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; } -/** - * An interface representing DatadogSingleSignOnResource. - */ -export interface DatadogSingleSignOnResource extends BaseResource { +/** 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.** + * 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.** + * 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.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; properties?: DatadogSingleSignOnProperties; /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * 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; } -/** - * 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; +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 additional info. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The login URL specific to this Datadog Organization. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly info?: any; + readonly singleSignOnUrl?: string; } -/** - * The error detail. - */ -export interface ErrorDetail { - /** - * The error code. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly code?: string; - /** - * The error message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * The error target. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly target?: string; - /** - * The error details. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly details?: ErrorDetail[]; - /** - * The error additional info. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" } /** - * Common error response for all Azure Resource Manager APIs to return error details for failed - * operations. (This also follows the OData error response format.). - * @summary Error response + * 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 interface ErrorResponse { - /** - * The error object. - */ - error?: ErrorDetail; -} +export type CreatedByType = string; -/** - * Optional Parameters. - */ -export interface MarketplaceAgreementsCreateOrUpdateOptionalParams - extends msRest.RequestOptionsBase { - body?: DatadogAgreementResource; +/** 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" } /** - * Optional Parameters. + * 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 interface MonitorsSetDefaultKeyOptionalParams extends msRest.RequestOptionsBase { - body?: DatadogApiKey; -} +export type ProvisioningState = string; -/** - * Optional Parameters. - */ -export interface MonitorsCreateOptionalParams extends msRest.RequestOptionsBase { - body?: DatadogMonitorResource; +/** Known values of {@link MonitoringStatus} that the service accepts. */ +export enum KnownMonitoringStatus { + Enabled = "Enabled", + Disabled = "Disabled" } /** - * Optional Parameters. + * 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 interface MonitorsUpdateOptionalParams extends msRest.RequestOptionsBase { - body?: DatadogMonitorResourceUpdateParameters; -} +export type MonitoringStatus = string; -/** - * Optional Parameters. - */ -export interface MonitorsBeginCreateOptionalParams extends msRest.RequestOptionsBase { - body?: DatadogMonitorResource; +/** Known values of {@link MarketplaceSubscriptionStatus} that the service accepts. */ +export enum KnownMarketplaceSubscriptionStatus { + Provisioning = "Provisioning", + Active = "Active", + Suspended = "Suspended", + Unsubscribed = "Unsubscribed" } /** - * Optional Parameters. + * 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 interface MonitorsBeginUpdateOptionalParams extends msRest.RequestOptionsBase { - body?: DatadogMonitorResourceUpdateParameters; -} +export type MarketplaceSubscriptionStatus = string; -/** - * Optional Parameters. - */ -export interface TagRulesCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - body?: MonitoringTagRules; +/** Known values of {@link LiftrResourceCategories} that the service accepts. */ +export enum KnownLiftrResourceCategories { + Unknown = "Unknown", + MonitorLogs = "MonitorLogs" } /** - * Optional Parameters. + * 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 interface SingleSignOnConfigurationsCreateOrUpdateOptionalParams - extends msRest.RequestOptionsBase { - body?: DatadogSingleSignOnResource; -} +export type LiftrResourceCategories = string; -/** - * Optional Parameters. - */ -export interface SingleSignOnConfigurationsBeginCreateOrUpdateOptionalParams - extends msRest.RequestOptionsBase { - body?: DatadogSingleSignOnResource; +/** Known values of {@link ManagedIdentityTypes} that the service accepts. */ +export enum KnownManagedIdentityTypes { + SystemAssigned = "SystemAssigned", + UserAssigned = "UserAssigned" } /** - * An interface representing MicrosoftDatadogClientOptions. + * 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 interface MicrosoftDatadogClientOptions extends AzureServiceClientOptions { - baseUri?: string; -} +export type ManagedIdentityTypes = string; -/** - * @interface - * Response of a list operation. - * @extends Array - */ -export interface DatadogAgreementResourceListResponse extends Array { - /** - * Link to the next set of results, if any. - */ - nextLink?: string; +/** Known values of {@link TagAction} that the service accepts. */ +export enum KnownTagAction { + Include = "Include", + Exclude = "Exclude" } /** - * @interface - * Response of a list operation. - * @extends Array + * 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 interface DatadogApiKeyListResponse extends Array { - /** - * Link to the next set of results, if any. - */ - nextLink?: string; -} +export type TagAction = string; -/** - * @interface - * Response of a list operation. - * @extends Array - */ -export interface DatadogHostListResponse extends Array { - /** - * Link to the next set of results, if any. - */ - nextLink?: string; +/** Known values of {@link SingleSignOnStates} that the service accepts. */ +export enum KnownSingleSignOnStates { + Initial = "Initial", + Enable = "Enable", + Disable = "Disable", + Existing = "Existing" } /** - * @interface - * Response of a list operation. - * @extends Array + * 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 interface LinkedResourceListResponse extends Array { - /** - * Link to the next set of results, if any. - */ - nextLink?: string; -} +export type SingleSignOnStates = string; -/** - * @interface - * Response of a list operation. - * @extends Array - */ -export interface MonitoredResourceListResponse extends Array { - /** - * Link to the next set of results, if any. - */ - nextLink?: string; -} +/** Optional parameters. */ +export interface MarketplaceAgreementsListOptionalParams + extends coreClient.OperationOptions {} -/** - * @interface - * Response of a list operation. - * @extends Array - */ -export interface DatadogMonitorResourceListResponse extends Array { - /** - * Link to the next set of results, if any. - */ - nextLink?: string; -} +/** Contains response data for the list operation. */ +export type MarketplaceAgreementsListResponse = DatadogAgreementResourceListResponse; -/** - * @interface - * Result of GET request to list the Microsoft.Datadog operations. - * @extends Array - */ -export interface OperationListResult extends Array { - /** - * URL to get the next set of operation list results if there are any. - */ - nextLink?: string; +/** Optional parameters. */ +export interface MarketplaceAgreementsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + body?: DatadogAgreementResource; } -/** - * @interface - * Response of a list operation. - * @extends Array - */ -export interface MonitoringTagRulesListResponse extends Array { - /** - * Link to the next set of results, if any. - */ - nextLink?: string; -} +/** Contains response data for the createOrUpdate operation. */ +export type MarketplaceAgreementsCreateOrUpdateResponse = DatadogAgreementResource; -/** - * @interface - * Response of a list operation. - * @extends Array - */ -export interface DatadogSingleSignOnResourceListResponse - extends Array { - /** - * Link to the next set of results, if any. - */ - nextLink?: string; +/** Optional parameters. */ +export interface MarketplaceAgreementsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type MarketplaceAgreementsListNextResponse = DatadogAgreementResourceListResponse; + +/** 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; } -/** - * Defines values for CreatedByType. - * Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - * @readonly - * @enum {string} - */ -export type CreatedByType = "User" | "Application" | "ManagedIdentity" | "Key"; +/** Optional parameters. */ +export interface MonitorsListHostsOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for ProvisioningState. - * Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', - * 'Canceled', 'Deleted', 'NotSpecified' - * @readonly - * @enum {string} - */ -export type ProvisioningState = - | "Accepted" - | "Creating" - | "Updating" - | "Deleting" - | "Succeeded" - | "Failed" - | "Canceled" - | "Deleted" - | "NotSpecified"; +/** Contains response data for the listHosts operation. */ +export type MonitorsListHostsResponse = DatadogHostListResponse; -/** - * Defines values for MonitoringStatus. - * Possible values include: 'Enabled', 'Disabled' - * @readonly - * @enum {string} - */ -export type MonitoringStatus = "Enabled" | "Disabled"; +/** Optional parameters. */ +export interface MonitorsListLinkedResourcesOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for MarketplaceSubscriptionStatus. - * Possible values include: 'Provisioning', 'Active', 'Suspended', 'Unsubscribed' - * @readonly - * @enum {string} - */ -export type MarketplaceSubscriptionStatus = - | "Provisioning" - | "Active" - | "Suspended" - | "Unsubscribed"; +/** Contains response data for the listLinkedResources operation. */ +export type MonitorsListLinkedResourcesResponse = LinkedResourceListResponse; -/** - * Defines values for LiftrResourceCategories. - * Possible values include: 'Unknown', 'MonitorLogs' - * @readonly - * @enum {string} - */ -export type LiftrResourceCategories = "Unknown" | "MonitorLogs"; +/** Optional parameters. */ +export interface MonitorsListMonitoredResourcesOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for ManagedIdentityTypes. - * Possible values include: 'SystemAssigned', 'UserAssigned' - * @readonly - * @enum {string} - */ -export type ManagedIdentityTypes = "SystemAssigned" | "UserAssigned"; +/** Contains response data for the listMonitoredResources operation. */ +export type MonitorsListMonitoredResourcesResponse = MonitoredResourceListResponse; -/** - * Defines values for TagAction. - * Possible values include: 'Include', 'Exclude' - * @readonly - * @enum {string} - */ -export type TagAction = "Include" | "Exclude"; +/** Optional parameters. */ +export interface MonitorsListOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for SingleSignOnStates. - * Possible values include: 'Initial', 'Enable', 'Disable', 'Existing' - * @readonly - * @enum {string} - */ -export type SingleSignOnStates = "Initial" | "Enable" | "Disable" | "Existing"; +/** Contains response data for the list operation. */ +export type MonitorsListResponse = DatadogMonitorResourceListResponse; -/** - * Contains response data for the list operation. - */ -export type MarketplaceAgreementsListResponse = DatadogAgreementResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogAgreementResourceListResponse; - }; -}; +/** Optional parameters. */ +export interface MonitorsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the createOrUpdate operation. - */ -export type MarketplaceAgreementsCreateOrUpdateResponse = DatadogAgreementResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogAgreementResource; - }; -}; +/** Contains response data for the listByResourceGroup operation. */ +export type MonitorsListByResourceGroupResponse = DatadogMonitorResourceListResponse; -/** - * Contains response data for the listNext operation. - */ -export type MarketplaceAgreementsListNextResponse = DatadogAgreementResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogAgreementResourceListResponse; - }; -}; +/** Optional parameters. */ +export interface MonitorsGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listApiKeys operation. - */ -export type MonitorsListApiKeysResponse = DatadogApiKeyListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogApiKeyListResponse; - }; -}; +/** Contains response data for the get operation. */ +export type MonitorsGetResponse = DatadogMonitorResource; -/** - * Contains response data for the getDefaultKey operation. - */ -export type MonitorsGetDefaultKeyResponse = DatadogApiKey & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogApiKey; - }; -}; +/** 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 listHosts operation. - */ -export type MonitorsListHostsResponse = DatadogHostListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogHostListResponse; - }; -}; +/** Contains response data for the create operation. */ +export type MonitorsCreateResponse = DatadogMonitorResource; -/** - * Contains response data for the listLinkedResources operation. - */ -export type MonitorsListLinkedResourcesResponse = LinkedResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: LinkedResourceListResponse; - }; -}; +/** 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 listMonitoredResources operation. - */ -export type MonitorsListMonitoredResourcesResponse = MonitoredResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MonitoredResourceListResponse; - }; -}; +/** Contains response data for the update operation. */ +export type MonitorsUpdateResponse = DatadogMonitorResource; -/** - * Contains response data for the list operation. - */ -export type MonitorsListResponse = DatadogMonitorResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResourceListResponse; - }; -}; +/** Optional parameters. */ +export interface MonitorsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} -/** - * Contains response data for the listByResourceGroup operation. - */ -export type MonitorsListByResourceGroupResponse = DatadogMonitorResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResourceListResponse; - }; -}; +/** Optional parameters. */ +export interface MonitorsRefreshSetPasswordLinkOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the get operation. - */ -export type MonitorsGetResponse = DatadogMonitorResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResource; - }; -}; +/** Contains response data for the refreshSetPasswordLink operation. */ +export type MonitorsRefreshSetPasswordLinkResponse = DatadogSetPasswordLink; -/** - * Contains response data for the create operation. - */ -export type MonitorsCreateResponse = DatadogMonitorResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResource; - }; -}; +/** Optional parameters. */ +export interface MonitorsListApiKeysNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the update operation. - */ -export type MonitorsUpdateResponse = DatadogMonitorResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResource; - }; -}; +/** Contains response data for the listApiKeysNext operation. */ +export type MonitorsListApiKeysNextResponse = DatadogApiKeyListResponse; -/** - * Contains response data for the refreshSetPasswordLink operation. - */ -export type MonitorsRefreshSetPasswordLinkResponse = DatadogSetPasswordLink & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogSetPasswordLink; - }; -}; +/** Optional parameters. */ +export interface MonitorsListHostsNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the beginCreate operation. - */ -export type MonitorsBeginCreateResponse = DatadogMonitorResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResource; - }; -}; +/** Contains response data for the listHostsNext operation. */ +export type MonitorsListHostsNextResponse = DatadogHostListResponse; -/** - * Contains response data for the beginUpdate operation. - */ -export type MonitorsBeginUpdateResponse = DatadogMonitorResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResource; - }; -}; +/** Optional parameters. */ +export interface MonitorsListLinkedResourcesNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listApiKeysNext operation. - */ -export type MonitorsListApiKeysNextResponse = DatadogApiKeyListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogApiKeyListResponse; - }; -}; +/** Contains response data for the listLinkedResourcesNext operation. */ +export type MonitorsListLinkedResourcesNextResponse = LinkedResourceListResponse; -/** - * Contains response data for the listHostsNext operation. - */ -export type MonitorsListHostsNextResponse = DatadogHostListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogHostListResponse; - }; -}; +/** Optional parameters. */ +export interface MonitorsListMonitoredResourcesNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listLinkedResourcesNext operation. - */ -export type MonitorsListLinkedResourcesNextResponse = LinkedResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: LinkedResourceListResponse; - }; -}; +/** Contains response data for the listMonitoredResourcesNext operation. */ +export type MonitorsListMonitoredResourcesNextResponse = MonitoredResourceListResponse; -/** - * Contains response data for the listMonitoredResourcesNext operation. - */ -export type MonitorsListMonitoredResourcesNextResponse = MonitoredResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MonitoredResourceListResponse; - }; -}; +/** Optional parameters. */ +export interface MonitorsListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listNext operation. - */ -export type MonitorsListNextResponse = DatadogMonitorResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResourceListResponse; - }; -}; +/** Contains response data for the listNext operation. */ +export type MonitorsListNextResponse = DatadogMonitorResourceListResponse; -/** - * Contains response data for the listByResourceGroupNext operation. - */ -export type MonitorsListByResourceGroupNextResponse = DatadogMonitorResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogMonitorResourceListResponse; - }; -}; +/** Optional parameters. */ +export interface MonitorsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the list operation. - */ -export type OperationsListResponse = OperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Contains response data for the listByResourceGroupNext operation. */ +export type MonitorsListByResourceGroupNextResponse = DatadogMonitorResourceListResponse; -/** - * Contains response data for the listNext operation. - */ -export type OperationsListNextResponse = OperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the list operation. - */ -export type TagRulesListResponse = MonitoringTagRulesListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MonitoringTagRulesListResponse; - }; -}; +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; -/** - * Contains response data for the createOrUpdate operation. - */ -export type TagRulesCreateOrUpdateResponse = MonitoringTagRules & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MonitoringTagRules; - }; -}; +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the get operation. - */ -export type TagRulesGetResponse = MonitoringTagRules & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MonitoringTagRules; - }; -}; +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; -/** - * Contains response data for the listNext operation. - */ -export type TagRulesListNextResponse = MonitoringTagRulesListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MonitoringTagRulesListResponse; - }; -}; +/** Optional parameters. */ +export interface TagRulesListOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the list operation. - */ -export type SingleSignOnConfigurationsListResponse = DatadogSingleSignOnResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogSingleSignOnResourceListResponse; - }; -}; +/** Contains response data for the list operation. */ +export type TagRulesListResponse = MonitoringTagRulesListResponse; -/** - * Contains response data for the createOrUpdate operation. - */ -export type SingleSignOnConfigurationsCreateOrUpdateResponse = DatadogSingleSignOnResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogSingleSignOnResource; - }; -}; +/** 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 get operation. - */ -export type SingleSignOnConfigurationsGetResponse = DatadogSingleSignOnResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogSingleSignOnResource; - }; -}; +/** Contains response data for the createOrUpdate operation. */ +export type TagRulesCreateOrUpdateResponse = MonitoringTagRules; -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type SingleSignOnConfigurationsBeginCreateOrUpdateResponse = DatadogSingleSignOnResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogSingleSignOnResource; - }; -}; +/** Optional parameters. */ +export interface TagRulesGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listNext operation. - */ -export type SingleSignOnConfigurationsListNextResponse = DatadogSingleSignOnResourceListResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DatadogSingleSignOnResourceListResponse; - }; -}; +/** 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 MicrosoftDatadogClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/datadog/arm-datadog/src/models/mappers.ts b/sdk/datadog/arm-datadog/src/models/mappers.ts index ad8fdb00272e..46b9c4dae1f7 100644 --- a/sdk/datadog/arm-datadog/src/models/mappers.ts +++ b/sdk/datadog/arm-datadog/src/models/mappers.ts @@ -6,14 +6,80 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; +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: msRest.CompositeMapper = { - serializedName: "DatadogAgreementProperties", +export const DatadogAgreementProperties: coreClient.CompositeMapper = { type: { name: "Composite", className: "DatadogAgreementProperties", @@ -70,8 +136,7 @@ export const DatadogAgreementProperties: msRest.CompositeMapper = { } }; -export const SystemData: msRest.CompositeMapper = { - serializedName: "systemData", +export const SystemData: coreClient.CompositeMapper = { type: { name: "Composite", className: "SystemData", @@ -116,79 +181,121 @@ export const SystemData: msRest.CompositeMapper = { } }; -export const DatadogAgreementResource: msRest.CompositeMapper = { - serializedName: "DatadogAgreementResource", +export const ErrorResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogAgreementResource", + className: "ErrorResponse", modelProperties: { - id: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", readOnly: true, - serializedName: "id", type: { name: "String" } }, - name: { + message: { + serializedName: "message", readOnly: true, - serializedName: "name", type: { name: "String" } }, - type: { + target: { + serializedName: "target", readOnly: true, - serializedName: "type", type: { name: "String" } }, - properties: { - serializedName: "properties", + details: { + serializedName: "details", + readOnly: true, type: { - name: "Composite", - className: "DatadogAgreementProperties" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } } }, - systemData: { + additionalInfo: { + serializedName: "additionalInfo", readOnly: true, - serializedName: "systemData", type: { - name: "Composite", - className: "SystemData" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } } } } } }; -export const DatadogApiKey: msRest.CompositeMapper = { - serializedName: "DatadogApiKey", +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogApiKey", + className: "ErrorAdditionalInfo", modelProperties: { - createdBy: { - serializedName: "createdBy", + type: { + serializedName: "type", + readOnly: true, type: { name: "String" } }, - name: { - serializedName: "name", + info: { + serializedName: "info", + readOnly: true, type: { - name: "String" + name: "Dictionary", + value: { type: { name: "any" } } } - }, - key: { - required: true, - serializedName: "key", + } + } + } +}; + +export const DatadogApiKeyListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatadogApiKeyListResponse", + modelProperties: { + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DatadogApiKey" + } + } } }, - created: { - serializedName: "created", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -197,42 +304,32 @@ export const DatadogApiKey: msRest.CompositeMapper = { } }; -export const DatadogInstallMethod: msRest.CompositeMapper = { - serializedName: "DatadogInstallMethod", +export const DatadogApiKey: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogInstallMethod", + className: "DatadogApiKey", modelProperties: { - tool: { - serializedName: "tool", + createdBy: { + serializedName: "createdBy", type: { name: "String" } }, - toolVersion: { - serializedName: "toolVersion", + name: { + serializedName: "name", type: { name: "String" } }, - installerVersion: { - serializedName: "installerVersion", + key: { + serializedName: "key", + required: true, type: { name: "String" } - } - } - } -}; - -export const DatadogLogsAgent: msRest.CompositeMapper = { - serializedName: "DatadogLogsAgent", - type: { - name: "Composite", - className: "DatadogLogsAgent", - modelProperties: { - transport: { - serializedName: "transport", + }, + created: { + serializedName: "created", type: { name: "String" } @@ -241,38 +338,34 @@ export const DatadogLogsAgent: msRest.CompositeMapper = { } }; -export const DatadogHostMetadata: msRest.CompositeMapper = { - serializedName: "DatadogHostMetadata", +export const DatadogHostListResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogHostMetadata", + className: "DatadogHostListResponse", modelProperties: { - agentVersion: { - serializedName: "agentVersion", - type: { - name: "String" - } - }, - installMethod: { - serializedName: "installMethod", + value: { + serializedName: "value", type: { - name: "Composite", - className: "DatadogInstallMethod" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DatadogHost" + } + } } }, - logsAgent: { - serializedName: "logsAgent", + nextLink: { + serializedName: "nextLink", type: { - name: "Composite", - className: "DatadogLogsAgent" + name: "String" } } } } }; -export const DatadogHost: msRest.CompositeMapper = { - serializedName: "DatadogHost", +export const DatadogHost: coreClient.CompositeMapper = { type: { name: "Composite", className: "DatadogHost", @@ -316,54 +409,54 @@ export const DatadogHost: msRest.CompositeMapper = { } }; -export const LinkedResource: msRest.CompositeMapper = { - serializedName: "LinkedResource", +export const DatadogHostMetadata: coreClient.CompositeMapper = { type: { name: "Composite", - className: "LinkedResource", + className: "DatadogHostMetadata", modelProperties: { - id: { - serializedName: "id", + agentVersion: { + serializedName: "agentVersion", type: { name: "String" } + }, + installMethod: { + serializedName: "installMethod", + type: { + name: "Composite", + className: "DatadogInstallMethod" + } + }, + logsAgent: { + serializedName: "logsAgent", + type: { + name: "Composite", + className: "DatadogLogsAgent" + } } } } }; -export const MonitoredResource: msRest.CompositeMapper = { - serializedName: "MonitoredResource", +export const DatadogInstallMethod: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MonitoredResource", + className: "DatadogInstallMethod", modelProperties: { - id: { - serializedName: "id", + tool: { + serializedName: "tool", type: { name: "String" } }, - sendingMetrics: { - serializedName: "sendingMetrics", + toolVersion: { + serializedName: "toolVersion", type: { - name: "Boolean" + name: "String" } }, - reasonForMetricsStatus: { - serializedName: "reasonForMetricsStatus", - type: { - name: "String" - } - }, - sendingLogs: { - serializedName: "sendingLogs", - type: { - name: "Boolean" - } - }, - reasonForLogsStatus: { - serializedName: "reasonForLogsStatus", + installerVersion: { + serializedName: "installerVersion", type: { name: "String" } @@ -372,32 +465,40 @@ export const MonitoredResource: msRest.CompositeMapper = { } }; -export const OperationDisplay: msRest.CompositeMapper = { - serializedName: "OperationDisplay", +export const DatadogLogsAgent: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationDisplay", + className: "DatadogLogsAgent", modelProperties: { - provider: { - serializedName: "provider", - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", + transport: { + serializedName: "transport", type: { name: "String" } - }, - operation: { - serializedName: "operation", + } + } + } +}; + +export const LinkedResourceListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LinkedResourceListResponse", + modelProperties: { + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LinkedResource" + } + } } }, - description: { - serializedName: "description", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -406,44 +507,40 @@ export const OperationDisplay: msRest.CompositeMapper = { } }; -export const OperationResult: msRest.CompositeMapper = { - serializedName: "OperationResult", +export const LinkedResource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationResult", + className: "LinkedResource", modelProperties: { - name: { - serializedName: "name", + id: { + serializedName: "id", type: { name: "String" } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - isDataAction: { - serializedName: "isDataAction", - type: { - name: "Boolean" - } } } } }; -export const ResourceSku: msRest.CompositeMapper = { - serializedName: "ResourceSku", +export const MonitoredResourceListResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ResourceSku", + className: "MonitoredResourceListResponse", modelProperties: { - name: { - required: true, - serializedName: "name", + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MonitoredResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -452,58 +549,64 @@ export const ResourceSku: msRest.CompositeMapper = { } }; -export const DatadogOrganizationProperties: msRest.CompositeMapper = { - serializedName: "DatadogOrganizationProperties", +export const MonitoredResource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogOrganizationProperties", + className: "MonitoredResource", modelProperties: { - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, id: { - readOnly: true, serializedName: "id", type: { name: "String" } }, - linkingAuthCode: { - serializedName: "linkingAuthCode", + sendingMetrics: { + serializedName: "sendingMetrics", type: { - name: "String" + name: "Boolean" } }, - linkingClientId: { - serializedName: "linkingClientId", + reasonForMetricsStatus: { + serializedName: "reasonForMetricsStatus", type: { name: "String" } }, - redirectUri: { - serializedName: "redirectUri", + sendingLogs: { + serializedName: "sendingLogs", type: { - name: "String" + name: "Boolean" } }, - apiKey: { - serializedName: "apiKey", + reasonForLogsStatus: { + serializedName: "reasonForLogsStatus", type: { name: "String" } - }, - applicationKey: { - serializedName: "applicationKey", + } + } + } +}; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResult" + } + } } }, - enterpriseAppId: { - serializedName: "enterpriseAppId", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -512,121 +615,86 @@ export const DatadogOrganizationProperties: msRest.CompositeMapper = { } }; -export const UserInfo: msRest.CompositeMapper = { - serializedName: "UserInfo", +export const OperationResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "UserInfo", + className: "OperationResult", modelProperties: { name: { serializedName: "name", - constraints: { - MaxLength: 50 - }, type: { name: "String" } }, - emailAddress: { - serializedName: "emailAddress", - constraints: { - Pattern: /^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$/ - }, + display: { + serializedName: "display", type: { - name: "String" + name: "Composite", + className: "OperationDisplay" } }, - phoneNumber: { - serializedName: "phoneNumber", - constraints: { - MaxLength: 40 - }, + isDataAction: { + serializedName: "isDataAction", type: { - name: "String" + name: "Boolean" } } } } }; -export const MonitorProperties: msRest.CompositeMapper = { - serializedName: "MonitorProperties", +export const OperationDisplay: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MonitorProperties", + className: "OperationDisplay", modelProperties: { - provisioningState: { - serializedName: "provisioningState", + provider: { + serializedName: "provider", type: { name: "String" } }, - monitoringStatus: { - serializedName: "monitoringStatus", - defaultValue: "Enabled", + resource: { + serializedName: "resource", type: { name: "String" } }, - marketplaceSubscriptionStatus: { - serializedName: "marketplaceSubscriptionStatus", + operation: { + serializedName: "operation", type: { name: "String" } }, - datadogOrganizationProperties: { - serializedName: "datadogOrganizationProperties", - type: { - name: "Composite", - className: "DatadogOrganizationProperties" - } - }, - userInfo: { - serializedName: "userInfo", - type: { - name: "Composite", - className: "UserInfo" - } - }, - liftrResourceCategory: { - serializedName: "liftrResourceCategory", + description: { + serializedName: "description", type: { name: "String" } - }, - liftrResourcePreference: { - readOnly: true, - serializedName: "liftrResourcePreference", - type: { - name: "Number" - } } } } }; -export const IdentityProperties: msRest.CompositeMapper = { - serializedName: "IdentityProperties", +export const DatadogMonitorResourceListResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "IdentityProperties", + className: "DatadogMonitorResourceListResponse", modelProperties: { - principalId: { - readOnly: true, - serializedName: "principalId", - type: { - name: "String" - } - }, - tenantId: { - readOnly: true, - serializedName: "tenantId", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DatadogMonitorResource" + } + } } }, - type: { - serializedName: "type", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -635,29 +703,28 @@ export const IdentityProperties: msRest.CompositeMapper = { } }; -export const DatadogMonitorResource: msRest.CompositeMapper = { - serializedName: "DatadogMonitorResource", +export const DatadogMonitorResource: coreClient.CompositeMapper = { type: { name: "Composite", className: "DatadogMonitorResource", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, type: { - readOnly: true, serializedName: "type", + readOnly: true, type: { name: "String" } @@ -687,22 +754,17 @@ export const DatadogMonitorResource: msRest.CompositeMapper = { serializedName: "tags", type: { name: "Dictionary", - value: { - type: { - name: "String" - } - } + value: { type: { name: "String" } } } }, location: { - required: true, serializedName: "location", + required: true, type: { name: "String" } }, systemData: { - readOnly: true, serializedName: "systemData", type: { name: "Composite", @@ -713,15 +775,14 @@ export const DatadogMonitorResource: msRest.CompositeMapper = { } }; -export const MonitorUpdateProperties: msRest.CompositeMapper = { - serializedName: "MonitorUpdateProperties", +export const ResourceSku: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MonitorUpdateProperties", + className: "ResourceSku", modelProperties: { - monitoringStatus: { - serializedName: "monitoringStatus", - defaultValue: "Enabled", + name: { + serializedName: "name", + required: true, type: { name: "String" } @@ -730,250 +791,270 @@ export const MonitorUpdateProperties: msRest.CompositeMapper = { } }; -export const DatadogMonitorResourceUpdateParameters: msRest.CompositeMapper = { - serializedName: "DatadogMonitorResourceUpdateParameters", +export const MonitorProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogMonitorResourceUpdateParameters", + className: "MonitorProperties", modelProperties: { - properties: { - serializedName: "properties", + provisioningState: { + serializedName: "provisioningState", + readOnly: true, type: { - name: "Composite", - className: "MonitorUpdateProperties" + name: "String" } }, - tags: { - serializedName: "tags", + monitoringStatus: { + defaultValue: "Enabled", + serializedName: "monitoringStatus", type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } + name: "String" } }, - sku: { - serializedName: "sku", + marketplaceSubscriptionStatus: { + serializedName: "marketplaceSubscriptionStatus", + readOnly: true, + type: { + name: "String" + } + }, + datadogOrganizationProperties: { + serializedName: "datadogOrganizationProperties", type: { name: "Composite", - className: "ResourceSku" + className: "DatadogOrganizationProperties" } - } - } - } -}; - -export const DatadogSetPasswordLink: msRest.CompositeMapper = { - serializedName: "DatadogSetPasswordLink", - type: { - name: "Composite", - className: "DatadogSetPasswordLink", - modelProperties: { - setPasswordLink: { - serializedName: "setPasswordLink", + }, + 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 FilteringTag: msRest.CompositeMapper = { - serializedName: "FilteringTag", +export const DatadogOrganizationProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "FilteringTag", + className: "DatadogOrganizationProperties", modelProperties: { name: { serializedName: "name", + readOnly: true, type: { name: "String" } }, - value: { - serializedName: "value", + id: { + serializedName: "id", + readOnly: true, type: { name: "String" } }, - action: { - serializedName: "action", + linkingAuthCode: { + serializedName: "linkingAuthCode", type: { name: "String" } - } - } - } -}; - -export const LogRules: msRest.CompositeMapper = { - serializedName: "LogRules", - type: { - name: "Composite", - className: "LogRules", - modelProperties: { - sendAadLogs: { - serializedName: "sendAadLogs", + }, + linkingClientId: { + serializedName: "linkingClientId", type: { - name: "Boolean" + name: "String" } }, - sendSubscriptionLogs: { - serializedName: "sendSubscriptionLogs", + redirectUri: { + serializedName: "redirectUri", type: { - name: "Boolean" + name: "String" } }, - sendResourceLogs: { - serializedName: "sendResourceLogs", + apiKey: { + serializedName: "apiKey", type: { - name: "Boolean" + name: "String" } }, - filteringTags: { - serializedName: "filteringTags", + applicationKey: { + serializedName: "applicationKey", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FilteringTag" - } - } + name: "String" } - } - } - } -}; - -export const MetricRules: msRest.CompositeMapper = { - serializedName: "MetricRules", - type: { - name: "Composite", - className: "MetricRules", - modelProperties: { - filteringTags: { - serializedName: "filteringTags", + }, + enterpriseAppId: { + serializedName: "enterpriseAppId", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FilteringTag" - } - } + name: "String" } } } } }; -export const MonitoringTagRulesProperties: msRest.CompositeMapper = { - serializedName: "MonitoringTagRulesProperties", +export const UserInfo: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MonitoringTagRulesProperties", + className: "UserInfo", modelProperties: { - provisioningState: { - serializedName: "provisioningState", + name: { + constraints: { + MaxLength: 50 + }, + serializedName: "name", type: { name: "String" } }, - logRules: { - serializedName: "logRules", + emailAddress: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$" + ) + }, + serializedName: "emailAddress", type: { - name: "Composite", - className: "LogRules" + name: "String" } }, - metricRules: { - serializedName: "metricRules", + phoneNumber: { + constraints: { + MaxLength: 40 + }, + serializedName: "phoneNumber", type: { - name: "Composite", - className: "MetricRules" + name: "String" } } } } }; -export const MonitoringTagRules: msRest.CompositeMapper = { - serializedName: "MonitoringTagRules", +export const IdentityProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MonitoringTagRules", + className: "IdentityProperties", modelProperties: { - name: { + principalId: { + serializedName: "principalId", readOnly: true, - serializedName: "name", type: { name: "String" } }, - id: { + tenantId: { + serializedName: "tenantId", readOnly: true, - serializedName: "id", type: { name: "String" } }, type: { - readOnly: true, serializedName: "type", type: { name: "String" } - }, + } + } + } +}; + +export const DatadogMonitorResourceUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatadogMonitorResourceUpdateParameters", + modelProperties: { properties: { serializedName: "properties", type: { name: "Composite", - className: "MonitoringTagRulesProperties" + className: "MonitorUpdateProperties" } }, - systemData: { - readOnly: true, - serializedName: "systemData", + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + sku: { + serializedName: "sku", type: { name: "Composite", - className: "SystemData" + className: "ResourceSku" } } } } }; -export const DatadogSingleSignOnProperties: msRest.CompositeMapper = { - serializedName: "DatadogSingleSignOnProperties", +export const MonitorUpdateProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogSingleSignOnProperties", + className: "MonitorUpdateProperties", modelProperties: { - provisioningState: { - serializedName: "provisioningState", + monitoringStatus: { + defaultValue: "Enabled", + serializedName: "monitoringStatus", type: { name: "String" } - }, - singleSignOnState: { - serializedName: "singleSignOnState", + } + } + } +}; + +export const DatadogSetPasswordLink: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatadogSetPasswordLink", + modelProperties: { + setPasswordLink: { + serializedName: "setPasswordLink", type: { name: "String" } - }, - enterpriseAppId: { - serializedName: "enterpriseAppId", + } + } + } +}; + +export const MonitoringTagRulesListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoringTagRulesListResponse", + modelProperties: { + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MonitoringTagRules" + } + } } }, - singleSignOnUrl: { - readOnly: true, - serializedName: "singleSignOnUrl", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -982,29 +1063,28 @@ export const DatadogSingleSignOnProperties: msRest.CompositeMapper = { } }; -export const DatadogSingleSignOnResource: msRest.CompositeMapper = { - serializedName: "DatadogSingleSignOnResource", +export const MonitoringTagRules: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogSingleSignOnResource", + className: "MonitoringTagRules", modelProperties: { - id: { + name: { + serializedName: "name", readOnly: true, - serializedName: "id", type: { name: "String" } }, - name: { + id: { + serializedName: "id", readOnly: true, - serializedName: "name", type: { name: "String" } }, type: { - readOnly: true, serializedName: "type", + readOnly: true, type: { name: "String" } @@ -1013,11 +1093,10 @@ export const DatadogSingleSignOnResource: msRest.CompositeMapper = { serializedName: "properties", type: { name: "Composite", - className: "DatadogSingleSignOnProperties" + className: "MonitoringTagRulesProperties" } }, systemData: { - readOnly: true, serializedName: "systemData", type: { name: "Composite", @@ -1028,79 +1107,67 @@ export const DatadogSingleSignOnResource: msRest.CompositeMapper = { } }; -export const ErrorAdditionalInfo: msRest.CompositeMapper = { - serializedName: "ErrorAdditionalInfo", +export const MonitoringTagRulesProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ErrorAdditionalInfo", + className: "MonitoringTagRulesProperties", modelProperties: { - type: { + provisioningState: { + serializedName: "provisioningState", readOnly: true, - serializedName: "type", type: { name: "String" } }, - info: { - readOnly: true, - serializedName: "info", + logRules: { + serializedName: "logRules", + type: { + name: "Composite", + className: "LogRules" + } + }, + metricRules: { + serializedName: "metricRules", type: { - name: "Object" + name: "Composite", + className: "MetricRules" } } } } }; -export const ErrorDetail: msRest.CompositeMapper = { - serializedName: "ErrorDetail", +export const LogRules: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ErrorDetail", + className: "LogRules", modelProperties: { - code: { - readOnly: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - readOnly: true, - serializedName: "message", + sendAadLogs: { + serializedName: "sendAadLogs", type: { - name: "String" + name: "Boolean" } }, - target: { - readOnly: true, - serializedName: "target", + sendSubscriptionLogs: { + serializedName: "sendSubscriptionLogs", type: { - name: "String" + name: "Boolean" } }, - details: { - readOnly: true, - serializedName: "details", + sendResourceLogs: { + serializedName: "sendResourceLogs", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetail" - } - } + name: "Boolean" } }, - additionalInfo: { - readOnly: true, - serializedName: "additionalInfo", + filteringTags: { + serializedName: "filteringTags", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ErrorAdditionalInfo" + className: "FilteringTag" } } } @@ -1109,43 +1176,25 @@ export const ErrorDetail: msRest.CompositeMapper = { } }; -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", +export const FilteringTag: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ErrorResponse", + className: "FilteringTag", modelProperties: { - error: { - serializedName: "error", + name: { + serializedName: "name", type: { - name: "Composite", - className: "ErrorDetail" + name: "String" } - } - } - } -}; - -export const DatadogAgreementResourceListResponse: msRest.CompositeMapper = { - serializedName: "DatadogAgreementResourceListResponse", - type: { - name: "Composite", - className: "DatadogAgreementResourceListResponse", - modelProperties: { + }, value: { - serializedName: "", + serializedName: "value", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DatadogAgreementResource" - } - } + name: "String" } }, - nextLink: { - serializedName: "nextLink", + action: { + serializedName: "action", type: { name: "String" } @@ -1154,48 +1203,40 @@ export const DatadogAgreementResourceListResponse: msRest.CompositeMapper = { } }; -export const DatadogApiKeyListResponse: msRest.CompositeMapper = { - serializedName: "DatadogApiKeyListResponse", +export const MetricRules: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogApiKeyListResponse", + className: "MetricRules", modelProperties: { - value: { - serializedName: "", + filteringTags: { + serializedName: "filteringTags", type: { name: "Sequence", element: { type: { name: "Composite", - className: "DatadogApiKey" + className: "FilteringTag" } } } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } } } } }; -export const DatadogHostListResponse: msRest.CompositeMapper = { - serializedName: "DatadogHostListResponse", +export const DatadogSingleSignOnResourceListResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DatadogHostListResponse", + className: "DatadogSingleSignOnResourceListResponse", modelProperties: { value: { - serializedName: "", + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "DatadogHost" + className: "DatadogSingleSignOnResource" } } } @@ -1210,166 +1251,77 @@ export const DatadogHostListResponse: msRest.CompositeMapper = { } }; -export const LinkedResourceListResponse: msRest.CompositeMapper = { - serializedName: "LinkedResourceListResponse", +export const DatadogSingleSignOnResource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "LinkedResourceListResponse", + className: "DatadogSingleSignOnResource", modelProperties: { - value: { - serializedName: "", + id: { + serializedName: "id", + readOnly: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "LinkedResource" - } - } + name: "String" } }, - nextLink: { - serializedName: "nextLink", + name: { + serializedName: "name", + readOnly: true, type: { name: "String" } - } - } - } -}; - -export const MonitoredResourceListResponse: msRest.CompositeMapper = { - serializedName: "MonitoredResourceListResponse", - type: { - name: "Composite", - className: "MonitoredResourceListResponse", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MonitoredResource" - } - } - } }, - nextLink: { - serializedName: "nextLink", + type: { + serializedName: "type", + readOnly: true, type: { name: "String" } - } - } - } -}; - -export const DatadogMonitorResourceListResponse: msRest.CompositeMapper = { - serializedName: "DatadogMonitorResourceListResponse", - type: { - name: "Composite", - className: "DatadogMonitorResourceListResponse", - modelProperties: { - value: { - serializedName: "", + }, + properties: { + serializedName: "properties", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DatadogMonitorResource" - } - } + name: "Composite", + className: "DatadogSingleSignOnProperties" } }, - nextLink: { - serializedName: "nextLink", + systemData: { + serializedName: "systemData", type: { - name: "String" + name: "Composite", + className: "SystemData" } } } } }; -export const OperationListResult: msRest.CompositeMapper = { - serializedName: "OperationListResult", +export const DatadogSingleSignOnProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationListResult", + className: "DatadogSingleSignOnProperties", modelProperties: { - value: { - serializedName: "", + provisioningState: { + serializedName: "provisioningState", + readOnly: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationResult" - } - } + name: "String" } }, - nextLink: { - serializedName: "nextLink", + singleSignOnState: { + serializedName: "singleSignOnState", type: { name: "String" } - } - } - } -}; - -export const MonitoringTagRulesListResponse: msRest.CompositeMapper = { - serializedName: "MonitoringTagRulesListResponse", - type: { - name: "Composite", - className: "MonitoringTagRulesListResponse", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MonitoringTagRules" - } - } - } }, - nextLink: { - serializedName: "nextLink", + enterpriseAppId: { + serializedName: "enterpriseAppId", type: { name: "String" } - } - } - } -}; - -export const DatadogSingleSignOnResourceListResponse: msRest.CompositeMapper = { - serializedName: "DatadogSingleSignOnResourceListResponse", - type: { - name: "Composite", - className: "DatadogSingleSignOnResourceListResponse", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DatadogSingleSignOnResource" - } - } - } }, - nextLink: { - serializedName: "nextLink", + singleSignOnUrl: { + serializedName: "singleSignOnUrl", + readOnly: true, type: { name: "String" } diff --git a/sdk/datadog/arm-datadog/src/models/marketplaceAgreementsMappers.ts b/sdk/datadog/arm-datadog/src/models/marketplaceAgreementsMappers.ts deleted file mode 100644 index 71999e2f121d..000000000000 --- a/sdk/datadog/arm-datadog/src/models/marketplaceAgreementsMappers.ts +++ /dev/null @@ -1,31 +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 { - BaseResource, - DatadogAgreementProperties, - DatadogAgreementResource, - DatadogAgreementResourceListResponse, - DatadogMonitorResource, - DatadogOrganizationProperties, - DatadogSingleSignOnProperties, - DatadogSingleSignOnResource, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - FilteringTag, - IdentityProperties, - LogRules, - MetricRules, - MonitoringTagRules, - MonitoringTagRulesProperties, - MonitorProperties, - ResourceSku, - SystemData, - UserInfo -} from "../models/mappers"; diff --git a/sdk/datadog/arm-datadog/src/models/monitorsMappers.ts b/sdk/datadog/arm-datadog/src/models/monitorsMappers.ts deleted file mode 100644 index ae7d1141e3ea..000000000000 --- a/sdk/datadog/arm-datadog/src/models/monitorsMappers.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. - */ - -export { - BaseResource, - DatadogAgreementProperties, - DatadogAgreementResource, - DatadogApiKey, - DatadogApiKeyListResponse, - DatadogHost, - DatadogHostListResponse, - DatadogHostMetadata, - DatadogInstallMethod, - DatadogLogsAgent, - DatadogMonitorResource, - DatadogMonitorResourceListResponse, - DatadogMonitorResourceUpdateParameters, - DatadogOrganizationProperties, - DatadogSetPasswordLink, - DatadogSingleSignOnProperties, - DatadogSingleSignOnResource, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - FilteringTag, - IdentityProperties, - LinkedResource, - LinkedResourceListResponse, - LogRules, - MetricRules, - MonitoredResource, - MonitoredResourceListResponse, - MonitoringTagRules, - MonitoringTagRulesProperties, - MonitorProperties, - MonitorUpdateProperties, - ResourceSku, - SystemData, - UserInfo -} from "../models/mappers"; diff --git a/sdk/datadog/arm-datadog/src/models/parameters.ts b/sdk/datadog/arm-datadog/src/models/parameters.ts index 2da04e3458ac..87b66fb1b926 100644 --- a/sdk/datadog/arm-datadog/src/models/parameters.ts +++ b/sdk/datadog/arm-datadog/src/models/parameters.ts @@ -3,99 +3,169 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +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 +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, - serializedName: "api-version", + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { constraints: { MinLength: 1 }, + serializedName: "subscriptionId", + required: true, type: { name: "String" } } }; -export const configurationName: msRest.OperationURLParameter = { - parameterPath: "configurationName", + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", mapper: { - required: true, - serializedName: "configurationName", + defaultValue: "2021-03-01", + isConstant: true, + serializedName: "api-version", type: { name: "String" } } }; -export const monitorName: msRest.OperationURLParameter = { - parameterPath: "monitorName", + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - required: true, - serializedName: "monitorName", + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", + +export const body: OperationParameter = { + parameterPath: ["options", "body"], + mapper: DatadogAgreementResourceMapper +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { - required: true, serializedName: "nextLink", + required: true, type: { name: "String" } }, skipEncoding: true }; -export const resourceGroupName: msRest.OperationURLParameter = { + +export const resourceGroupName: OperationURLParameter = { parameterPath: "resourceGroupName", mapper: { - required: true, - serializedName: "resourceGroupName", constraints: { MaxLength: 90, - MinLength: 1, - Pattern: /^[-\w\._\(\)]+$/ + MinLength: 1 }, + serializedName: "resourceGroupName", + required: true, type: { name: "String" } } }; -export const ruleSetName: msRest.OperationURLParameter = { - parameterPath: "ruleSetName", + +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 subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", + +export const body5: OperationParameter = { + parameterPath: ["options", "body"], + mapper: DatadogSingleSignOnResourceMapper +}; + +export const configurationName: OperationURLParameter = { + parameterPath: "configurationName", mapper: { + serializedName: "configurationName", required: true, - serializedName: "subscriptionId", - constraints: { - MinLength: 1 - }, type: { name: "String" } diff --git a/sdk/datadog/arm-datadog/src/models/singleSignOnConfigurationsMappers.ts b/sdk/datadog/arm-datadog/src/models/singleSignOnConfigurationsMappers.ts deleted file mode 100644 index 2a548cdfb4e9..000000000000 --- a/sdk/datadog/arm-datadog/src/models/singleSignOnConfigurationsMappers.ts +++ /dev/null @@ -1,31 +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 { - BaseResource, - DatadogAgreementProperties, - DatadogAgreementResource, - DatadogMonitorResource, - DatadogOrganizationProperties, - DatadogSingleSignOnProperties, - DatadogSingleSignOnResource, - DatadogSingleSignOnResourceListResponse, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - FilteringTag, - IdentityProperties, - LogRules, - MetricRules, - MonitoringTagRules, - MonitoringTagRulesProperties, - MonitorProperties, - ResourceSku, - SystemData, - UserInfo -} from "../models/mappers"; diff --git a/sdk/datadog/arm-datadog/src/models/tagRulesMappers.ts b/sdk/datadog/arm-datadog/src/models/tagRulesMappers.ts deleted file mode 100644 index d7f386d16c58..000000000000 --- a/sdk/datadog/arm-datadog/src/models/tagRulesMappers.ts +++ /dev/null @@ -1,31 +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 { - BaseResource, - DatadogAgreementProperties, - DatadogAgreementResource, - DatadogMonitorResource, - DatadogOrganizationProperties, - DatadogSingleSignOnProperties, - DatadogSingleSignOnResource, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - FilteringTag, - IdentityProperties, - LogRules, - MetricRules, - MonitoringTagRules, - MonitoringTagRulesListResponse, - MonitoringTagRulesProperties, - MonitorProperties, - ResourceSku, - SystemData, - UserInfo -} from "../models/mappers"; diff --git a/sdk/datadog/arm-datadog/src/operations/index.ts b/sdk/datadog/arm-datadog/src/operations/index.ts index d3ed4233dbcb..63efb072de95 100644 --- a/sdk/datadog/arm-datadog/src/operations/index.ts +++ b/sdk/datadog/arm-datadog/src/operations/index.ts @@ -3,8 +3,7 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./marketplaceAgreements"; diff --git a/sdk/datadog/arm-datadog/src/operations/marketplaceAgreements.ts b/sdk/datadog/arm-datadog/src/operations/marketplaceAgreements.ts index b5b6d2b32e3a..7b1a7f0ab295 100644 --- a/sdk/datadog/arm-datadog/src/operations/marketplaceAgreements.ts +++ b/sdk/datadog/arm-datadog/src/operations/marketplaceAgreements.ts @@ -3,119 +3,125 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/marketplaceAgreementsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { MarketplaceAgreements } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { MicrosoftDatadogClientContext } from "../microsoftDatadogClientContext"; +import { MicrosoftDatadogClient } from "../microsoftDatadogClient"; +import { + DatadogAgreementResource, + MarketplaceAgreementsListNextOptionalParams, + MarketplaceAgreementsListOptionalParams, + MarketplaceAgreementsListResponse, + MarketplaceAgreementsCreateOrUpdateOptionalParams, + MarketplaceAgreementsCreateOrUpdateResponse, + MarketplaceAgreementsListNextResponse +} from "../models"; -/** Class representing a MarketplaceAgreements. */ -export class MarketplaceAgreements { - private readonly client: MicrosoftDatadogClientContext; +/// +/** Class containing MarketplaceAgreements operations. */ +export class MarketplaceAgreementsImpl implements MarketplaceAgreements { + private readonly client: MicrosoftDatadogClient; /** - * Create a MarketplaceAgreements. - * @param {MicrosoftDatadogClientContext} client Reference to the service client. + * Initialize a new instance of the class MarketplaceAgreements class. + * @param client Reference to the service client */ - constructor(client: MicrosoftDatadogClientContext) { + constructor(client: MicrosoftDatadogClient) { this.client = client; } /** - * @summary List Datadog marketplace agreements in the subscription. - * @param [options] The optional parameters - * @returns Promise + * List Datadog marketplace agreements in the subscription. + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: MarketplaceAgreementsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - listOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: MarketplaceAgreementsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: MarketplaceAgreementsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** - * @summary Create Datadog marketplace agreement in the subscription. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(options?: Models.MarketplaceAgreementsCreateOrUpdateOptionalParams): Promise; - /** - * @param callback The callback + * List Datadog marketplace agreements in the subscription. + * @param options The options parameters. */ - createOrUpdate(callback: msRest.ServiceCallback): void; + private _list( + options?: MarketplaceAgreementsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param options The optional parameters - * @param callback The callback + * Create Datadog marketplace agreement in the subscription. + * @param options The options parameters. */ - createOrUpdate(options: Models.MarketplaceAgreementsCreateOrUpdateOptionalParams, callback: msRest.ServiceCallback): void; - createOrUpdate(options?: Models.MarketplaceAgreementsCreateOrUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + createOrUpdate( + options?: MarketplaceAgreementsCreateOrUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - options - }, - createOrUpdateOperationSpec, - callback) as Promise; + { options }, + createOrUpdateOperationSpec + ); } /** - * @summary List Datadog marketplace agreements in the subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: MarketplaceAgreementsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.DatadogAgreementResourceListResponse @@ -124,28 +130,15 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const createOrUpdateOperationSpec: msRest.OperationSpec = { +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default", httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.DatadogAgreementResource - }, responses: { 200: { bodyMapper: Mappers.DatadogAgreementResource @@ -154,22 +147,16 @@ const createOrUpdateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DatadogAgreementResourceListResponse @@ -178,5 +165,12 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/datadog/arm-datadog/src/operations/monitors.ts b/sdk/datadog/arm-datadog/src/operations/monitors.ts index ec481387fbb0..184968f67674 100644 --- a/sdk/datadog/arm-datadog/src/operations/monitors.ts +++ b/sdk/datadog/arm-datadog/src/operations/monitors.ts @@ -3,913 +3,976 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/monitorsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Monitors } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { MicrosoftDatadogClientContext } from "../microsoftDatadogClientContext"; +import { MicrosoftDatadogClient } from "../microsoftDatadogClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + DatadogApiKey, + MonitorsListApiKeysNextOptionalParams, + MonitorsListApiKeysOptionalParams, + DatadogHost, + MonitorsListHostsNextOptionalParams, + MonitorsListHostsOptionalParams, + LinkedResource, + MonitorsListLinkedResourcesNextOptionalParams, + MonitorsListLinkedResourcesOptionalParams, + MonitoredResource, + MonitorsListMonitoredResourcesNextOptionalParams, + MonitorsListMonitoredResourcesOptionalParams, + DatadogMonitorResource, + MonitorsListNextOptionalParams, + MonitorsListOptionalParams, + MonitorsListByResourceGroupNextOptionalParams, + MonitorsListByResourceGroupOptionalParams, + MonitorsListApiKeysResponse, + MonitorsGetDefaultKeyOptionalParams, + MonitorsGetDefaultKeyResponse, + MonitorsSetDefaultKeyOptionalParams, + MonitorsListHostsResponse, + MonitorsListLinkedResourcesResponse, + MonitorsListMonitoredResourcesResponse, + MonitorsListResponse, + MonitorsListByResourceGroupResponse, + MonitorsGetOptionalParams, + MonitorsGetResponse, + MonitorsCreateOptionalParams, + MonitorsCreateResponse, + MonitorsUpdateOptionalParams, + MonitorsUpdateResponse, + MonitorsDeleteOptionalParams, + MonitorsRefreshSetPasswordLinkOptionalParams, + MonitorsRefreshSetPasswordLinkResponse, + MonitorsListApiKeysNextResponse, + MonitorsListHostsNextResponse, + MonitorsListLinkedResourcesNextResponse, + MonitorsListMonitoredResourcesNextResponse, + MonitorsListNextResponse, + MonitorsListByResourceGroupNextResponse +} from "../models"; -/** Class representing a Monitors. */ -export class Monitors { - private readonly client: MicrosoftDatadogClientContext; +/// +/** Class containing Monitors operations. */ +export class MonitorsImpl implements Monitors { + private readonly client: MicrosoftDatadogClient; /** - * Create a Monitors. - * @param {MicrosoftDatadogClientContext} client Reference to the service client. + * Initialize a new instance of the class Monitors class. + * @param client Reference to the service client */ - constructor(client: MicrosoftDatadogClientContext) { + constructor(client: MicrosoftDatadogClient) { this.client = client; } /** - * @summary List the api keys for a given monitor resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - listApiKeys( + public listApiKeys( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param callback The callback - */ - listApiKeys( + options?: MonitorsListApiKeysOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listApiKeysPagingAll( + resourceGroupName, + monitorName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listApiKeysPagingPage( + resourceGroupName, + monitorName, + options + ); + } + }; + } + + private async *listApiKeysPagingPage( resourceGroupName: string, monitorName: string, - callback: msRest.ServiceCallback - ): void; + options?: MonitorsListApiKeysOptionalParams + ): AsyncIterableIterator { + let result = await this._listApiKeys( + resourceGroupName, + monitorName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listApiKeysNext( + resourceGroupName, + monitorName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + 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 optional parameters - * @param callback The callback + * @param options The options parameters. */ - listApiKeys( + public listHosts( resourceGroupName: string, monitorName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listApiKeys( + options?: MonitorsListHostsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listHostsPagingAll( + resourceGroupName, + monitorName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listHostsPagingPage( + resourceGroupName, + monitorName, + options + ); + } + }; + } + + private async *listHostsPagingPage( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { + options?: MonitorsListHostsOptionalParams + ): AsyncIterableIterator { + let result = await this._listHosts(resourceGroupName, monitorName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listHostsNext( resourceGroupName, monitorName, + continuationToken, options - }, - listApiKeysOperationSpec, - callback - ) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } } - /** - * @summary 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 optional parameters - * @returns Promise - */ - getDefaultKey( + private async *listHostsPagingAll( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param callback The callback - */ - getDefaultKey( - resourceGroupName: string, - monitorName: string, - callback: msRest.ServiceCallback - ): void; + 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 optional parameters - * @param callback The callback + * @param options The options parameters. */ - getDefaultKey( + public listLinkedResources( resourceGroupName: string, monitorName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - getDefaultKey( + options?: MonitorsListLinkedResourcesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listLinkedResourcesPagingAll( + resourceGroupName, + monitorName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listLinkedResourcesPagingPage( + resourceGroupName, + monitorName, + options + ); + } + }; + } + + private async *listLinkedResourcesPagingPage( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { + options?: MonitorsListLinkedResourcesOptionalParams + ): AsyncIterableIterator { + let result = await this._listLinkedResources( + resourceGroupName, + monitorName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listLinkedResourcesNext( resourceGroupName, monitorName, + continuationToken, options - }, - getDefaultKeyOperationSpec, - callback - ) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } } - /** - * @summary 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 optional parameters - * @returns Promise - */ - setDefaultKey( + private async *listLinkedResourcesPagingAll( resourceGroupName: string, monitorName: string, - options?: Models.MonitorsSetDefaultKeyOptionalParams - ): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param callback The callback - */ - setDefaultKey( - resourceGroupName: string, - monitorName: string, - callback: msRest.ServiceCallback - ): void; + 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 optional parameters - * @param callback The callback + * @param options The options parameters. */ - setDefaultKey( + public listMonitoredResources( resourceGroupName: string, monitorName: string, - options: Models.MonitorsSetDefaultKeyOptionalParams, - callback: msRest.ServiceCallback - ): void; - setDefaultKey( + options?: MonitorsListMonitoredResourcesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listMonitoredResourcesPagingAll( + resourceGroupName, + monitorName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listMonitoredResourcesPagingPage( + resourceGroupName, + monitorName, + options + ); + } + }; + } + + private async *listMonitoredResourcesPagingPage( resourceGroupName: string, monitorName: string, - options?: Models.MonitorsSetDefaultKeyOptionalParams | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { + options?: MonitorsListMonitoredResourcesOptionalParams + ): AsyncIterableIterator { + let result = await this._listMonitoredResources( + resourceGroupName, + monitorName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listMonitoredResourcesNext( resourceGroupName, monitorName, + continuationToken, options - }, - setDefaultKeyOperationSpec, - callback - ); + ); + continuationToken = result.nextLink; + yield result.value || []; + } } - /** - * @summary 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 optional parameters - * @returns Promise - */ - listHosts( + private async *listMonitoredResourcesPagingAll( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise; + options?: MonitorsListMonitoredResourcesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listMonitoredResourcesPagingPage( + resourceGroupName, + monitorName, + options + )) { + yield* page; + } + } + /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param callback The callback + * List all monitors under the specified subscription. + * @param options The options parameters. */ - listHosts( - resourceGroupName: string, - monitorName: string, - callback: msRest.ServiceCallback - ): void; + public list( + options?: MonitorsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: MonitorsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + 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 monitorName Monitor resource name - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - listHosts( + public listByResourceGroup( resourceGroupName: string, - monitorName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listHosts( + options?: MonitorsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( resourceGroupName: string, - monitorName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { + options?: MonitorsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( resourceGroupName, - monitorName, + continuationToken, options - }, - listHostsOperationSpec, - callback - ) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: MonitorsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } } /** - * @summary List all Azure resources associated to the same Datadog organization as the target - * resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - listLinkedResources( + private _listApiKeys( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise; + 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 callback The callback + * @param options The options parameters. */ - listLinkedResources( + getDefaultKey( resourceGroupName: string, monitorName: string, - callback: msRest.ServiceCallback - ): void; + 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 optional parameters - * @param callback The callback + * @param options The options parameters. */ - listLinkedResources( - resourceGroupName: string, - monitorName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listLinkedResources( + setDefaultKey( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: MonitorsSetDefaultKeyOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - monitorName, - options - }, - listLinkedResourcesOperationSpec, - callback - ) as Promise; + { resourceGroupName, monitorName, options }, + setDefaultKeyOperationSpec + ); } /** - * @summary List the resources currently being monitored by the Datadog monitor resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - listMonitoredResources( + private _listHosts( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise; + 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 callback The callback + * @param options The options parameters. */ - listMonitoredResources( + private _listLinkedResources( resourceGroupName: string, monitorName: string, - callback: msRest.ServiceCallback - ): void; + 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 optional parameters - * @param callback The callback + * @param options The options parameters. */ - listMonitoredResources( - resourceGroupName: string, - monitorName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listMonitoredResources( + private _listMonitoredResources( resourceGroupName: string, monitorName: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: MonitorsListMonitoredResourcesOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - monitorName, - options - }, - listMonitoredResourcesOperationSpec, - callback - ) as Promise; + { resourceGroupName, monitorName, options }, + listMonitoredResourcesOperationSpec + ); } /** - * @summary List all monitors under the specified subscription. - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback + * List all monitors under the specified subscription. + * @param options The options parameters. */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list( - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - list( - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback - ) as Promise; + private _list( + options?: MonitorsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** - * @summary List all monitors under the specified resource group. + * List all monitors under the specified resource group. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listByResourceGroup( + private _listByResourceGroup( resourceGroupName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param callback The callback - */ - listByResourceGroup( - resourceGroupName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroup( - resourceGroupName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listByResourceGroup( - resourceGroupName: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: MonitorsListByResourceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listByResourceGroupOperationSpec, - callback - ) as Promise; + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); } /** - * @summary Get the properties of a specific monitor resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ get( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise; + 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 callback The callback + * @param options The options parameters. */ - get( + async beginCreate( resourceGroupName: string, monitorName: string, - callback: msRest.ServiceCallback - ): void; + options?: MonitorsCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MonitorsCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, monitorName, options }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + /** + * 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 optional parameters - * @param callback The callback + * @param options The options parameters. */ - get( + async beginCreateAndWait( resourceGroupName: string, monitorName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - get( - resourceGroupName: string, - monitorName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - monitorName, - options - }, - getOperationSpec, - callback - ) as Promise; + options?: MonitorsCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + monitorName, + options + ); + return poller.pollUntilDone(); } /** - * @summary Create a monitor resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - create( + async beginUpdate( resourceGroupName: string, monitorName: string, - options?: Models.MonitorsCreateOptionalParams - ): Promise { - return this.beginCreate(resourceGroupName, monitorName, options).then((lroPoller) => - lroPoller.pollUntilFinished() - ) as Promise; + options?: MonitorsUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MonitorsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, monitorName, options }, + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * @summary Update a monitor resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - update( + async beginUpdateAndWait( resourceGroupName: string, monitorName: string, - options?: Models.MonitorsUpdateOptionalParams - ): Promise { - return this.beginUpdate(resourceGroupName, monitorName, options).then((lroPoller) => - lroPoller.pollUntilFinished() - ) as Promise; + options?: MonitorsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + monitorName, + options + ); + return poller.pollUntilDone(); } /** - * @summary Delete a monitor resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod( + async beginDelete( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginDeleteMethod(resourceGroupName, monitorName, options).then((lroPoller) => - lroPoller.pollUntilFinished() + options?: MonitorsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, monitorName, options }, + deleteOperationSpec ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * @summary Refresh the set password link and return a latest one. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - refreshSetPasswordLink( + async beginDeleteAndWait( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise; + 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 callback The callback + * @param options The options parameters. */ refreshSetPasswordLink( resourceGroupName: string, monitorName: string, - callback: msRest.ServiceCallback - ): void; + 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 options The optional parameters - * @param callback The callback + * @param nextLink The nextLink from the previous successful call to the ListApiKeys method. + * @param options The options parameters. */ - refreshSetPasswordLink( - resourceGroupName: string, - monitorName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - refreshSetPasswordLink( + private _listApiKeysNext( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + nextLink: string, + options?: MonitorsListApiKeysNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - monitorName, - options - }, - refreshSetPasswordLinkOperationSpec, - callback - ) as Promise; + { resourceGroupName, monitorName, nextLink, options }, + listApiKeysNextOperationSpec + ); } /** - * @summary Create a monitor resource. + * ListHostsNext * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name - * @param [options] The optional parameters - * @returns Promise + * @param nextLink The nextLink from the previous successful call to the ListHosts method. + * @param options The options parameters. */ - beginCreate( + private _listHostsNext( resourceGroupName: string, monitorName: string, - options?: Models.MonitorsBeginCreateOptionalParams - ): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - monitorName, - options - }, - beginCreateOperationSpec, - options + nextLink: string, + options?: MonitorsListHostsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, nextLink, options }, + listHostsNextOperationSpec ); } /** - * @summary Update a monitor resource. + * ListLinkedResourcesNext * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name - * @param [options] The optional parameters - * @returns Promise + * @param nextLink The nextLink from the previous successful call to the ListLinkedResources method. + * @param options The options parameters. */ - beginUpdate( + private _listLinkedResourcesNext( resourceGroupName: string, monitorName: string, - options?: Models.MonitorsBeginUpdateOptionalParams - ): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - monitorName, - options - }, - beginUpdateOperationSpec, - options + nextLink: string, + options?: MonitorsListLinkedResourcesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, nextLink, options }, + listLinkedResourcesNextOperationSpec ); } /** - * @summary Delete a monitor resource. + * ListMonitoredResourcesNext * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name - * @param [options] The optional parameters - * @returns Promise + * @param nextLink The nextLink from the previous successful call to the ListMonitoredResources method. + * @param options The options parameters. */ - beginDeleteMethod( + private _listMonitoredResourcesNext( resourceGroupName: string, monitorName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - monitorName, - options - }, - beginDeleteMethodOperationSpec, - options - ); - } - - /** - * @summary List the api keys for a given monitor resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listApiKeysNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listApiKeysNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listApiKeysNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listApiKeysNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + nextLink: string, + options?: MonitorsListMonitoredResourcesNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listApiKeysNextOperationSpec, - callback - ) as Promise; - } - - /** - * @summary List the hosts for a given monitor resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listHostsNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listHostsNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listHostsNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listHostsNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listHostsNextOperationSpec, - callback - ) as Promise; - } - - /** - * @summary List all Azure resources associated to the same Datadog organization as the target - * resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listLinkedResourcesNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listLinkedResourcesNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listLinkedResourcesNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listLinkedResourcesNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listLinkedResourcesNextOperationSpec, - callback - ) as Promise; - } - - /** - * @summary List the resources currently being monitored by the Datadog monitor resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listMonitoredResourcesNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listMonitoredResourcesNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listMonitoredResourcesNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listMonitoredResourcesNext( - nextPageLink: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listMonitoredResourcesNextOperationSpec, - callback - ) as Promise; + { resourceGroupName, monitorName, nextLink, options }, + listMonitoredResourcesNextOperationSpec + ); } /** - * @summary List all monitors under the specified subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listNext( - nextPageLink: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + private _listNext( + nextLink: string, + options?: MonitorsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback - ) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } /** - * @summary List all monitors under the specified resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroupNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByResourceGroupNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * 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. */ - listByResourceGroupNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listByResourceGroupNext( - nextPageLink: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: MonitorsListByResourceGroupNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByResourceGroupNextOperationSpec, - callback - ) as Promise; + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listApiKeysOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listApiKeysOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.DatadogApiKeyListResponse @@ -918,16 +981,20 @@ const listApiKeysOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const getDefaultKeyOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", +const getDefaultKeyOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.DatadogApiKey @@ -936,36 +1003,42 @@ const getDefaultKeyOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const setDefaultKeyOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", +const setDefaultKeyOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: ["options", "body"], - mapper: Mappers.DatadogApiKey - }, + "/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: msRest.OperationSpec = { - httpMethod: "POST", +const listHostsOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.DatadogHostListResponse @@ -974,16 +1047,20 @@ const listHostsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const listLinkedResourcesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", +const listLinkedResourcesOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.LinkedResourceListResponse @@ -992,16 +1069,20 @@ const listLinkedResourcesOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const listMonitoredResourcesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", +const listMonitoredResourcesOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.MonitoredResourceListResponse @@ -1010,15 +1091,19 @@ const listMonitoredResourcesOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors", - urlParameters: [Parameters.subscriptionId], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], responses: { 200: { bodyMapper: Mappers.DatadogMonitorResourceListResponse @@ -1027,16 +1112,15 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DatadogMonitorResourceListResponse @@ -1045,16 +1129,19 @@ const listByResourceGroupOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", +const getOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DatadogMonitorResource @@ -1063,38 +1150,20 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const refreshSetPasswordLinkOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - responses: { - 200: { - bodyMapper: Mappers.DatadogSetPasswordLink - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const beginCreateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", +const createOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: ["options", "body"], - mapper: Mappers.DatadogMonitorResource - }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.DatadogMonitorResource @@ -1102,24 +1171,32 @@ const beginCreateOperationSpec: msRest.OperationSpec = { 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 beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", +const updateOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: ["options", "body"], - mapper: Mappers.DatadogMonitorResourceUpdateParameters - }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", + httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.DatadogMonitorResource @@ -1127,38 +1204,76 @@ const beginUpdateOperationSpec: msRest.OperationSpec = { 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 beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", +const deleteOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/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 listApiKeysNextOperationSpec: msRest.OperationSpec = { +const refreshSetPasswordLinkOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink", httpMethod: "POST", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], + responses: { + 200: { + bodyMapper: Mappers.DatadogSetPasswordLink + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + 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 @@ -1167,16 +1282,20 @@ const listApiKeysNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const listHostsNextOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - baseUrl: "https://management.azure.com", +const listHostsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DatadogHostListResponse @@ -1185,16 +1304,20 @@ const listHostsNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const listLinkedResourcesNextOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - baseUrl: "https://management.azure.com", +const listLinkedResourcesNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.LinkedResourceListResponse @@ -1203,16 +1326,20 @@ const listLinkedResourcesNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const listMonitoredResourcesNextOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - baseUrl: "https://management.azure.com", +const listMonitoredResourcesNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MonitoredResourceListResponse @@ -1221,16 +1348,20 @@ const listMonitoredResourcesNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DatadogMonitorResourceListResponse @@ -1239,16 +1370,18 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DatadogMonitorResourceListResponse @@ -1257,5 +1390,13 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + 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 index ab04af050051..068b3256f755 100644 --- a/sdk/datadog/arm-datadog/src/operations/operations.ts +++ b/sdk/datadog/arm-datadog/src/operations/operations.ts @@ -3,92 +3,109 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { MicrosoftDatadogClientContext } from "../microsoftDatadogClientContext"; +import { MicrosoftDatadogClient } from "../microsoftDatadogClient"; +import { + OperationResult, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; -/** Class representing a Operations. */ -export class Operations { - private readonly client: MicrosoftDatadogClientContext; +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: MicrosoftDatadogClient; /** - * Create a Operations. - * @param {MicrosoftDatadogClientContext} client Reference to the service client. + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client */ - constructor(client: MicrosoftDatadogClientContext) { + constructor(client: MicrosoftDatadogClient) { this.client = client; } /** - * @summary List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. - * @param [options] The optional parameters - * @returns Promise + * List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - listOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** - * @summary List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * List all operations provided by Microsoft.Datadog for the 2021-03-01 api version. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Datadog/operations", httpMethod: "GET", - path: "providers/Microsoft.Datadog/operations", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.OperationListResult @@ -97,22 +114,14 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.OperationListResult @@ -121,5 +130,8 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + 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 index 2f0f7fbe14f6..51ced7d31ed4 100644 --- a/sdk/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts +++ b/sdk/datadog/arm-datadog/src/operations/singleSignOnConfigurations.ts @@ -3,175 +3,255 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/singleSignOnConfigurationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SingleSignOnConfigurations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { MicrosoftDatadogClientContext } from "../microsoftDatadogClientContext"; +import { MicrosoftDatadogClient } from "../microsoftDatadogClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + DatadogSingleSignOnResource, + SingleSignOnConfigurationsListNextOptionalParams, + SingleSignOnConfigurationsListOptionalParams, + SingleSignOnConfigurationsListResponse, + SingleSignOnConfigurationsCreateOrUpdateOptionalParams, + SingleSignOnConfigurationsCreateOrUpdateResponse, + SingleSignOnConfigurationsGetOptionalParams, + SingleSignOnConfigurationsGetResponse, + SingleSignOnConfigurationsListNextResponse +} from "../models"; -/** Class representing a SingleSignOnConfigurations. */ -export class SingleSignOnConfigurations { - private readonly client: MicrosoftDatadogClientContext; +/// +/** Class containing SingleSignOnConfigurations operations. */ +export class SingleSignOnConfigurationsImpl + implements SingleSignOnConfigurations { + private readonly client: MicrosoftDatadogClient; /** - * Create a SingleSignOnConfigurations. - * @param {MicrosoftDatadogClientContext} client Reference to the service client. + * Initialize a new instance of the class SingleSignOnConfigurations class. + * @param client Reference to the service client */ - constructor(client: MicrosoftDatadogClientContext) { + constructor(client: MicrosoftDatadogClient) { this.client = client; } /** - * @summary List the single sign-on configurations for a given monitor resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - list(resourceGroupName: string, monitorName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param callback The callback - */ - list(resourceGroupName: string, monitorName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The optional parameters - * @param callback The callback - */ - list(resourceGroupName: string, monitorName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(resourceGroupName: string, monitorName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + 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: () => { + return this.listPagingPage(resourceGroupName, monitorName, options); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + monitorName: string, + options?: SingleSignOnConfigurationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, monitorName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( resourceGroupName, monitorName, + continuationToken, options - }, - listOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + monitorName: string, + options?: SingleSignOnConfigurationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + monitorName, + options + )) { + yield* page; + } } /** - * @summary Configures single-sign-on for this resource. + * 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 configurationName Configuration name - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, monitorName: string, configurationName: string, options?: Models.SingleSignOnConfigurationsCreateOrUpdateOptionalParams): Promise { - return this.beginCreateOrUpdate(resourceGroupName,monitorName,configurationName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + private _list( + resourceGroupName: string, + monitorName: string, + options?: SingleSignOnConfigurationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, monitorName, options }, + listOperationSpec + ); } /** - * @summary Gets the datadog single sign-on resource for the given Monitor. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, monitorName: string, configurationName: string, options?: msRest.RequestOptionsBase): Promise; + async beginCreateOrUpdate( + resourceGroupName: string, + monitorName: string, + configurationName: string, + options?: SingleSignOnConfigurationsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SingleSignOnConfigurationsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, monitorName, configurationName, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + /** + * 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 callback The callback + * @param options The options parameters. */ - get(resourceGroupName: string, monitorName: string, configurationName: string, callback: msRest.ServiceCallback): void; + 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 optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(resourceGroupName: string, monitorName: string, configurationName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, monitorName: string, configurationName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + monitorName: string, + configurationName: string, + options?: SingleSignOnConfigurationsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - monitorName, - configurationName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, monitorName, configurationName, options }, + getOperationSpec + ); } /** - * @summary Configures single-sign-on for this resource. + * ListNext * @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 optional parameters - * @returns Promise - */ - beginCreateOrUpdate(resourceGroupName: string, monitorName: string, configurationName: string, options?: Models.SingleSignOnConfigurationsBeginCreateOrUpdateOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - monitorName, - configurationName, - options - }, - beginCreateOrUpdateOperationSpec, - options); - } - - /** - * @summary List the single sign-on configurations for a given monitor resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + resourceGroupName: string, + monitorName: string, + nextLink: string, + options?: SingleSignOnConfigurationsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { resourceGroupName, monitorName, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.DatadogSingleSignOnResourceListResponse @@ -180,84 +260,76 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.configurationName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + 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 } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", + requestBody: Parameters.body5, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName, Parameters.configurationName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.DatadogSingleSignOnResource - }, + 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 }, - 201: { - 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: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DatadogSingleSignOnResourceListResponse @@ -266,5 +338,14 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + 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 index d6f11bd84f83..54558411729c 100644 --- a/sdk/datadog/arm-datadog/src/operations/tagRules.ts +++ b/sdk/datadog/arm-datadog/src/operations/tagRules.ts @@ -3,177 +3,180 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/tagRulesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { TagRules } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { MicrosoftDatadogClientContext } from "../microsoftDatadogClientContext"; +import { MicrosoftDatadogClient } from "../microsoftDatadogClient"; +import { + MonitoringTagRules, + TagRulesListNextOptionalParams, + TagRulesListOptionalParams, + TagRulesListResponse, + TagRulesCreateOrUpdateOptionalParams, + TagRulesCreateOrUpdateResponse, + TagRulesGetOptionalParams, + TagRulesGetResponse, + TagRulesListNextResponse +} from "../models"; -/** Class representing a TagRules. */ -export class TagRules { - private readonly client: MicrosoftDatadogClientContext; +/// +/** Class containing TagRules operations. */ +export class TagRulesImpl implements TagRules { + private readonly client: MicrosoftDatadogClient; /** - * Create a TagRules. - * @param {MicrosoftDatadogClientContext} client Reference to the service client. + * Initialize a new instance of the class TagRules class. + * @param client Reference to the service client */ - constructor(client: MicrosoftDatadogClientContext) { + constructor(client: MicrosoftDatadogClient) { this.client = client; } /** - * @summary List the tag rules for a given monitor resource. + * 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 optional parameters - * @returns Promise + * @param options The options parameters. */ - list(resourceGroupName: string, monitorName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param callback The callback - */ - list(resourceGroupName: string, monitorName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param options The optional parameters - * @param callback The callback - */ - list(resourceGroupName: string, monitorName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(resourceGroupName: string, monitorName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - monitorName, - options + 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; }, - listOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(resourceGroupName, monitorName, options); + } + }; } - /** - * @summary 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 optional parameters - * @returns Promise - */ - createOrUpdate(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: Models.TagRulesCreateOrUpdateOptionalParams): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name - * @param ruleSetName Rule set name - * @param callback The callback - */ - createOrUpdate(resourceGroupName: string, monitorName: string, ruleSetName: string, callback: msRest.ServiceCallback): void; - /** - * @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 optional parameters - * @param callback The callback - */ - createOrUpdate(resourceGroupName: string, monitorName: string, ruleSetName: string, options: Models.TagRulesCreateOrUpdateOptionalParams, callback: msRest.ServiceCallback): void; - createOrUpdate(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: Models.TagRulesCreateOrUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + private async *listPagingPage( + resourceGroupName: string, + monitorName: string, + options?: TagRulesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, monitorName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( resourceGroupName, monitorName, - ruleSetName, + continuationToken, options - }, - createOrUpdateOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + monitorName: string, + options?: TagRulesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + monitorName, + options + )) { + yield* page; + } } /** - * @summary Get a tag rule set for a given monitor resource. + * 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 ruleSetName Rule set name - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: msRest.RequestOptionsBase): Promise; + 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 callback The callback + * @param options The options parameters. */ - get(resourceGroupName: string, monitorName: string, ruleSetName: string, callback: msRest.ServiceCallback): void; + 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 optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(resourceGroupName: string, monitorName: string, ruleSetName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, monitorName: string, ruleSetName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + monitorName: string, + ruleSetName: string, + options?: TagRulesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - monitorName, - ruleSetName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, monitorName, ruleSetName, options }, + getOperationSpec + ); } /** - * @summary List the tag rules for a given monitor resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * 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. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + resourceGroupName: string, + monitorName: string, + nextLink: string, + options?: TagRulesListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { resourceGroupName, monitorName, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.monitorName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.MonitoringTagRulesListResponse @@ -182,31 +185,20 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const createOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.monitorName, - Parameters.ruleSetName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.monitorName ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.MonitoringTagRules - }, + 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 @@ -215,24 +207,23 @@ const createOrUpdateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}", + requestBody: Parameters.body4, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.monitorName, Parameters.ruleSetName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + 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 @@ -241,22 +232,20 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.monitorName, + Parameters.ruleSetName + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MonitoringTagRulesListResponse @@ -265,5 +254,14 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.monitorName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/datadog/arm-datadog/src/models/operationsMappers.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/index.ts similarity index 57% rename from sdk/datadog/arm-datadog/src/models/operationsMappers.ts rename to sdk/datadog/arm-datadog/src/operationsInterfaces/index.ts index e8a08c7f2128..63efb072de95 100644 --- a/sdk/datadog/arm-datadog/src/models/operationsMappers.ts +++ b/sdk/datadog/arm-datadog/src/operationsInterfaces/index.ts @@ -6,11 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - OperationDisplay, - OperationListResult, - OperationResult -} from "../models/mappers"; +export * from "./marketplaceAgreements"; +export * from "./monitors"; +export * from "./operations"; +export * from "./tagRules"; +export * from "./singleSignOnConfigurations"; diff --git a/sdk/datadog/arm-datadog/src/operationsInterfaces/marketplaceAgreements.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/marketplaceAgreements.ts new file mode 100644 index 000000000000..5dc29f8a6829 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/operationsInterfaces/marketplaceAgreements.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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"; + +/// +/** 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/monitors.ts b/sdk/datadog/arm-datadog/src/operationsInterfaces/monitors.ts new file mode 100644 index 000000000000..4b37fde1d63e --- /dev/null +++ b/sdk/datadog/arm-datadog/src/operationsInterfaces/monitors.ts @@ -0,0 +1,220 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { PollerLike, PollOperationState } 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"; + +/// +/** 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< + PollerLike< + PollOperationState, + 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< + PollerLike< + PollOperationState, + 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 new file mode 100644 index 000000000000..accb65d930a9 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { OperationResult, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List all operations provided by Microsoft.Datadog for the 2021-03-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 new file mode 100644 index 000000000000..b17f511b90e3 --- /dev/null +++ b/sdk/datadog/arm-datadog/src/operationsInterfaces/singleSignOnConfigurations.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + DatadogSingleSignOnResource, + SingleSignOnConfigurationsListOptionalParams, + SingleSignOnConfigurationsCreateOrUpdateOptionalParams, + SingleSignOnConfigurationsCreateOrUpdateResponse, + SingleSignOnConfigurationsGetOptionalParams, + SingleSignOnConfigurationsGetResponse +} from "../models"; + +/// +/** 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< + PollerLike< + PollOperationState, + 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 new file mode 100644 index 000000000000..66b8002b41cc --- /dev/null +++ b/sdk/datadog/arm-datadog/src/operationsInterfaces/tagRules.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + MonitoringTagRules, + TagRulesListOptionalParams, + TagRulesCreateOrUpdateOptionalParams, + TagRulesCreateOrUpdateResponse, + TagRulesGetOptionalParams, + TagRulesGetResponse +} from "../models"; + +/// +/** 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/test/sampleTest.ts b/sdk/datadog/arm-datadog/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/datadog/arm-datadog/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + 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" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/datadog/arm-datadog/tsconfig.json b/sdk/datadog/arm-datadog/tsconfig.json index 422b584abd5e..6e3251194117 100644 --- a/sdk/datadog/arm-datadog/tsconfig.json +++ b/sdk/datadog/arm-datadog/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,9 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", + "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/datadog/ci.yml b/sdk/datadog/ci.yml new file mode 100644 index 000000000000..8ccd0a329e1e --- /dev/null +++ b/sdk/datadog/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/datadog/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/datadog/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: datadog + Artifacts: + - name: azure-arm-datadog + safeName: azurearmdatadog + \ No newline at end of file