From b3f995cfd8d84dc9fb534136839b257269e8dbb1 Mon Sep 17 00:00:00 2001 From: colawwj Date: Fri, 11 Jun 2021 11:18:32 +0800 Subject: [PATCH 1/3] arm-trafficmanager-release --- .../arm-trafficmanager/LICENSE.txt | 2 +- .../arm-trafficmanager/README.md | 115 ++++++++++-------- .../arm-trafficmanager/package.json | 9 +- .../arm-trafficmanager/rollup.config.js | 4 +- .../src/models/endpointsMappers.ts | 4 +- .../models/geographicHierarchiesMappers.ts | 4 +- .../src/models/heatMapMappers.ts | 4 +- .../arm-trafficmanager/src/models/index.ts | 28 ++++- .../arm-trafficmanager/src/models/mappers.ts | 27 +++- .../src/models/parameters.ts | 5 +- .../src/models/profilesMappers.ts | 4 +- .../trafficManagerUserMetricsKeysMappers.ts | 4 +- .../src/operations/endpoints.ts | 5 +- .../src/operations/geographicHierarchies.ts | 5 +- .../src/operations/heatMap.ts | 5 +- .../src/operations/index.ts | 5 +- .../src/operations/profiles.ts | 5 +- .../trafficManagerUserMetricsKeys.ts | 5 +- .../src/trafficManagerManagementClient.ts | 15 ++- .../trafficManagerManagementClientContext.ts | 27 ++-- 20 files changed, 170 insertions(+), 112 deletions(-) diff --git a/sdk/trafficmanager/arm-trafficmanager/LICENSE.txt b/sdk/trafficmanager/arm-trafficmanager/LICENSE.txt index ea8fb1516028..2d3163745319 100644 --- a/sdk/trafficmanager/arm-trafficmanager/LICENSE.txt +++ b/sdk/trafficmanager/arm-trafficmanager/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 Microsoft +Copyright (c) 2021 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/trafficmanager/arm-trafficmanager/README.md b/sdk/trafficmanager/arm-trafficmanager/README.md index 83f08c7a1e84..c6a5d4e8e2c9 100644 --- a/sdk/trafficmanager/arm-trafficmanager/README.md +++ b/sdk/trafficmanager/arm-trafficmanager/README.md @@ -1,98 +1,105 @@ ## Azure TrafficManagerManagementClient SDK for JavaScript -This package contains an isomorphic SDK for TrafficManagerManagementClient. +This package contains an isomorphic SDK (runs both in node.js and in browsers) for TrafficManagerManagementClient. ### Currently supported environments -- Node.js version 6.x.x or higher +- Node.js version 8.x.x or higher - Browser JavaScript -### How to Install +### Prerequisites +You must have an [Azure subscription](https://azure.microsoft.com/free/). + +### How to install + +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 both packages using the below command: ```bash -npm install @azure/arm-trafficmanager +npm install --save @azure/arm-trafficmanager @azure/identity ``` +> **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 -#### nodejs - Authentication, client creation and get endpoints as an example written in TypeScript. +- 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. -##### Install @azure/ms-rest-nodeauth - -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. -```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" -``` +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. ##### Sample code -```typescript -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { TrafficManagerManagementClient, TrafficManagerManagementModels, TrafficManagerManagementMappers } from "@azure/arm-trafficmanager"; +```javascript +const { DefaultAzureCredential } = require("@azure/identity"); +const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager"); const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; -msRestNodeAuth.interactiveLogin().then((creds) => { - 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); - }); +// 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); }); ``` -#### browser - Authentication, client creation and get endpoints as an example written in JavaScript. +#### browser - Authentication, client creation, and get endpoints as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth - -```bash -npm install @azure/ms-rest-browserauth -``` +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 -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - - index.html + ```html @azure/arm-trafficmanager sample - - + diff --git a/sdk/trafficmanager/arm-trafficmanager/package.json b/sdk/trafficmanager/arm-trafficmanager/package.json index b154d1ebe61b..20ae82721d15 100644 --- a/sdk/trafficmanager/arm-trafficmanager/package.json +++ b/sdk/trafficmanager/arm-trafficmanager/package.json @@ -2,10 +2,11 @@ "name": "@azure/arm-trafficmanager", "author": "Microsoft Corporation", "description": "TrafficManagerManagementClient Library with typescript type definitions for node.js and browser.", - "version": "5.0.0", + "version": "5.1.0", "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", + "@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" }, "keywords": [ @@ -20,7 +21,7 @@ "module": "./esm/trafficManagerManagementClient.js", "types": "./esm/trafficManagerManagementClient.d.ts", "devDependencies": { - "typescript": "^3.5.3", + "typescript": "^3.6.0", "rollup": "^1.18.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-sourcemaps": "^0.4.2", diff --git a/sdk/trafficmanager/arm-trafficmanager/rollup.config.js b/sdk/trafficmanager/arm-trafficmanager/rollup.config.js index a17ee84b53b1..164228bd9fad 100644 --- a/sdk/trafficmanager/arm-trafficmanager/rollup.config.js +++ b/sdk/trafficmanager/arm-trafficmanager/rollup.config.js @@ -21,8 +21,8 @@ const config = { "@azure/ms-rest-azure-js": "msRestAzure" }, banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/endpointsMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/endpointsMappers.ts index 74e5202c4a5f..a13fdcfe3a69 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/endpointsMappers.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/endpointsMappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/geographicHierarchiesMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/geographicHierarchiesMappers.ts index 2d5082b2bd3f..509feee44585 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/geographicHierarchiesMappers.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/geographicHierarchiesMappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/heatMapMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/heatMapMappers.ts index 2d5082b2bd3f..509feee44585 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/heatMapMappers.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/heatMapMappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/index.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/index.ts index 0ac29100769d..33650bcd99cf 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/index.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/index.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. @@ -213,6 +213,18 @@ export interface Endpoint extends ProxyResource { * '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 @@ -388,6 +400,10 @@ export interface Profile extends TrackedResource { * profile. Possible values include: 'Enabled', 'Disabled' */ trafficViewEnrollmentStatus?: TrafficViewEnrollmentStatus; + /** + * The list of allowed endpoint record types. + */ + allowedEndpointRecordTypes?: AllowedEndpointRecordType[]; /** * Maximum number of endpoints to be returned for MultiValue routing type. */ @@ -537,6 +553,14 @@ export type TrafficRoutingMethod = 'Performance' | 'Priority' | 'Weighted' | 'Ge */ export type TrafficViewEnrollmentStatus = 'Enabled' | 'Disabled'; +/** + * Defines values for AllowedEndpointRecordType. + * Possible values include: 'DomainName', 'IPv4Address', 'IPv6Address', 'Any' + * @readonly + * @enum {string} + */ +export type AllowedEndpointRecordType = 'DomainName' | 'IPv4Address' | 'IPv6Address' | 'Any'; + /** * Contains response data for the update operation. */ diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/mappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/mappers.ts index 3a47f4b548ea..530afca7e3c0 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/mappers.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/mappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. @@ -329,6 +329,18 @@ export const Endpoint: msRest.CompositeMapper = { name: "Number" } }, + minChildEndpointsIPv4: { + serializedName: "properties.minChildEndpointsIPv4", + type: { + name: "Number" + } + }, + minChildEndpointsIPv6: { + serializedName: "properties.minChildEndpointsIPv6", + type: { + name: "Number" + } + }, geoMapping: { serializedName: "properties.geoMapping", type: { @@ -618,6 +630,17 @@ export const Profile: msRest.CompositeMapper = { name: "String" } }, + allowedEndpointRecordTypes: { + serializedName: "properties.allowedEndpointRecordTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, maxReturn: { serializedName: "properties.maxReturn", type: { diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/parameters.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/parameters.ts index e4def72ebab4..1b2b07e257c7 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/parameters.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/parameters.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/profilesMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/profilesMappers.ts index 77a57d2799ef..d2876b523221 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/profilesMappers.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/profilesMappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/trafficmanager/arm-trafficmanager/src/models/trafficManagerUserMetricsKeysMappers.ts b/sdk/trafficmanager/arm-trafficmanager/src/models/trafficManagerUserMetricsKeysMappers.ts index 74e5202c4a5f..a13fdcfe3a69 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/models/trafficManagerUserMetricsKeysMappers.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/models/trafficManagerUserMetricsKeysMappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/endpoints.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/endpoints.ts index a145afda82c4..6a73995ea38c 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/endpoints.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/endpoints.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/geographicHierarchies.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/geographicHierarchies.ts index 23ee086f81d9..7beed3575e5f 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/geographicHierarchies.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/geographicHierarchies.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/heatMap.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/heatMap.ts index 64f690a2ae0f..858cad24fbc2 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/heatMap.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/heatMap.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/index.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/index.ts index 7a6963644fb9..6c8f9d8ebee2 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/index.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/index.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/profiles.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/profiles.ts index c704f921817e..df121d1e6dc9 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/profiles.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/profiles.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/trafficmanager/arm-trafficmanager/src/operations/trafficManagerUserMetricsKeys.ts b/sdk/trafficmanager/arm-trafficmanager/src/operations/trafficManagerUserMetricsKeys.ts index 25f0c0a39267..0a514e8258d8 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/operations/trafficManagerUserMetricsKeys.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/operations/trafficManagerUserMetricsKeys.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 diff --git a/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClient.ts b/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClient.ts index 4891f23eaa38..b89b90ca52dd 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClient.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClient.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -9,6 +8,7 @@ */ 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"; @@ -25,12 +25,17 @@ class TrafficManagerManagementClient extends TrafficManagerManagementClientConte /** * Initializes a new instance of the TrafficManagerManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. + * @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, subscriptionId: string, options?: Models.TrafficManagerManagementClientOptions) { + 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); diff --git a/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClientContext.ts b/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClientContext.ts index 2a11ff723215..ae6556c0009a 100644 --- a/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClientContext.ts +++ b/sdk/trafficmanager/arm-trafficmanager/src/trafficManagerManagementClientContext.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -11,23 +10,29 @@ 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.0.0"; +const packageVersion = "5.1.0"; export class TrafficManagerManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; + 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. + * @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, subscriptionId: string, options?: Models.TrafficManagerManagementClientOptions) { + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.TrafficManagerManagementClientOptions) { if (credentials == undefined) { throw new Error('\'credentials\' cannot be null.'); } @@ -38,14 +43,14 @@ export class TrafficManagerManagementClientContext extends msRestAzure.AzureServ if (!options) { options = {}; } - if(!options.userAgent) { + if (!options.userAgent) { const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } super(credentials, options); - this.apiVersion = '2018-04-01'; + this.apiVersion = '2018-08-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; @@ -53,10 +58,10 @@ export class TrafficManagerManagementClientContext extends msRestAzure.AzureServ this.credentials = credentials; this.subscriptionId = subscriptionId; - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; } } From 435ac65497bb1206cb917be52bb0a6bea49947bd Mon Sep 17 00:00:00 2001 From: colawwj Date: Fri, 11 Jun 2021 14:17:37 +0800 Subject: [PATCH 2/3] readme update --- sdk/trafficmanager/arm-trafficmanager/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/trafficmanager/arm-trafficmanager/README.md b/sdk/trafficmanager/arm-trafficmanager/README.md index c6a5d4e8e2c9..72d87a5e5739 100644 --- a/sdk/trafficmanager/arm-trafficmanager/README.md +++ b/sdk/trafficmanager/arm-trafficmanager/README.md @@ -1,11 +1,11 @@ ## Azure TrafficManagerManagementClient SDK 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 TrafficManagerManagementClient. ### Currently supported environments -- Node.js version 8.x.x or higher -- Browser JavaScript +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge, and Firefox. ### Prerequisites From 4decda9b0a5384c3d36b76536a87c8f31e482287 Mon Sep 17 00:00:00 2001 From: colawwj Date: Thu, 24 Jun 2021 11:28:34 +0800 Subject: [PATCH 3/3] update package.json --- sdk/trafficmanager/arm-trafficmanager/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/trafficmanager/arm-trafficmanager/package.json b/sdk/trafficmanager/arm-trafficmanager/package.json index 20ae82721d15..41b4ac47a42a 100644 --- a/sdk/trafficmanager/arm-trafficmanager/package.json +++ b/sdk/trafficmanager/arm-trafficmanager/package.json @@ -27,7 +27,7 @@ "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.6.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/trafficmanager/arm-trafficmanager", + "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"