Skip to content

Commit 52abf2b

Browse files
author
SDKAuto
committed
CodeGen from PR 16944 in Azure/azure-rest-api-specs
Merge bbdee7abda44fb45b2073c7debdd7315ed22379b into 280a0e69f86b8544fafe9ce7245e4bc4593e80ca
1 parent f31aa42 commit 52abf2b

File tree

103 files changed

+19973
-11368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+19973
-11368
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 36 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rush.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* This is the main configuration file for Rush.
33
* For full documentation, please see https://rushjs.io
4-
*/ {
4+
*/{
55
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json",
66
/**
77
* (Required) This specifies the version of the Rush engine to be used in this repo.
@@ -1155,6 +1155,11 @@
11551155
"packageName": "@azure/arm-relay",
11561156
"projectFolder": "sdk/relay/arm-relay",
11571157
"versionPolicyName": "management"
1158+
},
1159+
{
1160+
"packageName": "@azure/arm-monitor",
1161+
"projectFolder": "sdk/monitor/arm-monitor",
1162+
"versionPolicyName": "management"
11581163
}
11591164
]
1160-
}
1165+
}

sdk/monitor/arm-monitor/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Release History
2+
3+
## 7.0.0-beta.1 (2021-12-15)
4+
5+
The package of @azure/arm-monitor is using our next generation design principles since version 7.0.0-beta.1, which contains breaking changes.
6+
7+
To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog).
8+
9+
To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide).
10+
11+
To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).

sdk/monitor/arm-monitor/LICENSE.txt renamed to sdk/monitor/arm-monitor/LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019 Microsoft
3+
Copyright (c) 2021 Microsoft
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

sdk/monitor/arm-monitor/README.md

Lines changed: 70 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,98 @@
1-
## Azure MonitorManagementClient SDK for JavaScript
1+
# Azure Monitor client library for JavaScript
22

3-
This package contains an isomorphic SDK for MonitorManagementClient.
3+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Monitor client.
4+
5+
Monitor Management Client
6+
7+
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/monitor/arm-monitor) |
8+
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-monitor) |
9+
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-monitor) |
10+
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
11+
12+
## Getting started
413

514
### Currently supported environments
615

716
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
8-
- Latest versions of Safari, Chrome, Edge, and Firefox.
17+
- Latest versions of Safari, Chrome, Edge and Firefox.
18+
19+
### Prerequisites
20+
21+
- An [Azure subscription][azure_sub].
22+
23+
### Install the `@azure/arm-monitor` package
924

10-
### How to Install
25+
Install the Azure Monitor client library for JavaScript with `npm`:
1126

1227
```bash
1328
npm install @azure/arm-monitor
1429
```
1530

16-
### How to use
31+
### Create and authenticate a `MonitorClient`
1732

18-
#### nodejs - Authentication, client creation and listByResourceGroup autoscaleSettings as an example written in TypeScript.
33+
To create a client object to access the Azure Monitor API, you will need the `endpoint` of your Azure Monitor resource and a `credential`. The Azure Monitor client can use Azure Active Directory credentials to authenticate.
34+
You can find the endpoint for your Azure Monitor resource in the [Azure Portal][azure_portal].
1935

20-
##### Install @azure/ms-rest-nodeauth
36+
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).
37+
38+
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
2139

22-
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
2340
```bash
24-
npm install @azure/ms-rest-nodeauth@"^3.0.0"
41+
npm install @azure/identity
2542
```
2643

27-
##### Sample code
28-
29-
```typescript
30-
import * as msRest from "@azure/ms-rest-js";
31-
import * as msRestAzure from "@azure/ms-rest-azure-js";
32-
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
33-
import { MonitorManagementClient, MonitorManagementModels, MonitorManagementMappers } from "@azure/arm-monitor";
34-
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
35-
36-
msRestNodeAuth.interactiveLogin().then((creds) => {
37-
const client = new MonitorManagementClient(creds, subscriptionId);
38-
const resourceGroupName = "testresourceGroupName";
39-
client.autoscaleSettings.listByResourceGroup(resourceGroupName).then((result) => {
40-
console.log("The result is:");
41-
console.log(result);
42-
});
43-
}).catch((err) => {
44-
console.error(err);
45-
});
44+
You will also need to **register a new AAD application and grant access to Azure Monitor** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
45+
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`.
46+
47+
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).
48+
49+
```javascript
50+
const { MonitorClient } = require("@azure/arm-monitor");
51+
const { DefaultAzureCredential } = require("@azure/identity");
52+
const subscriptionId = "00000000-0000-0000-0000-000000000000";
53+
const client = new MonitorClient(new DefaultAzureCredential(), subscriptionId);
4654
```
4755

48-
#### browser - Authentication, client creation and listByResourceGroup autoscaleSettings as an example written in JavaScript.
4956

50-
##### Install @azure/ms-rest-browserauth
57+
### JavaScript Bundle
58+
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).
5159

52-
```bash
53-
npm install @azure/ms-rest-browserauth
54-
```
60+
## Key concepts
5561

56-
##### Sample code
57-
58-
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
59-
60-
- index.html
61-
```html
62-
<!DOCTYPE html>
63-
<html lang="en">
64-
<head>
65-
<title>@azure/arm-monitor sample</title>
66-
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
67-
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
68-
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
69-
<script src="node_modules/@azure/arm-monitor/dist/arm-monitor.js"></script>
70-
<script type="text/javascript">
71-
const subscriptionId = "<Subscription_Id>";
72-
const authManager = new msAuth.AuthManager({
73-
clientId: "<client id for your Azure AD app>",
74-
tenant: "<optional tenant for your organization>"
75-
});
76-
authManager.finalizeLogin().then((res) => {
77-
if (!res.isLoggedIn) {
78-
// may cause redirects
79-
authManager.login();
80-
}
81-
const client = new Azure.ArmMonitor.MonitorManagementClient(res.creds, subscriptionId);
82-
const resourceGroupName = "testresourceGroupName";
83-
client.autoscaleSettings.listByResourceGroup(resourceGroupName).then((result) => {
84-
console.log("The result is:");
85-
console.log(result);
86-
}).catch((err) => {
87-
console.log("An error occurred:");
88-
console.error(err);
89-
});
90-
});
91-
</script>
92-
</head>
93-
<body></body>
94-
</html>
62+
### MonitorClient
63+
64+
`MonitorClient` is the primary interface for developers using the Azure Monitor client library. Explore the methods on this client object to understand the different features of the Azure Monitor service that you can access.
65+
66+
## Troubleshooting
67+
68+
### Logging
69+
70+
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`:
71+
72+
```javascript
73+
const { setLogLevel } = require("@azure/logger");
74+
setLogLevel("info");
9575
```
9676

77+
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).
78+
79+
## Next steps
80+
81+
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.
82+
83+
## Contributing
84+
85+
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.
86+
9787
## Related projects
9888

99-
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
89+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
10090

10191
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmonitor%2Farm-monitor%2FREADME.png)
92+
93+
[azure_cli]: https://docs.microsoft.com/cli/azure
94+
[azure_sub]: https://azure.microsoft.com/free/
95+
[azure_sub]: https://azure.microsoft.com/free/
96+
[azure_portal]: https://portal.azure.com
97+
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
98+
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential

0 commit comments

Comments
 (0)