Skip to content

Commit 82295c9

Browse files
author
SDKAuto
committed
CodeGen from PR 16113 in Azure/azure-rest-api-specs
Merge 709c19c1a51b807fc96d5b09ced99aa6af8b2daf into a62f0a79c6abf6e876ca9816e13f206850dd7822
1 parent 3c7a547 commit 82295c9

17 files changed

+1353
-1955
lines changed

sdk/iothub/arm-iothub/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
## Azure IotHubClient SDK for JavaScript
22

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

55
### Currently supported environments
66

77
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
8-
- Latest versions of Safari, Chrome, Edge, and Firefox.
8+
- Latest versions of Safari, Chrome, Edge and Firefox.
99

1010
### Prerequisites
1111

@@ -21,7 +21,6 @@ Install both packages using the below command:
2121
```bash
2222
npm install --save @azure/arm-iothub @azure/identity
2323
```
24-
2524
> **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.
2625
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.
2726

@@ -37,7 +36,6 @@ If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/
3736

3837
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
3938
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.
40-
4139
#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
4240

4341
##### Sample code
@@ -51,7 +49,6 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
5149
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
5250
const creds = new DefaultAzureCredential();
5351
const client = new IotHubClient(creds, subscriptionId);
54-
5552
client.operations.list().then((result) => {
5653
console.log("The result is:");
5754
console.log(result);
@@ -86,7 +83,7 @@ In browser applications, we recommend using the `InteractiveBrowserCredential` t
8683
const credential = new InteractiveBrowserCredential(
8784
{
8885
clientId: "<client id for your Azure AD app>",
89-
tenantId: "<optional tenant for your organization>"
86+
tenant: "<optional tenant for your organization>"
9087
});
9188
const client = new Azure.ArmIothub.IotHubClient(creds, subscriptionId);
9289
client.operations.list().then((result) => {

sdk/iothub/arm-iothub/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"rollup-plugin-sourcemaps": "^0.4.2",
2828
"uglify-js": "^3.6.0"
2929
},
30-
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/feature/v4/sdk/iothub/arm-iothub",
30+
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iothub/arm-iothub",
3131
"repository": {
3232
"type": "git",
3333
"url": "https://github.com/Azure/azure-sdk-for-js.git"

sdk/iothub/arm-iothub/rollup.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import sourcemaps from "rollup-plugin-sourcemaps";
77
*/
88
const config = {
99
input: "./esm/iotHubClient.js",
10-
external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"],
10+
external: [
11+
"@azure/ms-rest-js",
12+
"@azure/ms-rest-azure-js"
13+
],
1114
output: {
1215
file: "./dist/arm-iothub.js",
1316
format: "umd",
@@ -25,7 +28,10 @@ const config = {
2528
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
2629
*/`
2730
},
28-
plugins: [nodeResolve({ mainFields: ["module", "main"] }), sourcemaps()]
31+
plugins: [
32+
nodeResolve({ mainFields: ['module', 'main'] }),
33+
sourcemaps()
34+
]
2935
};
3036

3137
export default config;

sdk/iothub/arm-iothub/src/iotHubClient.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import * as Mappers from "./models/mappers";
1414
import * as operations from "./operations";
1515
import { IotHubClientContext } from "./iotHubClientContext";
1616

17+
1718
class IotHubClient extends IotHubClientContext {
1819
// Operation groups
1920
operations: operations.Operations;
@@ -35,11 +36,7 @@ class IotHubClient extends IotHubClientContext {
3536
* @param subscriptionId The subscription identifier.
3637
* @param [options] The parameter options
3738
*/
38-
constructor(
39-
credentials: msRest.ServiceClientCredentials | TokenCredential,
40-
subscriptionId: string,
41-
options?: Models.IotHubClientOptions
42-
) {
39+
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.IotHubClientOptions) {
4340
super(credentials, subscriptionId, options);
4441
this.operations = new operations.Operations(this);
4542
this.iotHubResource = new operations.IotHubResource(this);
@@ -53,5 +50,10 @@ class IotHubClient extends IotHubClientContext {
5350

5451
// Operation Specifications
5552

56-
export { IotHubClient, IotHubClientContext, Models as IotHubModels, Mappers as IotHubMappers };
53+
export {
54+
IotHubClient,
55+
IotHubClientContext,
56+
Models as IotHubModels,
57+
Mappers as IotHubMappers
58+
};
5759
export * from "./operations";

sdk/iothub/arm-iothub/src/iotHubClientContext.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
import * as Models from "./models";
1111
import * as msRest from "@azure/ms-rest-js";
12-
import { TokenCredential } from "@azure/core-auth";
1312
import * as msRestAzure from "@azure/ms-rest-azure-js";
13+
import { TokenCredential } from "@azure/core-auth";
1414

1515
const packageName = "@azure/arm-iothub";
1616
const packageVersion = "5.1.1";
@@ -31,16 +31,12 @@ export class IotHubClientContext extends msRestAzure.AzureServiceClient {
3131
* @param subscriptionId The subscription identifier.
3232
* @param [options] The parameter options
3333
*/
34-
constructor(
35-
credentials: msRest.ServiceClientCredentials | TokenCredential,
36-
subscriptionId: string,
37-
options?: Models.IotHubClientOptions
38-
) {
34+
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.IotHubClientOptions) {
3935
if (credentials == undefined) {
40-
throw new Error("'credentials' cannot be null.");
36+
throw new Error('\'credentials\' cannot be null.');
4137
}
4238
if (subscriptionId == undefined) {
43-
throw new Error("'subscriptionId' cannot be null.");
39+
throw new Error('\'subscriptionId\' cannot be null.');
4440
}
4541

4642
if (!options) {
@@ -53,8 +49,8 @@ export class IotHubClientContext extends msRestAzure.AzureServiceClient {
5349

5450
super(credentials, options);
5551

56-
this.apiVersion = "2021-03-31";
57-
this.acceptLanguage = "en-US";
52+
this.apiVersion = '2021-07-01';
53+
this.acceptLanguage = 'en-US';
5854
this.longRunningOperationRetryTimeout = 30;
5955
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
6056
this.requestContentType = "application/json; charset=utf-8";
@@ -64,10 +60,7 @@ export class IotHubClientContext extends msRestAzure.AzureServiceClient {
6460
if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
6561
this.acceptLanguage = options.acceptLanguage;
6662
}
67-
if (
68-
options.longRunningOperationRetryTimeout !== null &&
69-
options.longRunningOperationRetryTimeout !== undefined
70-
) {
63+
if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
7164
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
7265
}
7366
}

0 commit comments

Comments
 (0)