Skip to content

Commit c6d5478

Browse files
authored
Arm datafactory release (Azure#15379)
1 parent c1b4460 commit c6d5478

18 files changed

+1086
-97
lines changed

sdk/datafactory/arm-datafactory/README.md

Lines changed: 57 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,108 @@
11
## Azure DataFactoryManagementClient SDK for JavaScript
22

3-
This package contains an isomorphic SDK for DataFactoryManagementClient.
3+
This package contains an isomorphic SDK (runs both in node.js and in browsers) for DataFactoryManagementClient.
44

55
### Currently supported environments
66

7-
- Node.js version 6.x.x or higher
8-
- Browser JavaScript
7+
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
8+
- Latest versions of Safari, Chrome, Edge, and Firefox.
99

10-
### How to Install
10+
### Prerequisites
11+
12+
You must have an [Azure subscription](https://azure.microsoft.com/free/).
13+
14+
### How to install
15+
16+
To use this SDK in your project, you will need to install two packages.
17+
18+
- `@azure/arm-datafactory` that contains the client.
19+
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
20+
21+
Install both packages using the below command:
1122

1223
```bash
13-
npm install @azure/arm-datafactory
24+
npm install --save @azure/arm-datafactory @azure/identity
1425
```
1526

27+
> **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.
28+
> 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.
29+
1630
### How to use
1731

18-
#### nodejs - client creation and list operations as an example written in TypeScript.
32+
- If you are writing a client side browser application,
33+
- 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.
34+
- 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.
35+
- If you are writing a server side application,
36+
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
37+
- Complete the set up steps required by the credential if any.
38+
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
1939

20-
##### Install @azure/ms-rest-nodeauth
40+
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
41+
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.
2142

22-
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
23-
```bash
24-
npm install @azure/ms-rest-nodeauth@"^3.0.0"
25-
```
43+
#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
2644

2745
##### Sample code
2846

29-
While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
30-
```typescript
31-
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
47+
```javascript
48+
const { DefaultAzureCredential } = require("@azure/identity");
3249
const { DataFactoryManagementClient } = require("@azure/arm-datafactory");
3350
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
3451

35-
msRestNodeAuth.interactiveLogin().then((creds) => {
36-
const client = new DataFactoryManagementClient(creds, subscriptionId);
37-
client.operations.list().then((result) => {
52+
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
53+
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
54+
const creds = new DefaultAzureCredential();
55+
const client = new DataFactoryManagementClient(creds, subscriptionId);
56+
client.operations
57+
.list()
58+
.then((result) => {
3859
console.log("The result is:");
3960
console.log(result);
61+
})
62+
.catch((err) => {
63+
console.log("An error occurred:");
64+
console.error(err);
4065
});
41-
}).catch((err) => {
42-
console.error(err);
43-
});
4466
```
4567

46-
#### browser - Authentication, client creation and list operations as an example written in JavaScript.
68+
#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
4769

48-
##### Install @azure/ms-rest-browserauth
70+
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
4971

50-
```bash
51-
npm install @azure/ms-rest-browserauth
52-
```
72+
- 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.
73+
- Note down the client Id from the previous step and use it in the browser sample below.
5374

5475
##### Sample code
5576

56-
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
57-
5877
- index.html
78+
5979
```html
6080
<!DOCTYPE html>
6181
<html lang="en">
6282
<head>
6383
<title>@azure/arm-datafactory sample</title>
64-
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
6584
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
66-
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
85+
<script src="node_modules/@azure/identity/dist/index.js"></script>
6786
<script src="node_modules/@azure/arm-datafactory/dist/arm-datafactory.js"></script>
6887
<script type="text/javascript">
6988
const subscriptionId = "<Subscription_Id>";
70-
const authManager = new msAuth.AuthManager({
89+
// Create credentials using the `@azure/identity` package.
90+
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
91+
const credential = new InteractiveBrowserCredential({
7192
clientId: "<client id for your Azure AD app>",
7293
tenant: "<optional tenant for your organization>"
7394
});
74-
authManager.finalizeLogin().then((res) => {
75-
if (!res.isLoggedIn) {
76-
// may cause redirects
77-
authManager.login();
78-
}
79-
const client = new Azure.ArmDatafactory.DataFactoryManagementClient(res.creds, subscriptionId);
80-
client.operations.list().then((result) => {
95+
const client = new Azure.ArmDatafactory.DataFactoryManagementClient(creds, subscriptionId);
96+
client.operations
97+
.list()
98+
.then((result) => {
8199
console.log("The result is:");
82100
console.log(result);
83-
}).catch((err) => {
101+
})
102+
.catch((err) => {
84103
console.log("An error occurred:");
85104
console.error(err);
86105
});
87-
});
88106
</script>
89107
</head>
90108
<body></body>

sdk/datafactory/arm-datafactory/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
"name": "@azure/arm-datafactory",
33
"author": "Microsoft Corporation",
44
"description": "DataFactoryManagementClient Library with typescript type definitions for node.js and browser.",
5-
"version": "7.7.0",
5+
"version": "7.8.0",
66
"dependencies": {
7-
"@azure/ms-rest-azure-js": "^2.0.1",
8-
"@azure/ms-rest-js": "^2.0.4",
7+
"@azure/ms-rest-azure-js": "^2.1.0",
8+
"@azure/ms-rest-js": "^2.2.0",
9+
"@azure/core-auth": "^1.1.4",
910
"tslib": "^1.10.0"
1011
},
1112
"keywords": [
@@ -20,7 +21,7 @@
2021
"module": "./esm/dataFactoryManagementClient.js",
2122
"types": "./esm/dataFactoryManagementClient.d.ts",
2223
"devDependencies": {
23-
"typescript": "^3.5.3",
24+
"typescript": "^3.6.0",
2425
"rollup": "^1.18.0",
2526
"rollup-plugin-node-resolve": "^5.2.0",
2627
"rollup-plugin-sourcemaps": "^0.4.2",

sdk/datafactory/arm-datafactory/src/dataFactoryManagementClient.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
import * as msRest from "@azure/ms-rest-js";
11+
import { TokenCredential } from "@azure/core-auth";
1112
import * as Models from "./models";
1213
import * as Mappers from "./models/mappers";
1314
import * as operations from "./operations";
@@ -38,12 +39,17 @@ class DataFactoryManagementClient extends DataFactoryManagementClientContext {
3839

3940
/**
4041
* Initializes a new instance of the DataFactoryManagementClient class.
41-
* @param credentials Credentials needed for the client to connect to Azure.
42+
* @param credentials Credentials needed for the client to connect to Azure. Credentials
43+
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
44+
* more information about these credentials, see
45+
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
46+
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
47+
* @azure/ms-rest-browserauth are also supported.
4248
* @param subscriptionId The subscription identifier.
4349
* @param [options] The parameter options
4450
*/
4551
constructor(
46-
credentials: msRest.ServiceClientCredentials,
52+
credentials: msRest.ServiceClientCredentials | TokenCredential,
4753
subscriptionId: string,
4854
options?: Models.DataFactoryManagementClientOptions
4955
) {

sdk/datafactory/arm-datafactory/src/dataFactoryManagementClientContext.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,29 @@
1010
import * as Models from "./models";
1111
import * as msRest from "@azure/ms-rest-js";
1212
import * as msRestAzure from "@azure/ms-rest-azure-js";
13+
import { TokenCredential } from "@azure/core-auth";
1314

1415
const packageName = "@azure/arm-datafactory";
15-
const packageVersion = "7.7.0";
16+
const packageVersion = "7.8.0";
1617

1718
export class DataFactoryManagementClientContext extends msRestAzure.AzureServiceClient {
18-
credentials: msRest.ServiceClientCredentials;
19+
credentials: msRest.ServiceClientCredentials | TokenCredential;
1920
subscriptionId: string;
2021
apiVersion?: string;
2122

2223
/**
2324
* Initializes a new instance of the DataFactoryManagementClient class.
24-
* @param credentials Credentials needed for the client to connect to Azure.
25+
* @param credentials Credentials needed for the client to connect to Azure. Credentials
26+
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
27+
* more information about these credentials, see
28+
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
29+
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
30+
* @azure/ms-rest-browserauth are also supported.
2531
* @param subscriptionId The subscription identifier.
2632
* @param [options] The parameter options
2733
*/
2834
constructor(
29-
credentials: msRest.ServiceClientCredentials,
35+
credentials: msRest.ServiceClientCredentials | TokenCredential,
3036
subscriptionId: string,
3137
options?: Models.DataFactoryManagementClientOptions
3238
) {

sdk/datafactory/arm-datafactory/src/models/dataFlowsMappers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ export {
338338
MarketoLinkedService,
339339
MarketoObjectDataset,
340340
MarketoSource,
341+
MetadataItem,
341342
MicrosoftAccessLinkedService,
342343
MicrosoftAccessSink,
343344
MicrosoftAccessSource,

sdk/datafactory/arm-datafactory/src/models/datasetsMappers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ export {
338338
MarketoLinkedService,
339339
MarketoObjectDataset,
340340
MarketoSource,
341+
MetadataItem,
341342
MicrosoftAccessLinkedService,
342343
MicrosoftAccessSink,
343344
MicrosoftAccessSource,

sdk/datafactory/arm-datafactory/src/models/factoriesMappers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ export {
343343
MarketoLinkedService,
344344
MarketoObjectDataset,
345345
MarketoSource,
346+
MetadataItem,
346347
MicrosoftAccessLinkedService,
347348
MicrosoftAccessSink,
348349
MicrosoftAccessSource,

0 commit comments

Comments
 (0)