Skip to content

Commit dec3e3d

Browse files
author
SDKAuto
committed
CodeGen from PR 13322 in Azure/azure-rest-api-specs
Merge c18917b127c248e0cec397a9be45aa5bfa546dc0 into 7601061bfbb72b2f19cb29c46cbf9a397c2d8893
1 parent 785029b commit dec3e3d

22 files changed

+1858
-381
lines changed

sdk/streamanalytics/arm-streamanalytics/README.md

Lines changed: 59 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,103 @@
11
## Azure StreamAnalyticsManagementClient SDK for JavaScript
22

3-
This package contains an isomorphic SDK for StreamAnalyticsManagementClient.
3+
This package contains an isomorphic SDK (runs both in node.js and in browsers) for StreamAnalyticsManagementClient.
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-streamanalytics` 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:
1221
```bash
13-
npm install @azure/arm-streamanalytics
22+
npm install --save @azure/arm-streamanalytics @azure/identity
1423
```
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 - client creation and get functions 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-
- 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-
```
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 functions as an example written in JavaScript.
2640

2741
##### Sample code
2842

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");
43+
```javascript
44+
const { DefaultAzureCredential } = require("@azure/identity");
3245
const { StreamAnalyticsManagementClient } = require("@azure/arm-streamanalytics");
3346
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
3447

35-
msRestNodeAuth.interactiveLogin().then((creds) => {
36-
const client = new StreamAnalyticsManagementClient(creds, subscriptionId);
37-
const resourceGroupName = "testresourceGroupName";
38-
const jobName = "testjobName";
39-
const functionName = "testfunctionName";
40-
client.functions.get(resourceGroupName, jobName, functionName).then((result) => {
41-
console.log("The result is:");
42-
console.log(result);
43-
});
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 StreamAnalyticsManagementClient(creds, subscriptionId);
52+
const resourceGroupName = "testresourceGroupName";
53+
const jobName = "testjobName";
54+
const functionName = "testfunctionName";
55+
client.functions.get(resourceGroupName, jobName, functionName).then((result) => {
56+
console.log("The result is:");
57+
console.log(result);
4458
}).catch((err) => {
59+
console.log("An error occurred:");
4560
console.error(err);
4661
});
4762
```
4863

49-
#### browser - Authentication, client creation and get functions as an example written in JavaScript.
64+
#### browser - Authentication, client creation, and get functions as an example written in JavaScript.
5065

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

5770
##### Sample code
5871

59-
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
60-
6172
- index.html
73+
6274
```html
6375
<!DOCTYPE html>
6476
<html lang="en">
6577
<head>
6678
<title>@azure/arm-streamanalytics sample</title>
67-
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
6879
<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>
80+
<script src="node_modules/@azure/identity/dist/index.js"></script>
7081
<script src="node_modules/@azure/arm-streamanalytics/dist/arm-streamanalytics.js"></script>
7182
<script type="text/javascript">
7283
const subscriptionId = "<Subscription_Id>";
73-
const authManager = new msAuth.AuthManager({
84+
// Create credentials using the `@azure/identity` package.
85+
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
86+
const credential = new InteractiveBrowserCredential(
87+
{
7488
clientId: "<client id for your Azure AD app>",
7589
tenant: "<optional tenant for your organization>"
7690
});
77-
authManager.finalizeLogin().then((res) => {
78-
if (!res.isLoggedIn) {
79-
// may cause redirects
80-
authManager.login();
81-
}
82-
const client = new Azure.ArmStreamanalytics.StreamAnalyticsManagementClient(res.creds, subscriptionId);
83-
const resourceGroupName = "testresourceGroupName";
84-
const jobName = "testjobName";
85-
const functionName = "testfunctionName";
86-
client.functions.get(resourceGroupName, jobName, functionName).then((result) => {
87-
console.log("The result is:");
88-
console.log(result);
89-
}).catch((err) => {
90-
console.log("An error occurred:");
91-
console.error(err);
92-
});
91+
const client = new Azure.ArmStreamanalytics.StreamAnalyticsManagementClient(creds, subscriptionId);
92+
const resourceGroupName = "testresourceGroupName";
93+
const jobName = "testjobName";
94+
const functionName = "testfunctionName";
95+
client.functions.get(resourceGroupName, jobName, functionName).then((result) => {
96+
console.log("The result is:");
97+
console.log(result);
98+
}).catch((err) => {
99+
console.log("An error occurred:");
100+
console.error(err);
93101
});
94102
</script>
95103
</head>

sdk/streamanalytics/arm-streamanalytics/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"description": "StreamAnalyticsManagementClient Library with typescript type definitions for node.js and browser.",
55
"version": "2.0.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,13 +21,13 @@
2021
"module": "./esm/streamAnalyticsManagementClient.js",
2122
"types": "./esm/streamAnalyticsManagementClient.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",
2728
"uglify-js": "^3.6.0"
2829
},
29-
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/streamanalytics/arm-streamanalytics",
30+
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/streamanalytics/arm-streamanalytics",
3031
"repository": {
3132
"type": "git",
3233
"url": "https://github.com/Azure/azure-sdk-for-js.git"

sdk/streamanalytics/arm-streamanalytics/src/models/clustersMappers.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,14 @@ export {
7171
PrivateLinkConnectionState,
7272
PrivateLinkServiceConnection,
7373
ProxyResource,
74+
QueryTestingResult,
75+
RawOutputDatasource,
76+
RawReferenceInputDataSource,
77+
RawStreamInputDataSource,
7478
ReferenceInputDataSource,
7579
ReferenceInputProperties,
7680
Resource,
81+
SampleInputResult,
7782
ScalarFunctionProperties,
7883
Serialization,
7984
ServiceBusQueueOutputDataSource,
@@ -85,6 +90,7 @@ export {
8590
StreamInputProperties,
8691
SubResource,
8792
SubscriptionQuota,
93+
TestDatasourceResult,
8894
TrackedResource,
8995
Transformation
9096
} from "../models/mappers";

sdk/streamanalytics/arm-streamanalytics/src/models/functionsMappers.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export {
3030
BlobOutputDataSource,
3131
BlobReferenceInputDataSource,
3232
BlobStreamInputDataSource,
33-
CloudError,
3433
Cluster,
3534
ClusterInfo,
3635
ClusterProperties,
@@ -43,6 +42,9 @@ export {
4342
DiagnosticCondition,
4443
Diagnostics,
4544
DocumentDbOutputDataSource,
45+
ErrorDetails,
46+
ErrorError,
47+
ErrorModel,
4648
ErrorResponse,
4749
EventHubOutputDataSource,
4850
EventHubStreamInputDataSource,
@@ -76,10 +78,15 @@ export {
7678
PrivateLinkConnectionState,
7779
PrivateLinkServiceConnection,
7880
ProxyResource,
81+
QueryTestingResult,
82+
RawOutputDatasource,
83+
RawReferenceInputDataSource,
84+
RawStreamInputDataSource,
7985
ReferenceInputDataSource,
8086
ReferenceInputProperties,
8187
Resource,
8288
ResourceTestStatus,
89+
SampleInputResult,
8390
ScalarFunctionProperties,
8491
Serialization,
8592
ServiceBusQueueOutputDataSource,
@@ -91,6 +98,7 @@ export {
9198
StreamInputProperties,
9299
SubResource,
93100
SubscriptionQuota,
101+
TestDatasourceResult,
94102
TrackedResource,
95103
Transformation
96104
} from "../models/mappers";

0 commit comments

Comments
 (0)