Skip to content

Commit 87063cd

Browse files
authored
relay-track2 (Azure#18921)
* relay-track2 * update * update version
1 parent da1b34f commit 87063cd

Some content is hidden

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

48 files changed

+7867
-3727
lines changed

common/config/rush/pnpm-lock.yaml

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

rush.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,11 @@
11551155
"packageName": "@azure/arm-loadtestservice",
11561156
"projectFolder": "sdk/loadtestservice/arm-loadtestservice",
11571157
"versionPolicyName": "management"
1158+
},
1159+
{
1160+
"packageName": "@azure/arm-relay",
1161+
"projectFolder": "sdk/relay/arm-relay",
1162+
"versionPolicyName": "management"
11581163
}
11591164
]
1160-
}
1165+
}

sdk/relay/arm-relay/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+
## 3.0.0 (2021-12-10)
4+
5+
The package of @azure/arm-relay is using our next generation design principles since version 3.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: 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) 2018 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/relay/arm-relay/README.md

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

3-
This package contains an isomorphic SDK for RelayManagementClient.
3+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client.
4+
5+
Use these API to manage Azure Relay resources through Azure Resource Manager.
6+
7+
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/relay/arm-relay) |
8+
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-relay) |
9+
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-relay) |
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.
9-
### How to Install
17+
- Latest versions of Safari, Chrome, Edge and Firefox.
1018

11-
```
19+
### Prerequisites
20+
21+
- An [Azure subscription][azure_sub].
22+
23+
### Install the `@azure/arm-relay` package
24+
25+
Install the Azure Service client library for JavaScript with `npm`:
26+
27+
```bash
1228
npm install @azure/arm-relay
1329
```
1430

15-
### How to use
31+
### Create and authenticate a `RelayAPI`
1632

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

19-
##### 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).
2037

21-
```
22-
npm install @azure/ms-rest-nodeauth
23-
```
38+
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
2439

25-
##### Sample code
26-
27-
```ts
28-
import * as msRest from "@azure/ms-rest-js";
29-
import * as msRestAzure from "@azure/ms-rest-azure-js";
30-
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
31-
import { RelayManagementClient, RelayManagementModels, RelayManagementMappers } from "@azure/arm-relay";
32-
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
33-
34-
msRestNodeAuth.interactiveLogin().then((creds) => {
35-
const client = new RelayManagementClient(creds, subscriptionId);
36-
client.operations.list().then((result) => {
37-
console.log("The result is:");
38-
console.log(result);
39-
});
40-
}).catch((err) => {
41-
console.error(err);
42-
});
40+
```bash
41+
npm install @azure/identity
4342
```
4443

45-
#### browser - Authentication, client creation and list operations as an example written in JavaScript.
44+
You will also need to **register a new AAD application and grant access to Azure Service** 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`.
4646

47-
##### Install @azure/ms-rest-browserauth
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).
4848

49+
```javascript
50+
const { RelayAPI } = require("@azure/arm-relay");
51+
const { DefaultAzureCredential } = require("@azure/identity");
52+
const subscriptionId = "00000000-0000-0000-0000-000000000000";
53+
const client = new RelayAPI(new DefaultAzureCredential(), subscriptionId);
4954
```
50-
npm install @azure/ms-rest-browserauth
51-
```
5255

53-
##### Sample code
54-
55-
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
56-
57-
- index.html
58-
```html
59-
<!DOCTYPE html>
60-
<html lang="en">
61-
<head>
62-
<title>@azure/arm-relay sample</title>
63-
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
64-
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
65-
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
66-
<script src="node_modules/@azure/arm-relay/dist/arm-relay.js"></script>
67-
<script type="text/javascript">
68-
const subscriptionId = "<Subscription_Id>";
69-
const authManager = new msAuth.AuthManager({
70-
clientId: "<client id for your Azure AD app>",
71-
tenant: "<optional tenant for your organization>"
72-
});
73-
authManager.finalizeLogin().then((res) => {
74-
if (!res.isLoggedIn) {
75-
// may cause redirects
76-
authManager.login();
77-
}
78-
const client = new Azure.ArmRelay.RelayManagementClient(res.creds, subscriptionId);
79-
client.operations.list().then((result) => {
80-
console.log("The result is:");
81-
console.log(result);
82-
}).catch((err) => {
83-
console.log("An error occurred:");
84-
console.error(err);
85-
});
86-
});
87-
</script>
88-
</head>
89-
<body></body>
90-
</html>
56+
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).
59+
60+
## Key concepts
61+
62+
### RelayAPI
63+
64+
`RelayAPI` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service 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");
9175
```
9276

93-
## Related projects
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).
9478

95-
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
79+
## Next steps
9680

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+
87+
## Related projects
88+
89+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
9790

9891
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Frelay%2Farm-relay%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

sdk/relay/arm-relay/_meta.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"commit": "76f8e0c50629ef12aa338d55782278ceca46212a",
3+
"readme": "specification/relay/resource-manager/readme.md",
4+
"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=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/relay/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1",
5+
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
6+
"use": "@autorest/typescript@6.0.0-alpha.16.20211130.1"
7+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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": { "enabled": true },
5+
"apiReport": { "enabled": true, "reportFolder": "./review" },
6+
"dtsRollup": {
7+
"enabled": true,
8+
"untrimmedFilePath": "",
9+
"publicTrimmedFilePath": "./types/arm-relay.d.ts"
10+
},
11+
"messages": {
12+
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
13+
"extractorMessageReporting": {
14+
"ae-missing-release-tag": { "logLevel": "none" },
15+
"ae-unresolved-link": { "logLevel": "none" }
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)