Skip to content

Commit 3a5d820

Browse files
authored
[AzureStack][Mgmt]hybrid-profile-2020-09-01-for-network (Azure#20746)
1 parent 050057c commit 3a5d820

File tree

99 files changed

+22351
-17483
lines changed

Some content is hidden

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

99 files changed

+22351
-17483
lines changed

common/config/rush/pnpm-lock.yaml

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

eng/ignore-links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-policy-profile-2020-09-01-h
1818
https://docs.microsoft.com/javascript/api/@azure/arm-subscriptions-profile-2020-09-01-hybrid
1919
https://docs.microsoft.com/javascript/api/@azure/arm-storage-profile-2020-09-01-hybrid
2020
https://docs.microsoft.com/javascript/api/@azure/arm-keyvault-profile-2020-09-01-hybrid
21+
https://docs.microsoft.com/javascript/api/@azure/arm-network-profile-2020-09-01-hybrid

rush.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,11 @@
16191619
"packageName": "@azure/arm-keyvault-profile-2020-09-01-hybrid",
16201620
"projectFolder": "sdk/keyvault/arm-keyvault-profile-2020-09-01-hybrid",
16211621
"versionPolicyName": "management"
1622+
},
1623+
{
1624+
"packageName": "@azure/arm-network-profile-2020-09-01-hybrid",
1625+
"projectFolder": "sdk/network/arm-network-profile-2020-09-01-hybrid",
1626+
"versionPolicyName": "management"
16221627
}
16231628
]
16241629
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Release History
2+
3+
## 2.0.0 (2022-03-09)
4+
5+
The package of @azure/arm-network-profile-2020-09-01-hybrid is using our next generation design principles since version 2.0.0, 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).
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 Microsoft
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 82 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,109 @@
1-
## Azure NetworkManagementClient SDK for JavaScript
1+
# Azure NetworkManagement client library for JavaScript
22

3-
This package contains an isomorphic SDK for NetworkManagementClient.
3+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure NetworkManagement client.
4+
5+
Network Client
6+
7+
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/network/arm-network-profile-2020-09-01-hybrid) |
8+
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-network-profile-2020-09-01-hybrid) |
9+
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-network-profile-2020-09-01-hybrid) |
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+
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
20+
21+
### Prerequisites
22+
23+
- An [Azure subscription][azure_sub].
24+
25+
### Install the `@azure/arm-network-profile-2020-09-01-hybrid` package
926

10-
### How to Install
27+
Install the Azure NetworkManagement client library for JavaScript with `npm`:
1128

1229
```bash
1330
npm install @azure/arm-network-profile-2020-09-01-hybrid
1431
```
1532

16-
### How to use
33+
### Create and authenticate a `NetworkManagementClient`
1734

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

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

22-
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
2342
```bash
24-
npm install @azure/ms-rest-nodeauth@"^3.0.0"
43+
npm install @azure/identity
2544
```
2645

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 { NetworkManagementClient, NetworkManagementModels, NetworkManagementMappers } from "@azure/arm-network-profile-2020-09-01-hybrid";
34-
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
35-
36-
msRestNodeAuth.interactiveLogin().then((creds) => {
37-
const client = new NetworkManagementClient(creds, subscriptionId);
38-
const resourceGroupName = "testresourceGroupName";
39-
const virtualNetworkGatewayName = "testvirtualNetworkGatewayName";
40-
client.virtualNetworkGateways.get(resourceGroupName, virtualNetworkGatewayName).then((result) => {
41-
console.log("The result is:");
42-
console.log(result);
43-
});
44-
}).catch((err) => {
45-
console.error(err);
46-
});
47-
```
46+
You will also need to **register a new AAD application and grant access to Azure NetworkManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
47+
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`.
4848

49-
#### browser - Authentication, client creation and get virtualNetworkGateways as an example written in JavaScript.
49+
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).
5050

51-
##### Install @azure/ms-rest-browserauth
51+
```javascript
52+
const { NetworkManagementClient } = require("@azure/arm-network-profile-2020-09-01-hybrid");
53+
const { DefaultAzureCredential } = require("@azure/identity");
54+
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
5255

53-
```bash
54-
npm install @azure/ms-rest-browserauth
56+
const subscriptionId = "00000000-0000-0000-0000-000000000000";
57+
const client = new NetworkManagementClient(new DefaultAzureCredential(), subscriptionId);
58+
59+
// For client-side applications running in the browser, use this code instead:
60+
// const credential = new InteractiveBrowserCredential({
61+
// tenantId: "<YOUR_TENANT_ID>",
62+
// clientId: "<YOUR_CLIENT_ID>"
63+
// });
64+
// const client = new NetworkManagementClient(credential, subscriptionId);
5565
```
5666

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

88+
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).
89+
90+
## Next steps
91+
92+
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.
93+
94+
## Contributing
95+
96+
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.
97+
9998
## Related projects
10099

101-
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
100+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
101+
102+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fnetwork%2Farm-network-profile-2020-09-01-hybrid%2FREADME.png)
102103

103-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/network/arm-network-profile-2020-09-01-hybrid/README.png)
104+
[azure_cli]: https://docs.microsoft.com/cli/azure
105+
[azure_sub]: https://azure.microsoft.com/free/
106+
[azure_sub]: https://azure.microsoft.com/free/
107+
[azure_portal]: https://portal.azure.com
108+
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
109+
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"commit": "1067b78669466324a1a2666adf053433c61e7f77",
3+
"readme": "specification/network/resource-manager/readme.md",
4+
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\network\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --tag=profile-hybrid-2020-09-01 --profile-content=profile-hybrid-2020-09-01",
5+
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
6+
"release_tool": "@azure-tools/js-sdk-release-tools@2.1.1",
7+
"use": "@autorest/typescript@6.0.0-beta.16"
8+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
4+
"docModel": {
5+
"enabled": true
6+
},
7+
"apiReport": {
8+
"enabled": true,
9+
"reportFolder": "./review"
10+
},
11+
"dtsRollup": {
12+
"enabled": true,
13+
"untrimmedFilePath": "",
14+
"publicTrimmedFilePath": "./types/arm-network-profile-2020-09-01-hybrid.d.ts"
15+
},
16+
"messages": {
17+
"tsdocMessageReporting": {
18+
"default": {
19+
"logLevel": "none"
20+
}
21+
},
22+
"extractorMessageReporting": {
23+
"ae-missing-release-tag": {
24+
"logLevel": "none"
25+
},
26+
"ae-unresolved-link": {
27+
"logLevel": "none"
28+
}
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)