From 3b8c9e88624bb5af53f0c92df7bdafb9f0636ecd Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 10 Apr 2019 14:24:40 -0700 Subject: [PATCH] Generated from c35f0c9e68ea65edd1fd423599c451818c2a836e (#2174) Manual failover swagger --- packages/@azure/arm-iothub/LICENSE.txt | 42 ++-- packages/@azure/arm-iothub/README.md | 195 +++++++++--------- .../@azure/arm-iothub/lib/iotHubClient.ts | 2 + .../arm-iothub/lib/iotHubClientContext.ts | 4 +- .../lib/models/certificatesMappers.ts | 3 +- .../@azure/arm-iothub/lib/models/index.ts | 163 +++++++++++---- .../arm-iothub/lib/models/iotHubMappers.ts | 42 ++++ .../lib/models/iotHubResourceMappers.ts | 3 +- .../@azure/arm-iothub/lib/models/mappers.ts | 103 +++++++-- .../@azure/arm-iothub/lib/operations/index.ts | 1 + .../arm-iothub/lib/operations/iotHub.ts | 101 +++++++++ packages/@azure/arm-iothub/package.json | 8 +- packages/@azure/arm-iothub/rollup.config.js | 22 +- 13 files changed, 494 insertions(+), 195 deletions(-) create mode 100644 packages/@azure/arm-iothub/lib/models/iotHubMappers.ts create mode 100644 packages/@azure/arm-iothub/lib/operations/iotHub.ts 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 3e4fea2328fa..fd95240c703b 100644 --- a/packages/@azure/arm-iothub/README.md +++ b/packages/@azure/arm-iothub/README.md @@ -1,99 +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) - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fpackages%2F%40azure%2Farm-iothub%2FREADME.png) +## 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/iotHubClient.ts b/packages/@azure/arm-iothub/lib/iotHubClient.ts index 36360600b831..acbec4a87d10 100644 --- a/packages/@azure/arm-iothub/lib/iotHubClient.ts +++ b/packages/@azure/arm-iothub/lib/iotHubClient.ts @@ -21,6 +21,7 @@ class IotHubClient extends IotHubClientContext { iotHubResource: operations.IotHubResource; resourceProviderCommon: operations.ResourceProviderCommon; certificates: operations.Certificates; + iotHub: operations.IotHub; /** * Initializes a new instance of the IotHubClient class. @@ -34,6 +35,7 @@ class IotHubClient extends IotHubClientContext { this.iotHubResource = new operations.IotHubResource(this); this.resourceProviderCommon = new operations.ResourceProviderCommon(this); this.certificates = new operations.Certificates(this); + this.iotHub = new operations.IotHub(this); } } diff --git a/packages/@azure/arm-iothub/lib/iotHubClientContext.ts b/packages/@azure/arm-iothub/lib/iotHubClientContext.ts index 4e27860b04d5..86967fe65040 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 = '2019-03-22-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..dcbfc44f4d88 100644 --- a/packages/@azure/arm-iothub/lib/models/certificatesMappers.ts +++ b/packages/@azure/arm-iothub/lib/models/certificatesMappers.ts @@ -33,11 +33,12 @@ export { RoutingStorageContainerProperties, RouteProperties, FallbackRouteProperties, + EnrichmentProperties, StorageEndpointProperties, MessagingEndpointProperties, 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..2c7f606062d0 100644 --- a/packages/@azure/arm-iothub/lib/models/index.ts +++ b/packages/@azure/arm-iothub/lib/models/index.ts @@ -356,9 +356,8 @@ export interface RoutingServiceBusQueueEndpointProperties { * @member {string} name The name that identifies this endpoint. The name can * only include alphanumeric characters, periods, underscores, hyphens and * has a maximum length of 64 characters. The following names are reserved: - * events, operationsMonitoringEvents, fileNotifications, $default. Endpoint - * names must be unique across endpoint types. The name need not be the same - * as the actual queue name. + * events, fileNotifications, $default. Endpoint names must be unique across + * endpoint types. The name need not be the same as the actual queue name. */ name: string; /** @@ -389,9 +388,8 @@ export interface RoutingServiceBusTopicEndpointProperties { * @member {string} name The name that identifies this endpoint. The name can * only include alphanumeric characters, periods, underscores, hyphens and * has a maximum length of 64 characters. The following names are reserved: - * events, operationsMonitoringEvents, fileNotifications, $default. Endpoint - * names must be unique across endpoint types. The name need not be the same - * as the actual topic name. + * events, fileNotifications, $default. Endpoint names must be unique across + * endpoint types. The name need not be the same as the actual topic name. */ name: string; /** @@ -422,8 +420,8 @@ export interface RoutingEventHubProperties { * @member {string} name The name that identifies this endpoint. The name can * only include alphanumeric characters, periods, underscores, hyphens and * has a maximum length of 64 characters. The following names are reserved: - * events, operationsMonitoringEvents, fileNotifications, $default. Endpoint - * names must be unique across endpoint types. + * events, fileNotifications, $default. Endpoint names must be unique across + * endpoint types. */ name: string; /** @@ -454,8 +452,8 @@ export interface RoutingStorageContainerProperties { * @member {string} name The name that identifies this endpoint. The name can * only include alphanumeric characters, periods, underscores, hyphens and * has a maximum length of 64 characters. The following names are reserved: - * events, operationsMonitoringEvents, fileNotifications, $default. Endpoint - * names must be unique across endpoint types. + * events, fileNotifications, $default. Endpoint names must be unique across + * endpoint types. */ name: string; /** @@ -492,11 +490,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; } /** @@ -609,6 +607,29 @@ export interface FallbackRouteProperties { isEnabled: boolean; } +/** + * @interface + * An interface representing EnrichmentProperties. + * The properties of an enrichment that your IoT hub applies to messages + * delivered to endpoints. + * + */ +export interface EnrichmentProperties { + /** + * @member {string} key The key or name for the enrichment property. + */ + key: string; + /** + * @member {string} value The value for the enrichment property. + */ + value: string; + /** + * @member {string[]} endpointNames The list of endpoints for which the + * enrichment is applied to the message. + */ + endpointNames: string[]; +} + /** * @interface * An interface representing RoutingProperties. @@ -637,6 +658,12 @@ export interface RoutingProperties { * eventhub endpoint. */ fallbackRoute?: FallbackRouteProperties; + /** + * @member {EnrichmentProperties[]} [enrichments] The list of user-provided + * enrichments that the IoT hub applies to messages to be delivered to + * built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid + */ + enrichments?: EnrichmentProperties[]; } /** @@ -647,8 +674,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; @@ -745,18 +772,15 @@ export interface CloudToDeviceProperties { /** * @interface - * An interface representing OperationsMonitoringProperties. - * The operations monitoring properties for the IoT hub. The possible keys to - * the dictionary are Connections, DeviceTelemetry, C2DCommands, - * DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, - * C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. + * An interface representing IotHubPropertiesDeviceStreams. + * The device streams properties of iothub. * */ -export interface OperationsMonitoringProperties { +export interface IotHubPropertiesDeviceStreams { /** - * @member {{ [propertyName: string]: OperationMonitoringLevel }} [events] + * @member {string[]} [streamingEndpoints] List of Device Streams Endpoints. */ - events?: { [propertyName: string]: OperationMonitoringLevel }; + streamingEndpoints?: string[]; } /** @@ -783,7 +807,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.** */ @@ -796,10 +820,9 @@ export interface IotHubProperties { readonly hostName?: string; /** * @member {{ [propertyName: string]: EventHubProperties }} - * [eventHubEndpoints] The Event Hub-compatible endpoint properties. The - * possible keys to this dictionary are events and - * operationsMonitoringEvents. Both of these keys have to be present in the - * dictionary while making create or update calls for the IoT hub. + * [eventHubEndpoints] The Event Hub-compatible endpoint properties. The only + * possible keys to this dictionary is events. This key has to be present in + * the dictionary while making create or update calls for the IoT hub. */ eventHubEndpoints?: { [propertyName: string]: EventHubProperties }; /** @@ -836,9 +859,10 @@ export interface IotHubProperties { */ comments?: string; /** - * @member {OperationsMonitoringProperties} [operationsMonitoringProperties] + * @member {IotHubPropertiesDeviceStreams} [deviceStreams] The device streams + * properties of iothub. */ - operationsMonitoringProperties?: OperationsMonitoringProperties; + deviceStreams?: IotHubPropertiesDeviceStreams; /** * @member {Capabilities} [features] The capabilities and features enabled * for the IoT hub. Possible values include: 'None', 'DeviceManagement' @@ -957,6 +981,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 +1082,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 +1439,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; } /** @@ -1621,6 +1662,19 @@ export interface ImportDevicesRequest { outputBlobContainerUri: string; } +/** + * @interface + * An interface representing FailoverInput. + * Use to provide failover region when requesting manual Failover for a hub. + * + */ +export interface FailoverInput { + /** + * @member {string} failoverRegion Region the hub will be failed over to + */ + failoverRegion: string; +} + /** * @interface * An interface representing IotHubResourceCreateOrUpdateOptionalParams. @@ -1889,14 +1943,6 @@ export type IpFilterActionType = 'Accept' | 'Reject'; */ export type RoutingSource = 'Invalid' | 'DeviceMessages' | 'TwinChangeEvents' | 'DeviceLifecycleEvents' | 'DeviceJobLifecycleEvents'; -/** - * Defines values for OperationMonitoringLevel. - * Possible values include: 'None', 'Error', 'Information', 'Error, Information' - * @readonly - * @enum {string} - */ -export type OperationMonitoringLevel = 'None' | 'Error' | 'Information' | 'Error, Information'; - /** * Defines values for Capabilities. * Possible values include: 'None', 'DeviceManagement' @@ -1979,6 +2025,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. */ @@ -2765,3 +2819,22 @@ export type CertificatesVerifyResponse = CertificateDescription & { parsedBody: CertificateDescription; }; }; + +/** + * Contains response data for the manualFailover operation. + */ +export type IotHubManualFailoverResponse = IotHubDescription & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: IotHubDescription; + }; +}; diff --git a/packages/@azure/arm-iothub/lib/models/iotHubMappers.ts b/packages/@azure/arm-iothub/lib/models/iotHubMappers.ts new file mode 100644 index 000000000000..a79d2bb178cb --- /dev/null +++ b/packages/@azure/arm-iothub/lib/models/iotHubMappers.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * 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. + */ + +export { + FailoverInput, + IotHubDescription, + Resource, + BaseResource, + IotHubProperties, + SharedAccessSignatureAuthorizationRule, + IpFilterRule, + EventHubProperties, + RoutingProperties, + RoutingEndpoints, + RoutingServiceBusQueueEndpointProperties, + RoutingServiceBusTopicEndpointProperties, + RoutingEventHubProperties, + RoutingStorageContainerProperties, + RouteProperties, + FallbackRouteProperties, + EnrichmentProperties, + StorageEndpointProperties, + MessagingEndpointProperties, + CloudToDeviceProperties, + FeedbackProperties, + IotHubPropertiesDeviceStreams, + IotHubSkuInfo, + ErrorDetails, + CertificateDescription, + CertificateProperties, + CertificateWithNonceDescription, + CertificatePropertiesWithNonce, + EventHubConsumerGroupInfo +} from "../models/mappers"; + diff --git a/packages/@azure/arm-iothub/lib/models/iotHubResourceMappers.ts b/packages/@azure/arm-iothub/lib/models/iotHubResourceMappers.ts index edcf42a6f5d8..403b1f437ac8 100644 --- a/packages/@azure/arm-iothub/lib/models/iotHubResourceMappers.ts +++ b/packages/@azure/arm-iothub/lib/models/iotHubResourceMappers.ts @@ -24,11 +24,12 @@ export { RoutingStorageContainerProperties, RouteProperties, FallbackRouteProperties, + EnrichmentProperties, StorageEndpointProperties, MessagingEndpointProperties, 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..2f189f155645 100644 --- a/packages/@azure/arm-iothub/lib/models/mappers.ts +++ b/packages/@azure/arm-iothub/lib/models/mappers.ts @@ -781,6 +781,45 @@ export const FallbackRouteProperties: msRest.CompositeMapper = { } }; +export const EnrichmentProperties: msRest.CompositeMapper = { + serializedName: "EnrichmentProperties", + type: { + name: "Composite", + className: "EnrichmentProperties", + modelProperties: { + key: { + required: true, + serializedName: "key", + type: { + name: "String" + } + }, + value: { + required: true, + serializedName: "value", + type: { + name: "String" + } + }, + endpointNames: { + required: true, + serializedName: "endpointNames", + constraints: { + MinItems: 1 + }, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + export const RoutingProperties: msRest.CompositeMapper = { serializedName: "RoutingProperties", type: { @@ -812,6 +851,18 @@ export const RoutingProperties: msRest.CompositeMapper = { name: "Composite", className: "FallbackRouteProperties" } + }, + enrichments: { + serializedName: "enrichments", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EnrichmentProperties" + } + } + } } } } @@ -944,17 +995,17 @@ export const CloudToDeviceProperties: msRest.CompositeMapper = { } }; -export const OperationsMonitoringProperties: msRest.CompositeMapper = { - serializedName: "OperationsMonitoringProperties", +export const IotHubPropertiesDeviceStreams: msRest.CompositeMapper = { + serializedName: "IotHubProperties_deviceStreams", type: { name: "Composite", - className: "OperationsMonitoringProperties", + className: "IotHubPropertiesDeviceStreams", modelProperties: { - events: { - serializedName: "events", + streamingEndpoints: { + serializedName: "streamingEndpoints", type: { - name: "Dictionary", - value: { + name: "Sequence", + element: { type: { name: "String" } @@ -1078,11 +1129,11 @@ export const IotHubProperties: msRest.CompositeMapper = { name: "String" } }, - operationsMonitoringProperties: { - serializedName: "operationsMonitoringProperties", + deviceStreams: { + serializedName: "deviceStreams", type: { name: "Composite", - className: "OperationsMonitoringProperties" + className: "IotHubPropertiesDeviceStreams" } }, features: { @@ -1240,6 +1291,13 @@ export const OperationDisplay: msRest.CompositeMapper = { type: { name: "String" } + }, + description: { + readOnly: true, + serializedName: "description", + type: { + name: "String" + } } } } @@ -1808,14 +1866,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" } @@ -2116,6 +2174,23 @@ export const ImportDevicesRequest: msRest.CompositeMapper = { } }; +export const FailoverInput: msRest.CompositeMapper = { + serializedName: "FailoverInput", + type: { + name: "Composite", + className: "FailoverInput", + modelProperties: { + failoverRegion: { + required: true, + serializedName: "failoverRegion", + type: { + name: "String" + } + } + } + } +}; + export const OperationListResult: msRest.CompositeMapper = { serializedName: "OperationListResult", type: { diff --git a/packages/@azure/arm-iothub/lib/operations/index.ts b/packages/@azure/arm-iothub/lib/operations/index.ts index 6746b192f768..9c561acd7985 100644 --- a/packages/@azure/arm-iothub/lib/operations/index.ts +++ b/packages/@azure/arm-iothub/lib/operations/index.ts @@ -12,3 +12,4 @@ export * from "./operations"; export * from "./iotHubResource"; export * from "./resourceProviderCommon"; export * from "./certificates"; +export * from "./iotHub"; diff --git a/packages/@azure/arm-iothub/lib/operations/iotHub.ts b/packages/@azure/arm-iothub/lib/operations/iotHub.ts new file mode 100644 index 000000000000..06047b028bf2 --- /dev/null +++ b/packages/@azure/arm-iothub/lib/operations/iotHub.ts @@ -0,0 +1,101 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * 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. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/iotHubMappers"; +import * as Parameters from "../models/parameters"; +import { IotHubClientContext } from "../iotHubClientContext"; + +/** Class representing a IotHub. */ +export class IotHub { + private readonly client: IotHubClientContext; + + /** + * Create a IotHub. + * @param {IotHubClientContext} client Reference to the service client. + */ + constructor(client: IotHubClientContext) { + this.client = client; + } + + /** + * Perform manual fail over of given hub + * @summary Manual Failover Fail over + * @param iotHubName IotHub to fail over + * @param resourceGroupName resource group which Iot Hub belongs to + * @param failoverRegion Region the hub will be failed over to + * @param [options] The optional parameters + * @returns Promise + */ + manualFailover(iotHubName: string, resourceGroupName: string, failoverRegion: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param iotHubName IotHub to fail over + * @param resourceGroupName resource group which Iot Hub belongs to + * @param failoverRegion Region the hub will be failed over to + * @param callback The callback + */ + manualFailover(iotHubName: string, resourceGroupName: string, failoverRegion: string, callback: msRest.ServiceCallback): void; + /** + * @param iotHubName IotHub to fail over + * @param resourceGroupName resource group which Iot Hub belongs to + * @param failoverRegion Region the hub will be failed over to + * @param options The optional parameters + * @param callback The callback + */ + manualFailover(iotHubName: string, resourceGroupName: string, failoverRegion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + manualFailover(iotHubName: string, resourceGroupName: string, failoverRegion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + iotHubName, + resourceGroupName, + failoverRegion, + options + }, + manualFailoverOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const manualFailoverOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover", + urlParameters: [ + Parameters.iotHubName, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: { + failoverRegion: "failoverRegion" + }, + mapper: { + ...Mappers.FailoverInput, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.IotHubDescription + }, + default: { + bodyMapper: Mappers.ErrorDetails + } + }, + serializer +}; 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;