Skip to content

Commit

Permalink
CodeGen from PR 15845 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 5f0fd3d9f4a9488b8b337eb05d38f4ff8aa5a48e into a4a7566677191f61b9466a89bf93559d3075c3b9
  • Loading branch information
SDKAuto committed Oct 31, 2021
1 parent d67a884 commit 94fb413
Show file tree
Hide file tree
Showing 53 changed files with 1,025 additions and 14,804 deletions.
2 changes: 1 addition & 1 deletion sdk/monitor/arm-monitor/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 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
Expand Down
26 changes: 11 additions & 15 deletions sdk/monitor/arm-monitor/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Azure MonitorManagementClient SDK for JavaScript
## Azure MonitorClient SDK for JavaScript

This package contains an isomorphic SDK (runs both in Node.js and in browsers) for MonitorManagementClient.
This package contains an isomorphic SDK (runs both in node.js and in browsers) for MonitorClient.

### 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

Expand All @@ -21,7 +21,6 @@ Install both packages using the below command:
```bash
npm install --save @azure/arm-monitor @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.

Expand All @@ -37,22 +36,20 @@ If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/

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 listByResourceGroup autoscaleSettings as an example written in JavaScript.
#### nodejs - Authentication, client creation, and listBySubscription scheduledQueryRules as an example written in JavaScript.

##### Sample code

```javascript
const { DefaultAzureCredential } = require("@azure/identity");
const { MonitorManagementClient } = require("@azure/arm-monitor");
const { MonitorClient } = require("@azure/arm-monitor");
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 MonitorManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
client.autoscaleSettings.listByResourceGroup(resourceGroupName).then((result) => {
const client = new MonitorClient(creds, subscriptionId);
client.scheduledQueryRules.listBySubscription().then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand All @@ -61,7 +58,7 @@ client.autoscaleSettings.listByResourceGroup(resourceGroupName).then((result) =>
});
```

#### browser - Authentication, client creation, and listByResourceGroup autoscaleSettings as an example written in JavaScript.
#### browser - Authentication, client creation, and listBySubscription scheduledQueryRules 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.
Expand All @@ -86,11 +83,10 @@ In browser applications, we recommend using the `InteractiveBrowserCredential` t
const credential = new InteractiveBrowserCredential(
{
clientId: "<client id for your Azure AD app>",
tenantId: "<optional tenant for your organization>"
tenant: "<optional tenant for your organization>"
});
const client = new Azure.ArmMonitor.MonitorManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
client.autoscaleSettings.listByResourceGroup(resourceGroupName).then((result) => {
const client = new Azure.ArmMonitor.MonitorClient(creds, subscriptionId);
client.scheduledQueryRules.listBySubscription().then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand Down
8 changes: 4 additions & 4 deletions sdk/monitor/arm-monitor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@azure/arm-monitor",
"author": "Microsoft Corporation",
"description": "MonitorManagementClient Library with typescript type definitions for node.js and browser.",
"description": "MonitorClient Library with typescript type definitions for node.js and browser.",
"version": "6.1.1",
"dependencies": {
"@azure/ms-rest-azure-js": "^2.1.0",
Expand All @@ -18,16 +18,16 @@
],
"license": "MIT",
"main": "./dist/arm-monitor.js",
"module": "./esm/monitorManagementClient.js",
"types": "./esm/monitorManagementClient.d.ts",
"module": "./esm/monitorClient.js",
"types": "./esm/monitorClient.d.ts",
"devDependencies": {
"typescript": "^3.6.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"uglify-js": "^3.6.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/feature/v4/sdk/monitor/arm-monitor",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/monitor/arm-monitor",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
Expand Down
6 changes: 3 additions & 3 deletions sdk/monitor/arm-monitor/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sourcemaps from "rollup-plugin-sourcemaps";
* @type {rollup.RollupFileOptions}
*/
const config = {
input: "./esm/monitorManagementClient.js",
input: "./esm/monitorClient.js",
external: [
"@azure/ms-rest-js",
"@azure/ms-rest-azure-js"
Expand All @@ -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.
Expand Down
90 changes: 0 additions & 90 deletions sdk/monitor/arm-monitor/src/models/actionGroupsMappers.ts

This file was deleted.

89 changes: 0 additions & 89 deletions sdk/monitor/arm-monitor/src/models/activityLogAlertsMappers.ts

This file was deleted.

17 changes: 0 additions & 17 deletions sdk/monitor/arm-monitor/src/models/activityLogsMappers.ts

This file was deleted.

15 changes: 0 additions & 15 deletions sdk/monitor/arm-monitor/src/models/alertRuleIncidentsMappers.ts

This file was deleted.

Loading

0 comments on commit 94fb413

Please sign in to comment.