Skip to content

Commit 35fc536

Browse files
authored
arm-databricks-release (Azure#16327)
1 parent 719cb86 commit 35fc536

22 files changed

+3322
-425
lines changed

sdk/databricks/arm-databricks/LICENSE.txt

Lines changed: 1 addition & 1 deletion
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
Lines changed: 61 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,101 @@
1-
## Azure DatabricksClient SDK for JavaScript
1+
## Azure AzureDatabricksManagementClient SDK for JavaScript
22

3-
This package contains an isomorphic SDK for DatabricksClient.
3+
This package contains an isomorphic SDK (runs both in node.js and in browsers) for AzureDatabricksManagementClient.
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
1111

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+
- `@azure/arm-databricks` that contains the client.
18+
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
19+
20+
Install both packages using the below command:
21+
```bash
22+
npm install --save @azure/arm-databricks @azure/identity
1223
```
13-
npm install @azure/arm-databricks
14-
```
24+
> **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.
25+
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.
1526

1627
### How to use
1728

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

20-
##### Install @azure/ms-rest-nodeauth
21-
22-
```
23-
npm install @azure/ms-rest-nodeauth
24-
```
37+
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
38+
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.
39+
#### nodejs - Authentication, client creation, and get workspaces as an example written in JavaScript.
2540

2641
##### Sample code
2742

28-
```ts
29-
import * as msRest from "@azure/ms-rest-js";
30-
import * as msRestAzure from "@azure/ms-rest-azure-js";
31-
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
32-
import { DatabricksClient, DatabricksModels, DatabricksMappers } from "@azure/arm-databricks";
43+
```javascript
44+
const { DefaultAzureCredential } = require("@azure/identity");
45+
const { AzureDatabricksManagementClient } = require("@azure/arm-databricks");
3346
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
3447

35-
msRestNodeAuth.interactiveLogin().then((creds) => {
36-
const client = new DatabricksClient(creds, subscriptionId);
37-
const resourceGroupName = "testresourceGroupName";
38-
const workspaceName = "testworkspaceName";
39-
client.workspaces.get(resourceGroupName, workspaceName).then((result) => {
40-
console.log("The result is:");
41-
console.log(result);
42-
});
48+
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
49+
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
50+
const creds = new DefaultAzureCredential();
51+
const client = new AzureDatabricksManagementClient(creds, subscriptionId);
52+
const resourceGroupName = "testresourceGroupName";
53+
const workspaceName = "testworkspaceName";
54+
client.workspaces.get(resourceGroupName, workspaceName).then((result) => {
55+
console.log("The result is:");
56+
console.log(result);
4357
}).catch((err) => {
58+
console.log("An error occurred:");
4459
console.error(err);
4560
});
4661
```
4762

48-
#### browser - Authentication, client creation and get workspaces as an example written in JavaScript.
63+
#### browser - Authentication, client creation, and get workspaces as an example written in JavaScript.
4964

50-
##### Install @azure/ms-rest-browserauth
51-
52-
```
53-
npm install @azure/ms-rest-browserauth
54-
```
65+
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
66+
- 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.
67+
- Note down the client Id from the previous step and use it in the browser sample below.
5568

5669
##### Sample code
5770

58-
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
59-
6071
- index.html
72+
6173
```html
6274
<!DOCTYPE html>
6375
<html lang="en">
6476
<head>
6577
<title>@azure/arm-databricks sample</title>
66-
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
6778
<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>
79+
<script src="node_modules/@azure/identity/dist/index.js"></script>
6980
<script src="node_modules/@azure/arm-databricks/dist/arm-databricks.js"></script>
7081
<script type="text/javascript">
7182
const subscriptionId = "<Subscription_Id>";
72-
const authManager = new msAuth.AuthManager({
83+
// Create credentials using the `@azure/identity` package.
84+
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
85+
const credential = new InteractiveBrowserCredential(
86+
{
7387
clientId: "<client id for your Azure AD app>",
7488
tenant: "<optional tenant for your organization>"
7589
});
76-
authManager.finalizeLogin().then((res) => {
77-
if (!res.isLoggedIn) {
78-
// may cause redirects
79-
authManager.login();
80-
}
81-
const client = new Azure.ArmDatabricks.DatabricksClient(res.creds, subscriptionId);
82-
const resourceGroupName = "testresourceGroupName";
83-
const workspaceName = "testworkspaceName";
84-
client.workspaces.get(resourceGroupName, workspaceName).then((result) => {
85-
console.log("The result is:");
86-
console.log(result);
87-
}).catch((err) => {
88-
console.log("An error occurred:");
89-
console.error(err);
90-
});
90+
const client = new Azure.ArmDatabricks.AzureDatabricksManagementClient(creds, subscriptionId);
91+
const resourceGroupName = "testresourceGroupName";
92+
const workspaceName = "testworkspaceName";
93+
client.workspaces.get(resourceGroupName, workspaceName).then((result) => {
94+
console.log("The result is:");
95+
console.log(result);
96+
}).catch((err) => {
97+
console.log("An error occurred:");
98+
console.error(err);
9199
});
92100
</script>
93101
</head>
@@ -99,5 +107,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
99107

100108
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
101109

102-
103-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fdatabricks%2Farm-databricks%2FREADME.png)
110+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/databricks/arm-databricks/README.png)

sdk/databricks/arm-databricks/package.json

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "@azure/arm-databricks",
33
"author": "Microsoft Corporation",
4-
"description": "DatabricksClient Library with typescript type definitions for node.js and browser.",
5-
"version": "1.1.0",
4+
"description": "AzureDatabricksManagementClient Library with typescript type definitions for node.js and browser.",
5+
"version": "2.0.0",
66
"dependencies": {
7-
"@azure/ms-rest-azure-js": "^1.1.0",
8-
"@azure/ms-rest-js": "^1.1.0",
9-
"tslib": "^1.9.3"
7+
"@azure/ms-rest-azure-js": "^2.1.0",
8+
"@azure/ms-rest-js": "^2.2.0",
9+
"@azure/core-auth": "^1.1.4",
10+
"tslib": "^1.10.0"
1011
},
1112
"keywords": [
1213
"node",
@@ -17,21 +18,22 @@
1718
],
1819
"license": "MIT",
1920
"main": "./dist/arm-databricks.js",
20-
"module": "./esm/databricksClient.js",
21-
"types": "./esm/databricksClient.d.ts",
21+
"module": "./esm/azureDatabricksManagementClient.js",
22+
"types": "./esm/azureDatabricksManagementClient.d.ts",
2223
"devDependencies": {
23-
"typescript": "^3.1.1",
24-
"rollup": "^0.66.2",
25-
"rollup-plugin-node-resolve": "^3.4.0",
26-
"uglify-js": "^3.4.9"
24+
"typescript": "^3.6.0",
25+
"rollup": "^1.18.0",
26+
"rollup-plugin-node-resolve": "^5.2.0",
27+
"rollup-plugin-sourcemaps": "^0.4.2",
28+
"uglify-js": "^3.6.0"
2729
},
28-
"homepage": "https://github.com/azure/azure-sdk-for-js/tree/main/sdk/databricks/arm-databricks",
30+
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/feature/v4/sdk/databricks/arm-databricks",
2931
"repository": {
3032
"type": "git",
31-
"url": "https://github.com/azure/azure-sdk-for-js.git"
33+
"url": "https://github.com/Azure/azure-sdk-for-js.git"
3234
},
3335
"bugs": {
34-
"url": "https://github.com/azure/azure-sdk-for-js/issues"
36+
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
3537
},
3638
"files": [
3739
"dist/**/*.js",
@@ -43,6 +45,7 @@
4345
"esm/**/*.d.ts",
4446
"esm/**/*.d.ts.map",
4547
"src/**/*.ts",
48+
"README.md",
4649
"rollup.config.js",
4750
"tsconfig.json"
4851
],
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
import rollup from "rollup";
12
import nodeResolve from "rollup-plugin-node-resolve";
3+
import sourcemaps from "rollup-plugin-sourcemaps";
4+
25
/**
3-
* @type {import('rollup').RollupFileOptions}
6+
* @type {rollup.RollupFileOptions}
47
*/
58
const config = {
6-
input: './esm/databricksClient.js',
7-
external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"],
9+
input: "./esm/azureDatabricksManagementClient.js",
10+
external: [
11+
"@azure/ms-rest-js",
12+
"@azure/ms-rest-azure-js"
13+
],
814
output: {
915
file: "./dist/arm-databricks.js",
1016
format: "umd",
@@ -15,17 +21,17 @@ const config = {
1521
"@azure/ms-rest-azure-js": "msRestAzure"
1622
},
1723
banner: `/*
18-
* Copyright (c) Microsoft Corporation. All rights reserved.
19-
* Licensed under the MIT License. See License.txt in the project root for
20-
* license information.
24+
* Copyright (c) Microsoft Corporation.
25+
* Licensed under the MIT License.
2126
*
2227
* Code generated by Microsoft (R) AutoRest Code Generator.
23-
* Changes may cause incorrect behavior and will be lost if the code is
24-
* regenerated.
28+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
2529
*/`
2630
},
2731
plugins: [
28-
nodeResolve({ module: true })
32+
nodeResolve({ mainFields: ['module', 'main'] }),
33+
sourcemaps()
2934
]
3035
};
36+
3137
export default config;
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is
7+
* regenerated.
8+
*/
9+
10+
import * as msRest from "@azure/ms-rest-js";
11+
import { TokenCredential } from "@azure/core-auth";
12+
import * as Models from "./models";
13+
import * as Mappers from "./models/mappers";
14+
import * as operations from "./operations";
15+
import { AzureDatabricksManagementClientContext } from "./azureDatabricksManagementClientContext";
16+
17+
18+
class AzureDatabricksManagementClient extends AzureDatabricksManagementClientContext {
19+
// Operation groups
20+
workspaces: operations.Workspaces;
21+
operations: operations.Operations;
22+
privateLinkResources: operations.PrivateLinkResources;
23+
privateEndpointConnections: operations.PrivateEndpointConnections;
24+
vNetPeering: operations.VNetPeering;
25+
26+
/**
27+
* Initializes a new instance of the AzureDatabricksManagementClient class.
28+
* @param credentials Credentials needed for the client to connect to Azure. Credentials
29+
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
30+
* more information about these credentials, see
31+
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
32+
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
33+
* @azure/ms-rest-browserauth are also supported.
34+
* @param subscriptionId The ID of the target subscription.
35+
* @param [options] The parameter options
36+
*/
37+
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.AzureDatabricksManagementClientOptions) {
38+
super(credentials, subscriptionId, options);
39+
this.workspaces = new operations.Workspaces(this);
40+
this.operations = new operations.Operations(this);
41+
this.privateLinkResources = new operations.PrivateLinkResources(this);
42+
this.privateEndpointConnections = new operations.PrivateEndpointConnections(this);
43+
this.vNetPeering = new operations.VNetPeering(this);
44+
}
45+
}
46+
47+
// Operation Specifications
48+
49+
export {
50+
AzureDatabricksManagementClient,
51+
AzureDatabricksManagementClientContext,
52+
Models as AzureDatabricksManagementModels,
53+
Mappers as AzureDatabricksManagementMappers
54+
};
55+
export * from "./operations";

0 commit comments

Comments
 (0)