diff --git a/packages/@azure/arm-iothub/LICENSE.txt b/packages/@azure/arm-iothub/LICENSE.txt index a70e8cf66038..8f3d856145c5 100644 --- a/packages/@azure/arm-iothub/LICENSE.txt +++ b/packages/@azure/arm-iothub/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2019 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/@azure/arm-iothub/README.md b/packages/@azure/arm-iothub/README.md index 7b46488b411b..fd95240c703b 100644 --- a/packages/@azure/arm-iothub/README.md +++ b/packages/@azure/arm-iothub/README.md @@ -1,96 +1,96 @@ -## Azure IotHubClient SDK for JavaScript - -This package contains an isomorphic SDK for IotHubClient. - -### Currently supported environments - -- Node.js version 6.x.x or higher -- Browser JavaScript - -### How to Install - -``` -npm install @azure/arm-iothub -``` - -### How to use - -#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. - -##### Install @azure/ms-rest-nodeauth - -``` -npm install @azure/ms-rest-nodeauth -``` - -##### Sample code - -```ts -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { IotHubClient, IotHubModels, IotHubMappers } from "@azure/arm-iothub"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new IotHubClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); -``` - -#### browser - Authentication, client creation and list operations as an example written in JavaScript. - -##### Install @azure/ms-rest-browserauth - -``` -npm install @azure/ms-rest-browserauth -``` - -##### Sample code - -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-iothub sample - - - - - - - - -``` - -## Related projects - -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +## Azure IotHubClient SDK for JavaScript + +This package contains an isomorphic SDK for IotHubClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-iothub +``` + +### How to use + +#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +```bash +npm install @azure/ms-rest-nodeauth +``` + +##### Sample code + +```typescript +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; +import { IotHubClient, IotHubModels, IotHubMappers } from "@azure/arm-iothub"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new IotHubClient(creds, subscriptionId); + client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and list operations as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-iothub sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/arm-iothub/lib/iotHubClientContext.ts b/packages/@azure/arm-iothub/lib/iotHubClientContext.ts index 4e27860b04d5..a3e9918087ca 100644 --- a/packages/@azure/arm-iothub/lib/iotHubClientContext.ts +++ b/packages/@azure/arm-iothub/lib/iotHubClientContext.ts @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; const packageName = "@azure/arm-iothub"; -const packageVersion = "0.1.0"; +const packageVersion = "2.1.0"; export class IotHubClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; @@ -44,7 +44,7 @@ export class IotHubClientContext extends msRestAzure.AzureServiceClient { super(credentials, options); - this.apiVersion = '2018-04-01'; + this.apiVersion = '2018-12-01-preview'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; diff --git a/packages/@azure/arm-iothub/lib/models/certificatesMappers.ts b/packages/@azure/arm-iothub/lib/models/certificatesMappers.ts index 063684f78e5f..06bd7fe28ea3 100644 --- a/packages/@azure/arm-iothub/lib/models/certificatesMappers.ts +++ b/packages/@azure/arm-iothub/lib/models/certificatesMappers.ts @@ -38,6 +38,7 @@ export { CloudToDeviceProperties, FeedbackProperties, OperationsMonitoringProperties, + IotHubPropertiesDeviceStreams, IotHubSkuInfo } from "../models/mappers"; diff --git a/packages/@azure/arm-iothub/lib/models/index.ts b/packages/@azure/arm-iothub/lib/models/index.ts index e621acb66598..7dbdcc0668e2 100644 --- a/packages/@azure/arm-iothub/lib/models/index.ts +++ b/packages/@azure/arm-iothub/lib/models/index.ts @@ -492,11 +492,11 @@ export interface RoutingStorageContainerProperties { */ maxChunkSizeInBytes?: number; /** - * @member {string} [encoding] Encoding that is used to serialize messages to - * blobs. Supported values are 'avro' and 'avrodeflate'. Default value is - * 'avro'. + * @member {Encoding} [encoding] Encoding that is used to serialize messages + * to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default + * value is 'avro'. Possible values include: 'Avro', 'AvroDeflate', 'JSON' */ - encoding?: string; + encoding?: Encoding; } /** @@ -647,8 +647,8 @@ export interface RoutingProperties { */ export interface StorageEndpointProperties { /** - * @member {string} [sasTtlAsIso8601] The period of time for which the the - * SAS URI generated by IoT Hub for file upload is valid. See: + * @member {string} [sasTtlAsIso8601] The period of time for which the SAS + * URI generated by IoT Hub for file upload is valid. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. */ sasTtlAsIso8601?: string; @@ -759,6 +759,19 @@ export interface OperationsMonitoringProperties { events?: { [propertyName: string]: OperationMonitoringLevel }; } +/** + * @interface + * An interface representing IotHubPropertiesDeviceStreams. + * The device streams properties of iothub. + * + */ +export interface IotHubPropertiesDeviceStreams { + /** + * @member {string[]} [streamingEndpoints] List of Device Streams Endpoints. + */ + streamingEndpoints?: string[]; +} + /** * @interface * An interface representing IotHubProperties. @@ -783,7 +796,7 @@ export interface IotHubProperties { */ readonly provisioningState?: string; /** - * @member {string} [state] Thehub state state. + * @member {string} [state] The hub state. * **NOTE: This property will not be serialized. It can only be populated by * the server.** */ @@ -839,6 +852,11 @@ export interface IotHubProperties { * @member {OperationsMonitoringProperties} [operationsMonitoringProperties] */ operationsMonitoringProperties?: OperationsMonitoringProperties; + /** + * @member {IotHubPropertiesDeviceStreams} [deviceStreams] The device streams + * properties of iothub. + */ + deviceStreams?: IotHubPropertiesDeviceStreams; /** * @member {Capabilities} [features] The capabilities and features enabled * for the IoT hub. Possible values include: 'None', 'DeviceManagement' @@ -957,6 +975,12 @@ export interface OperationDisplay { * the server.** */ readonly operation?: string; + /** + * @member {string} [description] Description of the operation + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly description?: string; } /** @@ -1052,8 +1076,19 @@ export interface EndpointHealthData { */ endpointId?: string; /** - * @member {EndpointHealthStatus} [healthStatus] Health status. Possible - * values include: 'unknown', 'healthy', 'unhealthy', 'dead' + * @member {EndpointHealthStatus} [healthStatus] Health statuses have + * following meanings. The 'healthy' status shows that the endpoint is + * accepting messages as expected. The 'unhealthy' status shows that the + * endpoint is not accepting messages as expected and IoT Hub is retrying to + * send data to this endpoint. The status of an unhealthy endpoint will be + * updated to healthy when IoT Hub has established an eventually consistent + * state of health. The 'dead' status shows that the endpoint is not + * accepting messages, after IoT Hub retried sending messages for the retrial + * period. See IoT Hub metrics to identify errors and monitor issues with + * endpoints. The 'unknown' status shows that the IoT Hub has not established + * a connection with the endpoint. No messages have been delivered to or + * rejected from this endpoint. Possible values include: 'unknown', + * 'healthy', 'unhealthy', 'dead' */ healthStatus?: EndpointHealthStatus; } @@ -1398,13 +1433,13 @@ export interface RoutingMessage { */ export interface RoutingTwinProperties { /** - * @member {any} [desiredProperties] Twin desired properties + * @member {any} [desired] Twin desired properties */ - desiredProperties?: any; + desired?: any; /** - * @member {any} [reportedProperties] Twin desired properties + * @member {any} [reported] Twin desired properties */ - reportedProperties?: any; + reported?: any; } /** @@ -1979,6 +2014,14 @@ export type TestResultStatus = 'undefined' | 'false' | 'true'; */ export type RouteErrorSeverity = 'error' | 'warning'; +/** + * Defines values for Encoding. + * Possible values include: 'Avro', 'AvroDeflate', 'JSON' + * @readonly + * @enum {string} + */ +export type Encoding = 'Avro' | 'AvroDeflate' | 'JSON'; + /** * Contains response data for the list operation. */ diff --git a/packages/@azure/arm-iothub/lib/models/iotHubResourceMappers.ts b/packages/@azure/arm-iothub/lib/models/iotHubResourceMappers.ts index edcf42a6f5d8..c8a209fa4571 100644 --- a/packages/@azure/arm-iothub/lib/models/iotHubResourceMappers.ts +++ b/packages/@azure/arm-iothub/lib/models/iotHubResourceMappers.ts @@ -29,6 +29,7 @@ export { CloudToDeviceProperties, FeedbackProperties, OperationsMonitoringProperties, + IotHubPropertiesDeviceStreams, IotHubSkuInfo, ErrorDetails, TagsResource, diff --git a/packages/@azure/arm-iothub/lib/models/mappers.ts b/packages/@azure/arm-iothub/lib/models/mappers.ts index ffafd0911b12..002cd093384d 100644 --- a/packages/@azure/arm-iothub/lib/models/mappers.ts +++ b/packages/@azure/arm-iothub/lib/models/mappers.ts @@ -965,6 +965,27 @@ export const OperationsMonitoringProperties: msRest.CompositeMapper = { } }; +export const IotHubPropertiesDeviceStreams: msRest.CompositeMapper = { + serializedName: "IotHubProperties_deviceStreams", + type: { + name: "Composite", + className: "IotHubPropertiesDeviceStreams", + modelProperties: { + streamingEndpoints: { + serializedName: "streamingEndpoints", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + export const IotHubProperties: msRest.CompositeMapper = { serializedName: "IotHubProperties", type: { @@ -1085,6 +1106,13 @@ export const IotHubProperties: msRest.CompositeMapper = { className: "OperationsMonitoringProperties" } }, + deviceStreams: { + serializedName: "deviceStreams", + type: { + name: "Composite", + className: "IotHubPropertiesDeviceStreams" + } + }, features: { serializedName: "features", type: { @@ -1240,6 +1268,13 @@ export const OperationDisplay: msRest.CompositeMapper = { type: { name: "String" } + }, + description: { + readOnly: true, + serializedName: "description", + type: { + name: "String" + } } } } @@ -1808,14 +1843,14 @@ export const RoutingTwinProperties: msRest.CompositeMapper = { name: "Composite", className: "RoutingTwinProperties", modelProperties: { - desiredProperties: { - serializedName: "desiredProperties", + desired: { + serializedName: "desired", type: { name: "Object" } }, - reportedProperties: { - serializedName: "reportedProperties", + reported: { + serializedName: "reported", type: { name: "Object" } diff --git a/packages/@azure/arm-iothub/package.json b/packages/@azure/arm-iothub/package.json index 65b852e5fe63..2ffb54125116 100644 --- a/packages/@azure/arm-iothub/package.json +++ b/packages/@azure/arm-iothub/package.json @@ -4,8 +4,8 @@ "description": "IotHubClient Library with typescript type definitions for node.js and browser.", "version": "2.1.0", "dependencies": { - "@azure/ms-rest-azure-js": "^1.1.0", - "@azure/ms-rest-js": "^1.1.0", + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", "tslib": "^1.9.3" }, "keywords": [ @@ -23,6 +23,7 @@ "typescript": "^3.1.1", "rollup": "^0.66.2", "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.4.9" }, "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/packages/@azure/arm-iothub", @@ -51,6 +52,5 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-iothub.js.map'\" -o ./dist/arm-iothub.min.js ./dist/arm-iothub.js", "prepack": "npm install && npm run build" }, - "sideEffects": false, - "authPublish": true + "sideEffects": false } diff --git a/packages/@azure/arm-iothub/rollup.config.js b/packages/@azure/arm-iothub/rollup.config.js index 0209b0ba1400..8464171f6338 100644 --- a/packages/@azure/arm-iothub/rollup.config.js +++ b/packages/@azure/arm-iothub/rollup.config.js @@ -1,10 +1,16 @@ +import rollup from "rollup"; import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + /** - * @type {import('rollup').RollupFileOptions} + * @type {rollup.RollupFileOptions} */ const config = { - input: './esm/iotHubClient.js', - external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"], + input: "./esm/iotHubClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], output: { file: "./dist/arm-iothub.js", format: "umd", @@ -16,16 +22,16 @@ const config = { }, banner: `/* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */` }, plugins: [ - nodeResolve({ module: true }) + nodeResolve({ module: true }), + sourcemaps() ] }; + export default config;