From e34ce9e1ababcf6679170771030e77b46a0a3f86 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 10 Dec 2021 04:01:56 +0000 Subject: [PATCH] CodeGen from PR 17002 in Azure/azure-rest-api-specs [Go] track2 modify readme.go.md 10 (#17002) * [Go] track2 modify readme.go.md 10 * add go batch tag multiapi * version to version_with_hyphens * remove videoindexer * fix * output-folder add mgmt --- common/config/rush/pnpm-lock.yaml | 27 +- rush.json | 5 + .../arm-trafficmanager/CHANGELOG.md | 11 + .../{LICENSE.txt => LICENSE} | 2 +- .../arm-trafficmanager/README.md | 158 +-- .../arm-trafficmanager/_meta.json | 7 + .../arm-trafficmanager/api-extractor.json | 18 + .../arm-trafficmanager/package.json | 93 +- .../review/arm-trafficmanager.api.md | 483 +++++++ .../arm-trafficmanager/rollup.config.js | 211 ++- .../arm-trafficmanager/src/index.ts | 12 + .../src/models/endpointsMappers.ts | 31 - .../models/geographicHierarchiesMappers.ts | 30 - .../src/models/heatMapMappers.ts | 30 - .../arm-trafficmanager/src/models/index.ts | 1189 ++++++----------- .../arm-trafficmanager/src/models/mappers.ts | 703 +++++----- .../src/models/parameters.ts | 163 ++- .../src/models/profilesMappers.ts | 34 - .../trafficManagerUserMetricsKeysMappers.ts | 31 - .../src/operations/endpoints.ts | 324 ++--- .../src/operations/geographicHierarchies.ts | 70 +- .../src/operations/heatMap.ts | 93 +- .../src/operations/index.ts | 3 +- .../src/operations/profiles.ts | 534 ++++---- .../trafficManagerUserMetricsKeys.ts | 162 +-- .../src/operationsInterfaces/endpoints.ts | 90 ++ .../geographicHierarchies.ts | 23 + .../src/operationsInterfaces/heatMap.ts | 24 + .../src/operationsInterfaces/index.ts | 13 + .../src/operationsInterfaces/profiles.ts | 106 ++ .../trafficManagerUserMetricsKeys.ts | 41 + .../src/trafficManagerManagementClient.ts | 124 +- .../trafficManagerManagementClientContext.ts | 68 - .../arm-trafficmanager/test/sampleTest.ts | 48 + .../arm-trafficmanager/tsconfig.json | 6 +- sdk/trafficmanager/ci.yml | 29 + 36 files changed, 2724 insertions(+), 2272 deletions(-) create mode 100644 sdk/trafficmanager/arm-trafficmanager/CHANGELOG.md rename sdk/trafficmanager/arm-trafficmanager/{LICENSE.txt => LICENSE} (99%) create mode 100644 sdk/trafficmanager/arm-trafficmanager/_meta.json create mode 100644 sdk/trafficmanager/arm-trafficmanager/api-extractor.json create mode 100644 sdk/trafficmanager/arm-trafficmanager/review/arm-trafficmanager.api.md create mode 100644 sdk/trafficmanager/arm-trafficmanager/src/index.ts delete mode 100644 sdk/trafficmanager/arm-trafficmanager/src/models/endpointsMappers.ts delete mode 100644 sdk/trafficmanager/arm-trafficmanager/src/models/geographicHierarchiesMappers.ts delete mode 100644 sdk/trafficmanager/arm-trafficmanager/src/models/heatMapMappers.ts delete mode 100644 sdk/trafficmanager/arm-trafficmanager/src/models/profilesMappers.ts delete mode 100644 sdk/trafficmanager/arm-trafficmanager/src/models/trafficManagerUserMetricsKeysMappers.ts create mode 100644 sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/endpoints.ts create mode 100644 sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/geographicHierarchies.ts create mode 100644 sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/heatMap.ts create mode 100644 sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/index.ts create mode 100644 sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/profiles.ts create mode 100644 sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/trafficManagerUserMetricsKeys.ts delete mode 100644 sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClientContext.ts create mode 100644 sdk/trafficmanager/arm-trafficmanager/test/sampleTest.ts create mode 100644 sdk/trafficmanager/ci.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 6cf0e93679e3..008165754909 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -65,6 +65,7 @@ specifiers: '@rush-temp/arm-storage': file:./projects/arm-storage.tgz '@rush-temp/arm-streamanalytics': file:./projects/arm-streamanalytics.tgz '@rush-temp/arm-templatespecs': file:./projects/arm-templatespecs.tgz + '@rush-temp/arm-trafficmanager': file:./projects/arm-trafficmanager.tgz '@rush-temp/arm-videoanalyzer': file:./projects/arm-videoanalyzer.tgz '@rush-temp/arm-webpubsub': file:./projects/arm-webpubsub.tgz '@rush-temp/attestation': file:./projects/attestation.tgz @@ -234,6 +235,7 @@ dependencies: '@rush-temp/arm-storage': file:projects/arm-storage.tgz '@rush-temp/arm-streamanalytics': file:projects/arm-streamanalytics.tgz '@rush-temp/arm-templatespecs': file:projects/arm-templatespecs.tgz + '@rush-temp/arm-trafficmanager': file:projects/arm-trafficmanager.tgz '@rush-temp/arm-videoanalyzer': file:projects/arm-videoanalyzer.tgz '@rush-temp/arm-webpubsub': file:projects/arm-webpubsub.tgz '@rush-temp/attestation': file:projects/attestation.tgz @@ -8648,7 +8650,7 @@ packages: dev: false file:projects/app-configuration.tgz: - resolution: {integrity: sha512-HBZl2EancfACeRLK2hWk+nCAgXrptXnS9hX5E5SLleYzlPHovsJRBWf3bv0NopaHCgFPdRcAw5xwKa1C2tPz2g==, tarball: file:projects/app-configuration.tgz} + resolution: {integrity: sha512-h9nLQwnEqw1OjRBrG2YmgFUD/wOCQe+fC+/45l/Kpeh2QBkLKXeJslgi5fme0YsUC0wmSsZqYaQZtn9mOCLjlw==, tarball: file:projects/app-configuration.tgz} name: '@rush-temp/app-configuration' version: 0.0.0 dependencies: @@ -9122,7 +9124,7 @@ packages: dev: false file:projects/arm-eventhub.tgz: - resolution: {integrity: sha512-u7elK+VQEh/PpmETDYomvdkwVxKVjIPOb6dELGwpNB2cuTV0/nkZUEKeWux+36A8Lhwo5Lyc/XAkKWWlLixwWw==, tarball: file:projects/arm-eventhub.tgz} + resolution: {integrity: sha512-cWryEMqcziFmqSkDI9ZMhEhjBmX3UEdauByCW1fFHAJ9XGHISFxr8jpJ1hKOj+c6mbp5JBD0UIU2MyceWk/OMg==, tarball: file:projects/arm-eventhub.tgz} name: '@rush-temp/arm-eventhub' version: 0.0.0 dependencies: @@ -9870,6 +9872,27 @@ packages: uglify-js: 3.14.3 dev: false + file:projects/arm-trafficmanager.tgz: + resolution: {integrity: sha512-4AhyXl0S9pSYXRlBbLSnLPPKjjWfk+3kl1FDlLc8LmzAPYLu2a4iujXke+pgli0zvZTX5ym5EVmMmhVX2JVwsA==, tarball: file:projects/arm-trafficmanager.tgz} + name: '@rush-temp/arm-trafficmanager' + 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-videoanalyzer.tgz: resolution: {integrity: sha512-85e/n7OPI5a3aJ4G7QuGI/q0ezQ+2wH6hySHj1oplCEvz6Lfvz2nEwfsQzXPjzxoIjhn/wrd/D0B0ah5M06HwQ==, tarball: file:projects/arm-videoanalyzer.tgz} name: '@rush-temp/arm-videoanalyzer' diff --git a/rush.json b/rush.json index a7e20ebf1c9d..25d9af4d33b5 100644 --- a/rush.json +++ b/rush.json @@ -1155,6 +1155,11 @@ "packageName": "@azure/arm-loadtestservice", "projectFolder": "sdk/loadtestservice/arm-loadtestservice", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-trafficmanager", + "projectFolder": "sdk/trafficmanager/arm-trafficmanager", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/trafficmanager/arm-trafficmanager/CHANGELOG.md b/sdk/trafficmanager/arm-trafficmanager/CHANGELOG.md new file mode 100644 index 000000000000..9b8c085c34ba --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 6.0.0 (2021-12-10) + +The package of @azure/arm-trafficmanager is using our next generation design principles since version 6.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/trafficmanager/arm-trafficmanager/LICENSE.txt b/sdk/trafficmanager/arm-trafficmanager/LICENSE similarity index 99% rename from sdk/trafficmanager/arm-trafficmanager/LICENSE.txt rename to sdk/trafficmanager/arm-trafficmanager/LICENSE index 2d3163745319..ccb63b166732 100644 --- a/sdk/trafficmanager/arm-trafficmanager/LICENSE.txt +++ b/sdk/trafficmanager/arm-trafficmanager/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/trafficmanager/arm-trafficmanager/README.md b/sdk/trafficmanager/arm-trafficmanager/README.md index 72d87a5e5739..ac5087c55539 100644 --- a/sdk/trafficmanager/arm-trafficmanager/README.md +++ b/sdk/trafficmanager/arm-trafficmanager/README.md @@ -1,114 +1,98 @@ -## Azure TrafficManagerManagementClient SDK for JavaScript +# Azure TrafficManagerManagement client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for TrafficManagerManagementClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure TrafficManagerManagement client. + + + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/trafficmanager/arm-trafficmanager) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-trafficmanager) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-trafficmanager) | +[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-trafficmanager` package -To use this SDK in your project, you will need to install two packages. -- `@azure/arm-trafficmanager` that contains the client. -- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory. +Install the Azure TrafficManagerManagement client library for JavaScript with `npm`: -Install both packages using the below command: ```bash -npm install --save @azure/arm-trafficmanager @azure/identity +npm install @azure/arm-trafficmanager ``` -> **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. -### How to use +### Create and authenticate a `TrafficManagerManagementClient` -- 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 create a client object to access the Azure TrafficManagerManagement API, you will need the `endpoint` of your Azure TrafficManagerManagement resource and a `credential`. The Azure TrafficManagerManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure TrafficManagerManagement resource in the [Azure Portal][azure_portal]. -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. -#### nodejs - Authentication, client creation, and get endpoints as an example written in JavaScript. +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). -##### Sample code +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure TrafficManagerManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript -const { DefaultAzureCredential } = require("@azure/identity"); const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager"); -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 TrafficManagerManagementClient(creds, subscriptionId); -const resourceGroupName = "testresourceGroupName"; -const profileName = "testprofileName"; -const endpointType = "testendpointType"; -const endpointName = "testendpointName"; -client.endpoints.get(resourceGroupName, profileName, endpointType, endpointName).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 TrafficManagerManagementClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation, and get endpoints 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-trafficmanager 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 + +### TrafficManagerManagementClient + +`TrafficManagerManagementClient` is the primary interface for developers using the Azure TrafficManagerManagement client library. Explore the methods on this client object to understand the different features of the Azure TrafficManagerManagement 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%2Ftrafficmanager%2Farm-trafficmanager%2FREADME.png) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/trafficmanager/arm-trafficmanager/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/trafficmanager/arm-trafficmanager/_meta.json b/sdk/trafficmanager/arm-trafficmanager/_meta.json new file mode 100644 index 000000000000..3a4ab57887f1 --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "4cda81c5daed78441aa8043dd32ae00b02899c36", + "readme": "specification/trafficmanager/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/trafficmanager/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/trafficmanager/arm-trafficmanager/api-extractor.json b/sdk/trafficmanager/arm-trafficmanager/api-extractor.json new file mode 100644 index 000000000000..25d68fac86b4 --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/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-trafficmanager.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/trafficmanager/arm-trafficmanager/package.json b/sdk/trafficmanager/arm-trafficmanager/package.json index 41b4ac47a42a..439e74eb54b2 100644 --- a/sdk/trafficmanager/arm-trafficmanager/package.json +++ b/sdk/trafficmanager/arm-trafficmanager/package.json @@ -1,58 +1,89 @@ { "name": "@azure/arm-trafficmanager", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "TrafficManagerManagementClient Library with typescript type definitions for node.js and browser.", - "version": "5.1.0", + "description": "A generated SDK for TrafficManagerManagementClient.", + "version": "6.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-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-trafficmanager.js", - "module": "./esm/trafficManagerManagementClient.js", - "types": "./esm/trafficManagerManagementClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-trafficmanager.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/trafficmanager/arm-trafficmanager", "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-trafficmanager.js.map'\" -o ./dist/arm-trafficmanager.min.js ./dist/arm-trafficmanager.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/trafficmanager/arm-trafficmanager/review/arm-trafficmanager.api.md b/sdk/trafficmanager/arm-trafficmanager/review/arm-trafficmanager.api.md new file mode 100644 index 000000000000..c5c62e2ebcbe --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/review/arm-trafficmanager.api.md @@ -0,0 +1,483 @@ +## API Report File for "@azure/arm-trafficmanager" + +> 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'; + +// @public +export type AllowedEndpointRecordType = string; + +// @public +export interface CheckTrafficManagerRelativeDnsNameAvailabilityParameters { + name?: string; + type?: string; +} + +// @public +export interface CloudError { + error?: CloudErrorBody; +} + +// @public +export interface CloudErrorBody { + code?: string; + details?: CloudErrorBody[]; + message?: string; + target?: string; +} + +// @public +export interface DeleteOperationResult { + readonly operationResult?: boolean; +} + +// @public +export interface DnsConfig { + readonly fqdn?: string; + relativeName?: string; + ttl?: number; +} + +// @public +export type Endpoint = ProxyResource & { + targetResourceId?: string; + target?: string; + endpointStatus?: EndpointStatus; + weight?: number; + priority?: number; + endpointLocation?: string; + endpointMonitorStatus?: EndpointMonitorStatus; + minChildEndpoints?: number; + minChildEndpointsIPv4?: number; + minChildEndpointsIPv6?: number; + geoMapping?: string[]; + subnets?: EndpointPropertiesSubnetsItem[]; + customHeaders?: EndpointPropertiesCustomHeadersItem[]; +}; + +// @public +export type EndpointMonitorStatus = string; + +// @public +export interface EndpointPropertiesCustomHeadersItem { + name?: string; + value?: string; +} + +// @public +export interface EndpointPropertiesSubnetsItem { + first?: string; + last?: string; + scope?: number; +} + +// @public +export interface Endpoints { + createOrUpdate(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Endpoint, options?: EndpointsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, options?: EndpointsDeleteOptionalParams): Promise; + get(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, options?: EndpointsGetOptionalParams): Promise; + update(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Endpoint, options?: EndpointsUpdateOptionalParams): Promise; +} + +// @public +export interface EndpointsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsCreateOrUpdateResponse = Endpoint; + +// @public +export interface EndpointsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsDeleteResponse = DeleteOperationResult; + +// @public +export interface EndpointsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsGetResponse = Endpoint; + +// @public +export type EndpointStatus = string; + +// @public +export interface EndpointsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsUpdateResponse = Endpoint; + +// @public +export interface GeographicHierarchies { + getDefault(options?: GeographicHierarchiesGetDefaultOptionalParams): Promise; +} + +// @public +export interface GeographicHierarchiesGetDefaultOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GeographicHierarchiesGetDefaultResponse = TrafficManagerGeographicHierarchy; + +// @public +export interface HeatMap { + get(resourceGroupName: string, profileName: string, options?: HeatMapGetOptionalParams): Promise; +} + +// @public +export interface HeatMapEndpoint { + endpointId?: number; + resourceId?: string; +} + +// @public +export interface HeatMapGetOptionalParams extends coreClient.OperationOptions { + botRight?: number[]; + topLeft?: number[]; +} + +// @public +export type HeatMapGetResponse = HeatMapModel; + +// @public +export type HeatMapModel = ProxyResource & { + startTime?: Date; + endTime?: Date; + endpoints?: HeatMapEndpoint[]; + trafficFlows?: TrafficFlow[]; +}; + +// @public +export enum KnownAllowedEndpointRecordType { + // (undocumented) + Any = "Any", + // (undocumented) + DomainName = "DomainName", + // (undocumented) + IPv4Address = "IPv4Address", + // (undocumented) + IPv6Address = "IPv6Address" +} + +// @public +export enum KnownEndpointMonitorStatus { + // (undocumented) + CheckingEndpoint = "CheckingEndpoint", + // (undocumented) + Degraded = "Degraded", + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Inactive = "Inactive", + // (undocumented) + Online = "Online", + // (undocumented) + Stopped = "Stopped" +} + +// @public +export enum KnownEndpointStatus { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public +export enum KnownMonitorProtocol { + // (undocumented) + Http = "HTTP", + // (undocumented) + Https = "HTTPS", + // (undocumented) + TCP = "TCP" +} + +// @public +export enum KnownProfileMonitorStatus { + // (undocumented) + CheckingEndpoints = "CheckingEndpoints", + // (undocumented) + Degraded = "Degraded", + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Inactive = "Inactive", + // (undocumented) + Online = "Online" +} + +// @public +export enum KnownProfileStatus { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public +export enum KnownTrafficRoutingMethod { + // (undocumented) + Geographic = "Geographic", + // (undocumented) + MultiValue = "MultiValue", + // (undocumented) + Performance = "Performance", + // (undocumented) + Priority = "Priority", + // (undocumented) + Subnet = "Subnet", + // (undocumented) + Weighted = "Weighted" +} + +// @public +export enum KnownTrafficViewEnrollmentStatus { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public +export interface MonitorConfig { + customHeaders?: MonitorConfigCustomHeadersItem[]; + expectedStatusCodeRanges?: MonitorConfigExpectedStatusCodeRangesItem[]; + intervalInSeconds?: number; + path?: string; + port?: number; + profileMonitorStatus?: ProfileMonitorStatus; + protocol?: MonitorProtocol; + timeoutInSeconds?: number; + toleratedNumberOfFailures?: number; +} + +// @public +export interface MonitorConfigCustomHeadersItem { + name?: string; + value?: string; +} + +// @public +export interface MonitorConfigExpectedStatusCodeRangesItem { + max?: number; + min?: number; +} + +// @public +export type MonitorProtocol = string; + +// @public +export type Profile = TrackedResource & { + profileStatus?: ProfileStatus; + trafficRoutingMethod?: TrafficRoutingMethod; + dnsConfig?: DnsConfig; + monitorConfig?: MonitorConfig; + endpoints?: Endpoint[]; + trafficViewEnrollmentStatus?: TrafficViewEnrollmentStatus; + allowedEndpointRecordTypes?: AllowedEndpointRecordType[]; + maxReturn?: number; +}; + +// @public +export interface ProfileListResult { + value?: Profile[]; +} + +// @public +export type ProfileMonitorStatus = string; + +// @public +export interface Profiles { + checkTrafficManagerRelativeDnsNameAvailability(parameters: CheckTrafficManagerRelativeDnsNameAvailabilityParameters, options?: ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityOptionalParams): Promise; + createOrUpdate(resourceGroupName: string, profileName: string, parameters: Profile, options?: ProfilesCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, profileName: string, options?: ProfilesDeleteOptionalParams): Promise; + get(resourceGroupName: string, profileName: string, options?: ProfilesGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: ProfilesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: ProfilesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, profileName: string, parameters: Profile, options?: ProfilesUpdateOptionalParams): Promise; +} + +// @public +export interface ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityResponse = TrafficManagerNameAvailability; + +// @public +export interface ProfilesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProfilesCreateOrUpdateResponse = Profile; + +// @public +export interface ProfilesDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProfilesDeleteResponse = DeleteOperationResult; + +// @public +export interface ProfilesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProfilesGetResponse = Profile; + +// @public +export interface ProfilesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProfilesListByResourceGroupResponse = ProfileListResult; + +// @public +export interface ProfilesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProfilesListBySubscriptionResponse = ProfileListResult; + +// @public +export type ProfileStatus = string; + +// @public +export interface ProfilesUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProfilesUpdateResponse = Profile; + +// @public +export type ProxyResource = Resource & {}; + +// @public +export interface QueryExperience { + endpointId: number; + latency?: number; + queryCount: number; +} + +// @public +export interface Region { + code?: string; + name?: string; + regions?: Region[]; +} + +// @public +export interface Resource { + id?: string; + name?: string; + type?: string; +} + +// @public +export type TrackedResource = Resource & { + tags?: { + [propertyName: string]: string; + }; + location?: string; +}; + +// @public +export interface TrafficFlow { + latitude?: number; + longitude?: number; + queryExperiences?: QueryExperience[]; + sourceIp?: string; +} + +// @public +export type TrafficManagerGeographicHierarchy = ProxyResource & { + geographicHierarchy?: Region; +}; + +// @public (undocumented) +export class TrafficManagerManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: TrafficManagerManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + endpoints: Endpoints; + // (undocumented) + geographicHierarchies: GeographicHierarchies; + // (undocumented) + heatMap: HeatMap; + // (undocumented) + profiles: Profiles; + // (undocumented) + subscriptionId: string; + // (undocumented) + trafficManagerUserMetricsKeys: TrafficManagerUserMetricsKeys; +} + +// @public +export interface TrafficManagerManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface TrafficManagerNameAvailability { + message?: string; + name?: string; + nameAvailable?: boolean; + reason?: string; + type?: string; +} + +// @public +export interface TrafficManagerUserMetricsKeys { + createOrUpdate(options?: TrafficManagerUserMetricsKeysCreateOrUpdateOptionalParams): Promise; + delete(options?: TrafficManagerUserMetricsKeysDeleteOptionalParams): Promise; + get(options?: TrafficManagerUserMetricsKeysGetOptionalParams): Promise; +} + +// @public +export interface TrafficManagerUserMetricsKeysCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TrafficManagerUserMetricsKeysCreateOrUpdateResponse = UserMetricsModel; + +// @public +export interface TrafficManagerUserMetricsKeysDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TrafficManagerUserMetricsKeysDeleteResponse = DeleteOperationResult; + +// @public +export interface TrafficManagerUserMetricsKeysGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TrafficManagerUserMetricsKeysGetResponse = UserMetricsModel; + +// @public +export type TrafficRoutingMethod = string; + +// @public +export type TrafficViewEnrollmentStatus = string; + +// @public +export type UserMetricsModel = ProxyResource & { + key?: string; +}; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/trafficmanager/arm-trafficmanager/rollup.config.js b/sdk/trafficmanager/arm-trafficmanager/rollup.config.js index 164228bd9fad..9be1955eb7f1 100644 --- a/sdk/trafficmanager/arm-trafficmanager/rollup.config.js +++ b/sdk/trafficmanager/arm-trafficmanager/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/trafficManagerManagementClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-trafficmanager.js", - format: "umd", - name: "Azure.ArmTrafficmanager", - 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/trafficmanager/arm-trafficmanager/src/index.ts b/sdk/trafficmanager/arm-trafficmanager/src/index.ts new file mode 100644 index 000000000000..23f35fce0f97 --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/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 { TrafficManagerManagementClient } from "./trafficManagerManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/endpointsMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/endpointsMappers.ts deleted file mode 100644 index a13fdcfe3a69..000000000000 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/endpointsMappers.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, - CloudError, - DeleteOperationResult, - DnsConfig, - Endpoint, - EndpointPropertiesCustomHeadersItem, - EndpointPropertiesSubnetsItem, - HeatMapEndpoint, - HeatMapModel, - MonitorConfig, - MonitorConfigCustomHeadersItem, - MonitorConfigExpectedStatusCodeRangesItem, - Profile, - ProxyResource, - QueryExperience, - Region, - Resource, - TrackedResource, - TrafficFlow, - TrafficManagerGeographicHierarchy, - UserMetricsModel -} from "../models/mappers"; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/geographicHierarchiesMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/geographicHierarchiesMappers.ts deleted file mode 100644 index 509feee44585..000000000000 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/geographicHierarchiesMappers.ts +++ /dev/null @@ -1,30 +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, - CloudError, - DnsConfig, - Endpoint, - EndpointPropertiesCustomHeadersItem, - EndpointPropertiesSubnetsItem, - HeatMapEndpoint, - HeatMapModel, - MonitorConfig, - MonitorConfigCustomHeadersItem, - MonitorConfigExpectedStatusCodeRangesItem, - Profile, - ProxyResource, - QueryExperience, - Region, - Resource, - TrackedResource, - TrafficFlow, - TrafficManagerGeographicHierarchy, - UserMetricsModel -} from "../models/mappers"; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/heatMapMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/heatMapMappers.ts deleted file mode 100644 index 509feee44585..000000000000 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/heatMapMappers.ts +++ /dev/null @@ -1,30 +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, - CloudError, - DnsConfig, - Endpoint, - EndpointPropertiesCustomHeadersItem, - EndpointPropertiesSubnetsItem, - HeatMapEndpoint, - HeatMapModel, - MonitorConfig, - MonitorConfigCustomHeadersItem, - MonitorConfigExpectedStatusCodeRangesItem, - Profile, - ProxyResource, - QueryExperience, - Region, - Resource, - TrackedResource, - TrafficFlow, - TrafficManagerGeographicHierarchy, - UserMetricsModel -} from "../models/mappers"; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/index.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/index.ts index 33650bcd99cf..b9c43f08be28 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/index.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/index.ts @@ -6,877 +6,546 @@ * 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 }; - -/** - * The result of the request or operation. - */ -export interface DeleteOperationResult { - /** - * The result of the operation or request. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly operationResult?: boolean; -} - -/** - * Subnet first address, scope, and/or last address. - */ +/** Subnet first address, scope, and/or last address. */ export interface EndpointPropertiesSubnetsItem { - /** - * First address in the subnet. - */ + /** First address in the subnet. */ first?: string; - /** - * Last address in the subnet. - */ + /** Last address in the subnet. */ last?: string; - /** - * Block size (number of leading bits in the subnet mask). - */ + /** Block size (number of leading bits in the subnet mask). */ scope?: number; } -/** - * Custom header name and value. - */ +/** Custom header name and value. */ export interface EndpointPropertiesCustomHeadersItem { - /** - * Header name. - */ + /** Header name. */ name?: string; - /** - * Header value. - */ + /** Header value. */ value?: string; } -/** - * Class which is a sparse representation of a Traffic Manager endpoint. - */ -export interface HeatMapEndpoint { - /** - * The ARM Resource ID of this Traffic Manager endpoint. - */ - resourceId?: string; - /** - * A number uniquely identifying this endpoint in query experiences. - */ - endpointId?: number; -} - -/** - * Class representing a Traffic Manager HeatMap query experience properties. - */ -export interface QueryExperience { - /** - * The id of the endpoint from the 'endpoints' array which these queries were routed to. - */ - endpointId: number; - /** - * The number of queries originating from this location. - */ - queryCount: number; - /** - * The latency experienced by queries originating from this location. - */ - latency?: number; -} - -/** - * Class representing a Traffic Manager HeatMap traffic flow properties. - */ -export interface TrafficFlow { - /** - * The IP address that this query experience originated from. - */ - sourceIp?: string; - /** - * The approximate latitude that these queries originated from. - */ - latitude?: number; - /** - * The approximate longitude that these queries originated from. - */ - longitude?: number; - /** - * The query experiences produced in this HeatMap calculation. - */ - queryExperiences?: QueryExperience[]; -} - -/** - * The core properties of ARM resources - */ -export interface Resource extends BaseResource { - /** - * Fully qualified resource Id for the resource. Ex - - * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} - */ +/** The core properties of ARM resources */ +export interface Resource { + /** Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} */ id?: string; - /** - * The name of the resource - */ + /** The name of the resource */ name?: string; - /** - * The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - */ + /** The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. */ type?: string; } -/** - * The resource model definition for a ARM proxy resource. It will have everything other than - * required location and tags - */ -export interface ProxyResource extends Resource { +/** An error returned by the Azure Resource Manager */ +export interface CloudError { + /** The content of the error. */ + error?: CloudErrorBody; } -/** - * Class representing a Traffic Manager HeatMap. - */ -export interface HeatMapModel extends ProxyResource { - /** - * The beginning of the time window for this HeatMap, inclusive. - */ - startTime?: Date; - /** - * The ending of the time window for this HeatMap, exclusive. - */ - endTime?: Date; - /** - * The endpoints used in this HeatMap calculation. - */ - endpoints?: HeatMapEndpoint[]; - /** - * The traffic flows produced in this HeatMap calculation. - */ - trafficFlows?: TrafficFlow[]; +/** The content of an error returned by the Azure Resource Manager */ +export interface CloudErrorBody { + /** Error code */ + code?: string; + /** Error message */ + message?: string; + /** Error target */ + target?: string; + /** Error details */ + details?: CloudErrorBody[]; } -/** - * Class representing Traffic Manager User Metrics. - */ -export interface UserMetricsModel extends ProxyResource { +/** The result of the request or operation. */ +export interface DeleteOperationResult { /** - * The key returned by the User Metrics operation. + * The result of the operation or request. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - key?: string; + readonly operationResult?: boolean; } -/** - * Class representing a Traffic Manager endpoint. - */ -export interface Endpoint extends ProxyResource { - /** - * The Azure Resource URI of the of the endpoint. Not applicable to endpoints of type - * 'ExternalEndpoints'. - */ - targetResourceId?: string; - /** - * The fully-qualified DNS name or IP address of the endpoint. Traffic Manager returns this value - * in DNS responses to direct traffic to this endpoint. - */ - target?: string; - /** - * The status of the endpoint. If the endpoint is Enabled, it is probed for endpoint health and - * is included in the traffic routing method. Possible values include: 'Enabled', 'Disabled' - */ - endpointStatus?: EndpointStatus; - /** - * The weight of this endpoint when using the 'Weighted' traffic routing method. Possible values - * are from 1 to 1000. - */ - weight?: number; - /** - * The priority of this endpoint when using the 'Priority' traffic routing method. Possible - * values are from 1 to 1000, lower values represent higher priority. This is an optional - * parameter. If specified, it must be specified on all endpoints, and no two endpoints can - * share the same priority value. - */ - priority?: number; - /** - * Specifies the location of the external or nested endpoints when using the 'Performance' - * traffic routing method. - */ - endpointLocation?: string; - /** - * The monitoring status of the endpoint. Possible values include: 'CheckingEndpoint', 'Online', - * 'Degraded', 'Disabled', 'Inactive', 'Stopped' - */ - endpointMonitorStatus?: EndpointMonitorStatus; - /** - * The minimum number of endpoints that must be available in the child profile in order for the - * parent profile to be considered available. Only applicable to endpoint of type - * 'NestedEndpoints'. - */ - minChildEndpoints?: number; - /** - * The minimum number of IPv4 (DNS record type A) endpoints that must be available in the child - * profile in order for the parent profile to be considered available. Only applicable to - * endpoint of type 'NestedEndpoints'. - */ - minChildEndpointsIPv4?: number; - /** - * The minimum number of IPv6 (DNS record type AAAA) endpoints that must be available in the - * child profile in order for the parent profile to be considered available. Only applicable to - * endpoint of type 'NestedEndpoints'. - */ - minChildEndpointsIPv6?: number; - /** - * The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic - * routing method. Please consult Traffic Manager Geographic documentation for a full list of - * accepted values. - */ - geoMapping?: string[]; - /** - * The list of subnets, IP addresses, and/or address ranges mapped to this endpoint when using - * the 'Subnet' traffic routing method. An empty list will match all ranges not covered by other - * endpoints. - */ - subnets?: EndpointPropertiesSubnetsItem[]; - /** - * List of custom headers. - */ - customHeaders?: EndpointPropertiesCustomHeadersItem[]; +/** Parameters supplied to check Traffic Manager name operation. */ +export interface CheckTrafficManagerRelativeDnsNameAvailabilityParameters { + /** The name of the resource. */ + name?: string; + /** The type of the resource. */ + type?: string; } -/** - * Parameters supplied to check Traffic Manager name operation. - */ -export interface CheckTrafficManagerRelativeDnsNameAvailabilityParameters { - /** - * The name of the resource. - */ +/** Class representing a Traffic Manager Name Availability response. */ +export interface TrafficManagerNameAvailability { + /** The relative name. */ name?: string; - /** - * The type of the resource. - */ + /** Traffic Manager profile resource type. */ type?: string; + /** Describes whether the relative name is available or not. */ + nameAvailable?: boolean; + /** The reason why the name is not available, when applicable. */ + reason?: string; + /** Descriptive message that explains why the name is not available, when applicable. */ + message?: string; } -/** - * Class containing DNS settings in a Traffic Manager profile. - */ +/** The list Traffic Manager profiles operation response. */ +export interface ProfileListResult { + /** Gets the list of Traffic manager profiles. */ + value?: Profile[]; +} + +/** Class containing DNS settings in a Traffic Manager profile. */ export interface DnsConfig { - /** - * The relative DNS name provided by this Traffic Manager profile. This value is combined with - * the DNS domain name used by Azure Traffic Manager to form the fully-qualified domain name - * (FQDN) of the profile. - */ + /** The relative DNS name provided by this Traffic Manager profile. This value is combined with the DNS domain name used by Azure Traffic Manager to form the fully-qualified domain name (FQDN) of the profile. */ relativeName?: string; /** - * The fully-qualified domain name (FQDN) of the Traffic Manager profile. This is formed from the - * concatenation of the RelativeName with the DNS domain used by Azure Traffic Manager. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The fully-qualified domain name (FQDN) of the Traffic Manager profile. This is formed from the concatenation of the RelativeName with the DNS domain used by Azure Traffic Manager. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly fqdn?: string; - /** - * The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and DNS clients - * how long to cache DNS responses provided by this Traffic Manager profile. - */ + /** The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and DNS clients how long to cache DNS responses provided by this Traffic Manager profile. */ ttl?: number; } -/** - * Custom header name and value. - */ -export interface MonitorConfigCustomHeadersItem { - /** - * Header name. - */ - name?: string; - /** - * Header value. - */ - value?: string; -} - -/** - * Min and max value of a status code range. - */ -export interface MonitorConfigExpectedStatusCodeRangesItem { - /** - * Min status code. - */ - min?: number; - /** - * Max status code. - */ - max?: number; -} - -/** - * Class containing endpoint monitoring settings in a Traffic Manager profile. - */ +/** Class containing endpoint monitoring settings in a Traffic Manager profile. */ export interface MonitorConfig { - /** - * The profile-level monitoring status of the Traffic Manager profile. Possible values include: - * 'CheckingEndpoints', 'Online', 'Degraded', 'Disabled', 'Inactive' - */ + /** The profile-level monitoring status of the Traffic Manager profile. */ profileMonitorStatus?: ProfileMonitorStatus; - /** - * The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. Possible values include: - * 'HTTP', 'HTTPS', 'TCP' - */ + /** The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. */ protocol?: MonitorProtocol; - /** - * The TCP port used to probe for endpoint health. - */ + /** The TCP port used to probe for endpoint health. */ port?: number; - /** - * The path relative to the endpoint domain name used to probe for endpoint health. - */ + /** The path relative to the endpoint domain name used to probe for endpoint health. */ path?: string; - /** - * The monitor interval for endpoints in this profile. This is the interval at which Traffic - * Manager will check the health of each endpoint in this profile. - */ + /** The monitor interval for endpoints in this profile. This is the interval at which Traffic Manager will check the health of each endpoint in this profile. */ intervalInSeconds?: number; - /** - * The monitor timeout for endpoints in this profile. This is the time that Traffic Manager - * allows endpoints in this profile to response to the health check. - */ + /** The monitor timeout for endpoints in this profile. This is the time that Traffic Manager allows endpoints in this profile to response to the health check. */ timeoutInSeconds?: number; - /** - * The number of consecutive failed health check that Traffic Manager tolerates before declaring - * an endpoint in this profile Degraded after the next failed health check. - */ + /** The number of consecutive failed health check that Traffic Manager tolerates before declaring an endpoint in this profile Degraded after the next failed health check. */ toleratedNumberOfFailures?: number; - /** - * List of custom headers. - */ + /** List of custom headers. */ customHeaders?: MonitorConfigCustomHeadersItem[]; - /** - * List of expected status code ranges. - */ + /** List of expected status code ranges. */ expectedStatusCodeRanges?: MonitorConfigExpectedStatusCodeRangesItem[]; } -/** - * The resource model definition for a ARM tracked top level resource - */ -export interface TrackedResource extends Resource { - /** - * Resource tags. - */ +/** Custom header name and value. */ +export interface MonitorConfigCustomHeadersItem { + /** Header name. */ + name?: string; + /** Header value. */ + value?: string; +} + +/** Min and max value of a status code range. */ +export interface MonitorConfigExpectedStatusCodeRangesItem { + /** Min status code. */ + min?: number; + /** Max status code. */ + max?: number; +} + +/** Class representing a region in the Geographic hierarchy used with the Geographic traffic routing method. */ +export interface Region { + /** The code of the region */ + code?: string; + /** The name of the region */ + name?: string; + /** The list of Regions grouped under this Region in the Geographic Hierarchy. */ + regions?: Region[]; +} + +/** Class which is a sparse representation of a Traffic Manager endpoint. */ +export interface HeatMapEndpoint { + /** The ARM Resource ID of this Traffic Manager endpoint. */ + resourceId?: string; + /** A number uniquely identifying this endpoint in query experiences. */ + endpointId?: number; +} + +/** Class representing a Traffic Manager HeatMap traffic flow properties. */ +export interface TrafficFlow { + /** The IP address that this query experience originated from. */ + sourceIp?: string; + /** The approximate latitude that these queries originated from. */ + latitude?: number; + /** The approximate longitude that these queries originated from. */ + longitude?: number; + /** The query experiences produced in this HeatMap calculation. */ + queryExperiences?: QueryExperience[]; +} + +/** Class representing a Traffic Manager HeatMap query experience properties. */ +export interface QueryExperience { + /** The id of the endpoint from the 'endpoints' array which these queries were routed to. */ + endpointId: number; + /** The number of queries originating from this location. */ + queryCount: number; + /** The latency experienced by queries originating from this location. */ + latency?: number; +} + +/** The resource model definition for a ARM proxy resource. It will have everything other than required location and tags */ +export type ProxyResource = Resource & {}; + +/** The resource model definition for a ARM tracked top level resource */ +export type TrackedResource = Resource & { + /** Resource tags. */ tags?: { [propertyName: string]: string }; - /** - * The Azure Region where the resource lives - */ + /** The Azure Region where the resource lives */ location?: string; -} +}; -/** - * Class representing a Traffic Manager profile. - */ -export interface Profile extends TrackedResource { - /** - * The status of the Traffic Manager profile. Possible values include: 'Enabled', 'Disabled' - */ +/** Class representing a Traffic Manager endpoint. */ +export type Endpoint = ProxyResource & { + /** The Azure Resource URI of the of the endpoint. Not applicable to endpoints of type 'ExternalEndpoints'. */ + targetResourceId?: string; + /** The fully-qualified DNS name or IP address of the endpoint. Traffic Manager returns this value in DNS responses to direct traffic to this endpoint. */ + target?: string; + /** The status of the endpoint. If the endpoint is Enabled, it is probed for endpoint health and is included in the traffic routing method. */ + endpointStatus?: EndpointStatus; + /** The weight of this endpoint when using the 'Weighted' traffic routing method. Possible values are from 1 to 1000. */ + weight?: number; + /** The priority of this endpoint when using the 'Priority' traffic routing method. Possible values are from 1 to 1000, lower values represent higher priority. This is an optional parameter. If specified, it must be specified on all endpoints, and no two endpoints can share the same priority value. */ + priority?: number; + /** Specifies the location of the external or nested endpoints when using the 'Performance' traffic routing method. */ + endpointLocation?: string; + /** The monitoring status of the endpoint. */ + endpointMonitorStatus?: EndpointMonitorStatus; + /** The minimum number of endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. */ + minChildEndpoints?: number; + /** The minimum number of IPv4 (DNS record type A) endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. */ + minChildEndpointsIPv4?: number; + /** The minimum number of IPv6 (DNS record type AAAA) endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. */ + minChildEndpointsIPv6?: number; + /** The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic routing method. Please consult Traffic Manager Geographic documentation for a full list of accepted values. */ + geoMapping?: string[]; + /** The list of subnets, IP addresses, and/or address ranges mapped to this endpoint when using the 'Subnet' traffic routing method. An empty list will match all ranges not covered by other endpoints. */ + subnets?: EndpointPropertiesSubnetsItem[]; + /** List of custom headers. */ + customHeaders?: EndpointPropertiesCustomHeadersItem[]; +}; + +/** Class representing the Geographic hierarchy used with the Geographic traffic routing method. */ +export type TrafficManagerGeographicHierarchy = ProxyResource & { + /** The region at the root of the hierarchy from all the regions in the hierarchy can be retrieved. */ + geographicHierarchy?: Region; +}; + +/** Class representing a Traffic Manager HeatMap. */ +export type HeatMapModel = ProxyResource & { + /** The beginning of the time window for this HeatMap, inclusive. */ + startTime?: Date; + /** The ending of the time window for this HeatMap, exclusive. */ + endTime?: Date; + /** The endpoints used in this HeatMap calculation. */ + endpoints?: HeatMapEndpoint[]; + /** The traffic flows produced in this HeatMap calculation. */ + trafficFlows?: TrafficFlow[]; +}; + +/** Class representing Traffic Manager User Metrics. */ +export type UserMetricsModel = ProxyResource & { + /** The key returned by the User Metrics operation. */ + key?: string; +}; + +/** Class representing a Traffic Manager profile. */ +export type Profile = TrackedResource & { + /** The status of the Traffic Manager profile. */ profileStatus?: ProfileStatus; - /** - * The traffic routing method of the Traffic Manager profile. Possible values include: - * 'Performance', 'Priority', 'Weighted', 'Geographic', 'MultiValue', 'Subnet' - */ + /** The traffic routing method of the Traffic Manager profile. */ trafficRoutingMethod?: TrafficRoutingMethod; - /** - * The DNS settings of the Traffic Manager profile. - */ + /** The DNS settings of the Traffic Manager profile. */ dnsConfig?: DnsConfig; - /** - * The endpoint monitoring settings of the Traffic Manager profile. - */ + /** The endpoint monitoring settings of the Traffic Manager profile. */ monitorConfig?: MonitorConfig; - /** - * The list of endpoints in the Traffic Manager profile. - */ + /** The list of endpoints in the Traffic Manager profile. */ endpoints?: Endpoint[]; - /** - * Indicates whether Traffic View is 'Enabled' or 'Disabled' for the Traffic Manager profile. - * Null, indicates 'Disabled'. Enabling this feature will increase the cost of the Traffic Manage - * profile. Possible values include: 'Enabled', 'Disabled' - */ + /** Indicates whether Traffic View is 'Enabled' or 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature will increase the cost of the Traffic Manage profile. */ trafficViewEnrollmentStatus?: TrafficViewEnrollmentStatus; - /** - * The list of allowed endpoint record types. - */ + /** The list of allowed endpoint record types. */ allowedEndpointRecordTypes?: AllowedEndpointRecordType[]; - /** - * Maximum number of endpoints to be returned for MultiValue routing type. - */ + /** Maximum number of endpoints to be returned for MultiValue routing type. */ maxReturn?: number; +}; + +/** Known values of {@link EndpointStatus} that the service accepts. */ +export enum KnownEndpointStatus { + Enabled = "Enabled", + Disabled = "Disabled" } /** - * Class representing a Traffic Manager Name Availability response. + * Defines values for EndpointStatus. \ + * {@link KnownEndpointStatus} can be used interchangeably with EndpointStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** */ -export interface TrafficManagerNameAvailability { - /** - * The relative name. - */ - name?: string; - /** - * Traffic Manager profile resource type. - */ - type?: string; - /** - * Describes whether the relative name is available or not. - */ - nameAvailable?: boolean; - /** - * The reason why the name is not available, when applicable. - */ - reason?: string; - /** - * Descriptive message that explains why the name is not available, when applicable. - */ - message?: string; +export type EndpointStatus = string; + +/** Known values of {@link EndpointMonitorStatus} that the service accepts. */ +export enum KnownEndpointMonitorStatus { + CheckingEndpoint = "CheckingEndpoint", + Online = "Online", + Degraded = "Degraded", + Disabled = "Disabled", + Inactive = "Inactive", + Stopped = "Stopped" } /** - * Class representing a region in the Geographic hierarchy used with the Geographic traffic routing - * method. + * Defines values for EndpointMonitorStatus. \ + * {@link KnownEndpointMonitorStatus} can be used interchangeably with EndpointMonitorStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **CheckingEndpoint** \ + * **Online** \ + * **Degraded** \ + * **Disabled** \ + * **Inactive** \ + * **Stopped** */ -export interface Region { - /** - * The code of the region - */ - code?: string; - /** - * The name of the region - */ - name?: string; - /** - * The list of Regions grouped under this Region in the Geographic Hierarchy. - */ - regions?: Region[]; +export type EndpointMonitorStatus = string; + +/** Known values of {@link ProfileStatus} that the service accepts. */ +export enum KnownProfileStatus { + Enabled = "Enabled", + Disabled = "Disabled" } /** - * Class representing the Geographic hierarchy used with the Geographic traffic routing method. + * Defines values for ProfileStatus. \ + * {@link KnownProfileStatus} can be used interchangeably with ProfileStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** */ -export interface TrafficManagerGeographicHierarchy extends ProxyResource { - /** - * The region at the root of the hierarchy from all the regions in the hierarchy can be - * retrieved. - */ - geographicHierarchy?: Region; +export type ProfileStatus = string; + +/** Known values of {@link TrafficRoutingMethod} that the service accepts. */ +export enum KnownTrafficRoutingMethod { + Performance = "Performance", + Priority = "Priority", + Weighted = "Weighted", + Geographic = "Geographic", + MultiValue = "MultiValue", + Subnet = "Subnet" } /** - * Optional Parameters. - */ -export interface HeatMapGetOptionalParams extends msRest.RequestOptionsBase { - /** - * The top left latitude,longitude pair of the rectangular viewport to query for. - */ - topLeft?: number[]; - /** - * The bottom right latitude,longitude pair of the rectangular viewport to query for. - */ - botRight?: number[]; + * Defines values for TrafficRoutingMethod. \ + * {@link KnownTrafficRoutingMethod} can be used interchangeably with TrafficRoutingMethod, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Performance** \ + * **Priority** \ + * **Weighted** \ + * **Geographic** \ + * **MultiValue** \ + * **Subnet** + */ +export type TrafficRoutingMethod = string; + +/** Known values of {@link ProfileMonitorStatus} that the service accepts. */ +export enum KnownProfileMonitorStatus { + CheckingEndpoints = "CheckingEndpoints", + Online = "Online", + Degraded = "Degraded", + Disabled = "Disabled", + Inactive = "Inactive" } /** - * An interface representing TrafficManagerManagementClientOptions. + * Defines values for ProfileMonitorStatus. \ + * {@link KnownProfileMonitorStatus} can be used interchangeably with ProfileMonitorStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **CheckingEndpoints** \ + * **Online** \ + * **Degraded** \ + * **Disabled** \ + * **Inactive** */ -export interface TrafficManagerManagementClientOptions extends AzureServiceClientOptions { - baseUri?: string; +export type ProfileMonitorStatus = string; + +/** Known values of {@link MonitorProtocol} that the service accepts. */ +export enum KnownMonitorProtocol { + Http = "HTTP", + Https = "HTTPS", + TCP = "TCP" } /** - * @interface - * The list Traffic Manager profiles operation response. - * @extends Array + * Defines values for MonitorProtocol. \ + * {@link KnownMonitorProtocol} can be used interchangeably with MonitorProtocol, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **HTTP** \ + * **HTTPS** \ + * **TCP** */ -export interface ProfileListResult extends Array { +export type MonitorProtocol = string; + +/** Known values of {@link TrafficViewEnrollmentStatus} that the service accepts. */ +export enum KnownTrafficViewEnrollmentStatus { + Enabled = "Enabled", + Disabled = "Disabled" } /** - * Defines values for EndpointStatus. - * Possible values include: 'Enabled', 'Disabled' - * @readonly - * @enum {string} + * Defines values for TrafficViewEnrollmentStatus. \ + * {@link KnownTrafficViewEnrollmentStatus} can be used interchangeably with TrafficViewEnrollmentStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** */ -export type EndpointStatus = 'Enabled' | 'Disabled'; +export type TrafficViewEnrollmentStatus = string; -/** - * Defines values for EndpointMonitorStatus. - * Possible values include: 'CheckingEndpoint', 'Online', 'Degraded', 'Disabled', 'Inactive', - * 'Stopped' - * @readonly - * @enum {string} - */ -export type EndpointMonitorStatus = 'CheckingEndpoint' | 'Online' | 'Degraded' | 'Disabled' | 'Inactive' | 'Stopped'; +/** Known values of {@link AllowedEndpointRecordType} that the service accepts. */ +export enum KnownAllowedEndpointRecordType { + DomainName = "DomainName", + IPv4Address = "IPv4Address", + IPv6Address = "IPv6Address", + Any = "Any" +} /** - * Defines values for ProfileMonitorStatus. - * Possible values include: 'CheckingEndpoints', 'Online', 'Degraded', 'Disabled', 'Inactive' - * @readonly - * @enum {string} + * Defines values for AllowedEndpointRecordType. \ + * {@link KnownAllowedEndpointRecordType} can be used interchangeably with AllowedEndpointRecordType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **DomainName** \ + * **IPv4Address** \ + * **IPv6Address** \ + * **Any** */ -export type ProfileMonitorStatus = 'CheckingEndpoints' | 'Online' | 'Degraded' | 'Disabled' | 'Inactive'; +export type AllowedEndpointRecordType = string; -/** - * Defines values for MonitorProtocol. - * Possible values include: 'HTTP', 'HTTPS', 'TCP' - * @readonly - * @enum {string} - */ -export type MonitorProtocol = 'HTTP' | 'HTTPS' | 'TCP'; +/** Optional parameters. */ +export interface EndpointsUpdateOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for ProfileStatus. - * Possible values include: 'Enabled', 'Disabled' - * @readonly - * @enum {string} - */ -export type ProfileStatus = 'Enabled' | 'Disabled'; +/** Contains response data for the update operation. */ +export type EndpointsUpdateResponse = Endpoint; -/** - * Defines values for TrafficRoutingMethod. - * Possible values include: 'Performance', 'Priority', 'Weighted', 'Geographic', 'MultiValue', - * 'Subnet' - * @readonly - * @enum {string} - */ -export type TrafficRoutingMethod = 'Performance' | 'Priority' | 'Weighted' | 'Geographic' | 'MultiValue' | 'Subnet'; +/** Optional parameters. */ +export interface EndpointsGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for TrafficViewEnrollmentStatus. - * Possible values include: 'Enabled', 'Disabled' - * @readonly - * @enum {string} - */ -export type TrafficViewEnrollmentStatus = 'Enabled' | 'Disabled'; +/** Contains response data for the get operation. */ +export type EndpointsGetResponse = Endpoint; -/** - * Defines values for AllowedEndpointRecordType. - * Possible values include: 'DomainName', 'IPv4Address', 'IPv6Address', 'Any' - * @readonly - * @enum {string} - */ -export type AllowedEndpointRecordType = 'DomainName' | 'IPv4Address' | 'IPv6Address' | 'Any'; +/** Optional parameters. */ +export interface EndpointsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the update operation. - */ -export type EndpointsUpdateResponse = Endpoint & { - /** - * 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: Endpoint; - }; -}; +/** Contains response data for the createOrUpdate operation. */ +export type EndpointsCreateOrUpdateResponse = Endpoint; -/** - * Contains response data for the get operation. - */ -export type EndpointsGetResponse = Endpoint & { - /** - * 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: Endpoint; - }; -}; +/** Optional parameters. */ +export interface EndpointsDeleteOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the createOrUpdate operation. - */ -export type EndpointsCreateOrUpdateResponse = Endpoint & { - /** - * 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: Endpoint; - }; -}; +/** Contains response data for the delete operation. */ +export type EndpointsDeleteResponse = DeleteOperationResult; -/** - * Contains response data for the deleteMethod operation. - */ -export type EndpointsDeleteMethodResponse = DeleteOperationResult & { - /** - * 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: DeleteOperationResult; - }; -}; +/** Optional parameters. */ +export interface ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the checkTrafficManagerRelativeDnsNameAvailability operation. - */ -export type ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityResponse = TrafficManagerNameAvailability & { - /** - * 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: TrafficManagerNameAvailability; - }; -}; +/** Contains response data for the checkTrafficManagerRelativeDnsNameAvailability operation. */ +export type ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityResponse = TrafficManagerNameAvailability; -/** - * Contains response data for the listByResourceGroup operation. - */ -export type ProfilesListByResourceGroupResponse = ProfileListResult & { - /** - * 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: ProfileListResult; - }; -}; +/** Optional parameters. */ +export interface ProfilesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listBySubscription operation. - */ -export type ProfilesListBySubscriptionResponse = ProfileListResult & { - /** - * 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: ProfileListResult; - }; -}; +/** Contains response data for the listByResourceGroup operation. */ +export type ProfilesListByResourceGroupResponse = ProfileListResult; -/** - * Contains response data for the get operation. - */ -export type ProfilesGetResponse = Profile & { - /** - * 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: Profile; - }; -}; +/** Optional parameters. */ +export interface ProfilesListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the createOrUpdate operation. - */ -export type ProfilesCreateOrUpdateResponse = Profile & { - /** - * 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: Profile; - }; -}; +/** Contains response data for the listBySubscription operation. */ +export type ProfilesListBySubscriptionResponse = ProfileListResult; -/** - * Contains response data for the deleteMethod operation. - */ -export type ProfilesDeleteMethodResponse = DeleteOperationResult & { - /** - * 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: DeleteOperationResult; - }; -}; +/** Optional parameters. */ +export interface ProfilesGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the update operation. - */ -export type ProfilesUpdateResponse = Profile & { - /** - * 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: Profile; - }; -}; +/** Contains response data for the get operation. */ +export type ProfilesGetResponse = Profile; -/** - * Contains response data for the getDefault operation. - */ -export type GeographicHierarchiesGetDefaultResponse = TrafficManagerGeographicHierarchy & { - /** - * 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: TrafficManagerGeographicHierarchy; - }; -}; +/** Optional parameters. */ +export interface ProfilesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the get operation. - */ -export type HeatMapGetResponse = HeatMapModel & { - /** - * 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: HeatMapModel; - }; -}; +/** Contains response data for the createOrUpdate operation. */ +export type ProfilesCreateOrUpdateResponse = Profile; -/** - * Contains response data for the get operation. - */ -export type TrafficManagerUserMetricsKeysGetResponse = UserMetricsModel & { - /** - * 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: UserMetricsModel; - }; -}; +/** Optional parameters. */ +export interface ProfilesDeleteOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the createOrUpdate operation. - */ -export type TrafficManagerUserMetricsKeysCreateOrUpdateResponse = UserMetricsModel & { - /** - * 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: UserMetricsModel; - }; -}; +/** Contains response data for the delete operation. */ +export type ProfilesDeleteResponse = DeleteOperationResult; -/** - * Contains response data for the deleteMethod operation. - */ -export type TrafficManagerUserMetricsKeysDeleteMethodResponse = DeleteOperationResult & { - /** - * 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: DeleteOperationResult; - }; -}; +/** Optional parameters. */ +export interface ProfilesUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ProfilesUpdateResponse = Profile; + +/** Optional parameters. */ +export interface GeographicHierarchiesGetDefaultOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDefault operation. */ +export type GeographicHierarchiesGetDefaultResponse = TrafficManagerGeographicHierarchy; + +/** Optional parameters. */ +export interface HeatMapGetOptionalParams extends coreClient.OperationOptions { + /** The top left latitude,longitude pair of the rectangular viewport to query for. */ + topLeft?: number[]; + /** The bottom right latitude,longitude pair of the rectangular viewport to query for. */ + botRight?: number[]; +} + +/** Contains response data for the get operation. */ +export type HeatMapGetResponse = HeatMapModel; + +/** Optional parameters. */ +export interface TrafficManagerUserMetricsKeysGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type TrafficManagerUserMetricsKeysGetResponse = UserMetricsModel; + +/** Optional parameters. */ +export interface TrafficManagerUserMetricsKeysCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type TrafficManagerUserMetricsKeysCreateOrUpdateResponse = UserMetricsModel; + +/** Optional parameters. */ +export interface TrafficManagerUserMetricsKeysDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type TrafficManagerUserMetricsKeysDeleteResponse = DeleteOperationResult; + +/** Optional parameters. */ +export interface TrafficManagerManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/mappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/mappers.ts index 530afca7e3c0..00159cc76293 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/mappers.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/mappers.ts @@ -6,31 +6,9 @@ * 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 DeleteOperationResult: msRest.CompositeMapper = { - serializedName: "DeleteOperationResult", - type: { - name: "Composite", - className: "DeleteOperationResult", - modelProperties: { - operationResult: { - readOnly: true, - serializedName: "boolean", - type: { - name: "Boolean" - } - } - } - } -}; - -export const EndpointPropertiesSubnetsItem: msRest.CompositeMapper = { - serializedName: "EndpointProperties_subnetsItem", +export const EndpointPropertiesSubnetsItem: coreClient.CompositeMapper = { type: { name: "Composite", className: "EndpointPropertiesSubnetsItem", @@ -57,8 +35,7 @@ export const EndpointPropertiesSubnetsItem: msRest.CompositeMapper = { } }; -export const EndpointPropertiesCustomHeadersItem: msRest.CompositeMapper = { - serializedName: "EndpointProperties_customHeadersItem", +export const EndpointPropertiesCustomHeadersItem: coreClient.CompositeMapper = { type: { name: "Composite", className: "EndpointPropertiesCustomHeadersItem", @@ -79,90 +56,80 @@ export const EndpointPropertiesCustomHeadersItem: msRest.CompositeMapper = { } }; -export const HeatMapEndpoint: msRest.CompositeMapper = { - serializedName: "HeatMapEndpoint", +export const Resource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "HeatMapEndpoint", + className: "Resource", modelProperties: { - resourceId: { - serializedName: "resourceId", + id: { + serializedName: "id", type: { name: "String" } }, - endpointId: { - serializedName: "endpointId", + name: { + serializedName: "name", type: { - name: "Number" + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" } } } } }; -export const QueryExperience: msRest.CompositeMapper = { - serializedName: "QueryExperience", +export const CloudError: coreClient.CompositeMapper = { type: { name: "Composite", - className: "QueryExperience", + className: "CloudError", modelProperties: { - endpointId: { - required: true, - serializedName: "endpointId", - type: { - name: "Number" - } - }, - queryCount: { - required: true, - serializedName: "queryCount", - type: { - name: "Number" - } - }, - latency: { - serializedName: "latency", + error: { + serializedName: "error", type: { - name: "Number" + name: "Composite", + className: "CloudErrorBody" } } } } }; -export const TrafficFlow: msRest.CompositeMapper = { - serializedName: "TrafficFlow", +export const CloudErrorBody: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TrafficFlow", + className: "CloudErrorBody", modelProperties: { - sourceIp: { - serializedName: "sourceIp", + code: { + serializedName: "code", type: { name: "String" } }, - latitude: { - serializedName: "latitude", + message: { + serializedName: "message", type: { - name: "Number" + name: "String" } }, - longitude: { - serializedName: "longitude", + target: { + serializedName: "target", type: { - name: "Number" + name: "String" } }, - queryExperiences: { - serializedName: "queryExperiences", + details: { + serializedName: "details", type: { name: "Sequence", element: { type: { name: "Composite", - className: "QueryExperience" + className: "CloudErrorBody" } } } @@ -171,18 +138,27 @@ export const TrafficFlow: msRest.CompositeMapper = { } }; -export const Resource: msRest.CompositeMapper = { - serializedName: "Resource", +export const DeleteOperationResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Resource", + className: "DeleteOperationResult", modelProperties: { - id: { - serializedName: "id", + operationResult: { + serializedName: "boolean", + readOnly: true, type: { - name: "String" + name: "Boolean" } - }, + } + } + } +}; + +export const CheckTrafficManagerRelativeDnsNameAvailabilityParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckTrafficManagerRelativeDnsNameAvailabilityParameters", + modelProperties: { name: { serializedName: "name", type: { @@ -199,179 +175,161 @@ export const Resource: msRest.CompositeMapper = { } }; -export const ProxyResource: msRest.CompositeMapper = { - serializedName: "ProxyResource", - type: { - name: "Composite", - className: "ProxyResource", - modelProperties: { - ...Resource.type.modelProperties - } - } -}; - -export const HeatMapModel: msRest.CompositeMapper = { - serializedName: "HeatMapModel", +export const TrafficManagerNameAvailability: coreClient.CompositeMapper = { type: { name: "Composite", - className: "HeatMapModel", + className: "TrafficManagerNameAvailability", modelProperties: { - ...ProxyResource.type.modelProperties, - startTime: { - serializedName: "properties.startTime", + name: { + serializedName: "name", type: { - name: "DateTime" + name: "String" } }, - endTime: { - serializedName: "properties.endTime", + type: { + serializedName: "type", type: { - name: "DateTime" + name: "String" } }, - endpoints: { - serializedName: "properties.endpoints", + nameAvailable: { + serializedName: "nameAvailable", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "HeatMapEndpoint" - } - } + name: "Boolean" } }, - trafficFlows: { - serializedName: "properties.trafficFlows", + reason: { + serializedName: "reason", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "TrafficFlow" - } - } + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" } } } } }; -export const UserMetricsModel: msRest.CompositeMapper = { - serializedName: "UserMetricsModel", +export const ProfileListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "UserMetricsModel", + className: "ProfileListResult", modelProperties: { - ...ProxyResource.type.modelProperties, - key: { - serializedName: "properties.key", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Profile" + } + } } } } } }; -export const Endpoint: msRest.CompositeMapper = { - serializedName: "Endpoint", +export const DnsConfig: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Endpoint", + className: "DnsConfig", modelProperties: { - ...ProxyResource.type.modelProperties, - targetResourceId: { - serializedName: "properties.targetResourceId", - type: { - name: "String" - } - }, - target: { - serializedName: "properties.target", + relativeName: { + serializedName: "relativeName", type: { name: "String" } }, - endpointStatus: { - serializedName: "properties.endpointStatus", + fqdn: { + serializedName: "fqdn", + readOnly: true, type: { name: "String" } }, - weight: { - serializedName: "properties.weight", + ttl: { + serializedName: "ttl", type: { name: "Number" } - }, - priority: { - serializedName: "properties.priority", + } + } + } +}; + +export const MonitorConfig: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitorConfig", + modelProperties: { + profileMonitorStatus: { + serializedName: "profileMonitorStatus", type: { - name: "Number" + name: "String" } }, - endpointLocation: { - serializedName: "properties.endpointLocation", + protocol: { + serializedName: "protocol", type: { name: "String" } }, - endpointMonitorStatus: { - serializedName: "properties.endpointMonitorStatus", + port: { + serializedName: "port", type: { - name: "String" + name: "Number" } }, - minChildEndpoints: { - serializedName: "properties.minChildEndpoints", + path: { + serializedName: "path", type: { - name: "Number" + name: "String" } }, - minChildEndpointsIPv4: { - serializedName: "properties.minChildEndpointsIPv4", + intervalInSeconds: { + serializedName: "intervalInSeconds", type: { name: "Number" } }, - minChildEndpointsIPv6: { - serializedName: "properties.minChildEndpointsIPv6", + timeoutInSeconds: { + serializedName: "timeoutInSeconds", type: { name: "Number" } }, - geoMapping: { - serializedName: "properties.geoMapping", + toleratedNumberOfFailures: { + serializedName: "toleratedNumberOfFailures", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "Number" } }, - subnets: { - serializedName: "properties.subnets", + customHeaders: { + serializedName: "customHeaders", type: { name: "Sequence", element: { type: { name: "Composite", - className: "EndpointPropertiesSubnetsItem" + className: "MonitorConfigCustomHeadersItem" } } } }, - customHeaders: { - serializedName: "properties.customHeaders", + expectedStatusCodeRanges: { + serializedName: "expectedStatusCodeRanges", type: { name: "Sequence", element: { type: { name: "Composite", - className: "EndpointPropertiesCustomHeadersItem" + className: "MonitorConfigExpectedStatusCodeRangesItem" } } } @@ -380,11 +338,10 @@ export const Endpoint: msRest.CompositeMapper = { } }; -export const CheckTrafficManagerRelativeDnsNameAvailabilityParameters: msRest.CompositeMapper = { - serializedName: "CheckTrafficManagerRelativeDnsNameAvailabilityParameters", +export const MonitorConfigCustomHeadersItem: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CheckTrafficManagerRelativeDnsNameAvailabilityParameters", + className: "MonitorConfigCustomHeadersItem", modelProperties: { name: { serializedName: "name", @@ -392,8 +349,8 @@ export const CheckTrafficManagerRelativeDnsNameAvailabilityParameters: msRest.Co name: "String" } }, - type: { - serializedName: "type", + value: { + serializedName: "value", type: { name: "String" } @@ -402,27 +359,19 @@ export const CheckTrafficManagerRelativeDnsNameAvailabilityParameters: msRest.Co } }; -export const DnsConfig: msRest.CompositeMapper = { - serializedName: "DnsConfig", +export const MonitorConfigExpectedStatusCodeRangesItem: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DnsConfig", + className: "MonitorConfigExpectedStatusCodeRangesItem", modelProperties: { - relativeName: { - serializedName: "relativeName", - type: { - name: "String" - } - }, - fqdn: { - readOnly: true, - serializedName: "fqdn", + min: { + serializedName: "min", type: { - name: "String" + name: "Number" } }, - ttl: { - serializedName: "ttl", + max: { + serializedName: "max", type: { name: "Number" } @@ -431,42 +380,52 @@ export const DnsConfig: msRest.CompositeMapper = { } }; -export const MonitorConfigCustomHeadersItem: msRest.CompositeMapper = { - serializedName: "MonitorConfig_customHeadersItem", +export const Region: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MonitorConfigCustomHeadersItem", + className: "Region", modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, name: { serializedName: "name", type: { name: "String" } }, - value: { - serializedName: "value", + regions: { + serializedName: "regions", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Region" + } + } } } } } }; -export const MonitorConfigExpectedStatusCodeRangesItem: msRest.CompositeMapper = { - serializedName: "MonitorConfig_expectedStatusCodeRangesItem", +export const HeatMapEndpoint: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MonitorConfigExpectedStatusCodeRangesItem", + className: "HeatMapEndpoint", modelProperties: { - min: { - serializedName: "min", + resourceId: { + serializedName: "resourceId", type: { - name: "Number" + name: "String" } }, - max: { - serializedName: "max", + endpointId: { + serializedName: "endpointId", type: { name: "Number" } @@ -475,84 +434,85 @@ export const MonitorConfigExpectedStatusCodeRangesItem: msRest.CompositeMapper = } }; -export const MonitorConfig: msRest.CompositeMapper = { - serializedName: "MonitorConfig", +export const TrafficFlow: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MonitorConfig", + className: "TrafficFlow", modelProperties: { - profileMonitorStatus: { - serializedName: "profileMonitorStatus", + sourceIp: { + serializedName: "sourceIp", type: { name: "String" } }, - protocol: { - serializedName: "protocol", + latitude: { + serializedName: "latitude", type: { - name: "String" + name: "Number" } }, - port: { - serializedName: "port", + longitude: { + serializedName: "longitude", type: { name: "Number" } }, - path: { - serializedName: "path", + queryExperiences: { + serializedName: "queryExperiences", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QueryExperience" + } + } } - }, - intervalInSeconds: { - serializedName: "intervalInSeconds", + } + } + } +}; + +export const QueryExperience: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QueryExperience", + modelProperties: { + endpointId: { + serializedName: "endpointId", + required: true, type: { name: "Number" } }, - timeoutInSeconds: { - serializedName: "timeoutInSeconds", + queryCount: { + serializedName: "queryCount", + required: true, type: { name: "Number" } }, - toleratedNumberOfFailures: { - serializedName: "toleratedNumberOfFailures", + latency: { + serializedName: "latency", type: { name: "Number" } - }, - customHeaders: { - serializedName: "customHeaders", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MonitorConfigCustomHeadersItem" - } - } - } - }, - expectedStatusCodeRanges: { - serializedName: "expectedStatusCodeRanges", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MonitorConfigExpectedStatusCodeRangesItem" - } - } - } } } } }; -export const TrackedResource: msRest.CompositeMapper = { - serializedName: "TrackedResource", +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { type: { name: "Composite", className: "TrackedResource", @@ -562,11 +522,7 @@ export const TrackedResource: msRest.CompositeMapper = { serializedName: "tags", type: { name: "Dictionary", - value: { - type: { - name: "String" - } - } + value: { type: { name: "String" } } } }, location: { @@ -579,59 +535,74 @@ export const TrackedResource: msRest.CompositeMapper = { } }; -export const Profile: msRest.CompositeMapper = { - serializedName: "Profile", +export const Endpoint: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Profile", + className: "Endpoint", modelProperties: { - ...TrackedResource.type.modelProperties, - profileStatus: { - serializedName: "properties.profileStatus", + ...ProxyResource.type.modelProperties, + targetResourceId: { + serializedName: "properties.targetResourceId", type: { name: "String" } }, - trafficRoutingMethod: { - serializedName: "properties.trafficRoutingMethod", + target: { + serializedName: "properties.target", type: { name: "String" } }, - dnsConfig: { - serializedName: "properties.dnsConfig", + endpointStatus: { + serializedName: "properties.endpointStatus", type: { - name: "Composite", - className: "DnsConfig" + name: "String" } }, - monitorConfig: { - serializedName: "properties.monitorConfig", + weight: { + serializedName: "properties.weight", type: { - name: "Composite", - className: "MonitorConfig" + name: "Number" } }, - endpoints: { - serializedName: "properties.endpoints", + priority: { + serializedName: "properties.priority", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Endpoint" - } - } + name: "Number" } }, - trafficViewEnrollmentStatus: { - serializedName: "properties.trafficViewEnrollmentStatus", + endpointLocation: { + serializedName: "properties.endpointLocation", type: { name: "String" } }, - allowedEndpointRecordTypes: { - serializedName: "properties.allowedEndpointRecordTypes", + endpointMonitorStatus: { + serializedName: "properties.endpointMonitorStatus", + type: { + name: "String" + } + }, + minChildEndpoints: { + serializedName: "properties.minChildEndpoints", + type: { + name: "Number" + } + }, + minChildEndpointsIPv4: { + serializedName: "properties.minChildEndpointsIPv4", + type: { + name: "Number" + } + }, + minChildEndpointsIPv6: { + serializedName: "properties.minChildEndpointsIPv6", + type: { + name: "Number" + } + }, + geoMapping: { + serializedName: "properties.geoMapping", type: { name: "Sequence", element: { @@ -641,82 +612,89 @@ export const Profile: msRest.CompositeMapper = { } } }, - maxReturn: { - serializedName: "properties.maxReturn", + subnets: { + serializedName: "properties.subnets", type: { - name: "Number" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EndpointPropertiesSubnetsItem" + } + } + } + }, + customHeaders: { + serializedName: "properties.customHeaders", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EndpointPropertiesCustomHeadersItem" + } + } } } } } }; -export const TrafficManagerNameAvailability: msRest.CompositeMapper = { - serializedName: "TrafficManagerNameAvailability", +export const TrafficManagerGeographicHierarchy: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TrafficManagerNameAvailability", + className: "TrafficManagerGeographicHierarchy", modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - type: { - serializedName: "type", - type: { - name: "String" - } - }, - nameAvailable: { - serializedName: "nameAvailable", - type: { - name: "Boolean" - } - }, - reason: { - serializedName: "reason", - type: { - name: "String" - } - }, - message: { - serializedName: "message", + ...ProxyResource.type.modelProperties, + geographicHierarchy: { + serializedName: "properties.geographicHierarchy", type: { - name: "String" + name: "Composite", + className: "Region" } } } } }; -export const Region: msRest.CompositeMapper = { - serializedName: "Region", +export const HeatMapModel: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Region", + className: "HeatMapModel", modelProperties: { - code: { - serializedName: "code", + ...ProxyResource.type.modelProperties, + startTime: { + serializedName: "properties.startTime", type: { - name: "String" + name: "DateTime" } }, - name: { - serializedName: "name", + endTime: { + serializedName: "properties.endTime", type: { - name: "String" + name: "DateTime" } }, - regions: { - serializedName: "regions", + endpoints: { + serializedName: "properties.endpoints", type: { name: "Sequence", element: { type: { name: "Composite", - className: "Region" + className: "HeatMapEndpoint" + } + } + } + }, + trafficFlows: { + serializedName: "properties.trafficFlows", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TrafficFlow" } } } @@ -725,41 +703,88 @@ export const Region: msRest.CompositeMapper = { } }; -export const TrafficManagerGeographicHierarchy: msRest.CompositeMapper = { - serializedName: "TrafficManagerGeographicHierarchy", +export const UserMetricsModel: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TrafficManagerGeographicHierarchy", + className: "UserMetricsModel", modelProperties: { ...ProxyResource.type.modelProperties, - geographicHierarchy: { - serializedName: "properties.geographicHierarchy", + key: { + serializedName: "properties.key", type: { - name: "Composite", - className: "Region" + name: "String" } } } } }; -export const ProfileListResult: msRest.CompositeMapper = { - serializedName: "ProfileListResult", +export const Profile: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ProfileListResult", + className: "Profile", modelProperties: { - value: { - serializedName: "", + ...TrackedResource.type.modelProperties, + profileStatus: { + serializedName: "properties.profileStatus", + type: { + name: "String" + } + }, + trafficRoutingMethod: { + serializedName: "properties.trafficRoutingMethod", + type: { + name: "String" + } + }, + dnsConfig: { + serializedName: "properties.dnsConfig", + type: { + name: "Composite", + className: "DnsConfig" + } + }, + monitorConfig: { + serializedName: "properties.monitorConfig", + type: { + name: "Composite", + className: "MonitorConfig" + } + }, + endpoints: { + serializedName: "properties.endpoints", type: { name: "Sequence", element: { type: { name: "Composite", - className: "Profile" + className: "Endpoint" } } } + }, + trafficViewEnrollmentStatus: { + serializedName: "properties.trafficViewEnrollmentStatus", + type: { + name: "String" + } + }, + allowedEndpointRecordTypes: { + serializedName: "properties.allowedEndpointRecordTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + maxReturn: { + serializedName: "properties.maxReturn", + type: { + name: "Number" + } } } } diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/parameters.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/parameters.ts index 1b2b07e257c7..ea714b203224 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/parameters.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/parameters.ts @@ -3,127 +3,178 @@ * Licensed under the 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 { + Endpoint as EndpointMapper, + CheckTrafficManagerRelativeDnsNameAvailabilityParameters as CheckTrafficManagerRelativeDnsNameAvailabilityParametersMapper, + Profile as ProfileMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: EndpointMapper +}; + +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - required: true, - serializedName: "api-version", + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const botRight: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "botRight" - ], + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { - serializedName: "botRight", - constraints: { - MaxItems: 2, - MinItems: 2 - }, + serializedName: "$host", + required: true, type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } + name: "String" } }, - collectionFormat: msRest.QueryCollectionFormat.Csv + skipEncoding: true }; -export const endpointName: msRest.OperationURLParameter = { - parameterPath: "endpointName", + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", mapper: { + serializedName: "resourceGroupName", required: true, - serializedName: "endpointName", type: { name: "String" } } }; -export const endpointType: msRest.OperationURLParameter = { - parameterPath: "endpointType", + +export const profileName: OperationURLParameter = { + parameterPath: "profileName", mapper: { + serializedName: "profileName", required: true, - serializedName: "endpointType", type: { name: "String" } } }; -export const heatMapType: msRest.OperationURLParameter = { - parameterPath: "heatMapType", + +export const endpointType: OperationURLParameter = { + parameterPath: "endpointType", mapper: { + serializedName: "endpointType", required: true, - isConstant: true, - serializedName: "heatMapType", - defaultValue: 'default', type: { name: "String" } } }; -export const profileName: msRest.OperationURLParameter = { - parameterPath: "profileName", + +export const endpointName: OperationURLParameter = { + parameterPath: "endpointName", mapper: { + serializedName: "endpointName", required: true, - serializedName: "profileName", type: { name: "String" } } }; -export const resourceGroupName: msRest.OperationURLParameter = { - parameterPath: "resourceGroupName", + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", mapper: { - required: true, - serializedName: "resourceGroupName", + defaultValue: "2018-08-01", + isConstant: true, + serializedName: "api-version", type: { name: "String" } } }; -export const subscriptionId: msRest.OperationURLParameter = { + +export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { - required: true, serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters1: OperationParameter = { + parameterPath: "parameters", + mapper: CheckTrafficManagerRelativeDnsNameAvailabilityParametersMapper +}; + +export const parameters2: OperationParameter = { + parameterPath: "parameters", + mapper: ProfileMapper +}; + +export const heatMapType: OperationURLParameter = { + parameterPath: "heatMapType", + mapper: { + defaultValue: "default", + isConstant: true, + serializedName: "heatMapType", type: { name: "String" } } }; -export const topLeft: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "topLeft" - ], + +export const topLeft: OperationQueryParameter = { + parameterPath: ["options", "topLeft"], mapper: { + constraints: { + MinItems: 2, + MaxItems: 2 + }, serializedName: "topLeft", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + }, + collectionFormat: "CSV" +}; + +export const botRight: OperationQueryParameter = { + parameterPath: ["options", "botRight"], + mapper: { constraints: { - MaxItems: 2, - MinItems: 2 + MinItems: 2, + MaxItems: 2 }, + serializedName: "botRight", type: { name: "Sequence", element: { @@ -133,5 +184,5 @@ export const topLeft: msRest.OperationQueryParameter = { } } }, - collectionFormat: msRest.QueryCollectionFormat.Csv + collectionFormat: "CSV" }; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/profilesMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/profilesMappers.ts deleted file mode 100644 index d2876b523221..000000000000 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/profilesMappers.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - CheckTrafficManagerRelativeDnsNameAvailabilityParameters, - CloudError, - DeleteOperationResult, - DnsConfig, - Endpoint, - EndpointPropertiesCustomHeadersItem, - EndpointPropertiesSubnetsItem, - HeatMapEndpoint, - HeatMapModel, - MonitorConfig, - MonitorConfigCustomHeadersItem, - MonitorConfigExpectedStatusCodeRangesItem, - Profile, - ProfileListResult, - ProxyResource, - QueryExperience, - Region, - Resource, - TrackedResource, - TrafficFlow, - TrafficManagerGeographicHierarchy, - TrafficManagerNameAvailability, - UserMetricsModel -} from "../models/mappers"; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/trafficManagerUserMetricsKeysMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/trafficManagerUserMetricsKeysMappers.ts deleted file mode 100644 index a13fdcfe3a69..000000000000 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/trafficManagerUserMetricsKeysMappers.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, - CloudError, - DeleteOperationResult, - DnsConfig, - Endpoint, - EndpointPropertiesCustomHeadersItem, - EndpointPropertiesSubnetsItem, - HeatMapEndpoint, - HeatMapModel, - MonitorConfig, - MonitorConfigCustomHeadersItem, - MonitorConfigExpectedStatusCodeRangesItem, - Profile, - ProxyResource, - QueryExperience, - Region, - Resource, - TrackedResource, - TrafficFlow, - TrafficManagerGeographicHierarchy, - UserMetricsModel -} from "../models/mappers"; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/endpoints.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/endpoints.ts index 6a73995ea38c..41b2f2d90048 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/endpoints.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/endpoints.ts @@ -3,62 +3,56 @@ * Licensed under the 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/endpointsMappers"; +import { Endpoints } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { TrafficManagerManagementClientContext } from "../trafficManagerManagementClientContext"; +import { TrafficManagerManagementClient } from "../trafficManagerManagementClient"; +import { + Endpoint, + EndpointsUpdateOptionalParams, + EndpointsUpdateResponse, + EndpointsGetOptionalParams, + EndpointsGetResponse, + EndpointsCreateOrUpdateOptionalParams, + EndpointsCreateOrUpdateResponse, + EndpointsDeleteOptionalParams, + EndpointsDeleteResponse +} from "../models"; -/** Class representing a Endpoints. */ -export class Endpoints { - private readonly client: TrafficManagerManagementClientContext; +/** Class containing Endpoints operations. */ +export class EndpointsImpl implements Endpoints { + private readonly client: TrafficManagerManagementClient; /** - * Create a Endpoints. - * @param {TrafficManagerManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Endpoints class. + * @param client Reference to the service client */ - constructor(client: TrafficManagerManagementClientContext) { + constructor(client: TrafficManagerManagementClient) { this.client = client; } /** * Update a Traffic Manager endpoint. - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be updated. + * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint to + * be updated. * @param profileName The name of the Traffic Manager profile. * @param endpointType The type of the Traffic Manager endpoint to be updated. * @param endpointName The name of the Traffic Manager endpoint to be updated. * @param parameters The Traffic Manager endpoint parameters supplied to the Update operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Models.Endpoint, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be updated. - * @param profileName The name of the Traffic Manager profile. - * @param endpointType The type of the Traffic Manager endpoint to be updated. - * @param endpointName The name of the Traffic Manager endpoint to be updated. - * @param parameters The Traffic Manager endpoint parameters supplied to the Update operation. - * @param callback The callback - */ - update(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Models.Endpoint, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be updated. - * @param profileName The name of the Traffic Manager profile. - * @param endpointType The type of the Traffic Manager endpoint to be updated. - * @param endpointName The name of the Traffic Manager endpoint to be updated. - * @param parameters The Traffic Manager endpoint parameters supplied to the Update operation. - * @param options The optional parameters - * @param callback The callback - */ - update(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Models.Endpoint, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Models.Endpoint, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + resourceGroupName: string, + profileName: string, + endpointType: string, + endpointName: string, + parameters: Endpoint, + options?: EndpointsUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -68,8 +62,8 @@ export class Endpoints { parameters, options }, - updateOperationSpec, - callback) as Promise; + updateOperationSpec + ); } /** @@ -78,77 +72,39 @@ export class Endpoints { * @param profileName The name of the Traffic Manager profile. * @param endpointType The type of the Traffic Manager endpoint. * @param endpointName The name of the Traffic Manager endpoint. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint. - * @param profileName The name of the Traffic Manager profile. - * @param endpointType The type of the Traffic Manager endpoint. - * @param endpointName The name of the Traffic Manager endpoint. - * @param callback The callback - */ - get(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint. - * @param profileName The name of the Traffic Manager profile. - * @param endpointType The type of the Traffic Manager endpoint. - * @param endpointName The name of the Traffic Manager endpoint. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + profileName: string, + endpointType: string, + endpointName: string, + options?: EndpointsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - profileName, - endpointType, - endpointName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, profileName, endpointType, endpointName, options }, + getOperationSpec + ); } /** * Create or update a Traffic Manager endpoint. - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be created or updated. - * @param profileName The name of the Traffic Manager profile. - * @param endpointType The type of the Traffic Manager endpoint to be created or updated. - * @param endpointName The name of the Traffic Manager endpoint to be created or updated. - * @param parameters The Traffic Manager endpoint parameters supplied to the CreateOrUpdate - * operation. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Models.Endpoint, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be created or updated. - * @param profileName The name of the Traffic Manager profile. - * @param endpointType The type of the Traffic Manager endpoint to be created or updated. - * @param endpointName The name of the Traffic Manager endpoint to be created or updated. - * @param parameters The Traffic Manager endpoint parameters supplied to the CreateOrUpdate - * operation. - * @param callback The callback - */ - createOrUpdate(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Models.Endpoint, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be created or updated. + * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint to + * be created or updated. * @param profileName The name of the Traffic Manager profile. * @param endpointType The type of the Traffic Manager endpoint to be created or updated. * @param endpointName The name of the Traffic Manager endpoint to be created or updated. - * @param parameters The Traffic Manager endpoint parameters supplied to the CreateOrUpdate - * operation. - * @param options The optional parameters - * @param callback The callback + * @param parameters The Traffic Manager endpoint parameters supplied to the CreateOrUpdate operation. + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Models.Endpoint, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdate(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, parameters: Models.Endpoint, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + createOrUpdate( + resourceGroupName: string, + profileName: string, + endpointType: string, + endpointName: string, + parameters: Endpoint, + options?: EndpointsCreateOrUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -158,79 +114,39 @@ export class Endpoints { parameters, options }, - createOrUpdateOperationSpec, - callback) as Promise; + createOrUpdateOperationSpec + ); } /** * Deletes a Traffic Manager endpoint. - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be deleted. + * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint to + * be deleted. * @param profileName The name of the Traffic Manager profile. * @param endpointType The type of the Traffic Manager endpoint to be deleted. * @param endpointName The name of the Traffic Manager endpoint to be deleted. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be deleted. - * @param profileName The name of the Traffic Manager profile. - * @param endpointType The type of the Traffic Manager endpoint to be deleted. - * @param endpointName The name of the Traffic Manager endpoint to be deleted. - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint - * to be deleted. - * @param profileName The name of the Traffic Manager profile. - * @param endpointType The type of the Traffic Manager endpoint to be deleted. - * @param endpointName The name of the Traffic Manager endpoint to be deleted. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(resourceGroupName: string, profileName: string, endpointType: string, endpointName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + resourceGroupName: string, + profileName: string, + endpointType: string, + endpointName: string, + options?: EndpointsDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - profileName, - endpointType, - endpointName, - options - }, - deleteMethodOperationSpec, - callback) as Promise; + { resourceGroupName, profileName, endpointType, endpointName, options }, + deleteOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const updateOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.profileName, - Parameters.endpointType, - Parameters.endpointName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.Endpoint, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.Endpoint @@ -239,25 +155,24 @@ const updateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.resourceGroupName, Parameters.profileName, Parameters.endpointType, Parameters.endpointName, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Endpoint @@ -266,32 +181,22 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const createOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.resourceGroupName, Parameters.profileName, Parameters.endpointType, Parameters.endpointName, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.Endpoint, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.Endpoint @@ -303,25 +208,24 @@ const createOrUpdateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.resourceGroupName, Parameters.profileName, Parameters.endpointType, Parameters.endpointName, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", + httpMethod: "DELETE", responses: { 200: { bodyMapper: Mappers.DeleteOperationResult @@ -331,5 +235,15 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.profileName, + Parameters.endpointType, + Parameters.endpointName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/geographicHierarchies.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/geographicHierarchies.ts index 7beed3575e5f..ac79040e541b 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/geographicHierarchies.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/geographicHierarchies.ts @@ -3,64 +3,51 @@ * Licensed under the 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/geographicHierarchiesMappers"; +import { GeographicHierarchies } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { TrafficManagerManagementClientContext } from "../trafficManagerManagementClientContext"; +import { TrafficManagerManagementClient } from "../trafficManagerManagementClient"; +import { + GeographicHierarchiesGetDefaultOptionalParams, + GeographicHierarchiesGetDefaultResponse +} from "../models"; -/** Class representing a GeographicHierarchies. */ -export class GeographicHierarchies { - private readonly client: TrafficManagerManagementClientContext; +/** Class containing GeographicHierarchies operations. */ +export class GeographicHierarchiesImpl implements GeographicHierarchies { + private readonly client: TrafficManagerManagementClient; /** - * Create a GeographicHierarchies. - * @param {TrafficManagerManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class GeographicHierarchies class. + * @param client Reference to the service client */ - constructor(client: TrafficManagerManagementClientContext) { + constructor(client: TrafficManagerManagementClient) { this.client = client; } /** * Gets the default Geographic Hierarchy used by the Geographic traffic routing method. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getDefault(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - getDefault(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - getDefault(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getDefault(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getDefault( + options?: GeographicHierarchiesGetDefaultOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - options - }, - getDefaultOperationSpec, - callback) as Promise; + { options }, + getDefaultOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getDefaultOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getDefaultOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Network/trafficManagerGeographicHierarchies/default", httpMethod: "GET", - path: "providers/Microsoft.Network/trafficManagerGeographicHierarchies/default", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.TrafficManagerGeographicHierarchy @@ -69,5 +56,8 @@ const getDefaultOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/heatMap.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/heatMap.ts index 858cad24fbc2..9ea031fa2b93 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/heatMap.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/heatMap.ts @@ -3,25 +3,25 @@ * Licensed under the 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/heatMapMappers"; +import { HeatMap } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { TrafficManagerManagementClientContext } from "../trafficManagerManagementClientContext"; +import { TrafficManagerManagementClient } from "../trafficManagerManagementClient"; +import { HeatMapGetOptionalParams, HeatMapGetResponse } from "../models"; -/** Class representing a HeatMap. */ -export class HeatMap { - private readonly client: TrafficManagerManagementClientContext; +/** Class containing HeatMap operations. */ +export class HeatMapImpl implements HeatMap { + private readonly client: TrafficManagerManagementClient; /** - * Create a HeatMap. - * @param {TrafficManagerManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class HeatMap class. + * @param client Reference to the service client */ - constructor(client: TrafficManagerManagementClientContext) { + constructor(client: TrafficManagerManagementClient) { this.client = client; } @@ -29,54 +29,26 @@ export class HeatMap { * Gets latest heatmap for Traffic Manager profile. * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint. * @param profileName The name of the Traffic Manager profile. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, profileName: string, options?: Models.HeatMapGetOptionalParams): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint. - * @param profileName The name of the Traffic Manager profile. - * @param callback The callback - */ - get(resourceGroupName: string, profileName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint. - * @param profileName The name of the Traffic Manager profile. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, profileName: string, options: Models.HeatMapGetOptionalParams, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, profileName: string, options?: Models.HeatMapGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + profileName: string, + options?: HeatMapGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - profileName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, profileName, options }, + getOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.profileName, - Parameters.heatMapType - ], - queryParameters: [ - Parameters.topLeft, - Parameters.botRight, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.HeatMapModel @@ -85,5 +57,18 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.topLeft, + Parameters.botRight + ], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.profileName, + Parameters.subscriptionId, + Parameters.heatMapType + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/index.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/index.ts index 6c8f9d8ebee2..905f82d01e88 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/index.ts +++ b/sdk/trafficmanager/arm-trafficmanager/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 "./endpoints"; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/profiles.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/profiles.ts index df121d1e6dc9..3ab7078459b7 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/profiles.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/profiles.ts @@ -3,218 +3,224 @@ * Licensed under the 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/profilesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Profiles } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { TrafficManagerManagementClientContext } from "../trafficManagerManagementClientContext"; +import { TrafficManagerManagementClient } from "../trafficManagerManagementClient"; +import { + Profile, + ProfilesListByResourceGroupOptionalParams, + ProfilesListBySubscriptionOptionalParams, + CheckTrafficManagerRelativeDnsNameAvailabilityParameters, + ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityOptionalParams, + ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityResponse, + ProfilesListByResourceGroupResponse, + ProfilesListBySubscriptionResponse, + ProfilesGetOptionalParams, + ProfilesGetResponse, + ProfilesCreateOrUpdateOptionalParams, + ProfilesCreateOrUpdateResponse, + ProfilesDeleteOptionalParams, + ProfilesDeleteResponse, + ProfilesUpdateOptionalParams, + ProfilesUpdateResponse +} from "../models"; -/** Class representing a Profiles. */ -export class Profiles { - private readonly client: TrafficManagerManagementClientContext; +/// +/** Class containing Profiles operations. */ +export class ProfilesImpl implements Profiles { + private readonly client: TrafficManagerManagementClient; /** - * Create a Profiles. - * @param {TrafficManagerManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Profiles class. + * @param client Reference to the service client */ - constructor(client: TrafficManagerManagementClientContext) { + constructor(client: TrafficManagerManagementClient) { this.client = client; } /** - * Checks the availability of a Traffic Manager Relative DNS name. - * @param parameters The Traffic Manager name parameters supplied to the - * CheckTrafficManagerNameAvailability operation. - * @param [options] The optional parameters - * @returns Promise + * Lists all Traffic Manager profiles within a resource group. + * @param resourceGroupName The name of the resource group containing the Traffic Manager profiles to + * be listed. + * @param options The options parameters. */ - checkTrafficManagerRelativeDnsNameAvailability(parameters: Models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters, options?: msRest.RequestOptionsBase): Promise; + public listByResourceGroup( + resourceGroupName: string, + options?: ProfilesListByResourceGroupOptionalParams + ): 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, + options?: ProfilesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: ProfilesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + /** - * @param parameters The Traffic Manager name parameters supplied to the - * CheckTrafficManagerNameAvailability operation. - * @param callback The callback + * Lists all Traffic Manager profiles within a subscription. + * @param options The options parameters. */ - checkTrafficManagerRelativeDnsNameAvailability(parameters: Models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters, callback: msRest.ServiceCallback): void; + public listBySubscription( + options?: ProfilesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: ProfilesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + } + + private async *listBySubscriptionPagingAll( + options?: ProfilesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + /** + * Checks the availability of a Traffic Manager Relative DNS name. * @param parameters The Traffic Manager name parameters supplied to the - * CheckTrafficManagerNameAvailability operation. - * @param options The optional parameters - * @param callback The callback + * CheckTrafficManagerNameAvailability operation. + * @param options The options parameters. */ - checkTrafficManagerRelativeDnsNameAvailability(parameters: Models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - checkTrafficManagerRelativeDnsNameAvailability(parameters: Models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + checkTrafficManagerRelativeDnsNameAvailability( + parameters: CheckTrafficManagerRelativeDnsNameAvailabilityParameters, + options?: ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - parameters, - options - }, - checkTrafficManagerRelativeDnsNameAvailabilityOperationSpec, - callback) as Promise; + { parameters, options }, + checkTrafficManagerRelativeDnsNameAvailabilityOperationSpec + ); } /** * Lists all Traffic Manager profiles within a resource group. - * @param resourceGroupName The name of the resource group containing the Traffic Manager profiles - * to be listed. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profiles - * to be listed. - * @param callback The callback + * @param resourceGroupName The name of the resource group containing the Traffic Manager profiles to + * be listed. + * @param options The options parameters. */ - listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profiles - * to be listed. - * @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 { + private _listByResourceGroup( + resourceGroupName: string, + options?: ProfilesListByResourceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listByResourceGroupOperationSpec, - callback) as Promise; + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); } /** * Lists all Traffic Manager profiles within a subscription. - * @param [options] The optional parameters - * @returns Promise - */ - listBySubscription(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listBySubscription(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - listBySubscription(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBySubscription(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listBySubscription( + options?: ProfilesListBySubscriptionOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - options - }, - listBySubscriptionOperationSpec, - callback) as Promise; + { options }, + listBySubscriptionOperationSpec + ); } /** * Gets a Traffic Manager profile. * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. * @param profileName The name of the Traffic Manager profile. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, profileName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. - * @param profileName The name of the Traffic Manager profile. - * @param callback The callback - */ - get(resourceGroupName: string, profileName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. - * @param profileName The name of the Traffic Manager profile. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, profileName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, profileName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + profileName: string, + options?: ProfilesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - profileName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, profileName, options }, + getOperationSpec + ); } /** * Create or update a Traffic Manager profile. * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. * @param profileName The name of the Traffic Manager profile. - * @param parameters The Traffic Manager profile parameters supplied to the CreateOrUpdate - * operation. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(resourceGroupName: string, profileName: string, parameters: Models.Profile, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. - * @param profileName The name of the Traffic Manager profile. - * @param parameters The Traffic Manager profile parameters supplied to the CreateOrUpdate - * operation. - * @param callback The callback - */ - createOrUpdate(resourceGroupName: string, profileName: string, parameters: Models.Profile, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. - * @param profileName The name of the Traffic Manager profile. - * @param parameters The Traffic Manager profile parameters supplied to the CreateOrUpdate - * operation. - * @param options The optional parameters - * @param callback The callback + * @param parameters The Traffic Manager profile parameters supplied to the CreateOrUpdate operation. + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, profileName: string, parameters: Models.Profile, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdate(resourceGroupName: string, profileName: string, parameters: Models.Profile, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + createOrUpdate( + resourceGroupName: string, + profileName: string, + parameters: Profile, + options?: ProfilesCreateOrUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - profileName, - parameters, - options - }, - createOrUpdateOperationSpec, - callback) as Promise; + { resourceGroupName, profileName, parameters, options }, + createOrUpdateOperationSpec + ); } /** * Deletes a Traffic Manager profile. - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile - * to be deleted. + * @param resourceGroupName The name of the resource group containing the Traffic Manager profile to be + * deleted. * @param profileName The name of the Traffic Manager profile to be deleted. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, profileName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile - * to be deleted. - * @param profileName The name of the Traffic Manager profile to be deleted. - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, profileName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile - * to be deleted. - * @param profileName The name of the Traffic Manager profile to be deleted. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, profileName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(resourceGroupName: string, profileName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + resourceGroupName: string, + profileName: string, + options?: ProfilesDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - profileName, - options - }, - deleteMethodOperationSpec, - callback) as Promise; + { resourceGroupName, profileName, options }, + deleteOperationSpec + ); } /** @@ -222,56 +228,26 @@ export class Profiles { * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. * @param profileName The name of the Traffic Manager profile. * @param parameters The Traffic Manager profile parameters supplied to the Update operation. - * @param [options] The optional parameters - * @returns Promise - */ - update(resourceGroupName: string, profileName: string, parameters: Models.Profile, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. - * @param profileName The name of the Traffic Manager profile. - * @param parameters The Traffic Manager profile parameters supplied to the Update operation. - * @param callback The callback - */ - update(resourceGroupName: string, profileName: string, parameters: Models.Profile, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. - * @param profileName The name of the Traffic Manager profile. - * @param parameters The Traffic Manager profile parameters supplied to the Update operation. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - update(resourceGroupName: string, profileName: string, parameters: Models.Profile, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, profileName: string, parameters: Models.Profile, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + resourceGroupName: string, + profileName: string, + parameters: Profile, + options?: ProfilesUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - profileName, - parameters, - options - }, - updateOperationSpec, - callback) as Promise; + { resourceGroupName, profileName, parameters, options }, + updateOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const checkTrafficManagerRelativeDnsNameAvailabilityOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkTrafficManagerRelativeDnsNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Network/checkTrafficManagerNameAvailability", httpMethod: "POST", - path: "providers/Microsoft.Network/checkTrafficManagerNameAvailability", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.CheckTrafficManagerRelativeDnsNameAvailabilityParameters, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.TrafficManagerNameAvailability @@ -280,22 +256,17 @@ const checkTrafficManagerRelativeDnsNameAvailabilityOperationSpec: msRest.Operat bodyMapper: Mappers.CloudError } }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ProfileListResult @@ -304,21 +275,19 @@ const listByResourceGroupOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const listBySubscriptionOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ProfileListResult @@ -327,23 +296,15 @@ const listBySubscriptionOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.profileName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.Profile @@ -352,30 +313,20 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const createOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.resourceGroupName, Parameters.profileName, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.Profile, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.Profile @@ -387,23 +338,22 @@ const createOrUpdateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.resourceGroupName, Parameters.profileName, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", + httpMethod: "DELETE", responses: { 200: { bodyMapper: Mappers.DeleteOperationResult @@ -413,30 +363,20 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const updateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.resourceGroupName, Parameters.profileName, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.Profile, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", + httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.Profile @@ -445,5 +385,15 @@ const updateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.profileName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/trafficManagerUserMetricsKeys.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/trafficManagerUserMetricsKeys.ts index 0a514e8258d8..c508104ff9d2 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/trafficManagerUserMetricsKeys.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/trafficManagerUserMetricsKeys.ts @@ -3,115 +3,76 @@ * Licensed under the 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/trafficManagerUserMetricsKeysMappers"; +import { TrafficManagerUserMetricsKeys } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { TrafficManagerManagementClientContext } from "../trafficManagerManagementClientContext"; +import { TrafficManagerManagementClient } from "../trafficManagerManagementClient"; +import { + TrafficManagerUserMetricsKeysGetOptionalParams, + TrafficManagerUserMetricsKeysGetResponse, + TrafficManagerUserMetricsKeysCreateOrUpdateOptionalParams, + TrafficManagerUserMetricsKeysCreateOrUpdateResponse, + TrafficManagerUserMetricsKeysDeleteOptionalParams, + TrafficManagerUserMetricsKeysDeleteResponse +} from "../models"; -/** Class representing a TrafficManagerUserMetricsKeys. */ -export class TrafficManagerUserMetricsKeys { - private readonly client: TrafficManagerManagementClientContext; +/** Class containing TrafficManagerUserMetricsKeys operations. */ +export class TrafficManagerUserMetricsKeysImpl + implements TrafficManagerUserMetricsKeys { + private readonly client: TrafficManagerManagementClient; /** - * Create a TrafficManagerUserMetricsKeys. - * @param {TrafficManagerManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class TrafficManagerUserMetricsKeys class. + * @param client Reference to the service client */ - constructor(client: TrafficManagerManagementClientContext) { + constructor(client: TrafficManagerManagementClient) { this.client = client; } /** * Get the subscription-level key used for Real User Metrics collection. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - get(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - get(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - getOperationSpec, - callback) as Promise; + get( + options?: TrafficManagerUserMetricsKeysGetOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, getOperationSpec); } /** * Create or update a subscription-level key used for Real User Metrics collection. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - createOrUpdate(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - createOrUpdate(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdate(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + createOrUpdate( + options?: TrafficManagerUserMetricsKeysCreateOrUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - options - }, - createOrUpdateOperationSpec, - callback) as Promise; + { options }, + createOrUpdateOperationSpec + ); } /** * Delete a subscription-level key used for Real User Metrics collection. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - deleteMethod(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - deleteMethodOperationSpec, - callback) as Promise; + delete( + options?: TrafficManagerUserMetricsKeysDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, deleteOperationSpec); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.UserMetricsModel @@ -120,21 +81,15 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + 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.Network/trafficManagerUserMetricsKeys/default", httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 201: { bodyMapper: Mappers.UserMetricsModel @@ -143,21 +98,15 @@ const createOrUpdateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default", httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.DeleteOperationResult @@ -166,5 +115,8 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/endpoints.ts b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/endpoints.ts new file mode 100644 index 000000000000..68281fe1a0ff --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/endpoints.ts @@ -0,0 +1,90 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Endpoint, + EndpointsUpdateOptionalParams, + EndpointsUpdateResponse, + EndpointsGetOptionalParams, + EndpointsGetResponse, + EndpointsCreateOrUpdateOptionalParams, + EndpointsCreateOrUpdateResponse, + EndpointsDeleteOptionalParams, + EndpointsDeleteResponse +} from "../models"; + +/** Interface representing a Endpoints. */ +export interface Endpoints { + /** + * Update a Traffic Manager endpoint. + * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint to + * be updated. + * @param profileName The name of the Traffic Manager profile. + * @param endpointType The type of the Traffic Manager endpoint to be updated. + * @param endpointName The name of the Traffic Manager endpoint to be updated. + * @param parameters The Traffic Manager endpoint parameters supplied to the Update operation. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + profileName: string, + endpointType: string, + endpointName: string, + parameters: Endpoint, + options?: EndpointsUpdateOptionalParams + ): Promise; + /** + * Gets a Traffic Manager endpoint. + * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint. + * @param profileName The name of the Traffic Manager profile. + * @param endpointType The type of the Traffic Manager endpoint. + * @param endpointName The name of the Traffic Manager endpoint. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + profileName: string, + endpointType: string, + endpointName: string, + options?: EndpointsGetOptionalParams + ): Promise; + /** + * Create or update a Traffic Manager endpoint. + * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint to + * be created or updated. + * @param profileName The name of the Traffic Manager profile. + * @param endpointType The type of the Traffic Manager endpoint to be created or updated. + * @param endpointName The name of the Traffic Manager endpoint to be created or updated. + * @param parameters The Traffic Manager endpoint parameters supplied to the CreateOrUpdate operation. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + profileName: string, + endpointType: string, + endpointName: string, + parameters: Endpoint, + options?: EndpointsCreateOrUpdateOptionalParams + ): Promise; + /** + * Deletes a Traffic Manager endpoint. + * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint to + * be deleted. + * @param profileName The name of the Traffic Manager profile. + * @param endpointType The type of the Traffic Manager endpoint to be deleted. + * @param endpointName The name of the Traffic Manager endpoint to be deleted. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + profileName: string, + endpointType: string, + endpointName: string, + options?: EndpointsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/geographicHierarchies.ts b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/geographicHierarchies.ts new file mode 100644 index 000000000000..471b4746e32b --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/geographicHierarchies.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + GeographicHierarchiesGetDefaultOptionalParams, + GeographicHierarchiesGetDefaultResponse +} from "../models"; + +/** Interface representing a GeographicHierarchies. */ +export interface GeographicHierarchies { + /** + * Gets the default Geographic Hierarchy used by the Geographic traffic routing method. + * @param options The options parameters. + */ + getDefault( + options?: GeographicHierarchiesGetDefaultOptionalParams + ): Promise; +} diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/heatMap.ts b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/heatMap.ts new file mode 100644 index 000000000000..3f4f17c25db7 --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/heatMap.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { HeatMapGetOptionalParams, HeatMapGetResponse } from "../models"; + +/** Interface representing a HeatMap. */ +export interface HeatMap { + /** + * Gets latest heatmap for Traffic Manager profile. + * @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint. + * @param profileName The name of the Traffic Manager profile. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + profileName: string, + options?: HeatMapGetOptionalParams + ): Promise; +} diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/index.ts b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..905f82d01e88 --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./endpoints"; +export * from "./profiles"; +export * from "./geographicHierarchies"; +export * from "./heatMap"; +export * from "./trafficManagerUserMetricsKeys"; diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/profiles.ts b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/profiles.ts new file mode 100644 index 000000000000..2dc5dab5f2b3 --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/profiles.ts @@ -0,0 +1,106 @@ +/* + * 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 { + Profile, + ProfilesListByResourceGroupOptionalParams, + ProfilesListBySubscriptionOptionalParams, + CheckTrafficManagerRelativeDnsNameAvailabilityParameters, + ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityOptionalParams, + ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityResponse, + ProfilesGetOptionalParams, + ProfilesGetResponse, + ProfilesCreateOrUpdateOptionalParams, + ProfilesCreateOrUpdateResponse, + ProfilesDeleteOptionalParams, + ProfilesDeleteResponse, + ProfilesUpdateOptionalParams, + ProfilesUpdateResponse +} from "../models"; + +/// +/** Interface representing a Profiles. */ +export interface Profiles { + /** + * Lists all Traffic Manager profiles within a resource group. + * @param resourceGroupName The name of the resource group containing the Traffic Manager profiles to + * be listed. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: ProfilesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists all Traffic Manager profiles within a subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: ProfilesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Checks the availability of a Traffic Manager Relative DNS name. + * @param parameters The Traffic Manager name parameters supplied to the + * CheckTrafficManagerNameAvailability operation. + * @param options The options parameters. + */ + checkTrafficManagerRelativeDnsNameAvailability( + parameters: CheckTrafficManagerRelativeDnsNameAvailabilityParameters, + options?: ProfilesCheckTrafficManagerRelativeDnsNameAvailabilityOptionalParams + ): Promise; + /** + * Gets a Traffic Manager profile. + * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. + * @param profileName The name of the Traffic Manager profile. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + profileName: string, + options?: ProfilesGetOptionalParams + ): Promise; + /** + * Create or update a Traffic Manager profile. + * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. + * @param profileName The name of the Traffic Manager profile. + * @param parameters The Traffic Manager profile parameters supplied to the CreateOrUpdate operation. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + profileName: string, + parameters: Profile, + options?: ProfilesCreateOrUpdateOptionalParams + ): Promise; + /** + * Deletes a Traffic Manager profile. + * @param resourceGroupName The name of the resource group containing the Traffic Manager profile to be + * deleted. + * @param profileName The name of the Traffic Manager profile to be deleted. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + profileName: string, + options?: ProfilesDeleteOptionalParams + ): Promise; + /** + * Update a Traffic Manager profile. + * @param resourceGroupName The name of the resource group containing the Traffic Manager profile. + * @param profileName The name of the Traffic Manager profile. + * @param parameters The Traffic Manager profile parameters supplied to the Update operation. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + profileName: string, + parameters: Profile, + options?: ProfilesUpdateOptionalParams + ): Promise; +} diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/trafficManagerUserMetricsKeys.ts b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/trafficManagerUserMetricsKeys.ts new file mode 100644 index 000000000000..e72e2265b390 --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/src/operationsInterfaces/trafficManagerUserMetricsKeys.ts @@ -0,0 +1,41 @@ +/* + * 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 { + TrafficManagerUserMetricsKeysGetOptionalParams, + TrafficManagerUserMetricsKeysGetResponse, + TrafficManagerUserMetricsKeysCreateOrUpdateOptionalParams, + TrafficManagerUserMetricsKeysCreateOrUpdateResponse, + TrafficManagerUserMetricsKeysDeleteOptionalParams, + TrafficManagerUserMetricsKeysDeleteResponse +} from "../models"; + +/** Interface representing a TrafficManagerUserMetricsKeys. */ +export interface TrafficManagerUserMetricsKeys { + /** + * Get the subscription-level key used for Real User Metrics collection. + * @param options The options parameters. + */ + get( + options?: TrafficManagerUserMetricsKeysGetOptionalParams + ): Promise; + /** + * Create or update a subscription-level key used for Real User Metrics collection. + * @param options The options parameters. + */ + createOrUpdate( + options?: TrafficManagerUserMetricsKeysCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a subscription-level key used for Real User Metrics collection. + * @param options The options parameters. + */ + delete( + options?: TrafficManagerUserMetricsKeysDeleteOptionalParams + ): Promise; +} diff --git a/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClient.ts b/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClient.ts index b89b90ca52dd..f42ee318a105 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClient.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClient.ts @@ -3,54 +3,96 @@ * Licensed under the 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 { TrafficManagerManagementClientContext } from "./trafficManagerManagementClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + EndpointsImpl, + ProfilesImpl, + GeographicHierarchiesImpl, + HeatMapImpl, + TrafficManagerUserMetricsKeysImpl +} from "./operations"; +import { + Endpoints, + Profiles, + GeographicHierarchies, + HeatMap, + TrafficManagerUserMetricsKeys +} from "./operationsInterfaces"; +import { TrafficManagerManagementClientOptionalParams } from "./models"; - -class TrafficManagerManagementClient extends TrafficManagerManagementClientContext { - // Operation groups - endpoints: operations.Endpoints; - profiles: operations.Profiles; - geographicHierarchies: operations.GeographicHierarchies; - heatMap: operations.HeatMap; - trafficManagerUserMetricsKeys: operations.TrafficManagerUserMetricsKeys; +export class TrafficManagerManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; /** * Initializes a new instance of the TrafficManagerManagementClient 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 Gets subscription credentials which uniquely identify Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. - * @param [options] The parameter options + * subscription. The subscription ID forms part of the URI for every service call. + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.TrafficManagerManagementClientOptions) { - super(credentials, subscriptionId, options); - this.endpoints = new operations.Endpoints(this); - this.profiles = new operations.Profiles(this); - this.geographicHierarchies = new operations.GeographicHierarchies(this); - this.heatMap = new operations.HeatMap(this); - this.trafficManagerUserMetricsKeys = new operations.TrafficManagerUserMetricsKeys(this); - } -} + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: TrafficManagerManagementClientOptionalParams + ) { + 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: TrafficManagerManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; -// Operation Specifications + const packageDetails = `azsdk-js-arm-trafficmanager/6.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; -export { - TrafficManagerManagementClient, - TrafficManagerManagementClientContext, - Models as TrafficManagerManagementModels, - Mappers as TrafficManagerManagementMappers -}; -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 || "2018-08-01"; + this.endpoints = new EndpointsImpl(this); + this.profiles = new ProfilesImpl(this); + this.geographicHierarchies = new GeographicHierarchiesImpl(this); + this.heatMap = new HeatMapImpl(this); + this.trafficManagerUserMetricsKeys = new TrafficManagerUserMetricsKeysImpl( + this + ); + } + + endpoints: Endpoints; + profiles: Profiles; + geographicHierarchies: GeographicHierarchies; + heatMap: HeatMap; + trafficManagerUserMetricsKeys: TrafficManagerUserMetricsKeys; +} diff --git a/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClientContext.ts b/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClientContext.ts deleted file mode 100644 index ae6556c0009a..000000000000 --- a/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClientContext.ts +++ /dev/null @@ -1,68 +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 * as msRestAzure from "@azure/ms-rest-azure-js"; -import { TokenCredential } from "@azure/core-auth"; - -const packageName = "@azure/arm-trafficmanager"; -const packageVersion = "5.1.0"; - -export class TrafficManagerManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials | TokenCredential; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the TrafficManagerManagementClient 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 Gets subscription credentials which uniquely identify Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.TrafficManagerManagementClientOptions) { - 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 = '2018-08-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/trafficmanager/arm-trafficmanager/test/sampleTest.ts b/sdk/trafficmanager/arm-trafficmanager/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/trafficmanager/arm-trafficmanager/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/trafficmanager/arm-trafficmanager/tsconfig.json b/sdk/trafficmanager/arm-trafficmanager/tsconfig.json index 422b584abd5e..6e3251194117 100644 --- a/sdk/trafficmanager/arm-trafficmanager/tsconfig.json +++ b/sdk/trafficmanager/arm-trafficmanager/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/trafficmanager/ci.yml b/sdk/trafficmanager/ci.yml new file mode 100644 index 000000000000..f84cd0483f29 --- /dev/null +++ b/sdk/trafficmanager/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/trafficmanager/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/trafficmanager/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: trafficmanager + Artifacts: + - name: azure-arm-trafficmanager + safeName: azurearmtrafficmanager + \ No newline at end of file