diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 762d30c8e779..c36a31fb5a0c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -644,7 +644,7 @@ # PRLabel: %Mgmt %mgmt-review-needed /sdk/iotoperations/arm-iotoperations/ @qiaozha @MaryGao @JialinHuang803 -# PRLabel: %Mgmt +# PRLabel: %Mgmt %mgmt-review-needed /sdk/iothub/arm-iothub/ @qiaozha @MaryGao @JialinHuang803 # PRLabel: %Mgmt diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28421c2220b7..0d35af11653b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16704,24 +16704,27 @@ importers: sdk/iothub/arm-iothub: dependencies: + '@azure-rest/core-client': + specifier: ^2.3.1 + version: link:../../core/core-client-rest '@azure/abort-controller': specifier: ^2.1.2 version: link:../../core/abort-controller '@azure/core-auth': specifier: ^1.9.0 version: link:../../core/core-auth - '@azure/core-client': - specifier: ^1.9.3 - version: link:../../core/core-client '@azure/core-lro': - specifier: ^2.5.4 - version: 2.7.2 - '@azure/core-paging': - specifier: ^1.6.2 - version: link:../../core/core-paging + specifier: ^3.1.0 + version: link:../../core/core-lro '@azure/core-rest-pipeline': specifier: link:../../core/core-rest-pipeline version: link:../../core/core-rest-pipeline + '@azure/core-util': + specifier: ^1.12.0 + version: link:../../core/core-util + '@azure/logger': + specifier: ^1.2.0 + version: link:../../core/logger tslib: specifier: ^2.8.1 version: 2.8.1 @@ -16744,9 +16747,6 @@ importers: '@azure/identity': specifier: catalog:internal version: 4.13.0 - '@azure/logger': - specifier: ^1.1.4 - version: link:../../core/logger '@types/node': specifier: 'catalog:' version: 20.19.41 diff --git a/sdk/iothub/arm-iothub/CHANGELOG.md b/sdk/iothub/arm-iothub/CHANGELOG.md index 6bddc42cb36c..b13ddaa4db11 100644 --- a/sdk/iothub/arm-iothub/CHANGELOG.md +++ b/sdk/iothub/arm-iothub/CHANGELOG.md @@ -1,5 +1,73 @@ # Release History +## 7.0.0-beta.2 (2026-06-05) +Compared with version 6.3.0 + +### Features Added + - Added operation IotHubOperations.manualFailover + - Added operation IotHubResourceOperations.createOrUpdate + - Added operation IotHubResourceOperations.delete + - Added operation IotHubResourceOperations.update + - Added operation PrivateEndpointConnectionsOperations.delete + - Added operation PrivateEndpointConnectionsOperations.update + - Class IotHubClient has a new constructor "constructor(credential: TokenCredential, options?: IotHubClientOptionalParams);" + - Added Interface DeviceRegistry + - Added Interface EncryptionPropertiesDescription + - Added Interface IotHubDetails + - Added Interface IotHubPropertiesDeviceStreams + - Added Interface IotHubResourceListEndpointHealthOptionalParams + - Added Interface IotHubResourceListQuotaMetricsOptionalParams + - Added Interface IotHubResourceListValidSkusOptionalParams + - Added Interface KeyVaultKeyProperties + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface ProxyResource + - Added Interface RestorePollerOptions + - Added Interface RootCertificateProperties + - Added Interface SimplePollerLike + - Added Interface TrackedResource + - Interface CertificateDescription has a new optional parameter systemData + - Interface CertificateProperties has a new optional parameter policyResourceId + - Interface CertificatePropertiesWithNonce has a new optional parameter policyResourceId + - Interface EventHubConsumerGroupInfo has a new optional parameter systemData + - Interface IotHubProperties has a new optional parameter deviceHostName + - Interface IotHubProperties has a new optional parameter deviceRegistry + - Interface IotHubProperties has a new optional parameter deviceStreams + - Interface IotHubProperties has a new optional parameter encryption + - Interface IotHubProperties has a new optional parameter iotHubDetails + - Interface IotHubProperties has a new optional parameter ipVersion + - Interface IotHubProperties has a new optional parameter rootCertificate + - Interface IotHubProperties has a new optional parameter serviceHostName + - Interface PrivateEndpointConnection has a new optional parameter systemData + - Interface Resource has a new optional parameter systemData + - Added Type Alias AzureSupportedClouds + - Added Type Alias GatewayVersion + - Added Type Alias IpVersion + - Added Enum AzureClouds + - Added Enum KnownGatewayVersion + - Added Enum KnownIpVersion + - Added Enum KnownVersions + - Enum KnownIotHubSku has a new value GEN2 + - Enum KnownRoutingSource has a new value DigitalTwinChangeEvents + - Enum KnownRoutingSource has a new value MqttBrokerMessages + +### Breaking Changes + - Operation IotHubResource.beginCreateOrUpdate has a new signature + - Operation IotHubResource.beginCreateOrUpdateAndWait has a new signature + - Operation IotHubResource.beginDeleteAndWait has a new signature + - Operation IotHubResource.beginUpdateAndWait has a new signature + - Operation IotHubResource.get has a new signature + - Class IotHubClient no longer has parameter apiVersion + - Class IotHubClient no longer has parameter privateLinkResourcesOperations + - Class IotHubClient no longer has parameter subscriptionId + - Removed Interface CertificateBodyDescription + - Removed Interface IotHubResourceGetEndpointHealthOptionalParams + - Removed Interface IotHubResourceGetQuotaMetricsOptionalParams + - Removed Interface IotHubResourceGetValidSkusOptionalParams + - Interface Resource no longer has parameter location + - Interface Resource no longer has parameter tags + - Type alias "IotHubSkuTier" has been changed + ## 7.0.0-beta.1 (2025-11-06) Compared with version 6.3.0 diff --git a/sdk/iothub/arm-iothub/README.md b/sdk/iothub/arm-iothub/README.md index 3a7b9f0825dc..07fb24965066 100644 --- a/sdk/iothub/arm-iothub/README.md +++ b/sdk/iothub/arm-iothub/README.md @@ -1,13 +1,15 @@ -# Azure iotHub client library for JavaScript +# Azure IotHub client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure iotHub client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure IotHub client. Use this API to manage the IoT hubs in your Azure subscription. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-iothub) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-iothub?view=azure-node-preview) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-iothub) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-iothub?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub/samples) ## Getting started @@ -24,7 +26,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/arm-iothub` package -Install the Azure iotHub client library for JavaScript with `npm`: +Install the Azure IotHub client library for JavaScript with `npm`: ```bash npm install @azure/arm-iothub @@ -32,10 +34,10 @@ npm install @azure/arm-iothub ### Create and authenticate a `IotHubClient` -To create a client object to access the Azure iotHub API, you will need the `endpoint` of your Azure iotHub resource and a `credential`. The Azure iotHub client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure iotHub resource in the [Azure Portal][azure_portal]. +To create a client object to access the Azure IotHub API, you will need the `endpoint` of your Azure IotHub resource and a `credential`. The Azure IotHub client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure IotHub resource in the [Azure Portal][azure_portal]. -You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: @@ -43,7 +45,7 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure iotHub** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +You will also need to **register a new AAD application and grant access to Azure IotHub** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). @@ -63,14 +65,15 @@ For browser environments, use the `InteractiveBrowserCredential` from the `@azur import { InteractiveBrowserCredential } from "@azure/identity"; import { IotHubClient } from "@azure/arm-iothub"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new IotHubClient(credential, subscriptionId); ``` + ### JavaScript Bundle To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). @@ -78,7 +81,7 @@ To use this client library in the browser, first you need to use a bundler. For ### IotHubClient -`IotHubClient` is the primary interface for developers using the Azure iotHub client library. Explore the methods on this client object to understand the different features of the Azure iotHub service that you can access. +`IotHubClient` is the primary interface for developers using the Azure IotHub client library. Explore the methods on this client object to understand the different features of the Azure IotHub service that you can access. ## Troubleshooting @@ -96,7 +99,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## Next steps -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub/samples) directory for detailed examples on how to use this library. ## Contributing @@ -106,9 +109,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - -[azure_cli]: https://learn.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ [azure_sub]: https://azure.microsoft.com/free/ [azure_portal]: https://portal.azure.com [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity diff --git a/sdk/iothub/arm-iothub/_meta.json b/sdk/iothub/arm-iothub/_meta.json deleted file mode 100644 index 82f70fb9ff2e..000000000000 --- a/sdk/iothub/arm-iothub/_meta.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "commit": "a39b73b1c7d12a633805a3b2ed3177a8bfddd9e2", - "readme": "specification/iothub/resource-manager/Microsoft.Devices/IoTHub/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/readme.md --tag=package-preview-2025-08 --use=@autorest/typescript@6.0.45", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.14.9", - "tag": "package-preview-2025-08", - "use": "@autorest/typescript@6.0.45" -} diff --git a/sdk/iothub/arm-iothub/api-extractor.json b/sdk/iothub/arm-iothub/api-extractor.json index 16d81e2eb512..870d6d399477 100644 --- a/sdk/iothub/arm-iothub/api-extractor.json +++ b/sdk/iothub/arm-iothub/api-extractor.json @@ -1,3 +1 @@ -{ - "extends": "../../../api-extractor-base.json" -} +{ "extends": "../../../api-extractor-base.json" } diff --git a/sdk/iothub/arm-iothub/config/tsconfig.lint.json b/sdk/iothub/arm-iothub/config/tsconfig.lint.json index 8431a95cbcb1..3a31a03786d2 100644 --- a/sdk/iothub/arm-iothub/config/tsconfig.lint.json +++ b/sdk/iothub/arm-iothub/config/tsconfig.lint.json @@ -1,7 +1,4 @@ { "extends": "../../../../tsconfig.json", - "include": [ - "../src", - "../test" - ] + "include": ["../src", "../test"] } diff --git a/sdk/iothub/arm-iothub/config/tsconfig.samples.json b/sdk/iothub/arm-iothub/config/tsconfig.samples.json index 920d1b77f88f..ec37d0c2db90 100644 --- a/sdk/iothub/arm-iothub/config/tsconfig.samples.json +++ b/sdk/iothub/arm-iothub/config/tsconfig.samples.json @@ -2,9 +2,7 @@ "extends": "../../../../eng/tsconfigs/samples.json", "compilerOptions": { "paths": { - "@azure/arm-iothub": [ - "../dist/esm" - ] + "@azure/arm-iothub": ["../dist/esm"] } } } diff --git a/sdk/iothub/arm-iothub/config/tsconfig.src.browser.json b/sdk/iothub/arm-iothub/config/tsconfig.src.browser.json index 2e75154106a2..429817e79b26 100644 --- a/sdk/iothub/arm-iothub/config/tsconfig.src.browser.json +++ b/sdk/iothub/arm-iothub/config/tsconfig.src.browser.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.browser.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/iothub/arm-iothub/config/tsconfig.src.cjs.json b/sdk/iothub/arm-iothub/config/tsconfig.src.cjs.json index 018cc5885d5b..b000a4a9909e 100644 --- a/sdk/iothub/arm-iothub/config/tsconfig.src.cjs.json +++ b/sdk/iothub/arm-iothub/config/tsconfig.src.cjs.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.cjs.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/iothub/arm-iothub/config/tsconfig.src.esm.json b/sdk/iothub/arm-iothub/config/tsconfig.src.esm.json index bc91d3d2b231..b393943938eb 100644 --- a/sdk/iothub/arm-iothub/config/tsconfig.src.esm.json +++ b/sdk/iothub/arm-iothub/config/tsconfig.src.esm.json @@ -1,6 +1,4 @@ { "extends": "../../../../eng/tsconfigs/src.esm.json", - "include": [ - "../src/index.ts" - ] + "include": ["../src/index.ts"] } diff --git a/sdk/iothub/arm-iothub/config/tsconfig.test.browser.json b/sdk/iothub/arm-iothub/config/tsconfig.test.browser.json new file mode 100644 index 000000000000..e94d3d95d3a2 --- /dev/null +++ b/sdk/iothub/arm-iothub/config/tsconfig.test.browser.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../eng/tsconfigs/test.browser.json", + "compilerOptions": { + "paths": { + "@azure/arm-iothub": ["../src/index.ts"], + "@azure/arm-iothub/*": ["../src/*"], + "$internal/*": ["../src/*"] + } + } +} diff --git a/sdk/iothub/arm-iothub/config/tsconfig.test.node.json b/sdk/iothub/arm-iothub/config/tsconfig.test.node.json index d123d08c39d5..ad6ed7114fa9 100644 --- a/sdk/iothub/arm-iothub/config/tsconfig.test.node.json +++ b/sdk/iothub/arm-iothub/config/tsconfig.test.node.json @@ -1,3 +1,10 @@ { - "extends": "../../../../eng/tsconfigs/test.node.json" + "extends": "../../../../eng/tsconfigs/test.node.json", + "compilerOptions": { + "paths": { + "@azure/arm-iothub": ["../src/index.ts"], + "@azure/arm-iothub/*": ["../src/*"], + "$internal/*": ["../src/*"] + } + } } diff --git a/sdk/iothub/arm-iothub/metadata.json b/sdk/iothub/arm-iothub/metadata.json new file mode 100644 index 000000000000..0679bb13468a --- /dev/null +++ b/sdk/iothub/arm-iothub/metadata.json @@ -0,0 +1,168 @@ +{ + "apiVersions": { + "Microsoft.Devices": "2026-03-01-preview" + }, + "emitterVersion": "0.54.0", + "crossLanguageDefinitions": { + "CrossLanguagePackageId": "Microsoft.Devices", + "CrossLanguageDefinitionId": { + "@azure/arm-iothub!OperationListResult:interface": "Microsoft.Devices.OperationListResult", + "@azure/arm-iothub!Operation:interface": "Microsoft.Devices.Operation", + "@azure/arm-iothub!OperationDisplay:interface": "Microsoft.Devices.OperationDisplay", + "@azure/arm-iothub!ErrorDetails:interface": "Microsoft.Devices.ErrorDetails", + "@azure/arm-iothub!PrivateEndpointConnection:interface": "Microsoft.Devices.PrivateEndpointConnection", + "@azure/arm-iothub!PrivateEndpointConnectionProperties:interface": "Microsoft.Devices.PrivateEndpointConnectionProperties", + "@azure/arm-iothub!PrivateEndpoint:interface": "Microsoft.Devices.PrivateEndpoint", + "@azure/arm-iothub!PrivateLinkServiceConnectionState:interface": "Microsoft.Devices.PrivateLinkServiceConnectionState", + "@azure/arm-iothub!ProxyResource:interface": "Azure.ResourceManager.CommonTypes.ProxyResource", + "@azure/arm-iothub!Resource:interface": "Azure.ResourceManager.CommonTypes.Resource", + "@azure/arm-iothub!SystemData:interface": "Azure.ResourceManager.CommonTypes.SystemData", + "@azure/arm-iothub!ArmOperationStatusResourceProvisioningState:interface": "Azure.ResourceManager.ArmOperationStatus", + "@azure/arm-iothub!ErrorDetail:interface": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "@azure/arm-iothub!ErrorAdditionalInfo:interface": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "@azure/arm-iothub!IotHubDescription:interface": "Microsoft.Devices.IotHubDescription", + "@azure/arm-iothub!IotHubProperties:interface": "Microsoft.Devices.IotHubProperties", + "@azure/arm-iothub!SharedAccessSignatureAuthorizationRule:interface": "Microsoft.Devices.SharedAccessSignatureAuthorizationRule", + "@azure/arm-iothub!IpFilterRule:interface": "Microsoft.Devices.IpFilterRule", + "@azure/arm-iothub!NetworkRuleSetProperties:interface": "Microsoft.Devices.NetworkRuleSetProperties", + "@azure/arm-iothub!NetworkRuleSetIpRule:interface": "Microsoft.Devices.NetworkRuleSetIpRule", + "@azure/arm-iothub!EventHubProperties:interface": "Microsoft.Devices.EventHubProperties", + "@azure/arm-iothub!RoutingProperties:interface": "Microsoft.Devices.RoutingProperties", + "@azure/arm-iothub!RoutingEndpoints:interface": "Microsoft.Devices.RoutingEndpoints", + "@azure/arm-iothub!RoutingServiceBusQueueEndpointProperties:interface": "Microsoft.Devices.RoutingServiceBusQueueEndpointProperties", + "@azure/arm-iothub!ManagedIdentity:interface": "Microsoft.Devices.ManagedIdentity", + "@azure/arm-iothub!RoutingServiceBusTopicEndpointProperties:interface": "Microsoft.Devices.RoutingServiceBusTopicEndpointProperties", + "@azure/arm-iothub!RoutingEventHubProperties:interface": "Microsoft.Devices.RoutingEventHubProperties", + "@azure/arm-iothub!RoutingStorageContainerProperties:interface": "Microsoft.Devices.RoutingStorageContainerProperties", + "@azure/arm-iothub!RoutingCosmosDBSqlApiProperties:interface": "Microsoft.Devices.RoutingCosmosDBSqlApiProperties", + "@azure/arm-iothub!RouteProperties:interface": "Microsoft.Devices.RouteProperties", + "@azure/arm-iothub!FallbackRouteProperties:interface": "Microsoft.Devices.FallbackRouteProperties", + "@azure/arm-iothub!EnrichmentProperties:interface": "Microsoft.Devices.EnrichmentProperties", + "@azure/arm-iothub!StorageEndpointProperties:interface": "Microsoft.Devices.StorageEndpointProperties", + "@azure/arm-iothub!MessagingEndpointProperties:interface": "Microsoft.Devices.MessagingEndpointProperties", + "@azure/arm-iothub!CloudToDeviceProperties:interface": "Microsoft.Devices.CloudToDeviceProperties", + "@azure/arm-iothub!FeedbackProperties:interface": "Microsoft.Devices.FeedbackProperties", + "@azure/arm-iothub!IotHubPropertiesDeviceStreams:interface": "Microsoft.Devices.IotHubPropertiesDeviceStreams", + "@azure/arm-iothub!EncryptionPropertiesDescription:interface": "Microsoft.Devices.EncryptionPropertiesDescription", + "@azure/arm-iothub!KeyVaultKeyProperties:interface": "Microsoft.Devices.KeyVaultKeyProperties", + "@azure/arm-iothub!IotHubLocationDescription:interface": "Microsoft.Devices.IotHubLocationDescription", + "@azure/arm-iothub!RootCertificateProperties:interface": "Microsoft.Devices.RootCertificateProperties", + "@azure/arm-iothub!DeviceRegistry:interface": "Microsoft.Devices.DeviceRegistry", + "@azure/arm-iothub!IotHubDetails:interface": "Microsoft.Devices.IotHubDetails", + "@azure/arm-iothub!IotHubSkuInfo:interface": "Microsoft.Devices.IotHubSkuInfo", + "@azure/arm-iothub!ArmIdentity:interface": "Microsoft.Devices.ArmIdentity", + "@azure/arm-iothub!ArmUserIdentity:interface": "Microsoft.Devices.ArmUserIdentity", + "@azure/arm-iothub!TrackedResource:interface": "Azure.ResourceManager.CommonTypes.TrackedResource", + "@azure/arm-iothub!TagsResource:interface": "Microsoft.Devices.TagsResource", + "@azure/arm-iothub!IotHubDescriptionListResult:interface": "Azure.ResourceManager.ResourceListResult", + "@azure/arm-iothub!IotHubSkuDescriptionListResult:interface": "Microsoft.Devices.IotHubSkuDescriptionListResult", + "@azure/arm-iothub!IotHubSkuDescription:interface": "Microsoft.Devices.IotHubSkuDescription", + "@azure/arm-iothub!IotHubCapacity:interface": "Microsoft.Devices.IotHubCapacity", + "@azure/arm-iothub!JobResponseListResult:interface": "Microsoft.Devices.JobResponseListResult", + "@azure/arm-iothub!JobResponse:interface": "Microsoft.Devices.JobResponse", + "@azure/arm-iothub!IotHubQuotaMetricInfoListResult:interface": "Microsoft.Devices.IotHubQuotaMetricInfoListResult", + "@azure/arm-iothub!IotHubQuotaMetricInfo:interface": "Microsoft.Devices.IotHubQuotaMetricInfo", + "@azure/arm-iothub!EndpointHealthDataListResult:interface": "Microsoft.Devices.EndpointHealthDataListResult", + "@azure/arm-iothub!EndpointHealthData:interface": "Microsoft.Devices.EndpointHealthData", + "@azure/arm-iothub!TestAllRoutesInput:interface": "Microsoft.Devices.TestAllRoutesInput", + "@azure/arm-iothub!RoutingMessage:interface": "Microsoft.Devices.RoutingMessage", + "@azure/arm-iothub!RoutingTwin:interface": "Microsoft.Devices.RoutingTwin", + "@azure/arm-iothub!RoutingTwinProperties:interface": "Microsoft.Devices.RoutingTwinProperties", + "@azure/arm-iothub!TestAllRoutesResult:interface": "Microsoft.Devices.TestAllRoutesResult", + "@azure/arm-iothub!MatchedRoute:interface": "Microsoft.Devices.MatchedRoute", + "@azure/arm-iothub!TestRouteInput:interface": "Microsoft.Devices.TestRouteInput", + "@azure/arm-iothub!TestRouteResult:interface": "Microsoft.Devices.TestRouteResult", + "@azure/arm-iothub!TestRouteResultDetails:interface": "Microsoft.Devices.TestRouteResultDetails", + "@azure/arm-iothub!RouteCompilationError:interface": "Microsoft.Devices.RouteCompilationError", + "@azure/arm-iothub!RouteErrorRange:interface": "Microsoft.Devices.RouteErrorRange", + "@azure/arm-iothub!RouteErrorPosition:interface": "Microsoft.Devices.RouteErrorPosition", + "@azure/arm-iothub!SharedAccessSignatureAuthorizationRuleListResult:interface": "Microsoft.Devices.SharedAccessSignatureAuthorizationRuleListResult", + "@azure/arm-iothub!ExportDevicesRequest:interface": "Microsoft.Devices.ExportDevicesRequest", + "@azure/arm-iothub!ImportDevicesRequest:interface": "Microsoft.Devices.ImportDevicesRequest", + "@azure/arm-iothub!RegistryStatistics:interface": "Microsoft.Devices.RegistryStatistics", + "@azure/arm-iothub!EventHubConsumerGroupInfo:interface": "Microsoft.Devices.EventHubConsumerGroupInfo", + "@azure/arm-iothub!EventHubConsumerGroupBodyDescription:interface": "Microsoft.Devices.EventHubConsumerGroupBodyDescription", + "@azure/arm-iothub!EventHubConsumerGroupName:interface": "Microsoft.Devices.EventHubConsumerGroupName", + "@azure/arm-iothub!EventHubConsumerGroupsListResult:interface": "Microsoft.Devices.EventHubConsumerGroupsListResult", + "@azure/arm-iothub!OperationInputs:interface": "Microsoft.Devices.OperationInputs", + "@azure/arm-iothub!IotHubNameAvailabilityInfo:interface": "Microsoft.Devices.IotHubNameAvailabilityInfo", + "@azure/arm-iothub!FailoverInput:interface": "Microsoft.Devices.FailoverInput", + "@azure/arm-iothub!CertificateDescription:interface": "Microsoft.Devices.CertificateDescription", + "@azure/arm-iothub!CertificateProperties:interface": "Microsoft.Devices.CertificateProperties", + "@azure/arm-iothub!CertificateListDescription:interface": "Microsoft.Devices.CertificateListDescription", + "@azure/arm-iothub!CertificateWithNonceDescription:interface": "Microsoft.Devices.CertificateWithNonceDescription", + "@azure/arm-iothub!CertificatePropertiesWithNonce:interface": "Microsoft.Devices.CertificatePropertiesWithNonce", + "@azure/arm-iothub!CertificateVerificationDescription:interface": "Microsoft.Devices.CertificateVerificationDescription", + "@azure/arm-iothub!GroupIdInformation:interface": "Microsoft.Devices.GroupIdInformation", + "@azure/arm-iothub!GroupIdInformationProperties:interface": "Microsoft.Devices.GroupIdInformationProperties", + "@azure/arm-iothub!PrivateLinkResources:interface": "Microsoft.Devices.PrivateLinkResources", + "@azure/arm-iothub!UserSubscriptionQuotaListResult:interface": "Microsoft.Devices.UserSubscriptionQuotaListResult", + "@azure/arm-iothub!UserSubscriptionQuota:interface": "Microsoft.Devices.UserSubscriptionQuota", + "@azure/arm-iothub!Name:interface": "Microsoft.Devices.Name", + "@azure/arm-iothub!KnownPrivateLinkServiceConnectionStatus:enum": "Microsoft.Devices.PrivateLinkServiceConnectionStatus", + "@azure/arm-iothub!KnowncreatedByType:enum": "Azure.ResourceManager.CommonTypes.createdByType", + "@azure/arm-iothub!KnownResourceProvisioningState:enum": "Azure.ResourceManager.ResourceProvisioningState", + "@azure/arm-iothub!KnownAccessRights:enum": "Microsoft.Devices.AccessRights", + "@azure/arm-iothub!KnownPublicNetworkAccess:enum": "Microsoft.Devices.PublicNetworkAccess", + "@azure/arm-iothub!KnownIpFilterActionType:enum": "Microsoft.Devices.IpFilterActionType", + "@azure/arm-iothub!KnownDefaultAction:enum": "Microsoft.Devices.DefaultAction", + "@azure/arm-iothub!KnownNetworkRuleIPAction:enum": "Microsoft.Devices.NetworkRuleIPAction", + "@azure/arm-iothub!KnownAuthenticationType:enum": "Microsoft.Devices.AuthenticationType", + "@azure/arm-iothub!KnownRoutingStorageContainerPropertiesEncoding:enum": "Microsoft.Devices.RoutingStorageContainerPropertiesEncoding", + "@azure/arm-iothub!KnownRoutingSource:enum": "Microsoft.Devices.RoutingSource", + "@azure/arm-iothub!KnownCapabilities:enum": "Microsoft.Devices.Capabilities", + "@azure/arm-iothub!KnownIotHubReplicaRoleType:enum": "Microsoft.Devices.IotHubReplicaRoleType", + "@azure/arm-iothub!KnownIpVersion:enum": "Microsoft.Devices.IpVersion", + "@azure/arm-iothub!KnownGatewayVersion:enum": "Microsoft.Devices.GatewayVersion", + "@azure/arm-iothub!KnownIotHubSku:enum": "Microsoft.Devices.IotHubSku", + "@azure/arm-iothub!KnownIotHubSkuTier:enum": "Microsoft.Devices.IotHubSkuTier", + "@azure/arm-iothub!KnownResourceIdentityType:enum": "Microsoft.Devices.ResourceIdentityType", + "@azure/arm-iothub!KnownIotHubScaleType:enum": "Microsoft.Devices.IotHubScaleType", + "@azure/arm-iothub!KnownJobType:enum": "Microsoft.Devices.JobType", + "@azure/arm-iothub!KnownJobStatus:enum": "Microsoft.Devices.JobStatus", + "@azure/arm-iothub!KnownEndpointHealthStatus:enum": "Microsoft.Devices.EndpointHealthStatus", + "@azure/arm-iothub!KnownTestResultStatus:enum": "Microsoft.Devices.TestResultStatus", + "@azure/arm-iothub!KnownRouteErrorSeverity:enum": "Microsoft.Devices.RouteErrorSeverity", + "@azure/arm-iothub!KnownIotHubNameUnavailabilityReason:enum": "Microsoft.Devices.IotHubNameUnavailabilityReason", + "@azure/arm-iothub!KnownVersions:enum": "Microsoft.Devices.Versions", + "@azure/arm-iothub!ResourceProviderCommonOperations#getSubscriptionQuota:member": "Microsoft.Devices.ResourceProviderCommonOperationGroup.getSubscriptionQuota", + "@azure/arm-iothub!PrivateLinkResourcesOperations#list:member": "Microsoft.Devices.GroupIdInformations.list", + "@azure/arm-iothub!PrivateLinkResourcesOperations#get:member": "Microsoft.Devices.GroupIdInformations.get", + "@azure/arm-iothub!CertificatesOperations#verify:member": "Microsoft.Devices.CertificateDescriptions.verify", + "@azure/arm-iothub!CertificatesOperations#generateVerificationCode:member": "Microsoft.Devices.CertificateDescriptions.generateVerificationCode", + "@azure/arm-iothub!CertificatesOperations#listByIotHub:member": "Microsoft.Devices.CertificateDescriptions.listByIotHub", + "@azure/arm-iothub!CertificatesOperations#delete:member": "Microsoft.Devices.CertificateDescriptions.delete", + "@azure/arm-iothub!CertificatesOperations#createOrUpdate:member": "Microsoft.Devices.CertificateDescriptions.createOrUpdate", + "@azure/arm-iothub!CertificatesOperations#get:member": "Microsoft.Devices.CertificateDescriptions.get", + "@azure/arm-iothub!IotHubOperations#manualFailover:member": "Microsoft.Devices.IotHubDescriptions.manualFailover", + "@azure/arm-iothub!IotHubResourceOperations#checkNameAvailability:member": "Microsoft.Devices.IotHubResourceOperationGroup.checkNameAvailability", + "@azure/arm-iothub!IotHubResourceOperations#listEventHubConsumerGroups:member": "Microsoft.Devices.EventHubConsumerGroupInfos.listEventHubConsumerGroups", + "@azure/arm-iothub!IotHubResourceOperations#deleteEventHubConsumerGroup:member": "Microsoft.Devices.EventHubConsumerGroupInfos.deleteEventHubConsumerGroup", + "@azure/arm-iothub!IotHubResourceOperations#createEventHubConsumerGroup:member": "Microsoft.Devices.EventHubConsumerGroupInfos.createEventHubConsumerGroup", + "@azure/arm-iothub!IotHubResourceOperations#getEventHubConsumerGroup:member": "Microsoft.Devices.EventHubConsumerGroupInfos.getEventHubConsumerGroup", + "@azure/arm-iothub!IotHubResourceOperations#getStats:member": "Microsoft.Devices.IotHubDescriptionOperationGroup.getStats", + "@azure/arm-iothub!IotHubResourceOperations#importDevices:member": "Microsoft.Devices.IotHubDescriptions.importDevices", + "@azure/arm-iothub!IotHubResourceOperations#exportDevices:member": "Microsoft.Devices.IotHubDescriptions.exportDevices", + "@azure/arm-iothub!IotHubResourceOperations#getKeysForKeyName:member": "Microsoft.Devices.IotHubDescriptions.getKeysForKeyName", + "@azure/arm-iothub!IotHubResourceOperations#listKeys:member": "Microsoft.Devices.IotHubDescriptions.listKeys", + "@azure/arm-iothub!IotHubResourceOperations#testRoute:member": "Microsoft.Devices.IotHubDescriptions.testRoute", + "@azure/arm-iothub!IotHubResourceOperations#testAllRoutes:member": "Microsoft.Devices.IotHubDescriptions.testAllRoutes", + "@azure/arm-iothub!IotHubResourceOperations#listEndpointHealth:member": "Microsoft.Devices.IotHubDescriptions.getEndpointHealth", + "@azure/arm-iothub!IotHubResourceOperations#listQuotaMetrics:member": "Microsoft.Devices.IotHubDescriptions.getQuotaMetrics", + "@azure/arm-iothub!IotHubResourceOperations#getJob:member": "Microsoft.Devices.IotHubDescriptions.getJob", + "@azure/arm-iothub!IotHubResourceOperations#listJobs:member": "Microsoft.Devices.IotHubDescriptions.listJobs", + "@azure/arm-iothub!IotHubResourceOperations#listValidSkus:member": "Microsoft.Devices.IotHubDescriptions.getValidSkus", + "@azure/arm-iothub!IotHubResourceOperations#listBySubscription:member": "Microsoft.Devices.IotHubDescriptions.listBySubscription", + "@azure/arm-iothub!IotHubResourceOperations#listByResourceGroup:member": "Microsoft.Devices.IotHubDescriptions.listByResourceGroup", + "@azure/arm-iothub!IotHubResourceOperations#delete:member": "Microsoft.Devices.IotHubDescriptions.delete", + "@azure/arm-iothub!IotHubResourceOperations#update:member": "Microsoft.Devices.IotHubDescriptions.update", + "@azure/arm-iothub!IotHubResourceOperations#createOrUpdate:member": "Microsoft.Devices.IotHubDescriptions.createOrUpdate", + "@azure/arm-iothub!IotHubResourceOperations#get:member": "Microsoft.Devices.IotHubDescriptions.get", + "@azure/arm-iothub!PrivateEndpointConnectionsOperations#list:member": "Microsoft.Devices.PrivateEndpointConnections.list", + "@azure/arm-iothub!PrivateEndpointConnectionsOperations#delete:member": "Microsoft.Devices.PrivateEndpointConnections.delete", + "@azure/arm-iothub!PrivateEndpointConnectionsOperations#update:member": "Microsoft.Devices.PrivateEndpointConnections.update", + "@azure/arm-iothub!PrivateEndpointConnectionsOperations#get:member": "Microsoft.Devices.PrivateEndpointConnections.get", + "@azure/arm-iothub!OperationsOperations#list:member": "Azure.ResourceManager.Legacy.Operations.list" + } + } +} diff --git a/sdk/iothub/arm-iothub/package.json b/sdk/iothub/arm-iothub/package.json index 1ec34c10116a..d24f00faab1f 100644 --- a/sdk/iothub/arm-iothub/package.json +++ b/sdk/iothub/arm-iothub/package.json @@ -1,34 +1,211 @@ { "name": "@azure/arm-iothub", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", + "version": "7.0.0-beta.2", "description": "A generated SDK for IotHubClient.", - "version": "7.0.0-beta.1", "engines": { "node": ">=20.0.0" }, - "dependencies": { - "@azure/core-lro": "^2.5.4", - "@azure/abort-controller": "^2.1.2", - "@azure/core-paging": "^1.6.2", - "@azure/core-client": "^1.9.3", - "@azure/core-auth": "^1.9.0", - "@azure/core-rest-pipeline": "^1.19.1", - "tslib": "^2.8.1" + "sideEffects": false, + "autoPublish": false, + "type": "module", + "main": "./dist/commonjs/index.js", + "module": "./dist/esm/index.js", + "types": "./dist/commonjs/index.d.ts", + "browser": "./dist/browser/index.js", + "imports": { + "#platform/*": { + "browser": "./src/*-browser.mts", + "default": "./src/*.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/resourceProviderCommon": { + "browser": { + "types": "./dist/browser/api/resourceProviderCommon/index.d.ts", + "default": "./dist/browser/api/resourceProviderCommon/index.js" + }, + "import": { + "types": "./dist/esm/api/resourceProviderCommon/index.d.ts", + "default": "./dist/esm/api/resourceProviderCommon/index.js" + }, + "require": { + "types": "./dist/commonjs/api/resourceProviderCommon/index.d.ts", + "default": "./dist/commonjs/api/resourceProviderCommon/index.js" + } + }, + "./api/privateLinkResources": { + "browser": { + "types": "./dist/browser/api/privateLinkResources/index.d.ts", + "default": "./dist/browser/api/privateLinkResources/index.js" + }, + "import": { + "types": "./dist/esm/api/privateLinkResources/index.d.ts", + "default": "./dist/esm/api/privateLinkResources/index.js" + }, + "require": { + "types": "./dist/commonjs/api/privateLinkResources/index.d.ts", + "default": "./dist/commonjs/api/privateLinkResources/index.js" + } + }, + "./api/certificates": { + "browser": { + "types": "./dist/browser/api/certificates/index.d.ts", + "default": "./dist/browser/api/certificates/index.js" + }, + "import": { + "types": "./dist/esm/api/certificates/index.d.ts", + "default": "./dist/esm/api/certificates/index.js" + }, + "require": { + "types": "./dist/commonjs/api/certificates/index.d.ts", + "default": "./dist/commonjs/api/certificates/index.js" + } + }, + "./api/iotHub": { + "browser": { + "types": "./dist/browser/api/iotHub/index.d.ts", + "default": "./dist/browser/api/iotHub/index.js" + }, + "import": { + "types": "./dist/esm/api/iotHub/index.d.ts", + "default": "./dist/esm/api/iotHub/index.js" + }, + "require": { + "types": "./dist/commonjs/api/iotHub/index.d.ts", + "default": "./dist/commonjs/api/iotHub/index.js" + } + }, + "./api/iotHubResource": { + "browser": { + "types": "./dist/browser/api/iotHubResource/index.d.ts", + "default": "./dist/browser/api/iotHubResource/index.js" + }, + "import": { + "types": "./dist/esm/api/iotHubResource/index.d.ts", + "default": "./dist/esm/api/iotHubResource/index.js" + }, + "require": { + "types": "./dist/commonjs/api/iotHubResource/index.d.ts", + "default": "./dist/commonjs/api/iotHubResource/index.js" + } + }, + "./api/privateEndpointConnections": { + "browser": { + "types": "./dist/browser/api/privateEndpointConnections/index.d.ts", + "default": "./dist/browser/api/privateEndpointConnections/index.js" + }, + "import": { + "types": "./dist/esm/api/privateEndpointConnections/index.d.ts", + "default": "./dist/esm/api/privateEndpointConnections/index.js" + }, + "require": { + "types": "./dist/commonjs/api/privateEndpointConnections/index.d.ts", + "default": "./dist/commonjs/api/privateEndpointConnections/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } }, "keywords": [ "node", "azure", + "cloud", "typescript", "browser", - "isomorphic", - "cloud" + "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", - "type": "module", + "files": [ + "dist/", + "!dist/**/*.d.*ts.map", + "README.md", + "LICENSE" + ], + "sdk-type": "mgmt", + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js", + "directory": "sdk/iothub/arm-iothub" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/iotHubContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure/core-util": "^1.12.0", + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, "devDependencies": { "@azure-tools/test-credential": "workspace:^", "@azure-tools/test-recorder": "workspace:^", @@ -36,84 +213,41 @@ "@azure/dev-tool": "workspace:^", "@azure/eslint-plugin-azure-sdk": "workspace:^", "@azure/identity": "catalog:internal", - "@azure/logger": "^1.1.4", "@types/node": "catalog:", - "@vitest/browser-playwright": "catalog:testing", - "@vitest/coverage-istanbul": "catalog:testing", "cross-env": "catalog:", - "dotenv": "catalog:testing", "eslint": "catalog:", - "playwright": "catalog:testing", "prettier": "catalog:", "rimraf": "catalog:", + "@vitest/browser-playwright": "catalog:testing", + "@vitest/coverage-istanbul": "catalog:testing", + "dotenv": "catalog:testing", + "playwright": "catalog:testing", "typescript": "catalog:", "vitest": "catalog:testing" }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js", - "directory": "sdk/iothub/arm-iothub" - }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE" - ], "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "prepack": "npm run build", - "pack": "npm pack 2>&1", - "extract-api": "dev-tool run extract-api", - "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "build:samples": "echo skipped.", - "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", - "execute:samples": "echo skipped", - "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", - "test": "tsc -b --noEmit && npm run test:node && npm run test:browser", + "extract-api": "rimraf review && dev-tool run extract-api", + "pack": "pnpm pack 2>&1", + "lint": "echo skipped", + "lint:fix": "echo skipped", + "build:samples": "tsc -p config/tsconfig.samples.json && dev-tool samples publish -f", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "execute:samples": "dev-tool samples run samples-dev", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", + "test:browser": "dev-tool run test:vitest --browser", + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", "test:node": "dev-tool run test:vitest", - "test:browser": "echo skipped", - "update-snippets": "dev-tool run update-snippets", - "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "test:node:esm": "dev-tool run test:vitest --esm" - }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/iotHubClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, - "browser": "./dist/browser/index.js", - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub/README.md", - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } + "test": "tsc -b --noEmit && npm run test:node && npm run test:browser", + "update-snippets": "dev-tool run update-snippets" }, - "imports": { - "#platform/*": { - "browser": "./src/*-browser.mts", - "default": "./src/*.ts" - } + "//sampleConfiguration": { + "productName": "@azure/arm-iothub", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-iothub?view=azure-node-preview" } } diff --git a/sdk/iothub/arm-iothub/review/arm-iothub-node.api.md b/sdk/iothub/arm-iothub/review/arm-iothub-node.api.md index 6f8ce0bb79e8..66b2a19e70b7 100644 --- a/sdk/iothub/arm-iothub/review/arm-iothub-node.api.md +++ b/sdk/iothub/arm-iothub/review/arm-iothub-node.api.md @@ -4,28 +4,34 @@ ```ts -import type * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { CancelOnProgress } from '@azure/core-lro'; +import type { ClientOptions } from '@azure-rest/core-client'; +import { isRestError } from '@azure/core-rest-pipeline'; +import type { OperationOptions } from '@azure-rest/core-client'; import type { OperationState } from '@azure/core-lro'; -import type { PagedAsyncIterableIterator } from '@azure/core-paging'; -import type { SimplePollerLike } from '@azure/core-lro'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { Pipeline } from '@azure/core-rest-pipeline'; +import type { PollerLike } from '@azure/core-lro'; +import { RestError } from '@azure/core-rest-pipeline'; +import type { TokenCredential } from '@azure/core-auth'; // @public export type AccessRights = "RegistryRead" | "RegistryWrite" | "ServiceConnect" | "DeviceConnect" | "RegistryRead, RegistryWrite" | "RegistryRead, ServiceConnect" | "RegistryRead, DeviceConnect" | "RegistryWrite, ServiceConnect" | "RegistryWrite, DeviceConnect" | "ServiceConnect, DeviceConnect" | "RegistryRead, RegistryWrite, ServiceConnect" | "RegistryRead, RegistryWrite, DeviceConnect" | "RegistryRead, ServiceConnect, DeviceConnect" | "RegistryWrite, ServiceConnect, DeviceConnect" | "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect"; -// @public (undocumented) +// @public export interface ArmIdentity { readonly principalId?: string; readonly tenantId?: string; type?: ResourceIdentityType; - userAssignedIdentities?: { - [propertyName: string]: ArmUserIdentity; - }; + userAssignedIdentities?: Record; } -// @public (undocumented) +// @public export interface ArmUserIdentity { + // (undocumented) readonly clientId?: string; + // (undocumented) readonly principalId?: string; } @@ -33,21 +39,22 @@ export interface ArmUserIdentity { export type AuthenticationType = string; // @public -export type Capabilities = string; +export enum AzureClouds { + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} // @public -export interface CertificateBodyDescription { - certificate?: string; - isVerified?: boolean; -} +export type AzureSupportedClouds = `${AzureClouds}`; // @public -export interface CertificateDescription { +export type Capabilities = string; + +// @public +export interface CertificateDescription extends ProxyResource { readonly etag?: string; - readonly id?: string; - readonly name?: string; properties?: CertificateProperties; - readonly type?: string; } // @public @@ -81,54 +88,39 @@ export interface CertificatePropertiesWithNonce { } // @public -export interface Certificates { - createOrUpdate(resourceGroupName: string, resourceName: string, certificateName: string, certificateDescription: CertificateDescription, options?: CertificatesCreateOrUpdateOptionalParams): Promise; - delete(resourceGroupName: string, resourceName: string, certificateName: string, ifMatch: string, options?: CertificatesDeleteOptionalParams): Promise; - generateVerificationCode(resourceGroupName: string, resourceName: string, certificateName: string, ifMatch: string, options?: CertificatesGenerateVerificationCodeOptionalParams): Promise; - get(resourceGroupName: string, resourceName: string, certificateName: string, options?: CertificatesGetOptionalParams): Promise; - listByIotHub(resourceGroupName: string, resourceName: string, options?: CertificatesListByIotHubOptionalParams): Promise; - verify(resourceGroupName: string, resourceName: string, certificateName: string, ifMatch: string, certificateVerificationBody: CertificateVerificationDescription, options?: CertificatesVerifyOptionalParams): Promise; -} - -// @public -export interface CertificatesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface CertificatesCreateOrUpdateOptionalParams extends OperationOptions { ifMatch?: string; } // @public -export type CertificatesCreateOrUpdateResponse = CertificateDescription; - -// @public -export interface CertificatesDeleteOptionalParams extends coreClient.OperationOptions { +export interface CertificatesDeleteOptionalParams extends OperationOptions { } // @public -export interface CertificatesGenerateVerificationCodeOptionalParams extends coreClient.OperationOptions { +export interface CertificatesGenerateVerificationCodeOptionalParams extends OperationOptions { } // @public -export type CertificatesGenerateVerificationCodeResponse = CertificateWithNonceDescription; - -// @public -export interface CertificatesGetOptionalParams extends coreClient.OperationOptions { +export interface CertificatesGetOptionalParams extends OperationOptions { } // @public -export type CertificatesGetResponse = CertificateDescription; - -// @public -export interface CertificatesListByIotHubOptionalParams extends coreClient.OperationOptions { +export interface CertificatesListByIotHubOptionalParams extends OperationOptions { } // @public -export type CertificatesListByIotHubResponse = CertificateListDescription; - -// @public -export interface CertificatesVerifyOptionalParams extends coreClient.OperationOptions { +export interface CertificatesOperations { + createOrUpdate: (resourceGroupName: string, resourceName: string, certificateName: string, certificateDescription: CertificateDescription, options?: CertificatesCreateOrUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, resourceName: string, certificateName: string, ifMatch: string, options?: CertificatesDeleteOptionalParams) => Promise; + generateVerificationCode: (resourceGroupName: string, resourceName: string, certificateName: string, ifMatch: string, options?: CertificatesGenerateVerificationCodeOptionalParams) => Promise; + get: (resourceGroupName: string, resourceName: string, certificateName: string, options?: CertificatesGetOptionalParams) => Promise; + listByIotHub: (resourceGroupName: string, resourceName: string, options?: CertificatesListByIotHubOptionalParams) => Promise; + verify: (resourceGroupName: string, resourceName: string, certificateName: string, ifMatch: string, certificateVerificationBody: CertificateVerificationDescription, options?: CertificatesVerifyOptionalParams) => Promise; } // @public -export type CertificatesVerifyResponse = CertificateDescription; +export interface CertificatesVerifyOptionalParams extends OperationOptions { +} // @public export interface CertificateVerificationDescription { @@ -151,6 +143,11 @@ export interface CloudToDeviceProperties { maxDeliveryCount?: number; } +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + // @public export type CreatedByType = string; @@ -179,12 +176,6 @@ export interface EndpointHealthData { lastSuccessfulSendAttemptTime?: Date; } -// @public -export interface EndpointHealthDataListResult { - readonly nextLink?: string; - value?: EndpointHealthData[]; -} - // @public export type EndpointHealthStatus = string; @@ -209,14 +200,9 @@ export interface EventHubConsumerGroupBodyDescription { } // @public -export interface EventHubConsumerGroupInfo { +export interface EventHubConsumerGroupInfo extends ProxyResource { readonly etag?: string; - readonly id?: string; - readonly name?: string; - properties?: { - [propertyName: string]: any; - }; - readonly type?: string; + properties?: Record; } // @public @@ -224,12 +210,6 @@ export interface EventHubConsumerGroupName { name: string; } -// @public -export interface EventHubConsumerGroupsListResult { - readonly nextLink?: string; - value?: EventHubConsumerGroupInfo[]; -} - // @public export interface EventHubProperties { readonly endpoint?: string; @@ -272,7 +252,7 @@ export interface FeedbackProperties { } // @public -export function getContinuationToken(page: unknown): string | undefined; +export type GatewayVersion = string; // @public export interface GroupIdInformation { @@ -301,12 +281,6 @@ export interface ImportDevicesRequest { outputBlobName?: string; } -// @public -export interface IotHub { - beginManualFailover(iotHubName: string, resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams): Promise, void>>; - beginManualFailoverAndWait(iotHubName: string, resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams): Promise; -} - // @public export interface IotHubCapacity { readonly default?: number; @@ -316,50 +290,36 @@ export interface IotHubCapacity { } // @public (undocumented) -export class IotHubClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: IotHubClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - certificates: Certificates; - // (undocumented) - iotHub: IotHub; - // (undocumented) - iotHubResource: IotHubResource; - // (undocumented) - operations: Operations; - // (undocumented) - privateEndpointConnections: PrivateEndpointConnections; - // (undocumented) - privateLinkResourcesOperations: PrivateLinkResourcesOperations; - // (undocumented) - resourceProviderCommon: ResourceProviderCommon; - // (undocumented) - subscriptionId: string; +export class IotHubClient { + constructor(credential: TokenCredential, options?: IotHubClientOptionalParams); + constructor(credential: TokenCredential, subscriptionId: string, options?: IotHubClientOptionalParams); + readonly certificates: CertificatesOperations; + readonly iotHub: IotHubOperations; + readonly iotHubResource: IotHubResourceOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + readonly privateLinkResources: PrivateLinkResourcesOperations; + readonly resourceProviderCommon: ResourceProviderCommonOperations; } // @public -export interface IotHubClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +export interface IotHubClientOptionalParams extends ClientOptions { apiVersion?: string; - endpoint?: string; + cloudSetting?: AzureSupportedClouds; } // @public -export interface IotHubDescription extends Resource { +export interface IotHubDescription extends TrackedResource { etag?: string; identity?: ArmIdentity; properties?: IotHubProperties; sku: IotHubSkuInfo; - readonly systemData?: SystemData; } // @public -export interface IotHubDescriptionListResult { - readonly nextLink?: string; - value?: IotHubDescription[]; +export interface IotHubDetails { + gatewayVersion?: GatewayVersion; } // @public @@ -369,15 +329,7 @@ export interface IotHubLocationDescription { } // @public -export interface IotHubManualFailoverHeaders { - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface IotHubManualFailoverOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface IotHubManualFailoverOptionalParams extends OperationOptions { updateIntervalInMs?: number; } @@ -391,12 +343,22 @@ export interface IotHubNameAvailabilityInfo { // @public export type IotHubNameUnavailabilityReason = "Invalid" | "AlreadyExists"; +// @public +export interface IotHubOperations { + // @deprecated (undocumented) + beginManualFailover: (iotHubName: string, resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginManualFailoverAndWait: (iotHubName: string, resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams) => Promise; + manualFailover: (iotHubName: string, resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams) => PollerLike, void>; +} + // @public export interface IotHubProperties { allowedFqdnList?: string[]; authorizationPolicies?: SharedAccessSignatureAuthorizationRule[]; cloudToDevice?: CloudToDeviceProperties; comments?: string; + readonly deviceHostName?: string; deviceRegistry?: DeviceRegistry; deviceStreams?: IotHubPropertiesDeviceStreams; disableDeviceSAS?: boolean; @@ -405,17 +367,14 @@ export interface IotHubProperties { enableDataResidency?: boolean; enableFileUploadNotifications?: boolean; encryption?: EncryptionPropertiesDescription; - eventHubEndpoints?: { - [propertyName: string]: EventHubProperties; - }; + eventHubEndpoints?: Record; features?: Capabilities; readonly hostName?: string; + readonly iotHubDetails?: IotHubDetails; ipFilterRules?: IpFilterRule[]; ipVersion?: IpVersion; readonly locations?: IotHubLocationDescription[]; - messagingEndpoints?: { - [propertyName: string]: MessagingEndpointProperties; - }; + messagingEndpoints?: Record; minTlsVersion?: string; networkRuleSets?: NetworkRuleSetProperties; privateEndpointConnections?: PrivateEndpointConnection[]; @@ -424,10 +383,9 @@ export interface IotHubProperties { restrictOutboundNetworkAccess?: boolean; rootCertificate?: RootCertificateProperties; routing?: RoutingProperties; + readonly serviceHostName?: string; readonly state?: string; - storageEndpoints?: { - [propertyName: string]: StorageEndpointProperties; - }; + storageEndpoints?: Record; } // @public @@ -442,283 +400,144 @@ export interface IotHubQuotaMetricInfo { readonly name?: string; } -// @public -export interface IotHubQuotaMetricInfoListResult { - readonly nextLink?: string; - value?: IotHubQuotaMetricInfo[]; -} - // @public export type IotHubReplicaRoleType = string; // @public -export interface IotHubResource { - beginCreateOrUpdate(resourceGroupName: string, resourceName: string, iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams): Promise, IotHubResourceCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, resourceName: string, options?: IotHubResourceDeleteOptionalParams): Promise, IotHubResourceDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, resourceName: string, options?: IotHubResourceDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, resourceName: string, iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams): Promise, IotHubResourceUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, resourceName: string, iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams): Promise; - checkNameAvailability(operationInputs: OperationInputs, options?: IotHubResourceCheckNameAvailabilityOptionalParams): Promise; - createEventHubConsumerGroup(resourceGroupName: string, resourceName: string, eventHubEndpointName: string, name: string, consumerGroupBody: EventHubConsumerGroupBodyDescription, options?: IotHubResourceCreateEventHubConsumerGroupOptionalParams): Promise; - deleteEventHubConsumerGroup(resourceGroupName: string, resourceName: string, eventHubEndpointName: string, name: string, options?: IotHubResourceDeleteEventHubConsumerGroupOptionalParams): Promise; - exportDevices(resourceGroupName: string, resourceName: string, exportDevicesParameters: ExportDevicesRequest, options?: IotHubResourceExportDevicesOptionalParams): Promise; - get(resourceGroupName: string, resourceName: string, options?: IotHubResourceGetOptionalParams): Promise; - getEventHubConsumerGroup(resourceGroupName: string, resourceName: string, eventHubEndpointName: string, name: string, options?: IotHubResourceGetEventHubConsumerGroupOptionalParams): Promise; - getJob(resourceGroupName: string, resourceName: string, jobId: string, options?: IotHubResourceGetJobOptionalParams): Promise; - getKeysForKeyName(resourceGroupName: string, resourceName: string, keyName: string, options?: IotHubResourceGetKeysForKeyNameOptionalParams): Promise; - getStats(resourceGroupName: string, resourceName: string, options?: IotHubResourceGetStatsOptionalParams): Promise; - importDevices(resourceGroupName: string, resourceName: string, importDevicesParameters: ImportDevicesRequest, options?: IotHubResourceImportDevicesOptionalParams): Promise; - listByResourceGroup(resourceGroupName: string, options?: IotHubResourceListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listBySubscription(options?: IotHubResourceListBySubscriptionOptionalParams): PagedAsyncIterableIterator; - listEndpointHealth(resourceGroupName: string, iotHubName: string, options?: IotHubResourceGetEndpointHealthOptionalParams): PagedAsyncIterableIterator; - listEventHubConsumerGroups(resourceGroupName: string, resourceName: string, eventHubEndpointName: string, options?: IotHubResourceListEventHubConsumerGroupsOptionalParams): PagedAsyncIterableIterator; - listJobs(resourceGroupName: string, resourceName: string, options?: IotHubResourceListJobsOptionalParams): PagedAsyncIterableIterator; - listKeys(resourceGroupName: string, resourceName: string, options?: IotHubResourceListKeysOptionalParams): PagedAsyncIterableIterator; - listQuotaMetrics(resourceGroupName: string, resourceName: string, options?: IotHubResourceGetQuotaMetricsOptionalParams): PagedAsyncIterableIterator; - listValidSkus(resourceGroupName: string, resourceName: string, options?: IotHubResourceGetValidSkusOptionalParams): PagedAsyncIterableIterator; - testAllRoutes(iotHubName: string, resourceGroupName: string, input: TestAllRoutesInput, options?: IotHubResourceTestAllRoutesOptionalParams): Promise; - testRoute(iotHubName: string, resourceGroupName: string, input: TestRouteInput, options?: IotHubResourceTestRouteOptionalParams): Promise; -} - -// @public -export interface IotHubResourceCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceCheckNameAvailabilityOptionalParams extends OperationOptions { } // @public -export type IotHubResourceCheckNameAvailabilityResponse = IotHubNameAvailabilityInfo; - -// @public -export interface IotHubResourceCreateEventHubConsumerGroupOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceCreateEventHubConsumerGroupResponse = EventHubConsumerGroupInfo; - -// @public -export interface IotHubResourceCreateOrUpdateHeaders { - azureAsyncOperation?: string; +export interface IotHubResourceCreateEventHubConsumerGroupOptionalParams extends OperationOptions { } // @public -export interface IotHubResourceCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceCreateOrUpdateOptionalParams extends OperationOptions { ifMatch?: string; - resumeFrom?: string; updateIntervalInMs?: number; } // @public -export type IotHubResourceCreateOrUpdateResponse = IotHubDescription; - -// @public -export interface IotHubResourceDeleteEventHubConsumerGroupOptionalParams extends coreClient.OperationOptions { -} - -// @public -export interface IotHubResourceDeleteHeaders { - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface IotHubResourceDeleteEventHubConsumerGroupOptionalParams extends OperationOptions { } // @public -export interface IotHubResourceDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface IotHubResourceDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type IotHubResourceDeleteResponse = IotHubDescription; - -// @public -export interface IotHubResourceExportDevicesOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceExportDevicesOptionalParams extends OperationOptions { } // @public -export type IotHubResourceExportDevicesResponse = JobResponse; - -// @public -export interface IotHubResourceGetEndpointHealthNextOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceGetEventHubConsumerGroupOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetEndpointHealthNextResponse = EndpointHealthDataListResult; - -// @public -export interface IotHubResourceGetEndpointHealthOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceGetJobOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetEndpointHealthResponse = EndpointHealthDataListResult; - -// @public -export interface IotHubResourceGetEventHubConsumerGroupOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceGetKeysForKeyNameOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetEventHubConsumerGroupResponse = EventHubConsumerGroupInfo; - -// @public -export interface IotHubResourceGetJobOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceGetOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetJobResponse = JobResponse; - -// @public -export interface IotHubResourceGetKeysForKeyNameOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceGetStatsOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetKeysForKeyNameResponse = SharedAccessSignatureAuthorizationRule; - -// @public -export interface IotHubResourceGetOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceImportDevicesOptionalParams extends OperationOptions { } // @public -export interface IotHubResourceGetQuotaMetricsNextOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceListByResourceGroupOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetQuotaMetricsNextResponse = IotHubQuotaMetricInfoListResult; - -// @public -export interface IotHubResourceGetQuotaMetricsOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceListBySubscriptionOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetQuotaMetricsResponse = IotHubQuotaMetricInfoListResult; - -// @public -export type IotHubResourceGetResponse = IotHubDescription; - -// @public -export interface IotHubResourceGetStatsOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceListEndpointHealthOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetStatsResponse = RegistryStatistics; - -// @public -export interface IotHubResourceGetValidSkusNextOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceListEventHubConsumerGroupsOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetValidSkusNextResponse = IotHubSkuDescriptionListResult; - -// @public -export interface IotHubResourceGetValidSkusOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceListJobsOptionalParams extends OperationOptions { } // @public -export type IotHubResourceGetValidSkusResponse = IotHubSkuDescriptionListResult; - -// @public -export interface IotHubResourceImportDevicesOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceListKeysOptionalParams extends OperationOptions { } // @public -export type IotHubResourceImportDevicesResponse = JobResponse; - -// @public -export interface IotHubResourceListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceListByResourceGroupNextResponse = IotHubDescriptionListResult; - -// @public -export interface IotHubResourceListByResourceGroupOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceListByResourceGroupResponse = IotHubDescriptionListResult; - -// @public -export interface IotHubResourceListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceListBySubscriptionNextResponse = IotHubDescriptionListResult; - -// @public -export interface IotHubResourceListBySubscriptionOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceListBySubscriptionResponse = IotHubDescriptionListResult; - -// @public -export interface IotHubResourceListEventHubConsumerGroupsNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceListEventHubConsumerGroupsNextResponse = EventHubConsumerGroupsListResult; - -// @public -export interface IotHubResourceListEventHubConsumerGroupsOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceListEventHubConsumerGroupsResponse = EventHubConsumerGroupsListResult; - -// @public -export interface IotHubResourceListJobsNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceListJobsNextResponse = JobResponseListResult; - -// @public -export interface IotHubResourceListJobsOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceListQuotaMetricsOptionalParams extends OperationOptions { } // @public -export type IotHubResourceListJobsResponse = JobResponseListResult; - -// @public -export interface IotHubResourceListKeysNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type IotHubResourceListKeysNextResponse = SharedAccessSignatureAuthorizationRuleListResult; - -// @public -export interface IotHubResourceListKeysOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceListValidSkusOptionalParams extends OperationOptions { } // @public -export type IotHubResourceListKeysResponse = SharedAccessSignatureAuthorizationRuleListResult; - -// @public -export interface IotHubResourceTestAllRoutesOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, resourceName: string, iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams) => Promise, IotHubDescription>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, resourceName: string, iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, resourceName: string, options?: IotHubResourceDeleteOptionalParams) => Promise, IotHubDescription>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, resourceName: string, options?: IotHubResourceDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, resourceName: string, iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams) => Promise, IotHubDescription>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, resourceName: string, iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams) => Promise; + checkNameAvailability: (operationInputs: OperationInputs, options?: IotHubResourceCheckNameAvailabilityOptionalParams) => Promise; + createEventHubConsumerGroup: (resourceGroupName: string, resourceName: string, eventHubEndpointName: string, name: string, consumerGroupBody: EventHubConsumerGroupBodyDescription, options?: IotHubResourceCreateEventHubConsumerGroupOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, resourceName: string, iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams) => PollerLike, IotHubDescription>; + delete: (resourceGroupName: string, resourceName: string, options?: IotHubResourceDeleteOptionalParams) => PollerLike, IotHubDescription>; + deleteEventHubConsumerGroup: (resourceGroupName: string, resourceName: string, eventHubEndpointName: string, name: string, options?: IotHubResourceDeleteEventHubConsumerGroupOptionalParams) => Promise; + exportDevices: (resourceGroupName: string, resourceName: string, exportDevicesParameters: ExportDevicesRequest, options?: IotHubResourceExportDevicesOptionalParams) => Promise; + get: (resourceGroupName: string, resourceName: string, options?: IotHubResourceGetOptionalParams) => Promise; + getEventHubConsumerGroup: (resourceGroupName: string, resourceName: string, eventHubEndpointName: string, name: string, options?: IotHubResourceGetEventHubConsumerGroupOptionalParams) => Promise; + getJob: (resourceGroupName: string, resourceName: string, jobId: string, options?: IotHubResourceGetJobOptionalParams) => Promise; + getKeysForKeyName: (resourceGroupName: string, resourceName: string, keyName: string, options?: IotHubResourceGetKeysForKeyNameOptionalParams) => Promise; + getStats: (resourceGroupName: string, resourceName: string, options?: IotHubResourceGetStatsOptionalParams) => Promise; + importDevices: (resourceGroupName: string, resourceName: string, importDevicesParameters: ImportDevicesRequest, options?: IotHubResourceImportDevicesOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: IotHubResourceListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: IotHubResourceListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + listEndpointHealth: (resourceGroupName: string, iotHubName: string, options?: IotHubResourceListEndpointHealthOptionalParams) => PagedAsyncIterableIterator; + listEventHubConsumerGroups: (resourceGroupName: string, resourceName: string, eventHubEndpointName: string, options?: IotHubResourceListEventHubConsumerGroupsOptionalParams) => PagedAsyncIterableIterator; + listJobs: (resourceGroupName: string, resourceName: string, options?: IotHubResourceListJobsOptionalParams) => PagedAsyncIterableIterator; + listKeys: (resourceGroupName: string, resourceName: string, options?: IotHubResourceListKeysOptionalParams) => PagedAsyncIterableIterator; + listQuotaMetrics: (resourceGroupName: string, resourceName: string, options?: IotHubResourceListQuotaMetricsOptionalParams) => PagedAsyncIterableIterator; + listValidSkus: (resourceGroupName: string, resourceName: string, options?: IotHubResourceListValidSkusOptionalParams) => PagedAsyncIterableIterator; + testAllRoutes: (iotHubName: string, resourceGroupName: string, input: TestAllRoutesInput, options?: IotHubResourceTestAllRoutesOptionalParams) => Promise; + testRoute: (iotHubName: string, resourceGroupName: string, input: TestRouteInput, options?: IotHubResourceTestRouteOptionalParams) => Promise; + update: (resourceGroupName: string, resourceName: string, iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams) => PollerLike, IotHubDescription>; } // @public -export type IotHubResourceTestAllRoutesResponse = TestAllRoutesResult; - -// @public -export interface IotHubResourceTestRouteOptionalParams extends coreClient.OperationOptions { +export interface IotHubResourceTestAllRoutesOptionalParams extends OperationOptions { } // @public -export type IotHubResourceTestRouteResponse = TestRouteResult; - -// @public -export interface IotHubResourceUpdateHeaders { - azureAsyncOperation?: string; +export interface IotHubResourceTestRouteOptionalParams extends OperationOptions { } // @public -export interface IotHubResourceUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface IotHubResourceUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type IotHubResourceUpdateResponse = IotHubResourceUpdateHeaders & IotHubDescription; - // @public export type IotHubScaleType = "Automatic" | "Manual" | "None"; @@ -732,12 +551,6 @@ export interface IotHubSkuDescription { sku: IotHubSkuInfo; } -// @public -export interface IotHubSkuDescriptionListResult { - readonly nextLink?: string; - value?: IotHubSkuDescription[]; -} - // @public export interface IotHubSkuInfo { capacity?: number; @@ -761,6 +574,8 @@ export interface IpFilterRule { // @public export type IpVersion = string; +export { isRestError } + // @public export interface JobResponse { readonly endTimeUtc?: Date; @@ -773,12 +588,6 @@ export interface JobResponse { readonly type?: JobType; } -// @public -export interface JobResponseListResult { - readonly nextLink?: string; - value?: JobResponse[]; -} - // @public export type JobStatus = "unknown" | "enqueued" | "running" | "completed" | "failed" | "cancelled"; @@ -826,6 +635,12 @@ export enum KnownEndpointHealthStatus { Unknown = "unknown" } +// @public +export enum KnownGatewayVersion { + V1 = "V1", + V2 = "V2" +} + // @public export enum KnownIotHubReplicaRoleType { Primary = "primary", @@ -916,6 +731,11 @@ export enum KnownTestResultStatus { Undefined = "undefined" } +// @public +export enum KnownVersions { + V20260301Preview = "2026-03-01-preview" +} + // @public export interface ManagedIdentity { userAssignedIdentity?: string; @@ -976,41 +796,34 @@ export interface OperationInputs { } // @public -export interface OperationListResult { - readonly nextLink?: string; - readonly value?: Operation[]; +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } // @public -export type OperationsListNextResponse = OperationListResult; - -// @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { +export interface PageSettings { + continuationToken?: string; } -// @public -export type OperationsListResponse = OperationListResult; - // @public export interface PrivateEndpoint { readonly id?: string; } // @public -export interface PrivateEndpointConnection { - readonly id?: string; - readonly name?: string; +export interface PrivateEndpointConnection extends ProxyResource { properties: PrivateEndpointConnectionProperties; - readonly type?: string; } // @public @@ -1020,82 +833,56 @@ export interface PrivateEndpointConnectionProperties { } // @public -export interface PrivateEndpointConnections { - beginDelete(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, PrivateEndpointConnectionsDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams): Promise, PrivateEndpointConnectionsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams): Promise; - get(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; - list(resourceGroupName: string, resourceName: string, options?: PrivateEndpointConnectionsListOptionalParams): Promise; -} - -// @public -export interface PrivateEndpointConnectionsDeleteHeaders { - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface PrivateEndpointConnectionsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type PrivateEndpointConnectionsDeleteResponse = PrivateEndpointConnection; - -// @public -export interface PrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions { +export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { } // @public -export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; - -// @public -export interface PrivateEndpointConnectionsListOptionalParams extends coreClient.OperationOptions { +export interface PrivateEndpointConnectionsListOptionalParams extends OperationOptions { } // @public -export type PrivateEndpointConnectionsListResponse = PrivateEndpointConnection[]; - -// @public -export interface PrivateEndpointConnectionsUpdateHeaders { - azureAsyncOperation?: string; +export interface PrivateEndpointConnectionsOperations { + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => Promise, PrivateEndpointConnection>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams) => Promise, PrivateEndpointConnection>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, PrivateEndpointConnection>; + get: (resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; + list: (resourceGroupName: string, resourceName: string, options?: PrivateEndpointConnectionsListOptionalParams) => Promise; + update: (resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams) => PollerLike, PrivateEndpointConnection>; } // @public -export interface PrivateEndpointConnectionsUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface PrivateEndpointConnectionsUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type PrivateEndpointConnectionsUpdateResponse = PrivateEndpointConnection; - // @public export interface PrivateLinkResources { value?: GroupIdInformation[]; } // @public -export interface PrivateLinkResourcesGetOptionalParams extends coreClient.OperationOptions { +export interface PrivateLinkResourcesGetOptionalParams extends OperationOptions { } // @public -export type PrivateLinkResourcesGetResponse = GroupIdInformation; - -// @public -export interface PrivateLinkResourcesListOptionalParams extends coreClient.OperationOptions { +export interface PrivateLinkResourcesListOptionalParams extends OperationOptions { } -// @public -export type PrivateLinkResourcesListResponse = PrivateLinkResources; - // @public export interface PrivateLinkResourcesOperations { - get(resourceGroupName: string, resourceName: string, groupId: string, options?: PrivateLinkResourcesGetOptionalParams): Promise; - list(resourceGroupName: string, resourceName: string, options?: PrivateLinkResourcesListOptionalParams): Promise; + get: (resourceGroupName: string, resourceName: string, groupId: string, options?: PrivateLinkResourcesGetOptionalParams) => Promise; + list: (resourceGroupName: string, resourceName: string, options?: PrivateLinkResourcesListOptionalParams) => Promise; } // @public @@ -1108,6 +895,10 @@ export interface PrivateLinkServiceConnectionState { // @public export type PrivateLinkServiceConnectionStatus = string; +// @public +export interface ProxyResource extends Resource { +} + // @public export type PublicNetworkAccess = string; @@ -1121,11 +912,8 @@ export interface RegistryStatistics { // @public export interface Resource { readonly id?: string; - location: string; readonly name?: string; - tags?: { - [propertyName: string]: string; - }; + readonly systemData?: SystemData; readonly type?: string; } @@ -1133,16 +921,25 @@ export interface Resource { export type ResourceIdentityType = "SystemAssigned" | "UserAssigned" | "SystemAssigned, UserAssigned" | "None"; // @public -export interface ResourceProviderCommon { - getSubscriptionQuota(options?: ResourceProviderCommonGetSubscriptionQuotaOptionalParams): Promise; +export interface ResourceProviderCommonGetSubscriptionQuotaOptionalParams extends OperationOptions { } // @public -export interface ResourceProviderCommonGetSubscriptionQuotaOptionalParams extends coreClient.OperationOptions { +export interface ResourceProviderCommonOperations { + getSubscriptionQuota: (options?: ResourceProviderCommonGetSubscriptionQuotaOptionalParams) => Promise; } +export { RestError } + // @public -export type ResourceProviderCommonGetSubscriptionQuotaResponse = UserSubscriptionQuotaListResult; +export function restorePoller(client: IotHubClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} // @public export interface RootCertificateProperties { @@ -1222,13 +1019,9 @@ export interface RoutingEventHubProperties { // @public export interface RoutingMessage { - appProperties?: { - [propertyName: string]: string; - }; + appProperties?: Record; body?: string; - systemProperties?: { - [propertyName: string]: string; - }; + systemProperties?: Record; } // @public @@ -1292,13 +1085,13 @@ export type RoutingStorageContainerPropertiesEncoding = string; export interface RoutingTwin { // (undocumented) properties?: RoutingTwinProperties; - tags?: Record; + tags?: any; } -// @public (undocumented) +// @public export interface RoutingTwinProperties { - desired?: Record; - reported?: Record; + desired?: any; + reported?: any; } // @public @@ -1310,9 +1103,25 @@ export interface SharedAccessSignatureAuthorizationRule { } // @public -export interface SharedAccessSignatureAuthorizationRuleListResult { - readonly nextLink?: string; - value?: SharedAccessSignatureAuthorizationRule[]; +export interface SimplePollerLike, TResult> { + getOperationState(): TState; + getResult(): TResult | undefined; + isDone(): boolean; + // @deprecated + isStopped(): boolean; + onProgress(callback: (state: TState) => void): CancelOnProgress; + poll(options?: { + abortSignal?: AbortSignalLike; + }): Promise; + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise; + serialize(): Promise; + // @deprecated + stopPolling(): void; + submitted(): Promise; + // @deprecated + toString(): string; } // @public @@ -1336,9 +1145,7 @@ export interface SystemData { // @public export interface TagsResource { - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public @@ -1374,6 +1181,12 @@ export interface TestRouteResultDetails { compilationErrors?: RouteCompilationError[]; } +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + // @public export interface UserSubscriptionQuota { currentValue?: number; @@ -1387,7 +1200,6 @@ export interface UserSubscriptionQuota { // @public export interface UserSubscriptionQuotaListResult { readonly nextLink?: string; - // (undocumented) value?: UserSubscriptionQuota[]; } diff --git a/sdk/iothub/arm-iothub/samples-dev/certificatesCreateOrUpdateSample.ts b/sdk/iothub/arm-iothub/samples-dev/certificatesCreateOrUpdateSample.ts index 3d09cdb22fd4..7979e61ff310 100644 --- a/sdk/iothub/arm-iothub/samples-dev/certificatesCreateOrUpdateSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/certificatesCreateOrUpdateSample.ts @@ -1,39 +1,43 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + /** - * This sample demonstrates how to Adds new or replaces existing certificate. + * This sample demonstrates how to adds new or replaces existing certificate. * - * @summary Adds new or replaces existing certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatescreateorupdate.json + * @summary adds new or replaces existing certificate. + * x-ms-original-file: 2026-03-01-preview/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json */ +async function createOrReplaceCertificatesWithDeviceRegistryPolicy(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate("myResourceGroup", "testHub", "cert", { + properties: { certificate: "############################################" }, + }); + console.log(result); +} -import type { CertificateDescription } from "@azure/arm-iothub"; -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - +/** + * This sample demonstrates how to adds new or replaces existing certificate. + * + * @summary adds new or replaces existing certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_certificatescreateorupdate.json + */ async function certificatesCreateOrUpdate(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "iothub"; - const certificateName = "cert"; - const certificateDescription: CertificateDescription = { - properties: { certificate: "############################################" }, - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.createOrUpdate( - resourceGroupName, - resourceName, - certificateName, - certificateDescription, - ); + const result = await client.certificates.createOrUpdate("myResourceGroup", "iothub", "cert", { + properties: { certificate: "############################################" }, + }); console.log(result); } async function main(): Promise { + await createOrReplaceCertificatesWithDeviceRegistryPolicy(); await certificatesCreateOrUpdate(); } diff --git a/sdk/iothub/arm-iothub/samples-dev/certificatesDeleteSample.ts b/sdk/iothub/arm-iothub/samples-dev/certificatesDeleteSample.ts index dbdbecb442b9..98f2769cd852 100644 --- a/sdk/iothub/arm-iothub/samples-dev/certificatesDeleteSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/certificatesDeleteSample.ts @@ -1,33 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Deletes an existing X509 certificate or does nothing if it does not exist. - * - * @summary Deletes an existing X509 certificate or does nothing if it does not exist. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatesdelete.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to deletes an existing X509 certificate or does nothing if it does not exist. + * + * @summary deletes an existing X509 certificate or does nothing if it does not exist. + * x-ms-original-file: 2026-03-01-preview/iothub_certificatesdelete.json + */ async function certificatesDelete(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myhub"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.delete( - resourceGroupName, - resourceName, - certificateName, - ifMatch, - ); - console.log(result); + await client.certificates.delete("myResourceGroup", "myhub", "cert", "AAAAAAAADGk="); } async function main(): Promise { diff --git a/sdk/iothub/arm-iothub/samples-dev/certificatesGenerateVerificationCodeSample.ts b/sdk/iothub/arm-iothub/samples-dev/certificatesGenerateVerificationCodeSample.ts index a2a866fb5461..f90c086a00ac 100644 --- a/sdk/iothub/arm-iothub/samples-dev/certificatesGenerateVerificationCodeSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/certificatesGenerateVerificationCodeSample.ts @@ -1,31 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. - * - * @summary Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_generateverificationcode.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * + * @summary generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_generateverificationcode.json + */ async function certificatesGenerateVerificationCode(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const result = await client.certificates.generateVerificationCode( - resourceGroupName, - resourceName, - certificateName, - ifMatch, + "myResourceGroup", + "testHub", + "cert", + "AAAAAAAADGk=", ); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/certificatesGetSample.ts b/sdk/iothub/arm-iothub/samples-dev/certificatesGetSample.ts index 4f6bcd874970..8583cf4043e2 100644 --- a/sdk/iothub/arm-iothub/samples-dev/certificatesGetSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/certificatesGetSample.ts @@ -1,26 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Returns the certificate. - * - * @summary Returns the certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getcertificate.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to returns the certificate. + * + * @summary returns the certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_getcertificate.json + */ async function certificatesGet(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testhub"; - const certificateName = "cert"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.get(resourceGroupName, resourceName, certificateName); + const result = await client.certificates.get("myResourceGroup", "testhub", "cert"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/certificatesListByIotHubSample.ts b/sdk/iothub/arm-iothub/samples-dev/certificatesListByIotHubSample.ts index 5ab3473d6644..41814b84df62 100644 --- a/sdk/iothub/arm-iothub/samples-dev/certificatesListByIotHubSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/certificatesListByIotHubSample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Returns the list of certificates. - * - * @summary Returns the list of certificates. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listcertificates.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to returns the list of certificates. + * + * @summary returns the list of certificates. + * x-ms-original-file: 2026-03-01-preview/iothub_listcertificates.json + */ async function certificatesListByIotHub(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testhub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.listByIotHub(resourceGroupName, resourceName); + const result = await client.certificates.listByIotHub("myResourceGroup", "testhub"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/certificatesVerifySample.ts b/sdk/iothub/arm-iothub/samples-dev/certificatesVerifySample.ts index 039495ed5b72..a9268dd5257f 100644 --- a/sdk/iothub/arm-iothub/samples-dev/certificatesVerifySample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/certificatesVerifySample.ts @@ -1,36 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. - * - * @summary Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certverify.json - */ - -import type { CertificateVerificationDescription } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @summary verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_certverify.json + */ async function certificatesVerify(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myFirstProvisioningService"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; - const certificateVerificationBody: CertificateVerificationDescription = { - certificate: "#####################################", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const result = await client.certificates.verify( - resourceGroupName, - resourceName, - certificateName, - ifMatch, - certificateVerificationBody, + "myResourceGroup", + "myFirstProvisioningService", + "cert", + "AAAAAAAADGk=", + { certificate: "#####################################" }, ); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubManualFailoverSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubManualFailoverSample.ts index 06e6ae7b0e1f..b242910777df 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubManualFailoverSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubManualFailoverSample.ts @@ -1,32 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover - * - * @summary Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/IotHub_ManualFailover.json - */ - -import type { FailoverInput } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover + * + * @summary manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover + * x-ms-original-file: 2026-03-01-preview/IotHub_ManualFailover.json + */ async function iotHubManualFailover(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const failoverInput: FailoverInput = { failoverRegion: "testHub" }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHub.beginManualFailoverAndWait( - iotHubName, - resourceGroupName, - failoverInput, - ); - console.log(result); + await client.iotHub.manualFailover("testHub", "myResourceGroup", { failoverRegion: "testHub" }); } async function main(): Promise { diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCheckNameAvailabilitySample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCheckNameAvailabilitySample.ts index 0d192a4f75a2..99acc6b77658 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCheckNameAvailabilitySample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCheckNameAvailabilitySample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Check if an IoT hub name is available. - * - * @summary Check if an IoT hub name is available. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/checkNameAvailability.json - */ - -import type { OperationInputs } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to check if an IoT hub name is available. + * + * @summary check if an IoT hub name is available. + * x-ms-original-file: 2026-03-01-preview/checkNameAvailability.json + */ async function iotHubResourceCheckNameAvailability(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const operationInputs: OperationInputs = { name: "test-request" }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.checkNameAvailability(operationInputs); + const result = await client.iotHubResource.checkNameAvailability({ name: "test-request" }); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCreateEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCreateEventHubConsumerGroupSample.ts index 38118e29e792..cc4c8fa2f913 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCreateEventHubConsumerGroupSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCreateEventHubConsumerGroupSample.ts @@ -1,36 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * - * @summary Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createconsumergroup.json - */ - -import type { EventHubConsumerGroupBodyDescription } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @summary add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_createconsumergroup.json + */ async function iotHubResourceCreateEventHubConsumerGroup(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; - const consumerGroupBody: EventHubConsumerGroupBodyDescription = { - properties: { name: "test" }, - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const result = await client.iotHubResource.createEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name, - consumerGroupBody, + "myResourceGroup", + "testHub", + "events", + "test", + { properties: { name: "test" } }, ); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCreateOrUpdateSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCreateOrUpdateSample.ts index 5dfe92f44580..920bacb94601 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCreateOrUpdateSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceCreateOrUpdateSample.ts @@ -1,43 +1,40 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * - * @summary Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_addRoutingCosmosDBEndpoint.json - */ - -import type { IotHubDescription } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; -async function iotHubResourceAddCosmosDbEndpoint(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const iotHubDescription: IotHubDescription = { +/** + * This sample demonstrates how to create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @summary create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * x-ms-original-file: 2026-03-01-preview/CreateOrReplace_IoTHub_With_DeviceRegistry.json + */ +async function createOrReplaceIoTHubWithDeviceRegistry(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.createOrUpdate("myResourceGroup", "testHub", { etag: "AAAAAAFD6M4=", location: "centraluseuap", properties: { cloudToDevice: { defaultTtlAsIso8601: "PT1H", - feedback: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H", - }, + feedback: { lockDurationAsIso8601: "PT1M", maxDeliveryCount: 10, ttlAsIso8601: "PT1H" }, maxDeliveryCount: 10, }, - enableDataResidency: false, - enableFileUploadNotifications: false, - eventHubEndpoints: { - events: { partitionCount: 2, retentionTimeInDays: 1 }, + deviceRegistry: { + identityResourceId: + "/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testIdentity", + namespaceResourceId: + "/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/namespaces/testNamespace", }, + enableDataResidency: true, + enableFileUploadNotifications: false, + eventHubEndpoints: { events: { partitionCount: 2, retentionTimeInDays: 1 } }, features: "None", ipFilterRules: [], + ipVersion: "ipv4ipv6", messagingEndpoints: { fileNotifications: { lockDurationAsIso8601: "PT1M", @@ -54,23 +51,9 @@ async function iotHubResourceAddCosmosDbEndpoint(): Promise { { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" }, ], }, + rootCertificate: { enableRootCertificateV2: true }, routing: { endpoints: { - cosmosDBSqlContainers: [ - { - name: "endpointcosmos", - authenticationType: "keyBased", - containerName: "test", - databaseName: "systemstore", - endpointUri: "https://test-systemstore-test2.documents.azure.com", - partitionKeyName: "keystamped", - partitionKeyTemplate: "{deviceid}-{YYYY}-{MM}", - primaryKey: "", - resourceGroup: "rg-test", - secondaryKey: "", - subscriptionId: "", - }, - ], eventHubs: [], serviceBusQueues: [], serviceBusTopics: [], @@ -86,57 +69,40 @@ async function iotHubResourceAddCosmosDbEndpoint(): Promise { routes: [], }, storageEndpoints: { - $default: { - connectionString: "", - containerName: "", - sasTtlAsIso8601: "PT1H", - }, + $default: { connectionString: "", containerName: "", sasTtlAsIso8601: "PT1H" }, }, }, - sku: { name: "S1", capacity: 1 }, + sku: { name: "GEN2", capacity: 1 }, tags: {}, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - iotHubDescription, - ); + }); console.log(result); } /** - * This sample demonstrates how to Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. + * This sample demonstrates how to create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. * - * @summary Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createOrUpdate.json + * @summary create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_createOrUpdate.json */ async function iotHubResourceCreateOrUpdate(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const iotHubDescription: IotHubDescription = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.createOrUpdate("myResourceGroup", "testHub", { etag: "AAAAAAFD6M4=", location: "centraluseuap", properties: { cloudToDevice: { defaultTtlAsIso8601: "PT1H", - feedback: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H", - }, + feedback: { lockDurationAsIso8601: "PT1M", maxDeliveryCount: 10, ttlAsIso8601: "PT1H" }, maxDeliveryCount: 10, }, - enableDataResidency: false, + enableDataResidency: true, enableFileUploadNotifications: false, - eventHubEndpoints: { - events: { partitionCount: 2, retentionTimeInDays: 1 }, - }, + eventHubEndpoints: { events: { partitionCount: 2, retentionTimeInDays: 1 } }, features: "None", ipFilterRules: [], + ipVersion: "ipv4ipv6", messagingEndpoints: { fileNotifications: { lockDurationAsIso8601: "PT1M", @@ -153,6 +119,7 @@ async function iotHubResourceCreateOrUpdate(): Promise { { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" }, ], }, + rootCertificate: { enableRootCertificateV2: true }, routing: { endpoints: { eventHubs: [], @@ -170,28 +137,17 @@ async function iotHubResourceCreateOrUpdate(): Promise { routes: [], }, storageEndpoints: { - $default: { - connectionString: "", - containerName: "", - sasTtlAsIso8601: "PT1H", - }, + $default: { connectionString: "", containerName: "", sasTtlAsIso8601: "PT1H" }, }, }, sku: { name: "S1", capacity: 1 }, tags: {}, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - iotHubDescription, - ); + }); console.log(result); } async function main(): Promise { - await iotHubResourceAddCosmosDbEndpoint(); + await createOrReplaceIoTHubWithDeviceRegistry(); await iotHubResourceCreateOrUpdate(); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceDeleteEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceDeleteEventHubConsumerGroupSample.ts index 2bf422158893..fd89d64a4383 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceDeleteEventHubConsumerGroupSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceDeleteEventHubConsumerGroupSample.ts @@ -1,33 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. - * - * @summary Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteconsumergroup.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @summary delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_deleteconsumergroup.json + */ async function iotHubResourceDeleteEventHubConsumerGroup(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.deleteEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name, + await client.iotHubResource.deleteEventHubConsumerGroup( + "myResourceGroup", + "testHub", + "events", + "test", ); - console.log(result); } async function main(): Promise { diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceDeleteSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceDeleteSample.ts index 55982565989d..d8bcd903165f 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceDeleteSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceDeleteSample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete an IoT hub. - * - * @summary Delete an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_delete.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete an IoT hub. + * + * @summary delete an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_delete.json + */ async function iotHubResourceDelete(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginDeleteAndWait(resourceGroupName, resourceName); + const result = await client.iotHubResource.delete("myResourceGroup", "testHub"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceExportDevicesSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceExportDevicesSample.ts index dfda33dc0254..5fb8df10ec24 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceExportDevicesSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceExportDevicesSample.ts @@ -1,34 +1,28 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * - * @summary Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_exportdevices.json - */ - -import type { ExportDevicesRequest } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @summary exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * x-ms-original-file: 2026-03-01-preview/iothub_exportdevices.json + */ async function iotHubResourceExportDevices(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const exportDevicesParameters: ExportDevicesRequest = { - excludeKeys: true, - exportBlobContainerUri: "testBlob", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.exportDevices( - resourceGroupName, - resourceName, - exportDevicesParameters, - ); + const result = await client.iotHubResource.exportDevices("myResourceGroup", "testHub", { + authenticationType: "identityBased", + excludeKeys: true, + exportBlobContainerUri: "testBlob", + identity: { + userAssignedIdentity: + "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + }, + }); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetEventHubConsumerGroupSample.ts index 22a9da1c290a..f8aaf962dff4 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetEventHubConsumerGroupSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetEventHubConsumerGroupSample.ts @@ -1,31 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. - * - * @summary Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getconsumergroup.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @summary get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_getconsumergroup.json + */ async function iotHubResourceListEventHubConsumerGroups(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const result = await client.iotHubResource.getEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name, + "myResourceGroup", + "testHub", + "events", + "test", ); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetJobSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetJobSample.ts index a722bd19f442..26ae654203b0 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetJobSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetJobSample.ts @@ -1,26 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the details of a job from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * - * @summary Get the details of a job from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getjob.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @summary get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * x-ms-original-file: 2026-03-01-preview/iothub_getjob.json + */ async function iotHubResourceGetJob(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const jobId = "test"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getJob(resourceGroupName, resourceName, jobId); + const result = await client.iotHubResource.getJob("myResourceGroup", "testHub", "test"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetKeysForKeyNameSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetKeysForKeyNameSample.ts index 79923ec4b061..9d252446d98e 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetKeysForKeyNameSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetKeysForKeyNameSample.ts @@ -1,29 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a shared access policy by name from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * - * @summary Get a shared access policy by name from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getkey.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @summary get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * x-ms-original-file: 2026-03-01-preview/iothub_getkey.json + */ async function iotHubResourceGetKeysForKeyName(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const keyName = "iothubowner"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const result = await client.iotHubResource.getKeysForKeyName( - resourceGroupName, - resourceName, - keyName, + "myResourceGroup", + "testHub", + "iothubowner", ); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetSample.ts index 96d36fbeb77d..e1a005b004c2 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetSample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the non-security related metadata of an IoT hub. - * - * @summary Get the non-security related metadata of an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_get.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the non-security related metadata of an IoT hub. + * + * @summary get the non-security related metadata of an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_get.json + */ async function iotHubResourceGet(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.get(resourceGroupName, resourceName); + const result = await client.iotHubResource.get("myResourceGroup", "testHub"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetStatsSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetStatsSample.ts index 18fe7ee3d6e6..cc5c48e33fd7 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetStatsSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetStatsSample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the statistics from an IoT hub. - * - * @summary Get the statistics from an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_stats.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the statistics from an IoT hub. + * + * @summary get the statistics from an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_stats.json + */ async function iotHubResourceGetStats(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getStats(resourceGroupName, resourceName); + const result = await client.iotHubResource.getStats("myResourceGroup", "testHub"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetValidSkusSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetValidSkusSample.ts deleted file mode 100644 index e7ec452a8630..000000000000 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetValidSkusSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to Get the list of valid SKUs for an IoT hub. - * - * @summary Get the list of valid SKUs for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getskus.json - */ - -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -async function iotHubResourceGetValidSkus(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.iotHubResource.listValidSkus(resourceGroupName, resourceName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await iotHubResourceGetValidSkus(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceImportDevicesSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceImportDevicesSample.ts index ff97819997fb..f2a1c5d16e99 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceImportDevicesSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceImportDevicesSample.ts @@ -1,34 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * - * @summary Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_importdevices.json - */ - -import type { ImportDevicesRequest } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @summary import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * x-ms-original-file: 2026-03-01-preview/iothub_importdevices.json + */ async function iotHubResourceImportDevices(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const importDevicesParameters: ImportDevicesRequest = { - inputBlobContainerUri: "testBlob", - outputBlobContainerUri: "testBlob", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.importDevices( - resourceGroupName, - resourceName, - importDevicesParameters, - ); + const result = await client.iotHubResource.importDevices("myResourceGroup", "testHub", { + inputBlobContainerUri: "testBlob", + outputBlobContainerUri: "testBlob", + }); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListByResourceGroupSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListByResourceGroupSample.ts index b784ff5d8a0c..5b1da5d4101e 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListByResourceGroupSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListByResourceGroupSample.ts @@ -1,27 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get all the IoT hubs in a resource group. - * - * @summary Get all the IoT hubs in a resource group. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbyrg.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get all the IoT hubs in a resource group. + * + * @summary get all the IoT hubs in a resource group. + * x-ms-original-file: 2026-03-01-preview/iothub_listbyrg.json + */ async function iotHubResourceListByResourceGroup(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.iotHubResource.listByResourceGroup(resourceGroupName)) { + for await (const item of client.iotHubResource.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListBySubscriptionSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListBySubscriptionSample.ts index 56f3269ee4bf..4170691ca80a 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListBySubscriptionSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListBySubscriptionSample.ts @@ -1,26 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get all the IoT hubs in a subscription. - * - * @summary Get all the IoT hubs in a subscription. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbysubscription.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get all the IoT hubs in a subscription. + * + * @summary get all the IoT hubs in a subscription. + * x-ms-original-file: 2026-03-01-preview/iothub_listbysubscription.json + */ async function iotHubResourceListBySubscription(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.iotHubResource.listBySubscription()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetEndpointHealthSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListEndpointHealthSample.ts similarity index 54% rename from sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetEndpointHealthSample.ts rename to sdk/iothub/arm-iothub/samples-dev/iotHubResourceListEndpointHealthSample.ts index c49068beb21d..1f3c8bf2ec15 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetEndpointHealthSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListEndpointHealthSample.ts @@ -1,31 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the health for routing endpoints. - * - * @summary Get the health for routing endpoints. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_routingendpointhealth.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the health for routing endpoints. + * + * @summary get the health for routing endpoints. + * x-ms-original-file: 2026-03-01-preview/iothub_routingendpointhealth.json + */ async function iotHubResourceGetEndpointHealth(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const iotHubName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.iotHubResource.listEndpointHealth( - resourceGroupName, - iotHubName, - )) { + for await (const item of client.iotHubResource.listEndpointHealth("myResourceGroup", "testHub")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListEventHubConsumerGroupsSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListEventHubConsumerGroupsSample.ts index 239c04a3e971..9ecf60e8d40c 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListEventHubConsumerGroupsSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListEventHubConsumerGroupsSample.ts @@ -1,33 +1,28 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. - * - * @summary Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listehgroups.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @summary get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_listehgroups.json + */ async function iotHubResourceListEventHubConsumerGroups(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.iotHubResource.listEventHubConsumerGroups( - resourceGroupName, - resourceName, - eventHubEndpointName, + "myResourceGroup", + "testHub", + "events", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListJobsSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListJobsSample.ts index 84508c8ff5ac..c51254d2a874 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListJobsSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListJobsSample.ts @@ -1,28 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get a list of all the jobs in an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * - * @summary Get a list of all the jobs in an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listjobs.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @summary get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * x-ms-original-file: 2026-03-01-preview/iothub_listjobs.json + */ async function iotHubResourceListJobs(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.iotHubResource.listJobs(resourceGroupName, resourceName)) { + for await (const item of client.iotHubResource.listJobs("myResourceGroup", "testHub")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListKeysSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListKeysSample.ts index a2dc39dd1d4d..09e60e93d0e4 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListKeysSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListKeysSample.ts @@ -1,28 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the security metadata for an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * - * @summary Get the security metadata for an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listkeys.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @summary get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * x-ms-original-file: 2026-03-01-preview/iothub_listkeys.json + */ async function iotHubResourceListKeys(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.iotHubResource.listKeys(resourceGroupName, resourceName)) { + for await (const item of client.iotHubResource.listKeys("myResourceGroup", "testHub")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetQuotaMetricsSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListQuotaMetricsSample.ts similarity index 54% rename from sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetQuotaMetricsSample.ts rename to sdk/iothub/arm-iothub/samples-dev/iotHubResourceListQuotaMetricsSample.ts index b41292d5fc66..0fb8a5e0f179 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceGetQuotaMetricsSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListQuotaMetricsSample.ts @@ -1,31 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the quota metrics for an IoT hub. - * - * @summary Get the quota metrics for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_quotametrics.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the quota metrics for an IoT hub. + * + * @summary get the quota metrics for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_quotametrics.json + */ async function iotHubResourceGetQuotaMetrics(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.iotHubResource.listQuotaMetrics( - resourceGroupName, - resourceName, - )) { + for await (const item of client.iotHubResource.listQuotaMetrics("myResourceGroup", "testHub")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListValidSkusSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListValidSkusSample.ts new file mode 100644 index 000000000000..94938a7dde0e --- /dev/null +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceListValidSkusSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the list of valid SKUs for an IoT hub. + * + * @summary get the list of valid SKUs for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_getskus.json + */ +async function iotHubResourceGetValidSkus(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listValidSkus("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceGetValidSkus(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceTestAllRoutesSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceTestAllRoutesSample.ts index b685579a8e78..7289dcfc5264 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceTestAllRoutesSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceTestAllRoutesSample.ts @@ -1,34 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Test all routes configured in this Iot Hub - * - * @summary Test all routes configured in this Iot Hub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testallroutes.json - */ - -import type { TestAllRoutesInput } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to test all routes configured in this Iot Hub + * + * @summary test all routes configured in this Iot Hub + * x-ms-original-file: 2026-03-01-preview/iothub_testallroutes.json + */ async function iotHubResourceTestAllRoutes(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const input: TestAllRoutesInput = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.testAllRoutes("testHub", "myResourceGroup", { message: { appProperties: { key1: "value1" }, body: "Body of message", systemProperties: { key1: "value1" }, }, routingSource: "DeviceMessages", - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.testAllRoutes(iotHubName, resourceGroupName, input); + }); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceTestRouteSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceTestRouteSample.ts index 2ff4b64d0cc2..8005caba80b5 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceTestRouteSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceTestRouteSample.ts @@ -1,39 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Test the new route for this Iot Hub - * - * @summary Test the new route for this Iot Hub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testnewroute.json - */ - -import type { TestRouteInput } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to test the new route for this Iot Hub + * + * @summary test the new route for this Iot Hub + * x-ms-original-file: 2026-03-01-preview/iothub_testnewroute.json + */ async function iotHubResourceTestRoute(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const input: TestRouteInput = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.testRoute("testHub", "myResourceGroup", { message: { appProperties: { key1: "value1" }, body: "Body of message", systemProperties: { key1: "value1" }, }, - route: { - name: "Routeid", - endpointNames: ["id1"], - isEnabled: true, - source: "DeviceMessages", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.testRoute(iotHubName, resourceGroupName, input); + route: { name: "Routeid", endpointNames: ["id1"], isEnabled: true, source: "DeviceMessages" }, + }); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceUpdateSample.ts b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceUpdateSample.ts index afe23f80af3d..88c1535b0c1f 100644 --- a/sdk/iothub/arm-iothub/samples-dev/iotHubResourceUpdateSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/iotHubResourceUpdateSample.ts @@ -1,31 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * - * @summary Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_patch.json - */ - -import type { TagsResource } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method + * + * @summary update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method + * x-ms-original-file: 2026-03-01-preview/iothub_patch.json + */ async function iotHubResourceUpdate(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myHub"; - const iotHubTags: TagsResource = { tags: { foo: "bar" } }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginUpdateAndWait( - resourceGroupName, - resourceName, - iotHubTags, - ); + const result = await client.iotHubResource.update("myResourceGroup", "myHub", { + tags: { foo: "bar" }, + }); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/operationsListSample.ts b/sdk/iothub/arm-iothub/samples-dev/operationsListSample.ts index ef384366f21b..35dd9c7f32d3 100644 --- a/sdk/iothub/arm-iothub/samples-dev/operationsListSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/operationsListSample.ts @@ -1,26 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Lists all of the available IoT Hub REST API operations. - * - * @summary Lists all of the available IoT Hub REST API operations. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_operations.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2026-03-01-preview/iothub_operations.json + */ async function operationsList(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); + const client = new IotHubClient(credential); const resArray = new Array(); for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsDeleteSample.ts b/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsDeleteSample.ts index 9bb958df8892..382df800cdd8 100644 --- a/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsDeleteSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsDeleteSample.ts @@ -1,29 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Delete private endpoint connection with the specified name - * - * @summary Delete private endpoint connection with the specified name - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteprivateendpointconnection.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to delete private endpoint connection with the specified name + * + * @summary delete private endpoint connection with the specified name + * x-ms-original-file: 2026-03-01-preview/iothub_deleteprivateendpointconnection.json + */ async function privateEndpointConnectionDelete(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - resourceName, - privateEndpointConnectionName, + const result = await client.privateEndpointConnections.delete( + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", ); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsGetSample.ts b/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsGetSample.ts index 43624d8b02b0..a41c784997a8 100644 --- a/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsGetSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsGetSample.ts @@ -1,29 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get private endpoint connection properties - * - * @summary Get private endpoint connection properties - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivateendpointconnection.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get private endpoint connection properties + * + * @summary get private endpoint connection properties + * x-ms-original-file: 2026-03-01-preview/iothub_getprivateendpointconnection.json + */ async function privateEndpointConnectionGet(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const result = await client.privateEndpointConnections.get( - resourceGroupName, - resourceName, - privateEndpointConnectionName, + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", ); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsListSample.ts b/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsListSample.ts index def720a71799..896bfabf1964 100644 --- a/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsListSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsListSample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List private endpoint connection properties - * - * @summary List private endpoint connection properties - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivateendpointconnections.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list private endpoint connection properties + * + * @summary list private endpoint connection properties + * x-ms-original-file: 2026-03-01-preview/iothub_listprivateendpointconnections.json + */ async function privateEndpointConnectionsList(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.list(resourceGroupName, resourceName); + const result = await client.privateEndpointConnections.list("myResourceGroup", "testHub"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsUpdateSample.ts b/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsUpdateSample.ts index 4706a55917ce..d95fd60e86b6 100644 --- a/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsUpdateSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/privateEndpointConnectionsUpdateSample.ts @@ -1,39 +1,31 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Update the status of a private endpoint connection with the specified name - * - * @summary Update the status of a private endpoint connection with the specified name - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_updateprivateendpointconnection.json - */ - -import type { PrivateEndpointConnection } from "@azure/arm-iothub"; import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to update the status of a private endpoint connection with the specified name + * + * @summary update the status of a private endpoint connection with the specified name + * x-ms-original-file: 2026-03-01-preview/iothub_updateprivateendpointconnection.json + */ async function privateEndpointConnectionUpdate(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; - const privateEndpointConnection: PrivateEndpointConnection = { - properties: { - privateLinkServiceConnectionState: { - description: "Approved by johndoe@contoso.com", - status: "Approved", - }, - }, - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginUpdateAndWait( - resourceGroupName, - resourceName, - privateEndpointConnectionName, - privateEndpointConnection, + const result = await client.privateEndpointConnections.update( + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", + { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved", + }, + }, + }, ); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/privateLinkResourcesGetSample.ts b/sdk/iothub/arm-iothub/samples-dev/privateLinkResourcesGetSample.ts index 45148e259506..6c376eebbce0 100644 --- a/sdk/iothub/arm-iothub/samples-dev/privateLinkResourcesGetSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/privateLinkResourcesGetSample.ts @@ -1,30 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the specified private link resource for the given IotHub - * - * @summary Get the specified private link resource for the given IotHub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivatelinkresources.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the specified private link resource for the given IotHub + * + * @summary get the specified private link resource for the given IotHub + * x-ms-original-file: 2026-03-01-preview/iothub_getprivatelinkresources.json + */ async function privateLinkResourcesList(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const groupId = "iotHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateLinkResourcesOperations.get( - resourceGroupName, - resourceName, - groupId, - ); + const result = await client.privateLinkResources.get("myResourceGroup", "testHub", "iotHub"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/privateLinkResourcesListSample.ts b/sdk/iothub/arm-iothub/samples-dev/privateLinkResourcesListSample.ts index aa714a2bccee..42d56307fa5b 100644 --- a/sdk/iothub/arm-iothub/samples-dev/privateLinkResourcesListSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/privateLinkResourcesListSample.ts @@ -1,25 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to List private link resources for the given IotHub - * - * @summary List private link resources for the given IotHub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivatelinkresources.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to list private link resources for the given IotHub + * + * @summary list private link resources for the given IotHub + * x-ms-original-file: 2026-03-01-preview/iothub_listprivatelinkresources.json + */ async function privateLinkResourcesList(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateLinkResourcesOperations.list(resourceGroupName, resourceName); + const result = await client.privateLinkResources.list("myResourceGroup", "testHub"); console.log(result); } diff --git a/sdk/iothub/arm-iothub/samples-dev/resourceProviderCommonGetSubscriptionQuotaSample.ts b/sdk/iothub/arm-iothub/samples-dev/resourceProviderCommonGetSubscriptionQuotaSample.ts index 24f3ca3bbb40..0a8beda2d70e 100644 --- a/sdk/iothub/arm-iothub/samples-dev/resourceProviderCommonGetSubscriptionQuotaSample.ts +++ b/sdk/iothub/arm-iothub/samples-dev/resourceProviderCommonGetSubscriptionQuotaSample.ts @@ -1,21 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/** - * This sample demonstrates how to Get the number of free and paid iot hubs in the subscription - * - * @summary Get the number of free and paid iot hubs in the subscription - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_usages.json - */ - import { IotHubClient } from "@azure/arm-iothub"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; +/** + * This sample demonstrates how to get the number of free and paid iot hubs in the subscription + * + * @summary get the number of free and paid iot hubs in the subscription + * x-ms-original-file: 2026-03-01-preview/iothub_usages.json + */ async function resourceProviderCommonGetSubscriptionQuota(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; const client = new IotHubClient(credential, subscriptionId); const result = await client.resourceProviderCommon.getSubscriptionQuota(); console.log(result); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/README.md b/sdk/iothub/arm-iothub/samples/v6/javascript/README.md deleted file mode 100644 index 02bec8a7ffa7..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/README.md +++ /dev/null @@ -1,124 +0,0 @@ -# client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [certificatesCreateOrUpdateSample.js][certificatescreateorupdatesample] | Adds new or replaces existing certificate. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatescreateorupdate.json | -| [certificatesDeleteSample.js][certificatesdeletesample] | Deletes an existing X509 certificate or does nothing if it does not exist. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatesdelete.json | -| [certificatesGenerateVerificationCodeSample.js][certificatesgenerateverificationcodesample] | Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_generateverificationcode.json | -| [certificatesGetSample.js][certificatesgetsample] | Returns the certificate. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getcertificate.json | -| [certificatesListByIotHubSample.js][certificateslistbyiothubsample] | Returns the list of certificates. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listcertificates.json | -| [certificatesVerifySample.js][certificatesverifysample] | Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certverify.json | -| [iotHubManualFailoverSample.js][iothubmanualfailoversample] | Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/IotHub_ManualFailover.json | -| [iotHubResourceCheckNameAvailabilitySample.js][iothubresourcechecknameavailabilitysample] | Check if an IoT hub name is available. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/checkNameAvailability.json | -| [iotHubResourceCreateEventHubConsumerGroupSample.js][iothubresourcecreateeventhubconsumergroupsample] | Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createconsumergroup.json | -| [iotHubResourceCreateOrUpdateSample.js][iothubresourcecreateorupdatesample] | Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_addRoutingCosmosDBEndpoint.json | -| [iotHubResourceDeleteEventHubConsumerGroupSample.js][iothubresourcedeleteeventhubconsumergroupsample] | Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteconsumergroup.json | -| [iotHubResourceDeleteSample.js][iothubresourcedeletesample] | Delete an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_delete.json | -| [iotHubResourceExportDevicesSample.js][iothubresourceexportdevicessample] | Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_exportdevices.json | -| [iotHubResourceGetEndpointHealthSample.js][iothubresourcegetendpointhealthsample] | Get the health for routing endpoints. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_routingendpointhealth.json | -| [iotHubResourceGetEventHubConsumerGroupSample.js][iothubresourcegeteventhubconsumergroupsample] | Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getconsumergroup.json | -| [iotHubResourceGetJobSample.js][iothubresourcegetjobsample] | Get the details of a job from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getjob.json | -| [iotHubResourceGetKeysForKeyNameSample.js][iothubresourcegetkeysforkeynamesample] | Get a shared access policy by name from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getkey.json | -| [iotHubResourceGetQuotaMetricsSample.js][iothubresourcegetquotametricssample] | Get the quota metrics for an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_quotametrics.json | -| [iotHubResourceGetSample.js][iothubresourcegetsample] | Get the non-security related metadata of an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_get.json | -| [iotHubResourceGetStatsSample.js][iothubresourcegetstatssample] | Get the statistics from an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_stats.json | -| [iotHubResourceGetValidSkusSample.js][iothubresourcegetvalidskussample] | Get the list of valid SKUs for an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getskus.json | -| [iotHubResourceImportDevicesSample.js][iothubresourceimportdevicessample] | Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_importdevices.json | -| [iotHubResourceListByResourceGroupSample.js][iothubresourcelistbyresourcegroupsample] | Get all the IoT hubs in a resource group. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbyrg.json | -| [iotHubResourceListBySubscriptionSample.js][iothubresourcelistbysubscriptionsample] | Get all the IoT hubs in a subscription. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbysubscription.json | -| [iotHubResourceListEventHubConsumerGroupsSample.js][iothubresourcelisteventhubconsumergroupssample] | Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listehgroups.json | -| [iotHubResourceListJobsSample.js][iothubresourcelistjobssample] | Get a list of all the jobs in an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listjobs.json | -| [iotHubResourceListKeysSample.js][iothubresourcelistkeyssample] | Get the security metadata for an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listkeys.json | -| [iotHubResourceTestAllRoutesSample.js][iothubresourcetestallroutessample] | Test all routes configured in this Iot Hub x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testallroutes.json | -| [iotHubResourceTestRouteSample.js][iothubresourcetestroutesample] | Test the new route for this Iot Hub x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testnewroute.json | -| [iotHubResourceUpdateSample.js][iothubresourceupdatesample] | Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_patch.json | -| [operationsListSample.js][operationslistsample] | Lists all of the available IoT Hub REST API operations. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_operations.json | -| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | Delete private endpoint connection with the specified name x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteprivateendpointconnection.json | -| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | Get private endpoint connection properties x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivateendpointconnection.json | -| [privateEndpointConnectionsListSample.js][privateendpointconnectionslistsample] | List private endpoint connection properties x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivateendpointconnections.json | -| [privateEndpointConnectionsUpdateSample.js][privateendpointconnectionsupdatesample] | Update the status of a private endpoint connection with the specified name x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_updateprivateendpointconnection.json | -| [privateLinkResourcesGetSample.js][privatelinkresourcesgetsample] | Get the specified private link resource for the given IotHub x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivatelinkresources.json | -| [privateLinkResourcesListSample.js][privatelinkresourceslistsample] | List private link resources for the given IotHub x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivatelinkresources.json | -| [resourceProviderCommonGetSubscriptionQuotaSample.js][resourceprovidercommongetsubscriptionquotasample] | Get the number of free and paid iot hubs in the subscription x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_usages.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node certificatesCreateOrUpdateSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -cross-env IOTHUB_SUBSCRIPTION_ID="" IOTHUB_RESOURCE_GROUP="" node certificatesCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[certificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesCreateOrUpdateSample.js -[certificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesDeleteSample.js -[certificatesgenerateverificationcodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesGenerateVerificationCodeSample.js -[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesGetSample.js -[certificateslistbyiothubsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesListByIotHubSample.js -[certificatesverifysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesVerifySample.js -[iothubmanualfailoversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubManualFailoverSample.js -[iothubresourcechecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCheckNameAvailabilitySample.js -[iothubresourcecreateeventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCreateEventHubConsumerGroupSample.js -[iothubresourcecreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCreateOrUpdateSample.js -[iothubresourcedeleteeventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceDeleteEventHubConsumerGroupSample.js -[iothubresourcedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceDeleteSample.js -[iothubresourceexportdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceExportDevicesSample.js -[iothubresourcegetendpointhealthsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetEndpointHealthSample.js -[iothubresourcegeteventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetEventHubConsumerGroupSample.js -[iothubresourcegetjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetJobSample.js -[iothubresourcegetkeysforkeynamesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetKeysForKeyNameSample.js -[iothubresourcegetquotametricssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetQuotaMetricsSample.js -[iothubresourcegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetSample.js -[iothubresourcegetstatssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetStatsSample.js -[iothubresourcegetvalidskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetValidSkusSample.js -[iothubresourceimportdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceImportDevicesSample.js -[iothubresourcelistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListByResourceGroupSample.js -[iothubresourcelistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListBySubscriptionSample.js -[iothubresourcelisteventhubconsumergroupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListEventHubConsumerGroupsSample.js -[iothubresourcelistjobssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListJobsSample.js -[iothubresourcelistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListKeysSample.js -[iothubresourcetestallroutessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceTestAllRoutesSample.js -[iothubresourcetestroutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceTestRouteSample.js -[iothubresourceupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceUpdateSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/operationsListSample.js -[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsDeleteSample.js -[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsGetSample.js -[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsListSample.js -[privateendpointconnectionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsUpdateSample.js -[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/privateLinkResourcesGetSample.js -[privatelinkresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/privateLinkResourcesListSample.js -[resourceprovidercommongetsubscriptionquotasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/javascript/resourceProviderCommonGetSubscriptionQuotaSample.js -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-iothub?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub/README.md diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesCreateOrUpdateSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesCreateOrUpdateSample.js deleted file mode 100644 index 3e3ef74b63a9..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesCreateOrUpdateSample.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Adds new or replaces existing certificate. - * - * @summary Adds new or replaces existing certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatescreateorupdate.json - */ -async function certificatesCreateOrUpdate() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "iothub"; - const certificateName = "cert"; - const certificateDescription = { - properties: { certificate: "############################################" }, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.createOrUpdate( - resourceGroupName, - resourceName, - certificateName, - certificateDescription - ); - console.log(result); -} - -async function main() { - certificatesCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesDeleteSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesDeleteSample.js deleted file mode 100644 index dbeba55c296b..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesDeleteSample.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Deletes an existing X509 certificate or does nothing if it does not exist. - * - * @summary Deletes an existing X509 certificate or does nothing if it does not exist. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatesdelete.json - */ -async function certificatesDelete() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myhub"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.delete( - resourceGroupName, - resourceName, - certificateName, - ifMatch - ); - console.log(result); -} - -async function main() { - certificatesDelete(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesGenerateVerificationCodeSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesGenerateVerificationCodeSample.js deleted file mode 100644 index a4a198585601..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesGenerateVerificationCodeSample.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. - * - * @summary Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_generateverificationcode.json - */ -async function certificatesGenerateVerificationCode() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.generateVerificationCode( - resourceGroupName, - resourceName, - certificateName, - ifMatch - ); - console.log(result); -} - -async function main() { - certificatesGenerateVerificationCode(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesGetSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesGetSample.js deleted file mode 100644 index c0f60c35f7da..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesGetSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Returns the certificate. - * - * @summary Returns the certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getcertificate.json - */ -async function certificatesGet() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testhub"; - const certificateName = "cert"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.get(resourceGroupName, resourceName, certificateName); - console.log(result); -} - -async function main() { - certificatesGet(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesListByIotHubSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesListByIotHubSample.js deleted file mode 100644 index 15121ea77057..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesListByIotHubSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Returns the list of certificates. - * - * @summary Returns the list of certificates. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listcertificates.json - */ -async function certificatesListByIotHub() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testhub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.listByIotHub(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - certificatesListByIotHub(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesVerifySample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesVerifySample.js deleted file mode 100644 index 8987cb54579f..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/certificatesVerifySample.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. - * - * @summary Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certverify.json - */ -async function certificatesVerify() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myFirstProvisioningService"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; - const certificateVerificationBody = { - certificate: "#####################################", - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.verify( - resourceGroupName, - resourceName, - certificateName, - ifMatch, - certificateVerificationBody - ); - console.log(result); -} - -async function main() { - certificatesVerify(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubManualFailoverSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubManualFailoverSample.js deleted file mode 100644 index fb070863bd7a..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubManualFailoverSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover - * - * @summary Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/IotHub_ManualFailover.json - */ -async function iotHubManualFailover() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const failoverInput = { failoverRegion: "testHub" }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHub.beginManualFailoverAndWait( - iotHubName, - resourceGroupName, - failoverInput - ); - console.log(result); -} - -async function main() { - iotHubManualFailover(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCheckNameAvailabilitySample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCheckNameAvailabilitySample.js deleted file mode 100644 index adbc74db6700..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCheckNameAvailabilitySample.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Check if an IoT hub name is available. - * - * @summary Check if an IoT hub name is available. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/checkNameAvailability.json - */ -async function iotHubResourceCheckNameAvailability() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const operationInputs = { name: "test-request" }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.checkNameAvailability(operationInputs); - console.log(result); -} - -async function main() { - iotHubResourceCheckNameAvailability(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCreateEventHubConsumerGroupSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCreateEventHubConsumerGroupSample.js deleted file mode 100644 index cf3a18b32432..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCreateEventHubConsumerGroupSample.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * - * @summary Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createconsumergroup.json - */ -async function iotHubResourceCreateEventHubConsumerGroup() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; - const consumerGroupBody = { - properties: { name: "test" }, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.createEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name, - consumerGroupBody - ); - console.log(result); -} - -async function main() { - iotHubResourceCreateEventHubConsumerGroup(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCreateOrUpdateSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCreateOrUpdateSample.js deleted file mode 100644 index 786df0f8a86d..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceCreateOrUpdateSample.js +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * - * @summary Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_addRoutingCosmosDBEndpoint.json - */ -async function iotHubResourceAddCosmosDbEndpoint() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const iotHubDescription = { - etag: "AAAAAAFD6M4=", - location: "centraluseuap", - properties: { - cloudToDevice: { - defaultTtlAsIso8601: "PT1H", - feedback: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H", - }, - maxDeliveryCount: 10, - }, - enableDataResidency: false, - enableFileUploadNotifications: false, - eventHubEndpoints: { - events: { partitionCount: 2, retentionTimeInDays: 1 }, - }, - features: "None", - ipFilterRules: [], - messagingEndpoints: { - fileNotifications: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H", - }, - }, - minTlsVersion: "1.2", - networkRuleSets: { - applyToBuiltInEventHubEndpoint: true, - defaultAction: "Deny", - ipRules: [ - { action: "Allow", filterName: "rule1", ipMask: "131.117.159.53" }, - { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" }, - ], - }, - routing: { - endpoints: { - cosmosDBSqlContainers: [ - { - name: "endpointcosmos", - authenticationType: "keyBased", - containerName: "test", - databaseName: "systemstore", - endpointUri: "https://test-systemstore-test2.documents.azure.com", - partitionKeyName: "keystamped", - partitionKeyTemplate: "{deviceid}-{YYYY}-{MM}", - primaryKey: "", - resourceGroup: "rg-test", - secondaryKey: "", - subscriptionId: "", - }, - ], - eventHubs: [], - serviceBusQueues: [], - serviceBusTopics: [], - storageContainers: [], - }, - fallbackRoute: { - name: "$fallback", - condition: "true", - endpointNames: ["events"], - isEnabled: true, - source: "DeviceMessages", - }, - routes: [], - }, - storageEndpoints: { - $default: { - connectionString: "", - containerName: "", - sasTtlAsIso8601: "PT1H", - }, - }, - }, - sku: { name: "S1", capacity: 1 }, - tags: {}, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - iotHubDescription - ); - console.log(result); -} - -/** - * This sample demonstrates how to Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * - * @summary Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createOrUpdate.json - */ -async function iotHubResourceCreateOrUpdate() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const iotHubDescription = { - etag: "AAAAAAFD6M4=", - location: "centraluseuap", - properties: { - cloudToDevice: { - defaultTtlAsIso8601: "PT1H", - feedback: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H", - }, - maxDeliveryCount: 10, - }, - enableDataResidency: false, - enableFileUploadNotifications: false, - eventHubEndpoints: { - events: { partitionCount: 2, retentionTimeInDays: 1 }, - }, - features: "None", - ipFilterRules: [], - messagingEndpoints: { - fileNotifications: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H", - }, - }, - minTlsVersion: "1.2", - networkRuleSets: { - applyToBuiltInEventHubEndpoint: true, - defaultAction: "Deny", - ipRules: [ - { action: "Allow", filterName: "rule1", ipMask: "131.117.159.53" }, - { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" }, - ], - }, - routing: { - endpoints: { - eventHubs: [], - serviceBusQueues: [], - serviceBusTopics: [], - storageContainers: [], - }, - fallbackRoute: { - name: "$fallback", - condition: "true", - endpointNames: ["events"], - isEnabled: true, - source: "DeviceMessages", - }, - routes: [], - }, - storageEndpoints: { - $default: { - connectionString: "", - containerName: "", - sasTtlAsIso8601: "PT1H", - }, - }, - }, - sku: { name: "S1", capacity: 1 }, - tags: {}, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - iotHubDescription - ); - console.log(result); -} - -async function main() { - iotHubResourceAddCosmosDbEndpoint(); - iotHubResourceCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceDeleteEventHubConsumerGroupSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceDeleteEventHubConsumerGroupSample.js deleted file mode 100644 index 4bc9d48553c0..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceDeleteEventHubConsumerGroupSample.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. - * - * @summary Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteconsumergroup.json - */ -async function iotHubResourceDeleteEventHubConsumerGroup() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.deleteEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name - ); - console.log(result); -} - -async function main() { - iotHubResourceDeleteEventHubConsumerGroup(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceDeleteSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceDeleteSample.js deleted file mode 100644 index f39600c0087b..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceDeleteSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete an IoT hub. - * - * @summary Delete an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_delete.json - */ -async function iotHubResourceDelete() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginDeleteAndWait(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - iotHubResourceDelete(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceExportDevicesSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceExportDevicesSample.js deleted file mode 100644 index a3e22cd13298..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceExportDevicesSample.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * - * @summary Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_exportdevices.json - */ -async function iotHubResourceExportDevices() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const exportDevicesParameters = { - excludeKeys: true, - exportBlobContainerUri: "testBlob", - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.exportDevices( - resourceGroupName, - resourceName, - exportDevicesParameters - ); - console.log(result); -} - -async function main() { - iotHubResourceExportDevices(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetEndpointHealthSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetEndpointHealthSample.js deleted file mode 100644 index 2c349ea4eead..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetEndpointHealthSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the health for routing endpoints. - * - * @summary Get the health for routing endpoints. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_routingendpointhealth.json - */ -async function iotHubResourceGetEndpointHealth() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const iotHubName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listEndpointHealth(resourceGroupName, iotHubName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - iotHubResourceGetEndpointHealth(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetEventHubConsumerGroupSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetEventHubConsumerGroupSample.js deleted file mode 100644 index 8ad6100ce1f2..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetEventHubConsumerGroupSample.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. - * - * @summary Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getconsumergroup.json - */ -async function iotHubResourceListEventHubConsumerGroups() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name - ); - console.log(result); -} - -async function main() { - iotHubResourceListEventHubConsumerGroups(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetJobSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetJobSample.js deleted file mode 100644 index 2d46fadf6bff..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetJobSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the details of a job from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * - * @summary Get the details of a job from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getjob.json - */ -async function iotHubResourceGetJob() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const jobId = "test"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getJob(resourceGroupName, resourceName, jobId); - console.log(result); -} - -async function main() { - iotHubResourceGetJob(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetKeysForKeyNameSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetKeysForKeyNameSample.js deleted file mode 100644 index 84d4beda8a8d..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetKeysForKeyNameSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a shared access policy by name from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * - * @summary Get a shared access policy by name from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getkey.json - */ -async function iotHubResourceGetKeysForKeyName() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const keyName = "iothubowner"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getKeysForKeyName( - resourceGroupName, - resourceName, - keyName - ); - console.log(result); -} - -async function main() { - iotHubResourceGetKeysForKeyName(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetQuotaMetricsSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetQuotaMetricsSample.js deleted file mode 100644 index 522f0bd2f602..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetQuotaMetricsSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the quota metrics for an IoT hub. - * - * @summary Get the quota metrics for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_quotametrics.json - */ -async function iotHubResourceGetQuotaMetrics() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listQuotaMetrics(resourceGroupName, resourceName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - iotHubResourceGetQuotaMetrics(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetSample.js deleted file mode 100644 index 845822c6983f..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the non-security related metadata of an IoT hub. - * - * @summary Get the non-security related metadata of an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_get.json - */ -async function iotHubResourceGet() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.get(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - iotHubResourceGet(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetStatsSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetStatsSample.js deleted file mode 100644 index 683b681b0582..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetStatsSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the statistics from an IoT hub. - * - * @summary Get the statistics from an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_stats.json - */ -async function iotHubResourceGetStats() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getStats(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - iotHubResourceGetStats(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetValidSkusSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetValidSkusSample.js deleted file mode 100644 index ce26adc72da6..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceGetValidSkusSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the list of valid SKUs for an IoT hub. - * - * @summary Get the list of valid SKUs for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getskus.json - */ -async function iotHubResourceGetValidSkus() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listValidSkus(resourceGroupName, resourceName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - iotHubResourceGetValidSkus(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceImportDevicesSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceImportDevicesSample.js deleted file mode 100644 index 0bea7950ce85..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceImportDevicesSample.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * - * @summary Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_importdevices.json - */ -async function iotHubResourceImportDevices() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const importDevicesParameters = { - inputBlobContainerUri: "testBlob", - outputBlobContainerUri: "testBlob", - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.importDevices( - resourceGroupName, - resourceName, - importDevicesParameters - ); - console.log(result); -} - -async function main() { - iotHubResourceImportDevices(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListByResourceGroupSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListByResourceGroupSample.js deleted file mode 100644 index bfe5239aea74..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListByResourceGroupSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get all the IoT hubs in a resource group. - * - * @summary Get all the IoT hubs in a resource group. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbyrg.json - */ -async function iotHubResourceListByResourceGroup() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - iotHubResourceListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListBySubscriptionSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListBySubscriptionSample.js deleted file mode 100644 index abfa5d907f65..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListBySubscriptionSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get all the IoT hubs in a subscription. - * - * @summary Get all the IoT hubs in a subscription. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbysubscription.json - */ -async function iotHubResourceListBySubscription() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - iotHubResourceListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListEventHubConsumerGroupsSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListEventHubConsumerGroupsSample.js deleted file mode 100644 index 3a3cc273febd..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListEventHubConsumerGroupsSample.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. - * - * @summary Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listehgroups.json - */ -async function iotHubResourceListEventHubConsumerGroups() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listEventHubConsumerGroups( - resourceGroupName, - resourceName, - eventHubEndpointName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - iotHubResourceListEventHubConsumerGroups(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListJobsSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListJobsSample.js deleted file mode 100644 index ca9f3ce6896d..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListJobsSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a list of all the jobs in an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * - * @summary Get a list of all the jobs in an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listjobs.json - */ -async function iotHubResourceListJobs() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listJobs(resourceGroupName, resourceName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - iotHubResourceListJobs(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListKeysSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListKeysSample.js deleted file mode 100644 index de436e4f92b1..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceListKeysSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the security metadata for an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * - * @summary Get the security metadata for an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listkeys.json - */ -async function iotHubResourceListKeys() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listKeys(resourceGroupName, resourceName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - iotHubResourceListKeys(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceTestAllRoutesSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceTestAllRoutesSample.js deleted file mode 100644 index 93d906b55d87..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceTestAllRoutesSample.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Test all routes configured in this Iot Hub - * - * @summary Test all routes configured in this Iot Hub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testallroutes.json - */ -async function iotHubResourceTestAllRoutes() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const input = { - message: { - appProperties: { key1: "value1" }, - body: "Body of message", - systemProperties: { key1: "value1" }, - }, - routingSource: "DeviceMessages", - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.testAllRoutes(iotHubName, resourceGroupName, input); - console.log(result); -} - -async function main() { - iotHubResourceTestAllRoutes(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceTestRouteSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceTestRouteSample.js deleted file mode 100644 index 34152b0a3ce9..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceTestRouteSample.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Test the new route for this Iot Hub - * - * @summary Test the new route for this Iot Hub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testnewroute.json - */ -async function iotHubResourceTestRoute() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const input = { - message: { - appProperties: { key1: "value1" }, - body: "Body of message", - systemProperties: { key1: "value1" }, - }, - route: { - name: "Routeid", - endpointNames: ["id1"], - isEnabled: true, - source: "DeviceMessages", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.testRoute(iotHubName, resourceGroupName, input); - console.log(result); -} - -async function main() { - iotHubResourceTestRoute(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceUpdateSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceUpdateSample.js deleted file mode 100644 index 30c3590e61e2..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/iotHubResourceUpdateSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * - * @summary Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_patch.json - */ -async function iotHubResourceUpdate() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myHub"; - const iotHubTags = { tags: { foo: "bar" } }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginUpdateAndWait( - resourceGroupName, - resourceName, - iotHubTags - ); - console.log(result); -} - -async function main() { - iotHubResourceUpdate(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/operationsListSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/operationsListSample.js deleted file mode 100644 index a22a3d612136..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/operationsListSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists all of the available IoT Hub REST API operations. - * - * @summary Lists all of the available IoT Hub REST API operations. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_operations.json - */ -async function operationsList() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsDeleteSample.js deleted file mode 100644 index 5e36eccf39c0..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsDeleteSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete private endpoint connection with the specified name - * - * @summary Delete private endpoint connection with the specified name - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteprivateendpointconnection.json - */ -async function privateEndpointConnectionDelete() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - resourceName, - privateEndpointConnectionName - ); - console.log(result); -} - -async function main() { - privateEndpointConnectionDelete(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsGetSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsGetSample.js deleted file mode 100644 index 50302d400129..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsGetSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get private endpoint connection properties - * - * @summary Get private endpoint connection properties - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivateendpointconnection.json - */ -async function privateEndpointConnectionGet() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.get( - resourceGroupName, - resourceName, - privateEndpointConnectionName - ); - console.log(result); -} - -async function main() { - privateEndpointConnectionGet(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsListSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsListSample.js deleted file mode 100644 index 939f271c08c0..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsListSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List private endpoint connection properties - * - * @summary List private endpoint connection properties - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivateendpointconnections.json - */ -async function privateEndpointConnectionsList() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.list(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - privateEndpointConnectionsList(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsUpdateSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsUpdateSample.js deleted file mode 100644 index 57644c63aa19..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/privateEndpointConnectionsUpdateSample.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update the status of a private endpoint connection with the specified name - * - * @summary Update the status of a private endpoint connection with the specified name - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_updateprivateendpointconnection.json - */ -async function privateEndpointConnectionUpdate() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; - const privateEndpointConnection = { - properties: { - privateLinkServiceConnectionState: { - description: "Approved by johndoe@contoso.com", - status: "Approved", - }, - }, - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginUpdateAndWait( - resourceGroupName, - resourceName, - privateEndpointConnectionName, - privateEndpointConnection - ); - console.log(result); -} - -async function main() { - privateEndpointConnectionUpdate(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/privateLinkResourcesGetSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/privateLinkResourcesGetSample.js deleted file mode 100644 index 866d1eb7b8e0..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/privateLinkResourcesGetSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the specified private link resource for the given IotHub - * - * @summary Get the specified private link resource for the given IotHub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivatelinkresources.json - */ -async function privateLinkResourcesList() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const groupId = "iotHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateLinkResourcesOperations.get( - resourceGroupName, - resourceName, - groupId - ); - console.log(result); -} - -async function main() { - privateLinkResourcesList(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/privateLinkResourcesListSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/privateLinkResourcesListSample.js deleted file mode 100644 index 1cc6d7d650d2..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/privateLinkResourcesListSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List private link resources for the given IotHub - * - * @summary List private link resources for the given IotHub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivatelinkresources.json - */ -async function privateLinkResourcesList() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateLinkResourcesOperations.list(resourceGroupName, resourceName); - console.log(result); -} - -async function main() { - privateLinkResourcesList(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/resourceProviderCommonGetSubscriptionQuotaSample.js b/sdk/iothub/arm-iothub/samples/v6/javascript/resourceProviderCommonGetSubscriptionQuotaSample.js deleted file mode 100644 index da75334905f2..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/resourceProviderCommonGetSubscriptionQuotaSample.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { IotHubClient } = require("@azure/arm-iothub"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get the number of free and paid iot hubs in the subscription - * - * @summary Get the number of free and paid iot hubs in the subscription - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_usages.json - */ -async function resourceProviderCommonGetSubscriptionQuota() { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || "91d12660-3dec-467a-be2a-213b5544ddc0"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.resourceProviderCommon.getSubscriptionQuota(); - console.log(result); -} - -async function main() { - resourceProviderCommonGetSubscriptionQuota(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/sample.env b/sdk/iothub/arm-iothub/samples/v6/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/README.md b/sdk/iothub/arm-iothub/samples/v6/typescript/README.md deleted file mode 100644 index 03ad4c5bdebc..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/README.md +++ /dev/null @@ -1,137 +0,0 @@ -# client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [certificatesCreateOrUpdateSample.ts][certificatescreateorupdatesample] | Adds new or replaces existing certificate. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatescreateorupdate.json | -| [certificatesDeleteSample.ts][certificatesdeletesample] | Deletes an existing X509 certificate or does nothing if it does not exist. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatesdelete.json | -| [certificatesGenerateVerificationCodeSample.ts][certificatesgenerateverificationcodesample] | Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_generateverificationcode.json | -| [certificatesGetSample.ts][certificatesgetsample] | Returns the certificate. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getcertificate.json | -| [certificatesListByIotHubSample.ts][certificateslistbyiothubsample] | Returns the list of certificates. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listcertificates.json | -| [certificatesVerifySample.ts][certificatesverifysample] | Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certverify.json | -| [iotHubManualFailoverSample.ts][iothubmanualfailoversample] | Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/IotHub_ManualFailover.json | -| [iotHubResourceCheckNameAvailabilitySample.ts][iothubresourcechecknameavailabilitysample] | Check if an IoT hub name is available. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/checkNameAvailability.json | -| [iotHubResourceCreateEventHubConsumerGroupSample.ts][iothubresourcecreateeventhubconsumergroupsample] | Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createconsumergroup.json | -| [iotHubResourceCreateOrUpdateSample.ts][iothubresourcecreateorupdatesample] | Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_addRoutingCosmosDBEndpoint.json | -| [iotHubResourceDeleteEventHubConsumerGroupSample.ts][iothubresourcedeleteeventhubconsumergroupsample] | Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteconsumergroup.json | -| [iotHubResourceDeleteSample.ts][iothubresourcedeletesample] | Delete an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_delete.json | -| [iotHubResourceExportDevicesSample.ts][iothubresourceexportdevicessample] | Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_exportdevices.json | -| [iotHubResourceGetEndpointHealthSample.ts][iothubresourcegetendpointhealthsample] | Get the health for routing endpoints. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_routingendpointhealth.json | -| [iotHubResourceGetEventHubConsumerGroupSample.ts][iothubresourcegeteventhubconsumergroupsample] | Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getconsumergroup.json | -| [iotHubResourceGetJobSample.ts][iothubresourcegetjobsample] | Get the details of a job from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getjob.json | -| [iotHubResourceGetKeysForKeyNameSample.ts][iothubresourcegetkeysforkeynamesample] | Get a shared access policy by name from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getkey.json | -| [iotHubResourceGetQuotaMetricsSample.ts][iothubresourcegetquotametricssample] | Get the quota metrics for an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_quotametrics.json | -| [iotHubResourceGetSample.ts][iothubresourcegetsample] | Get the non-security related metadata of an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_get.json | -| [iotHubResourceGetStatsSample.ts][iothubresourcegetstatssample] | Get the statistics from an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_stats.json | -| [iotHubResourceGetValidSkusSample.ts][iothubresourcegetvalidskussample] | Get the list of valid SKUs for an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getskus.json | -| [iotHubResourceImportDevicesSample.ts][iothubresourceimportdevicessample] | Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_importdevices.json | -| [iotHubResourceListByResourceGroupSample.ts][iothubresourcelistbyresourcegroupsample] | Get all the IoT hubs in a resource group. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbyrg.json | -| [iotHubResourceListBySubscriptionSample.ts][iothubresourcelistbysubscriptionsample] | Get all the IoT hubs in a subscription. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbysubscription.json | -| [iotHubResourceListEventHubConsumerGroupsSample.ts][iothubresourcelisteventhubconsumergroupssample] | Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listehgroups.json | -| [iotHubResourceListJobsSample.ts][iothubresourcelistjobssample] | Get a list of all the jobs in an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listjobs.json | -| [iotHubResourceListKeysSample.ts][iothubresourcelistkeyssample] | Get the security metadata for an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listkeys.json | -| [iotHubResourceTestAllRoutesSample.ts][iothubresourcetestallroutessample] | Test all routes configured in this Iot Hub x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testallroutes.json | -| [iotHubResourceTestRouteSample.ts][iothubresourcetestroutesample] | Test the new route for this Iot Hub x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testnewroute.json | -| [iotHubResourceUpdateSample.ts][iothubresourceupdatesample] | Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_patch.json | -| [operationsListSample.ts][operationslistsample] | Lists all of the available IoT Hub REST API operations. x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_operations.json | -| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | Delete private endpoint connection with the specified name x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteprivateendpointconnection.json | -| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | Get private endpoint connection properties x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivateendpointconnection.json | -| [privateEndpointConnectionsListSample.ts][privateendpointconnectionslistsample] | List private endpoint connection properties x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivateendpointconnections.json | -| [privateEndpointConnectionsUpdateSample.ts][privateendpointconnectionsupdatesample] | Update the status of a private endpoint connection with the specified name x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_updateprivateendpointconnection.json | -| [privateLinkResourcesGetSample.ts][privatelinkresourcesgetsample] | Get the specified private link resource for the given IotHub x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivatelinkresources.json | -| [privateLinkResourcesListSample.ts][privatelinkresourceslistsample] | List private link resources for the given IotHub x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivatelinkresources.json | -| [resourceProviderCommonGetSubscriptionQuotaSample.ts][resourceprovidercommongetsubscriptionquotasample] | Get the number of free and paid iot hubs in the subscription x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_usages.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/certificatesCreateOrUpdateSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -cross-env IOTHUB_SUBSCRIPTION_ID="" IOTHUB_RESOURCE_GROUP="" node dist/certificatesCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[certificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesCreateOrUpdateSample.ts -[certificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesDeleteSample.ts -[certificatesgenerateverificationcodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesGenerateVerificationCodeSample.ts -[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesGetSample.ts -[certificateslistbyiothubsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesListByIotHubSample.ts -[certificatesverifysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesVerifySample.ts -[iothubmanualfailoversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubManualFailoverSample.ts -[iothubresourcechecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCheckNameAvailabilitySample.ts -[iothubresourcecreateeventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCreateEventHubConsumerGroupSample.ts -[iothubresourcecreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCreateOrUpdateSample.ts -[iothubresourcedeleteeventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceDeleteEventHubConsumerGroupSample.ts -[iothubresourcedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceDeleteSample.ts -[iothubresourceexportdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceExportDevicesSample.ts -[iothubresourcegetendpointhealthsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetEndpointHealthSample.ts -[iothubresourcegeteventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetEventHubConsumerGroupSample.ts -[iothubresourcegetjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetJobSample.ts -[iothubresourcegetkeysforkeynamesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetKeysForKeyNameSample.ts -[iothubresourcegetquotametricssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetQuotaMetricsSample.ts -[iothubresourcegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetSample.ts -[iothubresourcegetstatssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetStatsSample.ts -[iothubresourcegetvalidskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetValidSkusSample.ts -[iothubresourceimportdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceImportDevicesSample.ts -[iothubresourcelistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListByResourceGroupSample.ts -[iothubresourcelistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListBySubscriptionSample.ts -[iothubresourcelisteventhubconsumergroupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListEventHubConsumerGroupsSample.ts -[iothubresourcelistjobssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListJobsSample.ts -[iothubresourcelistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListKeysSample.ts -[iothubresourcetestallroutessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceTestAllRoutesSample.ts -[iothubresourcetestroutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceTestRouteSample.ts -[iothubresourceupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceUpdateSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/operationsListSample.ts -[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsDeleteSample.ts -[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsGetSample.ts -[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsListSample.ts -[privateendpointconnectionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsUpdateSample.ts -[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateLinkResourcesGetSample.ts -[privatelinkresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateLinkResourcesListSample.ts -[resourceprovidercommongetsubscriptionquotasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v6/typescript/src/resourceProviderCommonGetSubscriptionQuotaSample.ts -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-iothub?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/sample.env b/sdk/iothub/arm-iothub/samples/v6/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesCreateOrUpdateSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesCreateOrUpdateSample.ts deleted file mode 100644 index 869d973f20ff..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesCreateOrUpdateSample.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { CertificateDescription, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Adds new or replaces existing certificate. - * - * @summary Adds new or replaces existing certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatescreateorupdate.json - */ -async function certificatesCreateOrUpdate(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "iothub"; - const certificateName = "cert"; - const certificateDescription: CertificateDescription = { - properties: { certificate: "############################################" } - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.createOrUpdate( - resourceGroupName, - resourceName, - certificateName, - certificateDescription - ); - console.log(result); -} - -async function main(): Promise { - certificatesCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesDeleteSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesDeleteSample.ts deleted file mode 100644 index b687128cd732..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesDeleteSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes an existing X509 certificate or does nothing if it does not exist. - * - * @summary Deletes an existing X509 certificate or does nothing if it does not exist. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatesdelete.json - */ -async function certificatesDelete(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myhub"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.delete( - resourceGroupName, - resourceName, - certificateName, - ifMatch - ); - console.log(result); -} - -async function main(): Promise { - certificatesDelete(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesGenerateVerificationCodeSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesGenerateVerificationCodeSample.ts deleted file mode 100644 index d65d81b29d15..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesGenerateVerificationCodeSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. - * - * @summary Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_generateverificationcode.json - */ -async function certificatesGenerateVerificationCode(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.generateVerificationCode( - resourceGroupName, - resourceName, - certificateName, - ifMatch - ); - console.log(result); -} - -async function main(): Promise { - certificatesGenerateVerificationCode(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesGetSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesGetSample.ts deleted file mode 100644 index 170aabb9620f..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesGetSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Returns the certificate. - * - * @summary Returns the certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getcertificate.json - */ -async function certificatesGet(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testhub"; - const certificateName = "cert"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.get( - resourceGroupName, - resourceName, - certificateName - ); - console.log(result); -} - -async function main(): Promise { - certificatesGet(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesListByIotHubSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesListByIotHubSample.ts deleted file mode 100644 index f1df888c2839..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesListByIotHubSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Returns the list of certificates. - * - * @summary Returns the list of certificates. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listcertificates.json - */ -async function certificatesListByIotHub(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testhub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.listByIotHub( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - certificatesListByIotHub(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesVerifySample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesVerifySample.ts deleted file mode 100644 index 505983e6f53e..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/certificatesVerifySample.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - CertificateVerificationDescription, - IotHubClient -} from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. - * - * @summary Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certverify.json - */ -async function certificatesVerify(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myFirstProvisioningService"; - const certificateName = "cert"; - const ifMatch = "AAAAAAAADGk="; - const certificateVerificationBody: CertificateVerificationDescription = { - certificate: "#####################################" - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.certificates.verify( - resourceGroupName, - resourceName, - certificateName, - ifMatch, - certificateVerificationBody - ); - console.log(result); -} - -async function main(): Promise { - certificatesVerify(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubManualFailoverSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubManualFailoverSample.ts deleted file mode 100644 index 214bfca191f0..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubManualFailoverSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { FailoverInput, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover - * - * @summary Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/IotHub_ManualFailover.json - */ -async function iotHubManualFailover(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const failoverInput: FailoverInput = { failoverRegion: "testHub" }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHub.beginManualFailoverAndWait( - iotHubName, - resourceGroupName, - failoverInput - ); - console.log(result); -} - -async function main(): Promise { - iotHubManualFailover(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCheckNameAvailabilitySample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCheckNameAvailabilitySample.ts deleted file mode 100644 index f3cd8275dbad..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { OperationInputs, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Check if an IoT hub name is available. - * - * @summary Check if an IoT hub name is available. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/checkNameAvailability.json - */ -async function iotHubResourceCheckNameAvailability(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const operationInputs: OperationInputs = { name: "test-request" }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.checkNameAvailability( - operationInputs - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceCheckNameAvailability(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCreateEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCreateEventHubConsumerGroupSample.ts deleted file mode 100644 index 8c86d5fbc4b1..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCreateEventHubConsumerGroupSample.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - EventHubConsumerGroupBodyDescription, - IotHubClient -} from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * - * @summary Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createconsumergroup.json - */ -async function iotHubResourceCreateEventHubConsumerGroup(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; - const consumerGroupBody: EventHubConsumerGroupBodyDescription = { - properties: { name: "test" } - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.createEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name, - consumerGroupBody - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceCreateEventHubConsumerGroup(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCreateOrUpdateSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCreateOrUpdateSample.ts deleted file mode 100644 index bcdde4bd83fb..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceCreateOrUpdateSample.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubDescription, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * - * @summary Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_addRoutingCosmosDBEndpoint.json - */ -async function iotHubResourceAddCosmosDbEndpoint(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const iotHubDescription: IotHubDescription = { - etag: "AAAAAAFD6M4=", - location: "centraluseuap", - properties: { - cloudToDevice: { - defaultTtlAsIso8601: "PT1H", - feedback: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H" - }, - maxDeliveryCount: 10 - }, - enableDataResidency: false, - enableFileUploadNotifications: false, - eventHubEndpoints: { - events: { partitionCount: 2, retentionTimeInDays: 1 } - }, - features: "None", - ipFilterRules: [], - messagingEndpoints: { - fileNotifications: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H" - } - }, - minTlsVersion: "1.2", - networkRuleSets: { - applyToBuiltInEventHubEndpoint: true, - defaultAction: "Deny", - ipRules: [ - { action: "Allow", filterName: "rule1", ipMask: "131.117.159.53" }, - { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" } - ] - }, - routing: { - endpoints: { - cosmosDBSqlContainers: [ - { - name: "endpointcosmos", - authenticationType: "keyBased", - containerName: "test", - databaseName: "systemstore", - endpointUri: "https://test-systemstore-test2.documents.azure.com", - partitionKeyName: "keystamped", - partitionKeyTemplate: "{deviceid}-{YYYY}-{MM}", - primaryKey: "", - resourceGroup: "rg-test", - secondaryKey: "", - subscriptionId: "" - } - ], - eventHubs: [], - serviceBusQueues: [], - serviceBusTopics: [], - storageContainers: [] - }, - fallbackRoute: { - name: "$fallback", - condition: "true", - endpointNames: ["events"], - isEnabled: true, - source: "DeviceMessages" - }, - routes: [] - }, - storageEndpoints: { - $default: { - connectionString: "", - containerName: "", - sasTtlAsIso8601: "PT1H" - } - } - }, - sku: { name: "S1", capacity: 1 }, - tags: {} - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - iotHubDescription - ); - console.log(result); -} - -/** - * This sample demonstrates how to Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * - * @summary Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to default, which may lead to unexpected behavior. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createOrUpdate.json - */ -async function iotHubResourceCreateOrUpdate(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const iotHubDescription: IotHubDescription = { - etag: "AAAAAAFD6M4=", - location: "centraluseuap", - properties: { - cloudToDevice: { - defaultTtlAsIso8601: "PT1H", - feedback: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H" - }, - maxDeliveryCount: 10 - }, - enableDataResidency: false, - enableFileUploadNotifications: false, - eventHubEndpoints: { - events: { partitionCount: 2, retentionTimeInDays: 1 } - }, - features: "None", - ipFilterRules: [], - messagingEndpoints: { - fileNotifications: { - lockDurationAsIso8601: "PT1M", - maxDeliveryCount: 10, - ttlAsIso8601: "PT1H" - } - }, - minTlsVersion: "1.2", - networkRuleSets: { - applyToBuiltInEventHubEndpoint: true, - defaultAction: "Deny", - ipRules: [ - { action: "Allow", filterName: "rule1", ipMask: "131.117.159.53" }, - { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" } - ] - }, - routing: { - endpoints: { - eventHubs: [], - serviceBusQueues: [], - serviceBusTopics: [], - storageContainers: [] - }, - fallbackRoute: { - name: "$fallback", - condition: "true", - endpointNames: ["events"], - isEnabled: true, - source: "DeviceMessages" - }, - routes: [] - }, - storageEndpoints: { - $default: { - connectionString: "", - containerName: "", - sasTtlAsIso8601: "PT1H" - } - } - }, - sku: { name: "S1", capacity: 1 }, - tags: {} - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginCreateOrUpdateAndWait( - resourceGroupName, - resourceName, - iotHubDescription - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceAddCosmosDbEndpoint(); - iotHubResourceCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceDeleteEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceDeleteEventHubConsumerGroupSample.ts deleted file mode 100644 index 846033f7f433..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceDeleteEventHubConsumerGroupSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. - * - * @summary Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteconsumergroup.json - */ -async function iotHubResourceDeleteEventHubConsumerGroup(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.deleteEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceDeleteEventHubConsumerGroup(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceDeleteSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceDeleteSample.ts deleted file mode 100644 index 052ba695e92e..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceDeleteSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete an IoT hub. - * - * @summary Delete an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_delete.json - */ -async function iotHubResourceDelete(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginDeleteAndWait( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceDelete(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceExportDevicesSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceExportDevicesSample.ts deleted file mode 100644 index 3bb239805259..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceExportDevicesSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ExportDevicesRequest, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * - * @summary Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_exportdevices.json - */ -async function iotHubResourceExportDevices(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const exportDevicesParameters: ExportDevicesRequest = { - excludeKeys: true, - exportBlobContainerUri: "testBlob" - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.exportDevices( - resourceGroupName, - resourceName, - exportDevicesParameters - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceExportDevices(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetEndpointHealthSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetEndpointHealthSample.ts deleted file mode 100644 index d3b1593d6f0c..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetEndpointHealthSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the health for routing endpoints. - * - * @summary Get the health for routing endpoints. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_routingendpointhealth.json - */ -async function iotHubResourceGetEndpointHealth(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const iotHubName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listEndpointHealth( - resourceGroupName, - iotHubName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - iotHubResourceGetEndpointHealth(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetEventHubConsumerGroupSample.ts deleted file mode 100644 index 7ac183e2a5ee..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetEventHubConsumerGroupSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. - * - * @summary Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getconsumergroup.json - */ -async function iotHubResourceListEventHubConsumerGroups(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const name = "test"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getEventHubConsumerGroup( - resourceGroupName, - resourceName, - eventHubEndpointName, - name - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceListEventHubConsumerGroups(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetJobSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetJobSample.ts deleted file mode 100644 index 5cea1d9da253..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetJobSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the details of a job from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * - * @summary Get the details of a job from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getjob.json - */ -async function iotHubResourceGetJob(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const jobId = "test"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getJob( - resourceGroupName, - resourceName, - jobId - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceGetJob(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetKeysForKeyNameSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetKeysForKeyNameSample.ts deleted file mode 100644 index 195bbd2f1370..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetKeysForKeyNameSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a shared access policy by name from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * - * @summary Get a shared access policy by name from an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getkey.json - */ -async function iotHubResourceGetKeysForKeyName(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const keyName = "iothubowner"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getKeysForKeyName( - resourceGroupName, - resourceName, - keyName - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceGetKeysForKeyName(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetQuotaMetricsSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetQuotaMetricsSample.ts deleted file mode 100644 index a6acfce9a28f..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetQuotaMetricsSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the quota metrics for an IoT hub. - * - * @summary Get the quota metrics for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_quotametrics.json - */ -async function iotHubResourceGetQuotaMetrics(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listQuotaMetrics( - resourceGroupName, - resourceName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - iotHubResourceGetQuotaMetrics(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetSample.ts deleted file mode 100644 index d01f7cd79d1b..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the non-security related metadata of an IoT hub. - * - * @summary Get the non-security related metadata of an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_get.json - */ -async function iotHubResourceGet(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.get( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceGet(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetStatsSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetStatsSample.ts deleted file mode 100644 index d3f4f277af41..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetStatsSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the statistics from an IoT hub. - * - * @summary Get the statistics from an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_stats.json - */ -async function iotHubResourceGetStats(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.getStats( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceGetStats(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetValidSkusSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetValidSkusSample.ts deleted file mode 100644 index 82a9cf3dd837..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceGetValidSkusSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the list of valid SKUs for an IoT hub. - * - * @summary Get the list of valid SKUs for an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getskus.json - */ -async function iotHubResourceGetValidSkus(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listValidSkus( - resourceGroupName, - resourceName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - iotHubResourceGetValidSkus(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceImportDevicesSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceImportDevicesSample.ts deleted file mode 100644 index 8fe3cac98b84..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceImportDevicesSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ImportDevicesRequest, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * - * @summary Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_importdevices.json - */ -async function iotHubResourceImportDevices(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const importDevicesParameters: ImportDevicesRequest = { - inputBlobContainerUri: "testBlob", - outputBlobContainerUri: "testBlob" - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.importDevices( - resourceGroupName, - resourceName, - importDevicesParameters - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceImportDevices(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListByResourceGroupSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListByResourceGroupSample.ts deleted file mode 100644 index 0e1df460358c..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListByResourceGroupSample.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get all the IoT hubs in a resource group. - * - * @summary Get all the IoT hubs in a resource group. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbyrg.json - */ -async function iotHubResourceListByResourceGroup(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - iotHubResourceListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListBySubscriptionSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListBySubscriptionSample.ts deleted file mode 100644 index 05ebe3962fa2..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListBySubscriptionSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get all the IoT hubs in a subscription. - * - * @summary Get all the IoT hubs in a subscription. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbysubscription.json - */ -async function iotHubResourceListBySubscription(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - iotHubResourceListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListEventHubConsumerGroupsSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListEventHubConsumerGroupsSample.ts deleted file mode 100644 index f766621dda6c..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListEventHubConsumerGroupsSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. - * - * @summary Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listehgroups.json - */ -async function iotHubResourceListEventHubConsumerGroups(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const eventHubEndpointName = "events"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listEventHubConsumerGroups( - resourceGroupName, - resourceName, - eventHubEndpointName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - iotHubResourceListEventHubConsumerGroups(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListJobsSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListJobsSample.ts deleted file mode 100644 index 1610cfe8346a..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListJobsSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a list of all the jobs in an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * - * @summary Get a list of all the jobs in an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listjobs.json - */ -async function iotHubResourceListJobs(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listJobs( - resourceGroupName, - resourceName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - iotHubResourceListJobs(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListKeysSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListKeysSample.ts deleted file mode 100644 index a4993ac3e911..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceListKeysSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the security metadata for an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * - * @summary Get the security metadata for an IoT hub. For more information, see: https://learn.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listkeys.json - */ -async function iotHubResourceListKeys(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.iotHubResource.listKeys( - resourceGroupName, - resourceName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - iotHubResourceListKeys(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceTestAllRoutesSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceTestAllRoutesSample.ts deleted file mode 100644 index 1bade4126243..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceTestAllRoutesSample.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { TestAllRoutesInput, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Test all routes configured in this Iot Hub - * - * @summary Test all routes configured in this Iot Hub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testallroutes.json - */ -async function iotHubResourceTestAllRoutes(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const input: TestAllRoutesInput = { - message: { - appProperties: { key1: "value1" }, - body: "Body of message", - systemProperties: { key1: "value1" } - }, - routingSource: "DeviceMessages" - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.testAllRoutes( - iotHubName, - resourceGroupName, - input - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceTestAllRoutes(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceTestRouteSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceTestRouteSample.ts deleted file mode 100644 index f60b88650e1b..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceTestRouteSample.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { TestRouteInput, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Test the new route for this Iot Hub - * - * @summary Test the new route for this Iot Hub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testnewroute.json - */ -async function iotHubResourceTestRoute(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const iotHubName = "testHub"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const input: TestRouteInput = { - message: { - appProperties: { key1: "value1" }, - body: "Body of message", - systemProperties: { key1: "value1" } - }, - route: { - name: "Routeid", - endpointNames: ["id1"], - isEnabled: true, - source: "DeviceMessages" - } - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.testRoute( - iotHubName, - resourceGroupName, - input - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceTestRoute(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceUpdateSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceUpdateSample.ts deleted file mode 100644 index f5316af8e5ca..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/iotHubResourceUpdateSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { TagsResource, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * - * @summary Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_patch.json - */ -async function iotHubResourceUpdate(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "myHub"; - const iotHubTags: TagsResource = { tags: { foo: "bar" } }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.iotHubResource.beginUpdateAndWait( - resourceGroupName, - resourceName, - iotHubTags - ); - console.log(result); -} - -async function main(): Promise { - iotHubResourceUpdate(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/operationsListSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/operationsListSample.ts deleted file mode 100644 index f4927dcc1cbc..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all of the available IoT Hub REST API operations. - * - * @summary Lists all of the available IoT Hub REST API operations. - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_operations.json - */ -async function operationsList(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsDeleteSample.ts deleted file mode 100644 index 8928ec765bc8..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsDeleteSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete private endpoint connection with the specified name - * - * @summary Delete private endpoint connection with the specified name - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteprivateendpointconnection.json - */ -async function privateEndpointConnectionDelete(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - resourceName, - privateEndpointConnectionName - ); - console.log(result); -} - -async function main(): Promise { - privateEndpointConnectionDelete(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsGetSample.ts deleted file mode 100644 index ba19a7eeab16..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsGetSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get private endpoint connection properties - * - * @summary Get private endpoint connection properties - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivateendpointconnection.json - */ -async function privateEndpointConnectionGet(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.get( - resourceGroupName, - resourceName, - privateEndpointConnectionName - ); - console.log(result); -} - -async function main(): Promise { - privateEndpointConnectionGet(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsListSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsListSample.ts deleted file mode 100644 index 55f4f49ff27d..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsListSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List private endpoint connection properties - * - * @summary List private endpoint connection properties - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivateendpointconnections.json - */ -async function privateEndpointConnectionsList(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.list( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - privateEndpointConnectionsList(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsUpdateSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsUpdateSample.ts deleted file mode 100644 index 1dc470fcb263..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateEndpointConnectionsUpdateSample.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PrivateEndpointConnection, IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Update the status of a private endpoint connection with the specified name - * - * @summary Update the status of a private endpoint connection with the specified name - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_updateprivateendpointconnection.json - */ -async function privateEndpointConnectionUpdate(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const privateEndpointConnectionName = "myPrivateEndpointConnection"; - const privateEndpointConnection: PrivateEndpointConnection = { - properties: { - privateLinkServiceConnectionState: { - description: "Approved by johndoe@contoso.com", - status: "Approved" - } - } - }; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginUpdateAndWait( - resourceGroupName, - resourceName, - privateEndpointConnectionName, - privateEndpointConnection - ); - console.log(result); -} - -async function main(): Promise { - privateEndpointConnectionUpdate(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateLinkResourcesGetSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateLinkResourcesGetSample.ts deleted file mode 100644 index ad7c4bfdf8d2..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateLinkResourcesGetSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the specified private link resource for the given IotHub - * - * @summary Get the specified private link resource for the given IotHub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivatelinkresources.json - */ -async function privateLinkResourcesList(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const groupId = "iotHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateLinkResourcesOperations.get( - resourceGroupName, - resourceName, - groupId - ); - console.log(result); -} - -async function main(): Promise { - privateLinkResourcesList(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateLinkResourcesListSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateLinkResourcesListSample.ts deleted file mode 100644 index 0d39c5f7dcfb..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/privateLinkResourcesListSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List private link resources for the given IotHub - * - * @summary List private link resources for the given IotHub - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivatelinkresources.json - */ -async function privateLinkResourcesList(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const resourceGroupName = - process.env["IOTHUB_RESOURCE_GROUP"] || "myResourceGroup"; - const resourceName = "testHub"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.privateLinkResourcesOperations.list( - resourceGroupName, - resourceName - ); - console.log(result); -} - -async function main(): Promise { - privateLinkResourcesList(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/src/resourceProviderCommonGetSubscriptionQuotaSample.ts b/sdk/iothub/arm-iothub/samples/v6/typescript/src/resourceProviderCommonGetSubscriptionQuotaSample.ts deleted file mode 100644 index 45115334e31d..000000000000 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/src/resourceProviderCommonGetSubscriptionQuotaSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { IotHubClient } from "@azure/arm-iothub"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get the number of free and paid iot hubs in the subscription - * - * @summary Get the number of free and paid iot hubs in the subscription - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_usages.json - */ -async function resourceProviderCommonGetSubscriptionQuota(): Promise { - const subscriptionId = - process.env["IOTHUB_SUBSCRIPTION_ID"] || - "91d12660-3dec-467a-be2a-213b5544ddc0"; - const credential = new DefaultAzureCredential(); - const client = new IotHubClient(credential, subscriptionId); - const result = await client.resourceProviderCommon.getSubscriptionQuota(); - console.log(result); -} - -async function main(): Promise { - resourceProviderCommonGetSubscriptionQuota(); -} - -main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/README.md b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/README.md new file mode 100644 index 000000000000..654d556165e0 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/README.md @@ -0,0 +1,124 @@ +# @azure/arm-iothub client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for @azure/arm-iothub in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [certificatesCreateOrUpdateSample.js][certificatescreateorupdatesample] | adds new or replaces existing certificate. x-ms-original-file: 2026-03-01-preview/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json | +| [certificatesDeleteSample.js][certificatesdeletesample] | deletes an existing X509 certificate or does nothing if it does not exist. x-ms-original-file: 2026-03-01-preview/iothub_certificatesdelete.json | +| [certificatesGenerateVerificationCodeSample.js][certificatesgenerateverificationcodesample] | generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. x-ms-original-file: 2026-03-01-preview/iothub_generateverificationcode.json | +| [certificatesGetSample.js][certificatesgetsample] | returns the certificate. x-ms-original-file: 2026-03-01-preview/iothub_getcertificate.json | +| [certificatesListByIotHubSample.js][certificateslistbyiothubsample] | returns the list of certificates. x-ms-original-file: 2026-03-01-preview/iothub_listcertificates.json | +| [certificatesVerifySample.js][certificatesverifysample] | verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: 2026-03-01-preview/iothub_certverify.json | +| [iotHubManualFailoverSample.js][iothubmanualfailoversample] | manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover x-ms-original-file: 2026-03-01-preview/IotHub_ManualFailover.json | +| [iotHubResourceCheckNameAvailabilitySample.js][iothubresourcechecknameavailabilitysample] | check if an IoT hub name is available. x-ms-original-file: 2026-03-01-preview/checkNameAvailability.json | +| [iotHubResourceCreateEventHubConsumerGroupSample.js][iothubresourcecreateeventhubconsumergroupsample] | add a consumer group to an Event Hub-compatible endpoint in an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_createconsumergroup.json | +| [iotHubResourceCreateOrUpdateSample.js][iothubresourcecreateorupdatesample] | create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. x-ms-original-file: 2026-03-01-preview/CreateOrReplace_IoTHub_With_DeviceRegistry.json | +| [iotHubResourceDeleteEventHubConsumerGroupSample.js][iothubresourcedeleteeventhubconsumergroupsample] | delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_deleteconsumergroup.json | +| [iotHubResourceDeleteSample.js][iothubresourcedeletesample] | delete an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_delete.json | +| [iotHubResourceExportDevicesSample.js][iothubresourceexportdevicessample] | exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. x-ms-original-file: 2026-03-01-preview/iothub_exportdevices.json | +| [iotHubResourceGetEventHubConsumerGroupSample.js][iothubresourcegeteventhubconsumergroupsample] | get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_getconsumergroup.json | +| [iotHubResourceGetJobSample.js][iothubresourcegetjobsample] | get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. x-ms-original-file: 2026-03-01-preview/iothub_getjob.json | +| [iotHubResourceGetKeysForKeyNameSample.js][iothubresourcegetkeysforkeynamesample] | get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. x-ms-original-file: 2026-03-01-preview/iothub_getkey.json | +| [iotHubResourceGetSample.js][iothubresourcegetsample] | get the non-security related metadata of an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_get.json | +| [iotHubResourceGetStatsSample.js][iothubresourcegetstatssample] | get the statistics from an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_stats.json | +| [iotHubResourceImportDevicesSample.js][iothubresourceimportdevicessample] | import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. x-ms-original-file: 2026-03-01-preview/iothub_importdevices.json | +| [iotHubResourceListByResourceGroupSample.js][iothubresourcelistbyresourcegroupsample] | get all the IoT hubs in a resource group. x-ms-original-file: 2026-03-01-preview/iothub_listbyrg.json | +| [iotHubResourceListBySubscriptionSample.js][iothubresourcelistbysubscriptionsample] | get all the IoT hubs in a subscription. x-ms-original-file: 2026-03-01-preview/iothub_listbysubscription.json | +| [iotHubResourceListEndpointHealthSample.js][iothubresourcelistendpointhealthsample] | get the health for routing endpoints. x-ms-original-file: 2026-03-01-preview/iothub_routingendpointhealth.json | +| [iotHubResourceListEventHubConsumerGroupsSample.js][iothubresourcelisteventhubconsumergroupssample] | get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_listehgroups.json | +| [iotHubResourceListJobsSample.js][iothubresourcelistjobssample] | get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. x-ms-original-file: 2026-03-01-preview/iothub_listjobs.json | +| [iotHubResourceListKeysSample.js][iothubresourcelistkeyssample] | get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. x-ms-original-file: 2026-03-01-preview/iothub_listkeys.json | +| [iotHubResourceListQuotaMetricsSample.js][iothubresourcelistquotametricssample] | get the quota metrics for an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_quotametrics.json | +| [iotHubResourceListValidSkusSample.js][iothubresourcelistvalidskussample] | get the list of valid SKUs for an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_getskus.json | +| [iotHubResourceTestAllRoutesSample.js][iothubresourcetestallroutessample] | test all routes configured in this Iot Hub x-ms-original-file: 2026-03-01-preview/iothub_testallroutes.json | +| [iotHubResourceTestRouteSample.js][iothubresourcetestroutesample] | test the new route for this Iot Hub x-ms-original-file: 2026-03-01-preview/iothub_testnewroute.json | +| [iotHubResourceUpdateSample.js][iothubresourceupdatesample] | update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method x-ms-original-file: 2026-03-01-preview/iothub_patch.json | +| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2026-03-01-preview/iothub_operations.json | +| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | delete private endpoint connection with the specified name x-ms-original-file: 2026-03-01-preview/iothub_deleteprivateendpointconnection.json | +| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | get private endpoint connection properties x-ms-original-file: 2026-03-01-preview/iothub_getprivateendpointconnection.json | +| [privateEndpointConnectionsListSample.js][privateendpointconnectionslistsample] | list private endpoint connection properties x-ms-original-file: 2026-03-01-preview/iothub_listprivateendpointconnections.json | +| [privateEndpointConnectionsUpdateSample.js][privateendpointconnectionsupdatesample] | update the status of a private endpoint connection with the specified name x-ms-original-file: 2026-03-01-preview/iothub_updateprivateendpointconnection.json | +| [privateLinkResourcesGetSample.js][privatelinkresourcesgetsample] | get the specified private link resource for the given IotHub x-ms-original-file: 2026-03-01-preview/iothub_getprivatelinkresources.json | +| [privateLinkResourcesListSample.js][privatelinkresourceslistsample] | list private link resources for the given IotHub x-ms-original-file: 2026-03-01-preview/iothub_listprivatelinkresources.json | +| [resourceProviderCommonGetSubscriptionQuotaSample.js][resourceprovidercommongetsubscriptionquotasample] | get the number of free and paid iot hubs in the subscription x-ms-original-file: 2026-03-01-preview/iothub_usages.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node certificatesCreateOrUpdateSample.js +``` + +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +node certificatesCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[certificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesCreateOrUpdateSample.js +[certificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesDeleteSample.js +[certificatesgenerateverificationcodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesGenerateVerificationCodeSample.js +[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesGetSample.js +[certificateslistbyiothubsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesListByIotHubSample.js +[certificatesverifysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesVerifySample.js +[iothubmanualfailoversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubManualFailoverSample.js +[iothubresourcechecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCheckNameAvailabilitySample.js +[iothubresourcecreateeventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCreateEventHubConsumerGroupSample.js +[iothubresourcecreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCreateOrUpdateSample.js +[iothubresourcedeleteeventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceDeleteEventHubConsumerGroupSample.js +[iothubresourcedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceDeleteSample.js +[iothubresourceexportdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceExportDevicesSample.js +[iothubresourcegeteventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetEventHubConsumerGroupSample.js +[iothubresourcegetjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetJobSample.js +[iothubresourcegetkeysforkeynamesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetKeysForKeyNameSample.js +[iothubresourcegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetSample.js +[iothubresourcegetstatssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetStatsSample.js +[iothubresourceimportdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceImportDevicesSample.js +[iothubresourcelistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListByResourceGroupSample.js +[iothubresourcelistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListBySubscriptionSample.js +[iothubresourcelistendpointhealthsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListEndpointHealthSample.js +[iothubresourcelisteventhubconsumergroupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListEventHubConsumerGroupsSample.js +[iothubresourcelistjobssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListJobsSample.js +[iothubresourcelistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListKeysSample.js +[iothubresourcelistquotametricssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListQuotaMetricsSample.js +[iothubresourcelistvalidskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListValidSkusSample.js +[iothubresourcetestallroutessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceTestAllRoutesSample.js +[iothubresourcetestroutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceTestRouteSample.js +[iothubresourceupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/operationsListSample.js +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsDeleteSample.js +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsGetSample.js +[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsListSample.js +[privateendpointconnectionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsUpdateSample.js +[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateLinkResourcesGetSample.js +[privatelinkresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateLinkResourcesListSample.js +[resourceprovidercommongetsubscriptionquotasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/javascript/resourceProviderCommonGetSubscriptionQuotaSample.js +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-iothub?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub/README.md diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesCreateOrUpdateSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesCreateOrUpdateSample.js new file mode 100644 index 000000000000..22d8c8b8e93f --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesCreateOrUpdateSample.js @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to adds new or replaces existing certificate. + * + * @summary adds new or replaces existing certificate. + * x-ms-original-file: 2026-03-01-preview/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json + */ +async function createOrReplaceCertificatesWithDeviceRegistryPolicy() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate("myResourceGroup", "testHub", "cert", { + properties: { certificate: "############################################" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to adds new or replaces existing certificate. + * + * @summary adds new or replaces existing certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_certificatescreateorupdate.json + */ +async function certificatesCreateOrUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate("myResourceGroup", "iothub", "cert", { + properties: { certificate: "############################################" }, + }); + console.log(result); +} + +async function main() { + await createOrReplaceCertificatesWithDeviceRegistryPolicy(); + await certificatesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesDeleteSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesDeleteSample.js new file mode 100644 index 000000000000..1c624b00135b --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes an existing X509 certificate or does nothing if it does not exist. + * + * @summary deletes an existing X509 certificate or does nothing if it does not exist. + * x-ms-original-file: 2026-03-01-preview/iothub_certificatesdelete.json + */ +async function certificatesDelete() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + await client.certificates.delete("myResourceGroup", "myhub", "cert", "AAAAAAAADGk="); +} + +async function main() { + await certificatesDelete(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesGenerateVerificationCodeSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesGenerateVerificationCodeSample.js new file mode 100644 index 000000000000..fc4d497abc79 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesGenerateVerificationCodeSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * + * @summary generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_generateverificationcode.json + */ +async function certificatesGenerateVerificationCode() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.generateVerificationCode( + "myResourceGroup", + "testHub", + "cert", + "AAAAAAAADGk=", + ); + console.log(result); +} + +async function main() { + await certificatesGenerateVerificationCode(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesGetSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesGetSample.js new file mode 100644 index 000000000000..bc55d99bf4d1 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to returns the certificate. + * + * @summary returns the certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_getcertificate.json + */ +async function certificatesGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.get("myResourceGroup", "testhub", "cert"); + console.log(result); +} + +async function main() { + await certificatesGet(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesListByIotHubSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesListByIotHubSample.js new file mode 100644 index 000000000000..3fcc2942297f --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesListByIotHubSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to returns the list of certificates. + * + * @summary returns the list of certificates. + * x-ms-original-file: 2026-03-01-preview/iothub_listcertificates.json + */ +async function certificatesListByIotHub() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.listByIotHub("myResourceGroup", "testhub"); + console.log(result); +} + +async function main() { + await certificatesListByIotHub(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesVerifySample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesVerifySample.js new file mode 100644 index 000000000000..70e3a417d5c8 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/certificatesVerifySample.js @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @summary verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_certverify.json + */ +async function certificatesVerify() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.verify( + "myResourceGroup", + "myFirstProvisioningService", + "cert", + "AAAAAAAADGk=", + { certificate: "#####################################" }, + ); + console.log(result); +} + +async function main() { + await certificatesVerify(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubManualFailoverSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubManualFailoverSample.js new file mode 100644 index 000000000000..c0611b12b8c0 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubManualFailoverSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover + * + * @summary manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover + * x-ms-original-file: 2026-03-01-preview/IotHub_ManualFailover.json + */ +async function iotHubManualFailover() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + await client.iotHub.manualFailover("testHub", "myResourceGroup", { failoverRegion: "testHub" }); +} + +async function main() { + await iotHubManualFailover(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCheckNameAvailabilitySample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..2e8ba10829de --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCheckNameAvailabilitySample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to check if an IoT hub name is available. + * + * @summary check if an IoT hub name is available. + * x-ms-original-file: 2026-03-01-preview/checkNameAvailability.json + */ +async function iotHubResourceCheckNameAvailability() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.checkNameAvailability({ name: "test-request" }); + console.log(result); +} + +async function main() { + await iotHubResourceCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCreateEventHubConsumerGroupSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCreateEventHubConsumerGroupSample.js new file mode 100644 index 000000000000..f9c90be58a7d --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCreateEventHubConsumerGroupSample.js @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @summary add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_createconsumergroup.json + */ +async function iotHubResourceCreateEventHubConsumerGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.createEventHubConsumerGroup( + "myResourceGroup", + "testHub", + "events", + "test", + { properties: { name: "test" } }, + ); + console.log(result); +} + +async function main() { + await iotHubResourceCreateEventHubConsumerGroup(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCreateOrUpdateSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCreateOrUpdateSample.js new file mode 100644 index 000000000000..d2c49f6807f7 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceCreateOrUpdateSample.js @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @summary create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * x-ms-original-file: 2026-03-01-preview/CreateOrReplace_IoTHub_With_DeviceRegistry.json + */ +async function createOrReplaceIoTHubWithDeviceRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.createOrUpdate("myResourceGroup", "testHub", { + etag: "AAAAAAFD6M4=", + location: "centraluseuap", + properties: { + cloudToDevice: { + defaultTtlAsIso8601: "PT1H", + feedback: { lockDurationAsIso8601: "PT1M", maxDeliveryCount: 10, ttlAsIso8601: "PT1H" }, + maxDeliveryCount: 10, + }, + deviceRegistry: { + identityResourceId: + "/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testIdentity", + namespaceResourceId: + "/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/namespaces/testNamespace", + }, + enableDataResidency: true, + enableFileUploadNotifications: false, + eventHubEndpoints: { events: { partitionCount: 2, retentionTimeInDays: 1 } }, + features: "None", + ipFilterRules: [], + ipVersion: "ipv4ipv6", + messagingEndpoints: { + fileNotifications: { + lockDurationAsIso8601: "PT1M", + maxDeliveryCount: 10, + ttlAsIso8601: "PT1H", + }, + }, + minTlsVersion: "1.2", + networkRuleSets: { + applyToBuiltInEventHubEndpoint: true, + defaultAction: "Deny", + ipRules: [ + { action: "Allow", filterName: "rule1", ipMask: "131.117.159.53" }, + { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" }, + ], + }, + rootCertificate: { enableRootCertificateV2: true }, + routing: { + endpoints: { + eventHubs: [], + serviceBusQueues: [], + serviceBusTopics: [], + storageContainers: [], + }, + fallbackRoute: { + name: "$fallback", + condition: "true", + endpointNames: ["events"], + isEnabled: true, + source: "DeviceMessages", + }, + routes: [], + }, + storageEndpoints: { + $default: { connectionString: "", containerName: "", sasTtlAsIso8601: "PT1H" }, + }, + }, + sku: { name: "GEN2", capacity: 1 }, + tags: {}, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @summary create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_createOrUpdate.json + */ +async function iotHubResourceCreateOrUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.createOrUpdate("myResourceGroup", "testHub", { + etag: "AAAAAAFD6M4=", + location: "centraluseuap", + properties: { + cloudToDevice: { + defaultTtlAsIso8601: "PT1H", + feedback: { lockDurationAsIso8601: "PT1M", maxDeliveryCount: 10, ttlAsIso8601: "PT1H" }, + maxDeliveryCount: 10, + }, + enableDataResidency: true, + enableFileUploadNotifications: false, + eventHubEndpoints: { events: { partitionCount: 2, retentionTimeInDays: 1 } }, + features: "None", + ipFilterRules: [], + ipVersion: "ipv4ipv6", + messagingEndpoints: { + fileNotifications: { + lockDurationAsIso8601: "PT1M", + maxDeliveryCount: 10, + ttlAsIso8601: "PT1H", + }, + }, + minTlsVersion: "1.2", + networkRuleSets: { + applyToBuiltInEventHubEndpoint: true, + defaultAction: "Deny", + ipRules: [ + { action: "Allow", filterName: "rule1", ipMask: "131.117.159.53" }, + { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" }, + ], + }, + rootCertificate: { enableRootCertificateV2: true }, + routing: { + endpoints: { + eventHubs: [], + serviceBusQueues: [], + serviceBusTopics: [], + storageContainers: [], + }, + fallbackRoute: { + name: "$fallback", + condition: "true", + endpointNames: ["events"], + isEnabled: true, + source: "DeviceMessages", + }, + routes: [], + }, + storageEndpoints: { + $default: { connectionString: "", containerName: "", sasTtlAsIso8601: "PT1H" }, + }, + }, + sku: { name: "S1", capacity: 1 }, + tags: {}, + }); + console.log(result); +} + +async function main() { + await createOrReplaceIoTHubWithDeviceRegistry(); + await iotHubResourceCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceDeleteEventHubConsumerGroupSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceDeleteEventHubConsumerGroupSample.js new file mode 100644 index 000000000000..e42a63a0f7e6 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceDeleteEventHubConsumerGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @summary delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_deleteconsumergroup.json + */ +async function iotHubResourceDeleteEventHubConsumerGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + await client.iotHubResource.deleteEventHubConsumerGroup( + "myResourceGroup", + "testHub", + "events", + "test", + ); +} + +async function main() { + await iotHubResourceDeleteEventHubConsumerGroup(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceDeleteSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceDeleteSample.js new file mode 100644 index 000000000000..86a1455b016d --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceDeleteSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete an IoT hub. + * + * @summary delete an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_delete.json + */ +async function iotHubResourceDelete() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.delete("myResourceGroup", "testHub"); + console.log(result); +} + +async function main() { + await iotHubResourceDelete(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceExportDevicesSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceExportDevicesSample.js new file mode 100644 index 000000000000..7d0c341aa93b --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceExportDevicesSample.js @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @summary exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * x-ms-original-file: 2026-03-01-preview/iothub_exportdevices.json + */ +async function iotHubResourceExportDevices() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.exportDevices("myResourceGroup", "testHub", { + authenticationType: "identityBased", + excludeKeys: true, + exportBlobContainerUri: "testBlob", + identity: { + userAssignedIdentity: + "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + }, + }); + console.log(result); +} + +async function main() { + await iotHubResourceExportDevices(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetEventHubConsumerGroupSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetEventHubConsumerGroupSample.js new file mode 100644 index 000000000000..0d0193bb6825 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetEventHubConsumerGroupSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @summary get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_getconsumergroup.json + */ +async function iotHubResourceListEventHubConsumerGroups() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.getEventHubConsumerGroup( + "myResourceGroup", + "testHub", + "events", + "test", + ); + console.log(result); +} + +async function main() { + await iotHubResourceListEventHubConsumerGroups(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetJobSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetJobSample.js new file mode 100644 index 000000000000..f0e4a47351a5 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetJobSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @summary get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * x-ms-original-file: 2026-03-01-preview/iothub_getjob.json + */ +async function iotHubResourceGetJob() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.getJob("myResourceGroup", "testHub", "test"); + console.log(result); +} + +async function main() { + await iotHubResourceGetJob(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetKeysForKeyNameSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetKeysForKeyNameSample.js new file mode 100644 index 000000000000..465b662d52df --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetKeysForKeyNameSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @summary get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * x-ms-original-file: 2026-03-01-preview/iothub_getkey.json + */ +async function iotHubResourceGetKeysForKeyName() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.getKeysForKeyName( + "myResourceGroup", + "testHub", + "iothubowner", + ); + console.log(result); +} + +async function main() { + await iotHubResourceGetKeysForKeyName(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetSample.js new file mode 100644 index 000000000000..f9fd04e6ccaf --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the non-security related metadata of an IoT hub. + * + * @summary get the non-security related metadata of an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_get.json + */ +async function iotHubResourceGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.get("myResourceGroup", "testHub"); + console.log(result); +} + +async function main() { + await iotHubResourceGet(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetStatsSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetStatsSample.js new file mode 100644 index 000000000000..8cdf9fdd37b3 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceGetStatsSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the statistics from an IoT hub. + * + * @summary get the statistics from an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_stats.json + */ +async function iotHubResourceGetStats() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.getStats("myResourceGroup", "testHub"); + console.log(result); +} + +async function main() { + await iotHubResourceGetStats(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceImportDevicesSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceImportDevicesSample.js new file mode 100644 index 000000000000..aa152193501a --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceImportDevicesSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @summary import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * x-ms-original-file: 2026-03-01-preview/iothub_importdevices.json + */ +async function iotHubResourceImportDevices() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.importDevices("myResourceGroup", "testHub", { + inputBlobContainerUri: "testBlob", + outputBlobContainerUri: "testBlob", + }); + console.log(result); +} + +async function main() { + await iotHubResourceImportDevices(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListByResourceGroupSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListByResourceGroupSample.js new file mode 100644 index 000000000000..a93fc6e0adce --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get all the IoT hubs in a resource group. + * + * @summary get all the IoT hubs in a resource group. + * x-ms-original-file: 2026-03-01-preview/iothub_listbyrg.json + */ +async function iotHubResourceListByResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await iotHubResourceListByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListBySubscriptionSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListBySubscriptionSample.js new file mode 100644 index 000000000000..39d906d6ba27 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListBySubscriptionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get all the IoT hubs in a subscription. + * + * @summary get all the IoT hubs in a subscription. + * x-ms-original-file: 2026-03-01-preview/iothub_listbysubscription.json + */ +async function iotHubResourceListBySubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await iotHubResourceListBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListEndpointHealthSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListEndpointHealthSample.js new file mode 100644 index 000000000000..e815dfddc91a --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListEndpointHealthSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the health for routing endpoints. + * + * @summary get the health for routing endpoints. + * x-ms-original-file: 2026-03-01-preview/iothub_routingendpointhealth.json + */ +async function iotHubResourceGetEndpointHealth() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listEndpointHealth("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await iotHubResourceGetEndpointHealth(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListEventHubConsumerGroupsSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListEventHubConsumerGroupsSample.js new file mode 100644 index 000000000000..fbf1c9c2e75a --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListEventHubConsumerGroupsSample.js @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @summary get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_listehgroups.json + */ +async function iotHubResourceListEventHubConsumerGroups() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listEventHubConsumerGroups( + "myResourceGroup", + "testHub", + "events", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await iotHubResourceListEventHubConsumerGroups(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListJobsSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListJobsSample.js new file mode 100644 index 000000000000..46ffe737d7ca --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListJobsSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @summary get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * x-ms-original-file: 2026-03-01-preview/iothub_listjobs.json + */ +async function iotHubResourceListJobs() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listJobs("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await iotHubResourceListJobs(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListKeysSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListKeysSample.js new file mode 100644 index 000000000000..ebef1902d377 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListKeysSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @summary get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * x-ms-original-file: 2026-03-01-preview/iothub_listkeys.json + */ +async function iotHubResourceListKeys() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listKeys("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await iotHubResourceListKeys(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListQuotaMetricsSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListQuotaMetricsSample.js new file mode 100644 index 000000000000..e270c83de5b6 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListQuotaMetricsSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the quota metrics for an IoT hub. + * + * @summary get the quota metrics for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_quotametrics.json + */ +async function iotHubResourceGetQuotaMetrics() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listQuotaMetrics("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await iotHubResourceGetQuotaMetrics(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListValidSkusSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListValidSkusSample.js new file mode 100644 index 000000000000..ad0693046490 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceListValidSkusSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the list of valid SKUs for an IoT hub. + * + * @summary get the list of valid SKUs for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_getskus.json + */ +async function iotHubResourceGetValidSkus() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listValidSkus("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await iotHubResourceGetValidSkus(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceTestAllRoutesSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceTestAllRoutesSample.js new file mode 100644 index 000000000000..25fc6d912005 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceTestAllRoutesSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to test all routes configured in this Iot Hub + * + * @summary test all routes configured in this Iot Hub + * x-ms-original-file: 2026-03-01-preview/iothub_testallroutes.json + */ +async function iotHubResourceTestAllRoutes() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.testAllRoutes("testHub", "myResourceGroup", { + message: { + appProperties: { key1: "value1" }, + body: "Body of message", + systemProperties: { key1: "value1" }, + }, + routingSource: "DeviceMessages", + }); + console.log(result); +} + +async function main() { + await iotHubResourceTestAllRoutes(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceTestRouteSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceTestRouteSample.js new file mode 100644 index 000000000000..6232e2ad785c --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceTestRouteSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to test the new route for this Iot Hub + * + * @summary test the new route for this Iot Hub + * x-ms-original-file: 2026-03-01-preview/iothub_testnewroute.json + */ +async function iotHubResourceTestRoute() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.testRoute("testHub", "myResourceGroup", { + message: { + appProperties: { key1: "value1" }, + body: "Body of message", + systemProperties: { key1: "value1" }, + }, + route: { name: "Routeid", endpointNames: ["id1"], isEnabled: true, source: "DeviceMessages" }, + }); + console.log(result); +} + +async function main() { + await iotHubResourceTestRoute(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceUpdateSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceUpdateSample.js new file mode 100644 index 000000000000..3b488ed89c67 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/iotHubResourceUpdateSample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method + * + * @summary update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method + * x-ms-original-file: 2026-03-01-preview/iothub_patch.json + */ +async function iotHubResourceUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.update("myResourceGroup", "myHub", { + tags: { foo: "bar" }, + }); + console.log(result); +} + +async function main() { + await iotHubResourceUpdate(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/operationsListSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..e5f7a567d415 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/operationsListSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2026-03-01-preview/iothub_operations.json + */ +async function operationsList() { + const credential = new DefaultAzureCredential(); + const client = new IotHubClient(credential); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await operationsList(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/javascript/package.json b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/package.json similarity index 69% rename from sdk/iothub/arm-iothub/samples/v6/javascript/package.json rename to sdk/iothub/arm-iothub/samples/v7-beta/javascript/package.json index 682f4891a61e..7f6846aef0b8 100644 --- a/sdk/iothub/arm-iothub/samples/v6/javascript/package.json +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/arm-iothub-js", + "name": "@azure-samples/arm-iothub-js-beta", "private": true, "version": "1.0.0", - "description": " client library samples for JavaScript", + "description": "@azure/arm-iothub client library samples for JavaScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -14,6 +14,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -25,8 +26,11 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub", "dependencies": { - "@azure/arm-iothub": "latest", + "@azure/arm-iothub": "beta", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "cross-env": "latest" } } diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsDeleteSample.js new file mode 100644 index 000000000000..3bb0cdbf013d --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsDeleteSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete private endpoint connection with the specified name + * + * @summary delete private endpoint connection with the specified name + * x-ms-original-file: 2026-03-01-preview/iothub_deleteprivateendpointconnection.json + */ +async function privateEndpointConnectionDelete() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.delete( + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", + ); + console.log(result); +} + +async function main() { + await privateEndpointConnectionDelete(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsGetSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsGetSample.js new file mode 100644 index 000000000000..65dda2e72325 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsGetSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get private endpoint connection properties + * + * @summary get private endpoint connection properties + * x-ms-original-file: 2026-03-01-preview/iothub_getprivateendpointconnection.json + */ +async function privateEndpointConnectionGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", + ); + console.log(result); +} + +async function main() { + await privateEndpointConnectionGet(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsListSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsListSample.js new file mode 100644 index 000000000000..3b01efb48b89 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsListSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list private endpoint connection properties + * + * @summary list private endpoint connection properties + * x-ms-original-file: 2026-03-01-preview/iothub_listprivateendpointconnections.json + */ +async function privateEndpointConnectionsList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.list("myResourceGroup", "testHub"); + console.log(result); +} + +async function main() { + await privateEndpointConnectionsList(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsUpdateSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsUpdateSample.js new file mode 100644 index 000000000000..65f9900077d5 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateEndpointConnectionsUpdateSample.js @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to update the status of a private endpoint connection with the specified name + * + * @summary update the status of a private endpoint connection with the specified name + * x-ms-original-file: 2026-03-01-preview/iothub_updateprivateendpointconnection.json + */ +async function privateEndpointConnectionUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.update( + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", + { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved", + }, + }, + }, + ); + console.log(result); +} + +async function main() { + await privateEndpointConnectionUpdate(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateLinkResourcesGetSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateLinkResourcesGetSample.js new file mode 100644 index 000000000000..35eff3f5d324 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateLinkResourcesGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the specified private link resource for the given IotHub + * + * @summary get the specified private link resource for the given IotHub + * x-ms-original-file: 2026-03-01-preview/iothub_getprivatelinkresources.json + */ +async function privateLinkResourcesList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateLinkResources.get("myResourceGroup", "testHub", "iotHub"); + console.log(result); +} + +async function main() { + await privateLinkResourcesList(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateLinkResourcesListSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateLinkResourcesListSample.js new file mode 100644 index 000000000000..e96f1b8be760 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/privateLinkResourcesListSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list private link resources for the given IotHub + * + * @summary list private link resources for the given IotHub + * x-ms-original-file: 2026-03-01-preview/iothub_listprivatelinkresources.json + */ +async function privateLinkResourcesList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateLinkResources.list("myResourceGroup", "testHub"); + console.log(result); +} + +async function main() { + await privateLinkResourcesList(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/resourceProviderCommonGetSubscriptionQuotaSample.js b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/resourceProviderCommonGetSubscriptionQuotaSample.js new file mode 100644 index 000000000000..6a101d6dbcc8 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/resourceProviderCommonGetSubscriptionQuotaSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { IotHubClient } = require("@azure/arm-iothub"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get the number of free and paid iot hubs in the subscription + * + * @summary get the number of free and paid iot hubs in the subscription + * x-ms-original-file: 2026-03-01-preview/iothub_usages.json + */ +async function resourceProviderCommonGetSubscriptionQuota() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.resourceProviderCommon.getSubscriptionQuota(); + console.log(result); +} + +async function main() { + await resourceProviderCommonGetSubscriptionQuota(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/javascript/sample.env b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/javascript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/README.md b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/README.md new file mode 100644 index 000000000000..4ca30775f7b1 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/README.md @@ -0,0 +1,137 @@ +# @azure/arm-iothub client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for @azure/arm-iothub in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [certificatesCreateOrUpdateSample.ts][certificatescreateorupdatesample] | adds new or replaces existing certificate. x-ms-original-file: 2026-03-01-preview/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json | +| [certificatesDeleteSample.ts][certificatesdeletesample] | deletes an existing X509 certificate or does nothing if it does not exist. x-ms-original-file: 2026-03-01-preview/iothub_certificatesdelete.json | +| [certificatesGenerateVerificationCodeSample.ts][certificatesgenerateverificationcodesample] | generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. x-ms-original-file: 2026-03-01-preview/iothub_generateverificationcode.json | +| [certificatesGetSample.ts][certificatesgetsample] | returns the certificate. x-ms-original-file: 2026-03-01-preview/iothub_getcertificate.json | +| [certificatesListByIotHubSample.ts][certificateslistbyiothubsample] | returns the list of certificates. x-ms-original-file: 2026-03-01-preview/iothub_listcertificates.json | +| [certificatesVerifySample.ts][certificatesverifysample] | verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. x-ms-original-file: 2026-03-01-preview/iothub_certverify.json | +| [iotHubManualFailoverSample.ts][iothubmanualfailoversample] | manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover x-ms-original-file: 2026-03-01-preview/IotHub_ManualFailover.json | +| [iotHubResourceCheckNameAvailabilitySample.ts][iothubresourcechecknameavailabilitysample] | check if an IoT hub name is available. x-ms-original-file: 2026-03-01-preview/checkNameAvailability.json | +| [iotHubResourceCreateEventHubConsumerGroupSample.ts][iothubresourcecreateeventhubconsumergroupsample] | add a consumer group to an Event Hub-compatible endpoint in an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_createconsumergroup.json | +| [iotHubResourceCreateOrUpdateSample.ts][iothubresourcecreateorupdatesample] | create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. x-ms-original-file: 2026-03-01-preview/CreateOrReplace_IoTHub_With_DeviceRegistry.json | +| [iotHubResourceDeleteEventHubConsumerGroupSample.ts][iothubresourcedeleteeventhubconsumergroupsample] | delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_deleteconsumergroup.json | +| [iotHubResourceDeleteSample.ts][iothubresourcedeletesample] | delete an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_delete.json | +| [iotHubResourceExportDevicesSample.ts][iothubresourceexportdevicessample] | exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. x-ms-original-file: 2026-03-01-preview/iothub_exportdevices.json | +| [iotHubResourceGetEventHubConsumerGroupSample.ts][iothubresourcegeteventhubconsumergroupsample] | get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_getconsumergroup.json | +| [iotHubResourceGetJobSample.ts][iothubresourcegetjobsample] | get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. x-ms-original-file: 2026-03-01-preview/iothub_getjob.json | +| [iotHubResourceGetKeysForKeyNameSample.ts][iothubresourcegetkeysforkeynamesample] | get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. x-ms-original-file: 2026-03-01-preview/iothub_getkey.json | +| [iotHubResourceGetSample.ts][iothubresourcegetsample] | get the non-security related metadata of an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_get.json | +| [iotHubResourceGetStatsSample.ts][iothubresourcegetstatssample] | get the statistics from an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_stats.json | +| [iotHubResourceImportDevicesSample.ts][iothubresourceimportdevicessample] | import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. x-ms-original-file: 2026-03-01-preview/iothub_importdevices.json | +| [iotHubResourceListByResourceGroupSample.ts][iothubresourcelistbyresourcegroupsample] | get all the IoT hubs in a resource group. x-ms-original-file: 2026-03-01-preview/iothub_listbyrg.json | +| [iotHubResourceListBySubscriptionSample.ts][iothubresourcelistbysubscriptionsample] | get all the IoT hubs in a subscription. x-ms-original-file: 2026-03-01-preview/iothub_listbysubscription.json | +| [iotHubResourceListEndpointHealthSample.ts][iothubresourcelistendpointhealthsample] | get the health for routing endpoints. x-ms-original-file: 2026-03-01-preview/iothub_routingendpointhealth.json | +| [iotHubResourceListEventHubConsumerGroupsSample.ts][iothubresourcelisteventhubconsumergroupssample] | get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_listehgroups.json | +| [iotHubResourceListJobsSample.ts][iothubresourcelistjobssample] | get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. x-ms-original-file: 2026-03-01-preview/iothub_listjobs.json | +| [iotHubResourceListKeysSample.ts][iothubresourcelistkeyssample] | get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. x-ms-original-file: 2026-03-01-preview/iothub_listkeys.json | +| [iotHubResourceListQuotaMetricsSample.ts][iothubresourcelistquotametricssample] | get the quota metrics for an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_quotametrics.json | +| [iotHubResourceListValidSkusSample.ts][iothubresourcelistvalidskussample] | get the list of valid SKUs for an IoT hub. x-ms-original-file: 2026-03-01-preview/iothub_getskus.json | +| [iotHubResourceTestAllRoutesSample.ts][iothubresourcetestallroutessample] | test all routes configured in this Iot Hub x-ms-original-file: 2026-03-01-preview/iothub_testallroutes.json | +| [iotHubResourceTestRouteSample.ts][iothubresourcetestroutesample] | test the new route for this Iot Hub x-ms-original-file: 2026-03-01-preview/iothub_testnewroute.json | +| [iotHubResourceUpdateSample.ts][iothubresourceupdatesample] | update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method x-ms-original-file: 2026-03-01-preview/iothub_patch.json | +| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2026-03-01-preview/iothub_operations.json | +| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | delete private endpoint connection with the specified name x-ms-original-file: 2026-03-01-preview/iothub_deleteprivateendpointconnection.json | +| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | get private endpoint connection properties x-ms-original-file: 2026-03-01-preview/iothub_getprivateendpointconnection.json | +| [privateEndpointConnectionsListSample.ts][privateendpointconnectionslistsample] | list private endpoint connection properties x-ms-original-file: 2026-03-01-preview/iothub_listprivateendpointconnections.json | +| [privateEndpointConnectionsUpdateSample.ts][privateendpointconnectionsupdatesample] | update the status of a private endpoint connection with the specified name x-ms-original-file: 2026-03-01-preview/iothub_updateprivateendpointconnection.json | +| [privateLinkResourcesGetSample.ts][privatelinkresourcesgetsample] | get the specified private link resource for the given IotHub x-ms-original-file: 2026-03-01-preview/iothub_getprivatelinkresources.json | +| [privateLinkResourcesListSample.ts][privatelinkresourceslistsample] | list private link resources for the given IotHub x-ms-original-file: 2026-03-01-preview/iothub_listprivatelinkresources.json | +| [resourceProviderCommonGetSubscriptionQuotaSample.ts][resourceprovidercommongetsubscriptionquotasample] | get the number of free and paid iot hubs in the subscription x-ms-original-file: 2026-03-01-preview/iothub_usages.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/certificatesCreateOrUpdateSample.js +``` + +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +node dist/certificatesCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[certificatescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesCreateOrUpdateSample.ts +[certificatesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesDeleteSample.ts +[certificatesgenerateverificationcodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesGenerateVerificationCodeSample.ts +[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesGetSample.ts +[certificateslistbyiothubsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesListByIotHubSample.ts +[certificatesverifysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesVerifySample.ts +[iothubmanualfailoversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubManualFailoverSample.ts +[iothubresourcechecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCheckNameAvailabilitySample.ts +[iothubresourcecreateeventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCreateEventHubConsumerGroupSample.ts +[iothubresourcecreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCreateOrUpdateSample.ts +[iothubresourcedeleteeventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceDeleteEventHubConsumerGroupSample.ts +[iothubresourcedeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceDeleteSample.ts +[iothubresourceexportdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceExportDevicesSample.ts +[iothubresourcegeteventhubconsumergroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetEventHubConsumerGroupSample.ts +[iothubresourcegetjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetJobSample.ts +[iothubresourcegetkeysforkeynamesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetKeysForKeyNameSample.ts +[iothubresourcegetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetSample.ts +[iothubresourcegetstatssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetStatsSample.ts +[iothubresourceimportdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceImportDevicesSample.ts +[iothubresourcelistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListByResourceGroupSample.ts +[iothubresourcelistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListBySubscriptionSample.ts +[iothubresourcelistendpointhealthsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListEndpointHealthSample.ts +[iothubresourcelisteventhubconsumergroupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListEventHubConsumerGroupsSample.ts +[iothubresourcelistjobssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListJobsSample.ts +[iothubresourcelistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListKeysSample.ts +[iothubresourcelistquotametricssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListQuotaMetricsSample.ts +[iothubresourcelistvalidskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListValidSkusSample.ts +[iothubresourcetestallroutessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceTestAllRoutesSample.ts +[iothubresourcetestroutesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceTestRouteSample.ts +[iothubresourceupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/operationsListSample.ts +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsGetSample.ts +[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsListSample.ts +[privateendpointconnectionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsUpdateSample.ts +[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateLinkResourcesGetSample.ts +[privatelinkresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateLinkResourcesListSample.ts +[resourceprovidercommongetsubscriptionquotasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/resourceProviderCommonGetSubscriptionQuotaSample.ts +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-iothub?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/package.json b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/package.json similarity index 71% rename from sdk/iothub/arm-iothub/samples/v6/typescript/package.json rename to sdk/iothub/arm-iothub/samples/v7-beta/typescript/package.json index ae3c60f16e81..1e1b89f3e2f5 100644 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/package.json +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/arm-iothub-ts", + "name": "@azure-samples/arm-iothub-ts-beta", "private": true, "version": "1.0.0", - "description": " client library samples for TypeScript", + "description": "@azure/arm-iothub client library samples for TypeScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -18,6 +18,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -29,13 +30,14 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub", "dependencies": { - "@azure/arm-iothub": "latest", + "@azure/arm-iothub": "beta", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.13.0" }, "devDependencies": { "@types/node": "^20.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" + "cross-env": "latest", + "rimraf": "latest", + "typescript": "~6.0.2" } } diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/sample.env b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesCreateOrUpdateSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..7979e61ff310 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesCreateOrUpdateSample.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to adds new or replaces existing certificate. + * + * @summary adds new or replaces existing certificate. + * x-ms-original-file: 2026-03-01-preview/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json + */ +async function createOrReplaceCertificatesWithDeviceRegistryPolicy(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate("myResourceGroup", "testHub", "cert", { + properties: { certificate: "############################################" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to adds new or replaces existing certificate. + * + * @summary adds new or replaces existing certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_certificatescreateorupdate.json + */ +async function certificatesCreateOrUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.createOrUpdate("myResourceGroup", "iothub", "cert", { + properties: { certificate: "############################################" }, + }); + console.log(result); +} + +async function main(): Promise { + await createOrReplaceCertificatesWithDeviceRegistryPolicy(); + await certificatesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesDeleteSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesDeleteSample.ts new file mode 100644 index 000000000000..98f2769cd852 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes an existing X509 certificate or does nothing if it does not exist. + * + * @summary deletes an existing X509 certificate or does nothing if it does not exist. + * x-ms-original-file: 2026-03-01-preview/iothub_certificatesdelete.json + */ +async function certificatesDelete(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + await client.certificates.delete("myResourceGroup", "myhub", "cert", "AAAAAAAADGk="); +} + +async function main(): Promise { + await certificatesDelete(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesGenerateVerificationCodeSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesGenerateVerificationCodeSample.ts new file mode 100644 index 000000000000..f90c086a00ac --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesGenerateVerificationCodeSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * + * @summary generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_generateverificationcode.json + */ +async function certificatesGenerateVerificationCode(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.generateVerificationCode( + "myResourceGroup", + "testHub", + "cert", + "AAAAAAAADGk=", + ); + console.log(result); +} + +async function main(): Promise { + await certificatesGenerateVerificationCode(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesGetSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesGetSample.ts new file mode 100644 index 000000000000..8583cf4043e2 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to returns the certificate. + * + * @summary returns the certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_getcertificate.json + */ +async function certificatesGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.get("myResourceGroup", "testhub", "cert"); + console.log(result); +} + +async function main(): Promise { + await certificatesGet(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesListByIotHubSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesListByIotHubSample.ts new file mode 100644 index 000000000000..41814b84df62 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesListByIotHubSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to returns the list of certificates. + * + * @summary returns the list of certificates. + * x-ms-original-file: 2026-03-01-preview/iothub_listcertificates.json + */ +async function certificatesListByIotHub(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.listByIotHub("myResourceGroup", "testhub"); + console.log(result); +} + +async function main(): Promise { + await certificatesListByIotHub(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesVerifySample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesVerifySample.ts new file mode 100644 index 000000000000..a9268dd5257f --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/certificatesVerifySample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * + * @summary verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. + * x-ms-original-file: 2026-03-01-preview/iothub_certverify.json + */ +async function certificatesVerify(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.certificates.verify( + "myResourceGroup", + "myFirstProvisioningService", + "cert", + "AAAAAAAADGk=", + { certificate: "#####################################" }, + ); + console.log(result); +} + +async function main(): Promise { + await certificatesVerify(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubManualFailoverSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubManualFailoverSample.ts new file mode 100644 index 000000000000..b242910777df --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubManualFailoverSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover + * + * @summary manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover + * x-ms-original-file: 2026-03-01-preview/IotHub_ManualFailover.json + */ +async function iotHubManualFailover(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + await client.iotHub.manualFailover("testHub", "myResourceGroup", { failoverRegion: "testHub" }); +} + +async function main(): Promise { + await iotHubManualFailover(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCheckNameAvailabilitySample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..99acc6b77658 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCheckNameAvailabilitySample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to check if an IoT hub name is available. + * + * @summary check if an IoT hub name is available. + * x-ms-original-file: 2026-03-01-preview/checkNameAvailability.json + */ +async function iotHubResourceCheckNameAvailability(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.checkNameAvailability({ name: "test-request" }); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCreateEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCreateEventHubConsumerGroupSample.ts new file mode 100644 index 000000000000..cc4c8fa2f913 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCreateEventHubConsumerGroupSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * + * @summary add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_createconsumergroup.json + */ +async function iotHubResourceCreateEventHubConsumerGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.createEventHubConsumerGroup( + "myResourceGroup", + "testHub", + "events", + "test", + { properties: { name: "test" } }, + ); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceCreateEventHubConsumerGroup(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCreateOrUpdateSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCreateOrUpdateSample.ts new file mode 100644 index 000000000000..920bacb94601 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceCreateOrUpdateSample.ts @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @summary create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * x-ms-original-file: 2026-03-01-preview/CreateOrReplace_IoTHub_With_DeviceRegistry.json + */ +async function createOrReplaceIoTHubWithDeviceRegistry(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.createOrUpdate("myResourceGroup", "testHub", { + etag: "AAAAAAFD6M4=", + location: "centraluseuap", + properties: { + cloudToDevice: { + defaultTtlAsIso8601: "PT1H", + feedback: { lockDurationAsIso8601: "PT1M", maxDeliveryCount: 10, ttlAsIso8601: "PT1H" }, + maxDeliveryCount: 10, + }, + deviceRegistry: { + identityResourceId: + "/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testIdentity", + namespaceResourceId: + "/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/namespaces/testNamespace", + }, + enableDataResidency: true, + enableFileUploadNotifications: false, + eventHubEndpoints: { events: { partitionCount: 2, retentionTimeInDays: 1 } }, + features: "None", + ipFilterRules: [], + ipVersion: "ipv4ipv6", + messagingEndpoints: { + fileNotifications: { + lockDurationAsIso8601: "PT1M", + maxDeliveryCount: 10, + ttlAsIso8601: "PT1H", + }, + }, + minTlsVersion: "1.2", + networkRuleSets: { + applyToBuiltInEventHubEndpoint: true, + defaultAction: "Deny", + ipRules: [ + { action: "Allow", filterName: "rule1", ipMask: "131.117.159.53" }, + { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" }, + ], + }, + rootCertificate: { enableRootCertificateV2: true }, + routing: { + endpoints: { + eventHubs: [], + serviceBusQueues: [], + serviceBusTopics: [], + storageContainers: [], + }, + fallbackRoute: { + name: "$fallback", + condition: "true", + endpointNames: ["events"], + isEnabled: true, + source: "DeviceMessages", + }, + routes: [], + }, + storageEndpoints: { + $default: { connectionString: "", containerName: "", sasTtlAsIso8601: "PT1H" }, + }, + }, + sku: { name: "GEN2", capacity: 1 }, + tags: {}, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * + * @summary create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_createOrUpdate.json + */ +async function iotHubResourceCreateOrUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.createOrUpdate("myResourceGroup", "testHub", { + etag: "AAAAAAFD6M4=", + location: "centraluseuap", + properties: { + cloudToDevice: { + defaultTtlAsIso8601: "PT1H", + feedback: { lockDurationAsIso8601: "PT1M", maxDeliveryCount: 10, ttlAsIso8601: "PT1H" }, + maxDeliveryCount: 10, + }, + enableDataResidency: true, + enableFileUploadNotifications: false, + eventHubEndpoints: { events: { partitionCount: 2, retentionTimeInDays: 1 } }, + features: "None", + ipFilterRules: [], + ipVersion: "ipv4ipv6", + messagingEndpoints: { + fileNotifications: { + lockDurationAsIso8601: "PT1M", + maxDeliveryCount: 10, + ttlAsIso8601: "PT1H", + }, + }, + minTlsVersion: "1.2", + networkRuleSets: { + applyToBuiltInEventHubEndpoint: true, + defaultAction: "Deny", + ipRules: [ + { action: "Allow", filterName: "rule1", ipMask: "131.117.159.53" }, + { action: "Allow", filterName: "rule2", ipMask: "157.55.59.128/25" }, + ], + }, + rootCertificate: { enableRootCertificateV2: true }, + routing: { + endpoints: { + eventHubs: [], + serviceBusQueues: [], + serviceBusTopics: [], + storageContainers: [], + }, + fallbackRoute: { + name: "$fallback", + condition: "true", + endpointNames: ["events"], + isEnabled: true, + source: "DeviceMessages", + }, + routes: [], + }, + storageEndpoints: { + $default: { connectionString: "", containerName: "", sasTtlAsIso8601: "PT1H" }, + }, + }, + sku: { name: "S1", capacity: 1 }, + tags: {}, + }); + console.log(result); +} + +async function main(): Promise { + await createOrReplaceIoTHubWithDeviceRegistry(); + await iotHubResourceCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceDeleteEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceDeleteEventHubConsumerGroupSample.ts new file mode 100644 index 000000000000..fd89d64a4383 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceDeleteEventHubConsumerGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @summary delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_deleteconsumergroup.json + */ +async function iotHubResourceDeleteEventHubConsumerGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + await client.iotHubResource.deleteEventHubConsumerGroup( + "myResourceGroup", + "testHub", + "events", + "test", + ); +} + +async function main(): Promise { + await iotHubResourceDeleteEventHubConsumerGroup(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceDeleteSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceDeleteSample.ts new file mode 100644 index 000000000000..d8bcd903165f --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceDeleteSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete an IoT hub. + * + * @summary delete an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_delete.json + */ +async function iotHubResourceDelete(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.delete("myResourceGroup", "testHub"); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceDelete(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceExportDevicesSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceExportDevicesSample.ts new file mode 100644 index 000000000000..5fb8df10ec24 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceExportDevicesSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @summary exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * x-ms-original-file: 2026-03-01-preview/iothub_exportdevices.json + */ +async function iotHubResourceExportDevices(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.exportDevices("myResourceGroup", "testHub", { + authenticationType: "identityBased", + excludeKeys: true, + exportBlobContainerUri: "testBlob", + identity: { + userAssignedIdentity: + "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + }, + }); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceExportDevices(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetEventHubConsumerGroupSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetEventHubConsumerGroupSample.ts new file mode 100644 index 000000000000..f8aaf962dff4 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetEventHubConsumerGroupSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @summary get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_getconsumergroup.json + */ +async function iotHubResourceListEventHubConsumerGroups(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.getEventHubConsumerGroup( + "myResourceGroup", + "testHub", + "events", + "test", + ); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceListEventHubConsumerGroups(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetJobSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetJobSample.ts new file mode 100644 index 000000000000..26ae654203b0 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetJobSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @summary get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * x-ms-original-file: 2026-03-01-preview/iothub_getjob.json + */ +async function iotHubResourceGetJob(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.getJob("myResourceGroup", "testHub", "test"); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceGetJob(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetKeysForKeyNameSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetKeysForKeyNameSample.ts new file mode 100644 index 000000000000..9d252446d98e --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetKeysForKeyNameSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @summary get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * x-ms-original-file: 2026-03-01-preview/iothub_getkey.json + */ +async function iotHubResourceGetKeysForKeyName(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.getKeysForKeyName( + "myResourceGroup", + "testHub", + "iothubowner", + ); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceGetKeysForKeyName(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetSample.ts new file mode 100644 index 000000000000..e1a005b004c2 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the non-security related metadata of an IoT hub. + * + * @summary get the non-security related metadata of an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_get.json + */ +async function iotHubResourceGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.get("myResourceGroup", "testHub"); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceGet(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetStatsSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetStatsSample.ts new file mode 100644 index 000000000000..cc5c48e33fd7 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceGetStatsSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the statistics from an IoT hub. + * + * @summary get the statistics from an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_stats.json + */ +async function iotHubResourceGetStats(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.getStats("myResourceGroup", "testHub"); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceGetStats(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceImportDevicesSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceImportDevicesSample.ts new file mode 100644 index 000000000000..f2a1c5d16e99 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceImportDevicesSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * + * @summary import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + * x-ms-original-file: 2026-03-01-preview/iothub_importdevices.json + */ +async function iotHubResourceImportDevices(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.importDevices("myResourceGroup", "testHub", { + inputBlobContainerUri: "testBlob", + outputBlobContainerUri: "testBlob", + }); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceImportDevices(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListByResourceGroupSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListByResourceGroupSample.ts new file mode 100644 index 000000000000..5b1da5d4101e --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get all the IoT hubs in a resource group. + * + * @summary get all the IoT hubs in a resource group. + * x-ms-original-file: 2026-03-01-preview/iothub_listbyrg.json + */ +async function iotHubResourceListByResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceListByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListBySubscriptionSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListBySubscriptionSample.ts new file mode 100644 index 000000000000..4170691ca80a --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get all the IoT hubs in a subscription. + * + * @summary get all the IoT hubs in a subscription. + * x-ms-original-file: 2026-03-01-preview/iothub_listbysubscription.json + */ +async function iotHubResourceListBySubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceListBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListEndpointHealthSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListEndpointHealthSample.ts new file mode 100644 index 000000000000..1f3c8bf2ec15 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListEndpointHealthSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the health for routing endpoints. + * + * @summary get the health for routing endpoints. + * x-ms-original-file: 2026-03-01-preview/iothub_routingendpointhealth.json + */ +async function iotHubResourceGetEndpointHealth(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listEndpointHealth("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceGetEndpointHealth(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListEventHubConsumerGroupsSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListEventHubConsumerGroupsSample.ts new file mode 100644 index 000000000000..9ecf60e8d40c --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListEventHubConsumerGroupsSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * + * @summary get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_listehgroups.json + */ +async function iotHubResourceListEventHubConsumerGroups(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listEventHubConsumerGroups( + "myResourceGroup", + "testHub", + "events", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceListEventHubConsumerGroups(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListJobsSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListJobsSample.ts new file mode 100644 index 000000000000..c51254d2a874 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListJobsSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * + * @summary get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + * x-ms-original-file: 2026-03-01-preview/iothub_listjobs.json + */ +async function iotHubResourceListJobs(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listJobs("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceListJobs(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListKeysSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListKeysSample.ts new file mode 100644 index 000000000000..09e60e93d0e4 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListKeysSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * + * @summary get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + * x-ms-original-file: 2026-03-01-preview/iothub_listkeys.json + */ +async function iotHubResourceListKeys(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listKeys("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceListKeys(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListQuotaMetricsSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListQuotaMetricsSample.ts new file mode 100644 index 000000000000..0fb8a5e0f179 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListQuotaMetricsSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the quota metrics for an IoT hub. + * + * @summary get the quota metrics for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_quotametrics.json + */ +async function iotHubResourceGetQuotaMetrics(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listQuotaMetrics("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceGetQuotaMetrics(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListValidSkusSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListValidSkusSample.ts new file mode 100644 index 000000000000..94938a7dde0e --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceListValidSkusSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the list of valid SKUs for an IoT hub. + * + * @summary get the list of valid SKUs for an IoT hub. + * x-ms-original-file: 2026-03-01-preview/iothub_getskus.json + */ +async function iotHubResourceGetValidSkus(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.iotHubResource.listValidSkus("myResourceGroup", "testHub")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await iotHubResourceGetValidSkus(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceTestAllRoutesSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceTestAllRoutesSample.ts new file mode 100644 index 000000000000..7289dcfc5264 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceTestAllRoutesSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to test all routes configured in this Iot Hub + * + * @summary test all routes configured in this Iot Hub + * x-ms-original-file: 2026-03-01-preview/iothub_testallroutes.json + */ +async function iotHubResourceTestAllRoutes(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.testAllRoutes("testHub", "myResourceGroup", { + message: { + appProperties: { key1: "value1" }, + body: "Body of message", + systemProperties: { key1: "value1" }, + }, + routingSource: "DeviceMessages", + }); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceTestAllRoutes(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceTestRouteSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceTestRouteSample.ts new file mode 100644 index 000000000000..8005caba80b5 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceTestRouteSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to test the new route for this Iot Hub + * + * @summary test the new route for this Iot Hub + * x-ms-original-file: 2026-03-01-preview/iothub_testnewroute.json + */ +async function iotHubResourceTestRoute(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.testRoute("testHub", "myResourceGroup", { + message: { + appProperties: { key1: "value1" }, + body: "Body of message", + systemProperties: { key1: "value1" }, + }, + route: { name: "Routeid", endpointNames: ["id1"], isEnabled: true, source: "DeviceMessages" }, + }); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceTestRoute(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceUpdateSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceUpdateSample.ts new file mode 100644 index 000000000000..88c1535b0c1f --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/iotHubResourceUpdateSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method + * + * @summary update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method + * x-ms-original-file: 2026-03-01-preview/iothub_patch.json + */ +async function iotHubResourceUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.iotHubResource.update("myResourceGroup", "myHub", { + tags: { foo: "bar" }, + }); + console.log(result); +} + +async function main(): Promise { + await iotHubResourceUpdate(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/operationsListSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..35dd9c7f32d3 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2026-03-01-preview/iothub_operations.json + */ +async function operationsList(): Promise { + const credential = new DefaultAzureCredential(); + const client = new IotHubClient(credential); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await operationsList(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts new file mode 100644 index 000000000000..382df800cdd8 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete private endpoint connection with the specified name + * + * @summary delete private endpoint connection with the specified name + * x-ms-original-file: 2026-03-01-preview/iothub_deleteprivateendpointconnection.json + */ +async function privateEndpointConnectionDelete(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.delete( + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", + ); + console.log(result); +} + +async function main(): Promise { + await privateEndpointConnectionDelete(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsGetSample.ts new file mode 100644 index 000000000000..a41c784997a8 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get private endpoint connection properties + * + * @summary get private endpoint connection properties + * x-ms-original-file: 2026-03-01-preview/iothub_getprivateendpointconnection.json + */ +async function privateEndpointConnectionGet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", + ); + console.log(result); +} + +async function main(): Promise { + await privateEndpointConnectionGet(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsListSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsListSample.ts new file mode 100644 index 000000000000..896bfabf1964 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsListSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list private endpoint connection properties + * + * @summary list private endpoint connection properties + * x-ms-original-file: 2026-03-01-preview/iothub_listprivateendpointconnections.json + */ +async function privateEndpointConnectionsList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.list("myResourceGroup", "testHub"); + console.log(result); +} + +async function main(): Promise { + await privateEndpointConnectionsList(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsUpdateSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsUpdateSample.ts new file mode 100644 index 000000000000..d95fd60e86b6 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateEndpointConnectionsUpdateSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update the status of a private endpoint connection with the specified name + * + * @summary update the status of a private endpoint connection with the specified name + * x-ms-original-file: 2026-03-01-preview/iothub_updateprivateendpointconnection.json + */ +async function privateEndpointConnectionUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.update( + "myResourceGroup", + "testHub", + "myPrivateEndpointConnection", + { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved", + }, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await privateEndpointConnectionUpdate(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateLinkResourcesGetSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateLinkResourcesGetSample.ts new file mode 100644 index 000000000000..6c376eebbce0 --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateLinkResourcesGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the specified private link resource for the given IotHub + * + * @summary get the specified private link resource for the given IotHub + * x-ms-original-file: 2026-03-01-preview/iothub_getprivatelinkresources.json + */ +async function privateLinkResourcesList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateLinkResources.get("myResourceGroup", "testHub", "iotHub"); + console.log(result); +} + +async function main(): Promise { + await privateLinkResourcesList(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateLinkResourcesListSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateLinkResourcesListSample.ts new file mode 100644 index 000000000000..42d56307fa5b --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/privateLinkResourcesListSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list private link resources for the given IotHub + * + * @summary list private link resources for the given IotHub + * x-ms-original-file: 2026-03-01-preview/iothub_listprivatelinkresources.json + */ +async function privateLinkResourcesList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.privateLinkResources.list("myResourceGroup", "testHub"); + console.log(result); +} + +async function main(): Promise { + await privateLinkResourcesList(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/resourceProviderCommonGetSubscriptionQuotaSample.ts b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/resourceProviderCommonGetSubscriptionQuotaSample.ts new file mode 100644 index 000000000000..0a8beda2d70e --- /dev/null +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/src/resourceProviderCommonGetSubscriptionQuotaSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { IotHubClient } from "@azure/arm-iothub"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get the number of free and paid iot hubs in the subscription + * + * @summary get the number of free and paid iot hubs in the subscription + * x-ms-original-file: 2026-03-01-preview/iothub_usages.json + */ +async function resourceProviderCommonGetSubscriptionQuota(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; + const client = new IotHubClient(credential, subscriptionId); + const result = await client.resourceProviderCommon.getSubscriptionQuota(); + console.log(result); +} + +async function main(): Promise { + await resourceProviderCommonGetSubscriptionQuota(); +} + +main().catch(console.error); diff --git a/sdk/iothub/arm-iothub/samples/v6/typescript/tsconfig.json b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/tsconfig.json similarity index 75% rename from sdk/iothub/arm-iothub/samples/v6/typescript/tsconfig.json rename to sdk/iothub/arm-iothub/samples/v7-beta/typescript/tsconfig.json index 984eed535aa8..82d2ed3be723 100644 --- a/sdk/iothub/arm-iothub/samples/v6/typescript/tsconfig.json +++ b/sdk/iothub/arm-iothub/samples/v7-beta/typescript/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", + "target": "ES2023", + "module": "nodenext", + "moduleResolution": "nodenext", "resolveJsonModule": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, diff --git a/sdk/iothub/arm-iothub/src/api/certificates/index.ts b/sdk/iothub/arm-iothub/src/api/certificates/index.ts new file mode 100644 index 000000000000..97c664c660d7 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/certificates/index.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + verify, + generateVerificationCode, + listByIotHub, + $delete, + createOrUpdate, + get, +} from "./operations.js"; +export type { + CertificatesVerifyOptionalParams, + CertificatesGenerateVerificationCodeOptionalParams, + CertificatesListByIotHubOptionalParams, + CertificatesDeleteOptionalParams, + CertificatesCreateOrUpdateOptionalParams, + CertificatesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/iothub/arm-iothub/src/api/certificates/operations.ts b/sdk/iothub/arm-iothub/src/api/certificates/operations.ts new file mode 100644 index 000000000000..9a6668824672 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/certificates/operations.ts @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext as Client } from "../index.js"; +import type { + CertificateDescription, + CertificateListDescription, + CertificateWithNonceDescription, + CertificateVerificationDescription, +} from "../../models/models.js"; +import { + errorDetailsDeserializer, + certificateDescriptionSerializer, + certificateDescriptionDeserializer, + certificateListDescriptionDeserializer, + certificateWithNonceDescriptionDeserializer, + certificateVerificationDescriptionSerializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + CertificatesVerifyOptionalParams, + CertificatesGenerateVerificationCodeOptionalParams, + CertificatesListByIotHubOptionalParams, + CertificatesDeleteOptionalParams, + CertificatesCreateOrUpdateOptionalParams, + CertificatesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _verifySend( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + certificateVerificationBody: CertificateVerificationDescription, + options: CertificatesVerifyOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + certificateName: certificateName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + "if-match": ifMatch, + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: certificateVerificationDescriptionSerializer(certificateVerificationBody), + }); +} + +export async function _verifyDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return certificateDescriptionDeserializer(result.body); +} + +/** Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. */ +export async function verify( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + certificateVerificationBody: CertificateVerificationDescription, + options: CertificatesVerifyOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _verifySend( + context, + resourceGroupName, + resourceName, + certificateName, + ifMatch, + certificateVerificationBody, + options, + ); + return _verifyDeserialize(result); +} + +export function _generateVerificationCodeSend( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + options: CertificatesGenerateVerificationCodeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + certificateName: certificateName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + "if-match": ifMatch, + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _generateVerificationCodeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return certificateWithNonceDescriptionDeserializer(result.body); +} + +/** Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. */ +export async function generateVerificationCode( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + options: CertificatesGenerateVerificationCodeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _generateVerificationCodeSend( + context, + resourceGroupName, + resourceName, + certificateName, + ifMatch, + options, + ); + return _generateVerificationCodeDeserialize(result); +} + +export function _listByIotHubSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: CertificatesListByIotHubOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByIotHubDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return certificateListDescriptionDeserializer(result.body); +} + +/** Returns the list of certificates. */ +export async function listByIotHub( + context: Client, + resourceGroupName: string, + resourceName: string, + options: CertificatesListByIotHubOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listByIotHubSend(context, resourceGroupName, resourceName, options); + return _listByIotHubDeserialize(result); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + options: CertificatesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + certificateName: certificateName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { "if-match": ifMatch, ...options.requestOptions?.headers }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Deletes an existing X509 certificate or does nothing if it does not exist. */ +export async function $delete( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + options: CertificatesDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend( + context, + resourceGroupName, + resourceName, + certificateName, + ifMatch, + options, + ); + return _$deleteDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + certificateDescription: CertificateDescription, + options: CertificatesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + certificateName: certificateName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: certificateDescriptionSerializer(certificateDescription), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return certificateDescriptionDeserializer(result.body); +} + +/** Adds new or replaces existing certificate. */ +export async function createOrUpdate( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + certificateDescription: CertificateDescription, + options: CertificatesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend( + context, + resourceGroupName, + resourceName, + certificateName, + certificateDescription, + options, + ); + return _createOrUpdateDeserialize(result); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + options: CertificatesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + certificateName: certificateName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return certificateDescriptionDeserializer(result.body); +} + +/** Returns the certificate. */ +export async function get( + context: Client, + resourceGroupName: string, + resourceName: string, + certificateName: string, + options: CertificatesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, resourceName, certificateName, options); + return _getDeserialize(result); +} diff --git a/sdk/iothub/arm-iothub/src/api/certificates/options.ts b/sdk/iothub/arm-iothub/src/api/certificates/options.ts new file mode 100644 index 000000000000..25584180ed16 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/certificates/options.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CertificatesVerifyOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificatesGenerateVerificationCodeOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificatesListByIotHubOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificatesDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificatesCreateOrUpdateOptionalParams extends OperationOptions { + /** ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface CertificatesGetOptionalParams extends OperationOptions {} diff --git a/sdk/iothub/arm-iothub/src/api/index.ts b/sdk/iothub/arm-iothub/src/api/index.ts new file mode 100644 index 000000000000..cb68be4a8025 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { IotHubContext, IotHubClientOptionalParams } from "./iotHubContext.js"; +export { createIotHub } from "./iotHubContext.js"; diff --git a/sdk/iothub/arm-iothub/src/api/iotHub/index.ts b/sdk/iothub/arm-iothub/src/api/iotHub/index.ts new file mode 100644 index 000000000000..9922ccfc3b21 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/iotHub/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { manualFailover } from "./operations.js"; +export type { IotHubManualFailoverOptionalParams } from "./options.js"; diff --git a/sdk/iothub/arm-iothub/src/api/iotHub/operations.ts b/sdk/iothub/arm-iothub/src/api/iotHub/operations.ts new file mode 100644 index 000000000000..05e0b107f011 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/iotHub/operations.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext as Client } from "../index.js"; +import type { FailoverInput } from "../../models/models.js"; +import { errorDetailsDeserializer, failoverInputSerializer } from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { IotHubManualFailoverOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _manualFailoverSend( + context: Client, + iotHubName: string, + resourceGroupName: string, + failoverInput: FailoverInput, + options: IotHubManualFailoverOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + iotHubName: iotHubName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: failoverInputSerializer(failoverInput), + }); +} + +export async function _manualFailoverDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover */ +export function manualFailover( + context: Client, + iotHubName: string, + resourceGroupName: string, + failoverInput: FailoverInput, + options: IotHubManualFailoverOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _manualFailoverDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _manualFailoverSend(context, iotHubName, resourceGroupName, failoverInput, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }) as PollerLike, void>; +} diff --git a/sdk/iothub/arm-iothub/src/api/iotHub/options.ts b/sdk/iothub/arm-iothub/src/api/iotHub/options.ts new file mode 100644 index 000000000000..d94586008c2f --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/iotHub/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface IotHubManualFailoverOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/iothub/arm-iothub/src/api/iotHubContext.ts b/sdk/iothub/arm-iothub/src/api/iotHubContext.ts new file mode 100644 index 000000000000..7f1d002159b5 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/iotHubContext.ts @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import type { AzureSupportedClouds } from "../static-helpers/cloudSettingHelpers.js"; +import { getArmEndpoint } from "../static-helpers/cloudSettingHelpers.js"; +import type { Client, ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import type { TokenCredential } from "@azure/core-auth"; + +/** Use this API to manage the IoT hubs in your Azure subscription. */ +export interface IotHubContext extends Client { + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Optional parameters for the client. */ +export interface IotHubClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; + /** Specifies the Azure cloud environment for the client. */ + cloudSetting?: AzureSupportedClouds; +} + +/** Use this API to manage the IoT hubs in your Azure subscription. */ +export function createIotHub( + credential: TokenCredential, + subscriptionId: string, + options: IotHubClientOptionalParams = {}, +): IotHubContext { + const endpointUrl = + options.endpoint ?? getArmEndpoint(options.cloudSetting) ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-iothub/7.0.0-beta.2`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? ["https://management.azure.com/.default"], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + const apiVersion = options.apiVersion; + return { ...clientContext, apiVersion, subscriptionId } as IotHubContext; +} diff --git a/sdk/iothub/arm-iothub/src/api/iotHubResource/index.ts b/sdk/iothub/arm-iothub/src/api/iotHubResource/index.ts new file mode 100644 index 000000000000..5b049f9aa2d4 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/iotHubResource/index.ts @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + checkNameAvailability, + listEventHubConsumerGroups, + deleteEventHubConsumerGroup, + createEventHubConsumerGroup, + getEventHubConsumerGroup, + getStats, + importDevices, + exportDevices, + getKeysForKeyName, + listKeys, + testRoute, + testAllRoutes, + listEndpointHealth, + listQuotaMetrics, + getJob, + listJobs, + listValidSkus, + listBySubscription, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export type { + IotHubResourceCheckNameAvailabilityOptionalParams, + IotHubResourceListEventHubConsumerGroupsOptionalParams, + IotHubResourceDeleteEventHubConsumerGroupOptionalParams, + IotHubResourceCreateEventHubConsumerGroupOptionalParams, + IotHubResourceGetEventHubConsumerGroupOptionalParams, + IotHubResourceGetStatsOptionalParams, + IotHubResourceImportDevicesOptionalParams, + IotHubResourceExportDevicesOptionalParams, + IotHubResourceGetKeysForKeyNameOptionalParams, + IotHubResourceListKeysOptionalParams, + IotHubResourceTestRouteOptionalParams, + IotHubResourceTestAllRoutesOptionalParams, + IotHubResourceListEndpointHealthOptionalParams, + IotHubResourceListQuotaMetricsOptionalParams, + IotHubResourceGetJobOptionalParams, + IotHubResourceListJobsOptionalParams, + IotHubResourceListValidSkusOptionalParams, + IotHubResourceListBySubscriptionOptionalParams, + IotHubResourceListByResourceGroupOptionalParams, + IotHubResourceDeleteOptionalParams, + IotHubResourceUpdateOptionalParams, + IotHubResourceCreateOrUpdateOptionalParams, + IotHubResourceGetOptionalParams, +} from "./options.js"; diff --git a/sdk/iothub/arm-iothub/src/api/iotHubResource/operations.ts b/sdk/iothub/arm-iothub/src/api/iotHubResource/operations.ts new file mode 100644 index 000000000000..166977b4ec40 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/iotHubResource/operations.ts @@ -0,0 +1,1440 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext as Client } from "../index.js"; +import type { + IotHubDescription, + SharedAccessSignatureAuthorizationRule, + TagsResource, + _IotHubDescriptionListResult, + _IotHubSkuDescriptionListResult, + IotHubSkuDescription, + _JobResponseListResult, + JobResponse, + _IotHubQuotaMetricInfoListResult, + IotHubQuotaMetricInfo, + _EndpointHealthDataListResult, + EndpointHealthData, + TestAllRoutesInput, + TestAllRoutesResult, + TestRouteInput, + TestRouteResult, + _SharedAccessSignatureAuthorizationRuleListResult, + ExportDevicesRequest, + ImportDevicesRequest, + RegistryStatistics, + EventHubConsumerGroupInfo, + EventHubConsumerGroupBodyDescription, + _EventHubConsumerGroupsListResult, + OperationInputs, + IotHubNameAvailabilityInfo, +} from "../../models/models.js"; +import { + errorDetailsDeserializer, + iotHubDescriptionSerializer, + iotHubDescriptionDeserializer, + sharedAccessSignatureAuthorizationRuleDeserializer, + tagsResourceSerializer, + _iotHubDescriptionListResultDeserializer, + _iotHubSkuDescriptionListResultDeserializer, + _jobResponseListResultDeserializer, + jobResponseDeserializer, + _iotHubQuotaMetricInfoListResultDeserializer, + _endpointHealthDataListResultDeserializer, + testAllRoutesInputSerializer, + testAllRoutesResultDeserializer, + testRouteInputSerializer, + testRouteResultDeserializer, + _sharedAccessSignatureAuthorizationRuleListResultDeserializer, + exportDevicesRequestSerializer, + importDevicesRequestSerializer, + registryStatisticsDeserializer, + eventHubConsumerGroupInfoDeserializer, + eventHubConsumerGroupBodyDescriptionSerializer, + _eventHubConsumerGroupsListResultDeserializer, + operationInputsSerializer, + iotHubNameAvailabilityInfoDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + IotHubResourceCheckNameAvailabilityOptionalParams, + IotHubResourceListEventHubConsumerGroupsOptionalParams, + IotHubResourceDeleteEventHubConsumerGroupOptionalParams, + IotHubResourceCreateEventHubConsumerGroupOptionalParams, + IotHubResourceGetEventHubConsumerGroupOptionalParams, + IotHubResourceGetStatsOptionalParams, + IotHubResourceImportDevicesOptionalParams, + IotHubResourceExportDevicesOptionalParams, + IotHubResourceGetKeysForKeyNameOptionalParams, + IotHubResourceListKeysOptionalParams, + IotHubResourceTestRouteOptionalParams, + IotHubResourceTestAllRoutesOptionalParams, + IotHubResourceListEndpointHealthOptionalParams, + IotHubResourceListQuotaMetricsOptionalParams, + IotHubResourceGetJobOptionalParams, + IotHubResourceListJobsOptionalParams, + IotHubResourceListValidSkusOptionalParams, + IotHubResourceListBySubscriptionOptionalParams, + IotHubResourceListByResourceGroupOptionalParams, + IotHubResourceDeleteOptionalParams, + IotHubResourceUpdateOptionalParams, + IotHubResourceCreateOrUpdateOptionalParams, + IotHubResourceGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _checkNameAvailabilitySend( + context: Client, + operationInputs: OperationInputs, + options: IotHubResourceCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: operationInputsSerializer(operationInputs), + }); +} + +export async function _checkNameAvailabilityDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return iotHubNameAvailabilityInfoDeserializer(result.body); +} + +/** Check if an IoT hub name is available. */ +export async function checkNameAvailability( + context: Client, + operationInputs: OperationInputs, + options: IotHubResourceCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkNameAvailabilitySend(context, operationInputs, options); + return _checkNameAvailabilityDeserialize(result); +} + +export function _listEventHubConsumerGroupsSend( + context: Client, + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + options: IotHubResourceListEventHubConsumerGroupsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + eventHubEndpointName: eventHubEndpointName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listEventHubConsumerGroupsDeserialize( + result: PathUncheckedResponse, +): Promise<_EventHubConsumerGroupsListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _eventHubConsumerGroupsListResultDeserializer(result.body); +} + +/** Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. */ +export function listEventHubConsumerGroups( + context: Client, + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + options: IotHubResourceListEventHubConsumerGroupsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listEventHubConsumerGroupsSend( + context, + resourceGroupName, + resourceName, + eventHubEndpointName, + options, + ), + _listEventHubConsumerGroupsDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} + +export function _deleteEventHubConsumerGroupSend( + context: Client, + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + options: IotHubResourceDeleteEventHubConsumerGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + eventHubEndpointName: eventHubEndpointName, + name: name, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteEventHubConsumerGroupDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return; +} + +/** Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. */ +export async function deleteEventHubConsumerGroup( + context: Client, + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + options: IotHubResourceDeleteEventHubConsumerGroupOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteEventHubConsumerGroupSend( + context, + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + options, + ); + return _deleteEventHubConsumerGroupDeserialize(result); +} + +export function _createEventHubConsumerGroupSend( + context: Client, + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + consumerGroupBody: EventHubConsumerGroupBodyDescription, + options: IotHubResourceCreateEventHubConsumerGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + eventHubEndpointName: eventHubEndpointName, + name: name, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: eventHubConsumerGroupBodyDescriptionSerializer(consumerGroupBody), + }); +} + +export async function _createEventHubConsumerGroupDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return eventHubConsumerGroupInfoDeserializer(result.body); +} + +/** Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. */ +export async function createEventHubConsumerGroup( + context: Client, + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + consumerGroupBody: EventHubConsumerGroupBodyDescription, + options: IotHubResourceCreateEventHubConsumerGroupOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createEventHubConsumerGroupSend( + context, + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + consumerGroupBody, + options, + ); + return _createEventHubConsumerGroupDeserialize(result); +} + +export function _getEventHubConsumerGroupSend( + context: Client, + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + options: IotHubResourceGetEventHubConsumerGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + eventHubEndpointName: eventHubEndpointName, + name: name, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getEventHubConsumerGroupDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return eventHubConsumerGroupInfoDeserializer(result.body); +} + +/** Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. */ +export async function getEventHubConsumerGroup( + context: Client, + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + options: IotHubResourceGetEventHubConsumerGroupOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getEventHubConsumerGroupSend( + context, + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + options, + ); + return _getEventHubConsumerGroupDeserialize(result); +} + +export function _getStatsSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceGetStatsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getStatsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return registryStatisticsDeserializer(result.body); +} + +/** Get the statistics from an IoT hub. */ +export async function getStats( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceGetStatsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getStatsSend(context, resourceGroupName, resourceName, options); + return _getStatsDeserialize(result); +} + +export function _importDevicesSend( + context: Client, + resourceGroupName: string, + resourceName: string, + importDevicesParameters: ImportDevicesRequest, + options: IotHubResourceImportDevicesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: importDevicesRequestSerializer(importDevicesParameters), + }); +} + +export async function _importDevicesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return jobResponseDeserializer(result.body); +} + +/** Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. */ +export async function importDevices( + context: Client, + resourceGroupName: string, + resourceName: string, + importDevicesParameters: ImportDevicesRequest, + options: IotHubResourceImportDevicesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _importDevicesSend( + context, + resourceGroupName, + resourceName, + importDevicesParameters, + options, + ); + return _importDevicesDeserialize(result); +} + +export function _exportDevicesSend( + context: Client, + resourceGroupName: string, + resourceName: string, + exportDevicesParameters: ExportDevicesRequest, + options: IotHubResourceExportDevicesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: exportDevicesRequestSerializer(exportDevicesParameters), + }); +} + +export async function _exportDevicesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return jobResponseDeserializer(result.body); +} + +/** Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. */ +export async function exportDevices( + context: Client, + resourceGroupName: string, + resourceName: string, + exportDevicesParameters: ExportDevicesRequest, + options: IotHubResourceExportDevicesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _exportDevicesSend( + context, + resourceGroupName, + resourceName, + exportDevicesParameters, + options, + ); + return _exportDevicesDeserialize(result); +} + +export function _getKeysForKeyNameSend( + context: Client, + resourceGroupName: string, + resourceName: string, + keyName: string, + options: IotHubResourceGetKeysForKeyNameOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + keyName: keyName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getKeysForKeyNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return sharedAccessSignatureAuthorizationRuleDeserializer(result.body); +} + +/** Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. */ +export async function getKeysForKeyName( + context: Client, + resourceGroupName: string, + resourceName: string, + keyName: string, + options: IotHubResourceGetKeysForKeyNameOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getKeysForKeyNameSend( + context, + resourceGroupName, + resourceName, + keyName, + options, + ); + return _getKeysForKeyNameDeserialize(result); +} + +export function _listKeysSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceListKeysOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listKeysDeserialize( + result: PathUncheckedResponse, +): Promise<_SharedAccessSignatureAuthorizationRuleListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _sharedAccessSignatureAuthorizationRuleListResultDeserializer(result.body); +} + +/** Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. */ +export function listKeys( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceListKeysOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listKeysSend(context, resourceGroupName, resourceName, options), + _listKeysDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} + +export function _testRouteSend( + context: Client, + iotHubName: string, + resourceGroupName: string, + input: TestRouteInput, + options: IotHubResourceTestRouteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + iotHubName: iotHubName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: testRouteInputSerializer(input), + }); +} + +export async function _testRouteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return testRouteResultDeserializer(result.body); +} + +/** Test the new route for this Iot Hub */ +export async function testRoute( + context: Client, + iotHubName: string, + resourceGroupName: string, + input: TestRouteInput, + options: IotHubResourceTestRouteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _testRouteSend(context, iotHubName, resourceGroupName, input, options); + return _testRouteDeserialize(result); +} + +export function _testAllRoutesSend( + context: Client, + iotHubName: string, + resourceGroupName: string, + input: TestAllRoutesInput, + options: IotHubResourceTestAllRoutesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + iotHubName: iotHubName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: testAllRoutesInputSerializer(input), + }); +} + +export async function _testAllRoutesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return testAllRoutesResultDeserializer(result.body); +} + +/** Test all routes configured in this Iot Hub */ +export async function testAllRoutes( + context: Client, + iotHubName: string, + resourceGroupName: string, + input: TestAllRoutesInput, + options: IotHubResourceTestAllRoutesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _testAllRoutesSend(context, iotHubName, resourceGroupName, input, options); + return _testAllRoutesDeserialize(result); +} + +export function _listEndpointHealthSend( + context: Client, + resourceGroupName: string, + iotHubName: string, + options: IotHubResourceListEndpointHealthOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + iotHubName: iotHubName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listEndpointHealthDeserialize( + result: PathUncheckedResponse, +): Promise<_EndpointHealthDataListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _endpointHealthDataListResultDeserializer(result.body); +} + +/** Get the health for routing endpoints. */ +export function listEndpointHealth( + context: Client, + resourceGroupName: string, + iotHubName: string, + options: IotHubResourceListEndpointHealthOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listEndpointHealthSend(context, resourceGroupName, iotHubName, options), + _listEndpointHealthDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} + +export function _listQuotaMetricsSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceListQuotaMetricsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listQuotaMetricsDeserialize( + result: PathUncheckedResponse, +): Promise<_IotHubQuotaMetricInfoListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _iotHubQuotaMetricInfoListResultDeserializer(result.body); +} + +/** Get the quota metrics for an IoT hub. */ +export function listQuotaMetrics( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceListQuotaMetricsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listQuotaMetricsSend(context, resourceGroupName, resourceName, options), + _listQuotaMetricsDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} + +export function _getJobSend( + context: Client, + resourceGroupName: string, + resourceName: string, + jobId: string, + options: IotHubResourceGetJobOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + jobId: jobId, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getJobDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return jobResponseDeserializer(result.body); +} + +/** Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. */ +export async function getJob( + context: Client, + resourceGroupName: string, + resourceName: string, + jobId: string, + options: IotHubResourceGetJobOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getJobSend(context, resourceGroupName, resourceName, jobId, options); + return _getJobDeserialize(result); +} + +export function _listJobsSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceListJobsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listJobsDeserialize( + result: PathUncheckedResponse, +): Promise<_JobResponseListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _jobResponseListResultDeserializer(result.body); +} + +/** Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. */ +export function listJobs( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceListJobsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listJobsSend(context, resourceGroupName, resourceName, options), + _listJobsDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} + +export function _listValidSkusSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceListValidSkusOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listValidSkusDeserialize( + result: PathUncheckedResponse, +): Promise<_IotHubSkuDescriptionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _iotHubSkuDescriptionListResultDeserializer(result.body); +} + +/** Get the list of valid SKUs for an IoT hub. */ +export function listValidSkus( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceListValidSkusOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listValidSkusSend(context, resourceGroupName, resourceName, options), + _listValidSkusDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} + +export function _listBySubscriptionSend( + context: Client, + options: IotHubResourceListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_IotHubDescriptionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _iotHubDescriptionListResultDeserializer(result.body); +} + +/** Get all the IoT hubs in a subscription. */ +export function listBySubscription( + context: Client, + options: IotHubResourceListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: IotHubResourceListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_IotHubDescriptionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _iotHubDescriptionListResultDeserializer(result.body); +} + +/** Get all the IoT hubs in a resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: IotHubResourceListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + const statusCode = Number.parseInt(result.status); + if (statusCode === 404) { + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + } else { + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + } + throw error; + } + + return iotHubDescriptionDeserializer(result.body); +} + +/** Delete an IoT hub. */ +export function $delete( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, IotHubDescription> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _$deleteSend(context, resourceGroupName, resourceName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }) as PollerLike, IotHubDescription>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + resourceName: string, + iotHubTags: TagsResource, + options: IotHubResourceUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: tagsResourceSerializer(iotHubTags), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return iotHubDescriptionDeserializer(result.body); +} + +/** Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method */ +export function update( + context: Client, + resourceGroupName: string, + resourceName: string, + iotHubTags: TagsResource, + options: IotHubResourceUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, IotHubDescription> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend(context, resourceGroupName, resourceName, iotHubTags, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }) as PollerLike, IotHubDescription>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + resourceName: string, + iotHubDescription: IotHubDescription, + options: IotHubResourceCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + ...(options?.ifMatch !== undefined ? { "if-match": options?.ifMatch } : {}), + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: iotHubDescriptionSerializer(iotHubDescription), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return iotHubDescriptionDeserializer(result.body); +} + +/** Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + resourceName: string, + iotHubDescription: IotHubDescription, + options: IotHubResourceCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, IotHubDescription> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, resourceName, iotHubDescription, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }) as PollerLike, IotHubDescription>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return iotHubDescriptionDeserializer(result.body); +} + +/** Get the non-security related metadata of an IoT hub. */ +export async function get( + context: Client, + resourceGroupName: string, + resourceName: string, + options: IotHubResourceGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, resourceName, options); + return _getDeserialize(result); +} diff --git a/sdk/iothub/arm-iothub/src/api/iotHubResource/options.ts b/sdk/iothub/arm-iothub/src/api/iotHubResource/options.ts new file mode 100644 index 000000000000..8f97feee7b14 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/iotHubResource/options.ts @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface IotHubResourceCheckNameAvailabilityOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceListEventHubConsumerGroupsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceDeleteEventHubConsumerGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceCreateEventHubConsumerGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceGetEventHubConsumerGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceGetStatsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceImportDevicesOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceExportDevicesOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceGetKeysForKeyNameOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceListKeysOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceTestRouteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceTestAllRoutesOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceListEndpointHealthOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceListQuotaMetricsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceGetJobOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceListJobsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceListValidSkusOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface IotHubResourceDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface IotHubResourceUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface IotHubResourceCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. */ + ifMatch?: string; +} + +/** Optional parameters. */ +export interface IotHubResourceGetOptionalParams extends OperationOptions {} diff --git a/sdk/iothub/arm-iothub/src/api/operations/index.ts b/sdk/iothub/arm-iothub/src/api/operations/index.ts new file mode 100644 index 000000000000..de883c05d2f1 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/iothub/arm-iothub/src/api/operations/operations.ts b/sdk/iothub/arm-iothub/src/api/operations/operations.ts new file mode 100644 index 000000000000..17461da45757 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/operations/operations.ts @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext as Client } from "../index.js"; +import type { _OperationListResult, Operation } from "../../models/models.js"; +import { _operationListResultDeserializer, errorDetailsDeserializer } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { OperationsListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.Devices/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }, + ); +} diff --git a/sdk/iothub/arm-iothub/src/api/operations/options.ts b/sdk/iothub/arm-iothub/src/api/operations/options.ts new file mode 100644 index 000000000000..b9a3fd9758a3 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/index.ts b/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/index.ts new file mode 100644 index 000000000000..791ba1787dce --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, $delete, update, get } from "./operations.js"; +export type { + PrivateEndpointConnectionsListOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsUpdateOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/operations.ts b/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/operations.ts new file mode 100644 index 000000000000..22e9ff7f15ff --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/operations.ts @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext as Client } from "../index.js"; +import type { PrivateEndpointConnection } from "../../models/models.js"; +import { + errorDetailsDeserializer, + privateEndpointConnectionSerializer, + privateEndpointConnectionDeserializer, + privateEndpointConnectionArrayDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + PrivateEndpointConnectionsListOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsUpdateOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: PrivateEndpointConnectionsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return privateEndpointConnectionArrayDeserializer(result.body); +} + +/** List private endpoint connection properties */ +export async function list( + context: Client, + resourceGroupName: string, + resourceName: string, + options: PrivateEndpointConnectionsListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, resourceGroupName, resourceName, options); + return _listDeserialize(result); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return privateEndpointConnectionDeserializer(result.body); +} + +/** Delete private endpoint connection with the specified name */ +export function $delete( + context: Client, + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, PrivateEndpointConnection> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + resourceName, + privateEndpointConnectionName, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }) as PollerLike, PrivateEndpointConnection>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options: PrivateEndpointConnectionsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: privateEndpointConnectionSerializer(privateEndpointConnection), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return privateEndpointConnectionDeserializer(result.body); +} + +/** Update the status of a private endpoint connection with the specified name */ +export function update( + context: Client, + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options: PrivateEndpointConnectionsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, PrivateEndpointConnection> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + options, + ), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-03-01-preview", + }) as PollerLike, PrivateEndpointConnection>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return privateEndpointConnectionDeserializer(result.body); +} + +/** Get private endpoint connection properties */ +export async function get( + context: Client, + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + resourceName, + privateEndpointConnectionName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/options.ts b/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/options.ts new file mode 100644 index 000000000000..12d00795ed3f --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/privateEndpointConnections/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions {} diff --git a/sdk/iothub/arm-iothub/src/api/privateLinkResources/index.ts b/sdk/iothub/arm-iothub/src/api/privateLinkResources/index.ts new file mode 100644 index 000000000000..a455b57d652c --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/privateLinkResources/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list, get } from "./operations.js"; +export type { + PrivateLinkResourcesListOptionalParams, + PrivateLinkResourcesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/iothub/arm-iothub/src/api/privateLinkResources/operations.ts b/sdk/iothub/arm-iothub/src/api/privateLinkResources/operations.ts new file mode 100644 index 000000000000..8387ba21ba06 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/privateLinkResources/operations.ts @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext as Client } from "../index.js"; +import type { GroupIdInformation, PrivateLinkResources } from "../../models/models.js"; +import { + errorDetailsDeserializer, + groupIdInformationDeserializer, + privateLinkResourcesDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + PrivateLinkResourcesListOptionalParams, + PrivateLinkResourcesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + resourceGroupName: string, + resourceName: string, + options: PrivateLinkResourcesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return privateLinkResourcesDeserializer(result.body); +} + +/** List private link resources for the given IotHub */ +export async function list( + context: Client, + resourceGroupName: string, + resourceName: string, + options: PrivateLinkResourcesListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, resourceGroupName, resourceName, options); + return _listDeserialize(result); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + resourceName: string, + groupId: string, + options: PrivateLinkResourcesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + resourceName: resourceName, + groupId: groupId, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return groupIdInformationDeserializer(result.body); +} + +/** Get the specified private link resource for the given IotHub */ +export async function get( + context: Client, + resourceGroupName: string, + resourceName: string, + groupId: string, + options: PrivateLinkResourcesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, resourceName, groupId, options); + return _getDeserialize(result); +} diff --git a/sdk/iothub/arm-iothub/src/api/privateLinkResources/options.ts b/sdk/iothub/arm-iothub/src/api/privateLinkResources/options.ts new file mode 100644 index 000000000000..8cddee7b3b80 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/privateLinkResources/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface PrivateLinkResourcesListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface PrivateLinkResourcesGetOptionalParams extends OperationOptions {} diff --git a/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/index.ts b/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/index.ts new file mode 100644 index 000000000000..90655aa712e6 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { getSubscriptionQuota } from "./operations.js"; +export type { ResourceProviderCommonGetSubscriptionQuotaOptionalParams } from "./options.js"; diff --git a/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/operations.ts b/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/operations.ts new file mode 100644 index 000000000000..9214ef56847e --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/operations.ts @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext as Client } from "../index.js"; +import type { UserSubscriptionQuotaListResult } from "../../models/models.js"; +import { + errorDetailsDeserializer, + userSubscriptionQuotaListResultDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { ResourceProviderCommonGetSubscriptionQuotaOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _getSubscriptionQuotaSend( + context: Client, + options: ResourceProviderCommonGetSubscriptionQuotaOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion ?? "2026-03-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getSubscriptionQuotaDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + if (result.body) { + error.details = errorDetailsDeserializer(result.body); + } + + throw error; + } + + return userSubscriptionQuotaListResultDeserializer(result.body); +} + +/** Get the number of free and paid iot hubs in the subscription */ +export async function getSubscriptionQuota( + context: Client, + options: ResourceProviderCommonGetSubscriptionQuotaOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSubscriptionQuotaSend(context, options); + return _getSubscriptionQuotaDeserialize(result); +} diff --git a/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/options.ts b/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/options.ts new file mode 100644 index 000000000000..f544f5f5b8a1 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/api/resourceProviderCommon/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ResourceProviderCommonGetSubscriptionQuotaOptionalParams extends OperationOptions {} diff --git a/sdk/iothub/arm-iothub/src/classic/certificates/index.ts b/sdk/iothub/arm-iothub/src/classic/certificates/index.ts new file mode 100644 index 000000000000..0227d21d84d4 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/classic/certificates/index.ts @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext } from "../../api/iotHubContext.js"; +import { + verify, + generateVerificationCode, + listByIotHub, + $delete, + createOrUpdate, + get, +} from "../../api/certificates/operations.js"; +import type { + CertificatesVerifyOptionalParams, + CertificatesGenerateVerificationCodeOptionalParams, + CertificatesListByIotHubOptionalParams, + CertificatesDeleteOptionalParams, + CertificatesCreateOrUpdateOptionalParams, + CertificatesGetOptionalParams, +} from "../../api/certificates/options.js"; +import type { + CertificateDescription, + CertificateListDescription, + CertificateWithNonceDescription, + CertificateVerificationDescription, +} from "../../models/models.js"; + +/** Interface representing a Certificates operations. */ +export interface CertificatesOperations { + /** Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate. */ + verify: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + certificateVerificationBody: CertificateVerificationDescription, + options?: CertificatesVerifyOptionalParams, + ) => Promise; + /** Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. */ + generateVerificationCode: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + options?: CertificatesGenerateVerificationCodeOptionalParams, + ) => Promise; + /** Returns the list of certificates. */ + listByIotHub: ( + resourceGroupName: string, + resourceName: string, + options?: CertificatesListByIotHubOptionalParams, + ) => Promise; + /** Deletes an existing X509 certificate or does nothing if it does not exist. */ + delete: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + options?: CertificatesDeleteOptionalParams, + ) => Promise; + /** Adds new or replaces existing certificate. */ + createOrUpdate: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + certificateDescription: CertificateDescription, + options?: CertificatesCreateOrUpdateOptionalParams, + ) => Promise; + /** Returns the certificate. */ + get: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + options?: CertificatesGetOptionalParams, + ) => Promise; +} + +function _getCertificates(context: IotHubContext) { + return { + verify: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + certificateVerificationBody: CertificateVerificationDescription, + options?: CertificatesVerifyOptionalParams, + ) => + verify( + context, + resourceGroupName, + resourceName, + certificateName, + ifMatch, + certificateVerificationBody, + options, + ), + generateVerificationCode: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + options?: CertificatesGenerateVerificationCodeOptionalParams, + ) => + generateVerificationCode( + context, + resourceGroupName, + resourceName, + certificateName, + ifMatch, + options, + ), + listByIotHub: ( + resourceGroupName: string, + resourceName: string, + options?: CertificatesListByIotHubOptionalParams, + ) => listByIotHub(context, resourceGroupName, resourceName, options), + delete: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + ifMatch: string, + options?: CertificatesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, resourceName, certificateName, ifMatch, options), + createOrUpdate: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + certificateDescription: CertificateDescription, + options?: CertificatesCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + resourceName, + certificateName, + certificateDescription, + options, + ), + get: ( + resourceGroupName: string, + resourceName: string, + certificateName: string, + options?: CertificatesGetOptionalParams, + ) => get(context, resourceGroupName, resourceName, certificateName, options), + }; +} + +export function _getCertificatesOperations(context: IotHubContext): CertificatesOperations { + return { + ..._getCertificates(context), + }; +} diff --git a/sdk/iothub/arm-iothub/src/classic/index.ts b/sdk/iothub/arm-iothub/src/classic/index.ts new file mode 100644 index 000000000000..1bcadc0db935 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/classic/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { CertificatesOperations } from "./certificates/index.js"; +export type { IotHubOperations } from "./iotHub/index.js"; +export type { IotHubResourceOperations } from "./iotHubResource/index.js"; +export type { OperationsOperations } from "./operations/index.js"; +export type { PrivateEndpointConnectionsOperations } from "./privateEndpointConnections/index.js"; +export type { PrivateLinkResourcesOperations } from "./privateLinkResources/index.js"; +export type { ResourceProviderCommonOperations } from "./resourceProviderCommon/index.js"; diff --git a/sdk/iothub/arm-iothub/src/classic/iotHub/index.ts b/sdk/iothub/arm-iothub/src/classic/iotHub/index.ts new file mode 100644 index 000000000000..93db9b6dfa31 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/classic/iotHub/index.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext } from "../../api/iotHubContext.js"; +import { manualFailover } from "../../api/iotHub/operations.js"; +import type { IotHubManualFailoverOptionalParams } from "../../api/iotHub/options.js"; +import type { FailoverInput } from "../../models/models.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a IotHub operations. */ +export interface IotHubOperations { + /** Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover */ + manualFailover: ( + iotHubName: string, + resourceGroupName: string, + failoverInput: FailoverInput, + options?: IotHubManualFailoverOptionalParams, + ) => PollerLike, void>; + /** @deprecated use manualFailover instead */ + beginManualFailover: ( + iotHubName: string, + resourceGroupName: string, + failoverInput: FailoverInput, + options?: IotHubManualFailoverOptionalParams, + ) => Promise, void>>; + /** @deprecated use manualFailover instead */ + beginManualFailoverAndWait: ( + iotHubName: string, + resourceGroupName: string, + failoverInput: FailoverInput, + options?: IotHubManualFailoverOptionalParams, + ) => Promise; +} + +function _getIotHub(context: IotHubContext) { + return { + manualFailover: ( + iotHubName: string, + resourceGroupName: string, + failoverInput: FailoverInput, + options?: IotHubManualFailoverOptionalParams, + ) => manualFailover(context, iotHubName, resourceGroupName, failoverInput, options), + beginManualFailover: async ( + iotHubName: string, + resourceGroupName: string, + failoverInput: FailoverInput, + options?: IotHubManualFailoverOptionalParams, + ) => { + const poller = manualFailover(context, iotHubName, resourceGroupName, failoverInput, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginManualFailoverAndWait: async ( + iotHubName: string, + resourceGroupName: string, + failoverInput: FailoverInput, + options?: IotHubManualFailoverOptionalParams, + ) => { + return await manualFailover(context, iotHubName, resourceGroupName, failoverInput, options); + }, + }; +} + +export function _getIotHubOperations(context: IotHubContext): IotHubOperations { + return { + ..._getIotHub(context), + }; +} diff --git a/sdk/iothub/arm-iothub/src/classic/iotHubResource/index.ts b/sdk/iothub/arm-iothub/src/classic/iotHubResource/index.ts new file mode 100644 index 000000000000..3373545f4626 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/classic/iotHubResource/index.ts @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext } from "../../api/iotHubContext.js"; +import { + checkNameAvailability, + listEventHubConsumerGroups, + deleteEventHubConsumerGroup, + createEventHubConsumerGroup, + getEventHubConsumerGroup, + getStats, + importDevices, + exportDevices, + getKeysForKeyName, + listKeys, + testRoute, + testAllRoutes, + listEndpointHealth, + listQuotaMetrics, + getJob, + listJobs, + listValidSkus, + listBySubscription, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/iotHubResource/operations.js"; +import type { + IotHubResourceCheckNameAvailabilityOptionalParams, + IotHubResourceListEventHubConsumerGroupsOptionalParams, + IotHubResourceDeleteEventHubConsumerGroupOptionalParams, + IotHubResourceCreateEventHubConsumerGroupOptionalParams, + IotHubResourceGetEventHubConsumerGroupOptionalParams, + IotHubResourceGetStatsOptionalParams, + IotHubResourceImportDevicesOptionalParams, + IotHubResourceExportDevicesOptionalParams, + IotHubResourceGetKeysForKeyNameOptionalParams, + IotHubResourceListKeysOptionalParams, + IotHubResourceTestRouteOptionalParams, + IotHubResourceTestAllRoutesOptionalParams, + IotHubResourceListEndpointHealthOptionalParams, + IotHubResourceListQuotaMetricsOptionalParams, + IotHubResourceGetJobOptionalParams, + IotHubResourceListJobsOptionalParams, + IotHubResourceListValidSkusOptionalParams, + IotHubResourceListBySubscriptionOptionalParams, + IotHubResourceListByResourceGroupOptionalParams, + IotHubResourceDeleteOptionalParams, + IotHubResourceUpdateOptionalParams, + IotHubResourceCreateOrUpdateOptionalParams, + IotHubResourceGetOptionalParams, +} from "../../api/iotHubResource/options.js"; +import type { + IotHubDescription, + SharedAccessSignatureAuthorizationRule, + TagsResource, + IotHubSkuDescription, + JobResponse, + IotHubQuotaMetricInfo, + EndpointHealthData, + TestAllRoutesInput, + TestAllRoutesResult, + TestRouteInput, + TestRouteResult, + ExportDevicesRequest, + ImportDevicesRequest, + RegistryStatistics, + EventHubConsumerGroupInfo, + EventHubConsumerGroupBodyDescription, + OperationInputs, + IotHubNameAvailabilityInfo, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a IotHubResource operations. */ +export interface IotHubResourceOperations { + /** Check if an IoT hub name is available. */ + checkNameAvailability: ( + operationInputs: OperationInputs, + options?: IotHubResourceCheckNameAvailabilityOptionalParams, + ) => Promise; + /** Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. */ + listEventHubConsumerGroups: ( + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + options?: IotHubResourceListEventHubConsumerGroupsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. */ + deleteEventHubConsumerGroup: ( + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + options?: IotHubResourceDeleteEventHubConsumerGroupOptionalParams, + ) => Promise; + /** Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. */ + createEventHubConsumerGroup: ( + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + consumerGroupBody: EventHubConsumerGroupBodyDescription, + options?: IotHubResourceCreateEventHubConsumerGroupOptionalParams, + ) => Promise; + /** Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. */ + getEventHubConsumerGroup: ( + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + options?: IotHubResourceGetEventHubConsumerGroupOptionalParams, + ) => Promise; + /** Get the statistics from an IoT hub. */ + getStats: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceGetStatsOptionalParams, + ) => Promise; + /** Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. */ + importDevices: ( + resourceGroupName: string, + resourceName: string, + importDevicesParameters: ImportDevicesRequest, + options?: IotHubResourceImportDevicesOptionalParams, + ) => Promise; + /** Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. */ + exportDevices: ( + resourceGroupName: string, + resourceName: string, + exportDevicesParameters: ExportDevicesRequest, + options?: IotHubResourceExportDevicesOptionalParams, + ) => Promise; + /** Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. */ + getKeysForKeyName: ( + resourceGroupName: string, + resourceName: string, + keyName: string, + options?: IotHubResourceGetKeysForKeyNameOptionalParams, + ) => Promise; + /** Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. */ + listKeys: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceListKeysOptionalParams, + ) => PagedAsyncIterableIterator; + /** Test the new route for this Iot Hub */ + testRoute: ( + iotHubName: string, + resourceGroupName: string, + input: TestRouteInput, + options?: IotHubResourceTestRouteOptionalParams, + ) => Promise; + /** Test all routes configured in this Iot Hub */ + testAllRoutes: ( + iotHubName: string, + resourceGroupName: string, + input: TestAllRoutesInput, + options?: IotHubResourceTestAllRoutesOptionalParams, + ) => Promise; + /** Get the health for routing endpoints. */ + listEndpointHealth: ( + resourceGroupName: string, + iotHubName: string, + options?: IotHubResourceListEndpointHealthOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get the quota metrics for an IoT hub. */ + listQuotaMetrics: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceListQuotaMetricsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. */ + getJob: ( + resourceGroupName: string, + resourceName: string, + jobId: string, + options?: IotHubResourceGetJobOptionalParams, + ) => Promise; + /** Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. */ + listJobs: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceListJobsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get the list of valid SKUs for an IoT hub. */ + listValidSkus: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceListValidSkusOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get all the IoT hubs in a subscription. */ + listBySubscription: ( + options?: IotHubResourceListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get all the IoT hubs in a resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: IotHubResourceListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete an IoT hub. */ + delete: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceDeleteOptionalParams, + ) => PollerLike, IotHubDescription>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceDeleteOptionalParams, + ) => Promise, IotHubDescription>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceDeleteOptionalParams, + ) => Promise; + /** Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method */ + update: ( + resourceGroupName: string, + resourceName: string, + iotHubTags: TagsResource, + options?: IotHubResourceUpdateOptionalParams, + ) => PollerLike, IotHubDescription>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + resourceName: string, + iotHubTags: TagsResource, + options?: IotHubResourceUpdateOptionalParams, + ) => Promise, IotHubDescription>>; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + resourceName: string, + iotHubTags: TagsResource, + options?: IotHubResourceUpdateOptionalParams, + ) => Promise; + /** Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub. */ + createOrUpdate: ( + resourceGroupName: string, + resourceName: string, + iotHubDescription: IotHubDescription, + options?: IotHubResourceCreateOrUpdateOptionalParams, + ) => PollerLike, IotHubDescription>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + resourceName: string, + iotHubDescription: IotHubDescription, + options?: IotHubResourceCreateOrUpdateOptionalParams, + ) => Promise, IotHubDescription>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + resourceName: string, + iotHubDescription: IotHubDescription, + options?: IotHubResourceCreateOrUpdateOptionalParams, + ) => Promise; + /** Get the non-security related metadata of an IoT hub. */ + get: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceGetOptionalParams, + ) => Promise; +} + +function _getIotHubResource(context: IotHubContext) { + return { + checkNameAvailability: ( + operationInputs: OperationInputs, + options?: IotHubResourceCheckNameAvailabilityOptionalParams, + ) => checkNameAvailability(context, operationInputs, options), + listEventHubConsumerGroups: ( + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + options?: IotHubResourceListEventHubConsumerGroupsOptionalParams, + ) => + listEventHubConsumerGroups( + context, + resourceGroupName, + resourceName, + eventHubEndpointName, + options, + ), + deleteEventHubConsumerGroup: ( + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + options?: IotHubResourceDeleteEventHubConsumerGroupOptionalParams, + ) => + deleteEventHubConsumerGroup( + context, + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + options, + ), + createEventHubConsumerGroup: ( + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + consumerGroupBody: EventHubConsumerGroupBodyDescription, + options?: IotHubResourceCreateEventHubConsumerGroupOptionalParams, + ) => + createEventHubConsumerGroup( + context, + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + consumerGroupBody, + options, + ), + getEventHubConsumerGroup: ( + resourceGroupName: string, + resourceName: string, + eventHubEndpointName: string, + name: string, + options?: IotHubResourceGetEventHubConsumerGroupOptionalParams, + ) => + getEventHubConsumerGroup( + context, + resourceGroupName, + resourceName, + eventHubEndpointName, + name, + options, + ), + getStats: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceGetStatsOptionalParams, + ) => getStats(context, resourceGroupName, resourceName, options), + importDevices: ( + resourceGroupName: string, + resourceName: string, + importDevicesParameters: ImportDevicesRequest, + options?: IotHubResourceImportDevicesOptionalParams, + ) => importDevices(context, resourceGroupName, resourceName, importDevicesParameters, options), + exportDevices: ( + resourceGroupName: string, + resourceName: string, + exportDevicesParameters: ExportDevicesRequest, + options?: IotHubResourceExportDevicesOptionalParams, + ) => exportDevices(context, resourceGroupName, resourceName, exportDevicesParameters, options), + getKeysForKeyName: ( + resourceGroupName: string, + resourceName: string, + keyName: string, + options?: IotHubResourceGetKeysForKeyNameOptionalParams, + ) => getKeysForKeyName(context, resourceGroupName, resourceName, keyName, options), + listKeys: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceListKeysOptionalParams, + ) => listKeys(context, resourceGroupName, resourceName, options), + testRoute: ( + iotHubName: string, + resourceGroupName: string, + input: TestRouteInput, + options?: IotHubResourceTestRouteOptionalParams, + ) => testRoute(context, iotHubName, resourceGroupName, input, options), + testAllRoutes: ( + iotHubName: string, + resourceGroupName: string, + input: TestAllRoutesInput, + options?: IotHubResourceTestAllRoutesOptionalParams, + ) => testAllRoutes(context, iotHubName, resourceGroupName, input, options), + listEndpointHealth: ( + resourceGroupName: string, + iotHubName: string, + options?: IotHubResourceListEndpointHealthOptionalParams, + ) => listEndpointHealth(context, resourceGroupName, iotHubName, options), + listQuotaMetrics: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceListQuotaMetricsOptionalParams, + ) => listQuotaMetrics(context, resourceGroupName, resourceName, options), + getJob: ( + resourceGroupName: string, + resourceName: string, + jobId: string, + options?: IotHubResourceGetJobOptionalParams, + ) => getJob(context, resourceGroupName, resourceName, jobId, options), + listJobs: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceListJobsOptionalParams, + ) => listJobs(context, resourceGroupName, resourceName, options), + listValidSkus: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceListValidSkusOptionalParams, + ) => listValidSkus(context, resourceGroupName, resourceName, options), + listBySubscription: (options?: IotHubResourceListBySubscriptionOptionalParams) => + listBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: IotHubResourceListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceDeleteOptionalParams, + ) => $delete(context, resourceGroupName, resourceName, options), + beginDelete: async ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, resourceName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, resourceName, options); + }, + update: ( + resourceGroupName: string, + resourceName: string, + iotHubTags: TagsResource, + options?: IotHubResourceUpdateOptionalParams, + ) => update(context, resourceGroupName, resourceName, iotHubTags, options), + beginUpdate: async ( + resourceGroupName: string, + resourceName: string, + iotHubTags: TagsResource, + options?: IotHubResourceUpdateOptionalParams, + ) => { + const poller = update(context, resourceGroupName, resourceName, iotHubTags, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + resourceName: string, + iotHubTags: TagsResource, + options?: IotHubResourceUpdateOptionalParams, + ) => { + return await update(context, resourceGroupName, resourceName, iotHubTags, options); + }, + createOrUpdate: ( + resourceGroupName: string, + resourceName: string, + iotHubDescription: IotHubDescription, + options?: IotHubResourceCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, resourceName, iotHubDescription, options), + beginCreateOrUpdate: async ( + resourceGroupName: string, + resourceName: string, + iotHubDescription: IotHubDescription, + options?: IotHubResourceCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + resourceName, + iotHubDescription, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + resourceName: string, + iotHubDescription: IotHubDescription, + options?: IotHubResourceCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + resourceName, + iotHubDescription, + options, + ); + }, + get: ( + resourceGroupName: string, + resourceName: string, + options?: IotHubResourceGetOptionalParams, + ) => get(context, resourceGroupName, resourceName, options), + }; +} + +export function _getIotHubResourceOperations(context: IotHubContext): IotHubResourceOperations { + return { + ..._getIotHubResource(context), + }; +} diff --git a/sdk/iothub/arm-iothub/src/classic/operations/index.ts b/sdk/iothub/arm-iothub/src/classic/operations/index.ts new file mode 100644 index 000000000000..540adc0e564d --- /dev/null +++ b/sdk/iothub/arm-iothub/src/classic/operations/index.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext } from "../../api/iotHubContext.js"; +import { list } from "../../api/operations/operations.js"; +import type { OperationsListOptionalParams } from "../../api/operations/options.js"; +import type { Operation } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +function _getOperations(context: IotHubContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations(context: IotHubContext): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/iothub/arm-iothub/src/classic/privateEndpointConnections/index.ts b/sdk/iothub/arm-iothub/src/classic/privateEndpointConnections/index.ts new file mode 100644 index 000000000000..5acd64a80b9c --- /dev/null +++ b/sdk/iothub/arm-iothub/src/classic/privateEndpointConnections/index.ts @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext } from "../../api/iotHubContext.js"; +import { list, $delete, update, get } from "../../api/privateEndpointConnections/operations.js"; +import type { + PrivateEndpointConnectionsListOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsUpdateOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, +} from "../../api/privateEndpointConnections/options.js"; +import type { PrivateEndpointConnection } from "../../models/models.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a PrivateEndpointConnections operations. */ +export interface PrivateEndpointConnectionsOperations { + /** List private endpoint connection properties */ + list: ( + resourceGroupName: string, + resourceName: string, + options?: PrivateEndpointConnectionsListOptionalParams, + ) => Promise; + /** Delete private endpoint connection with the specified name */ + delete: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => PollerLike, PrivateEndpointConnection>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => Promise< + SimplePollerLike, PrivateEndpointConnection> + >; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => Promise; + /** Update the status of a private endpoint connection with the specified name */ + update: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => PollerLike, PrivateEndpointConnection>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => Promise< + SimplePollerLike, PrivateEndpointConnection> + >; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => Promise; + /** Get private endpoint connection properties */ + get: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams, + ) => Promise; +} + +function _getPrivateEndpointConnections(context: IotHubContext) { + return { + list: ( + resourceGroupName: string, + resourceName: string, + options?: PrivateEndpointConnectionsListOptionalParams, + ) => list(context, resourceGroupName, resourceName, options), + delete: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, resourceName, privateEndpointConnectionName, options), + beginDelete: async ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => { + const poller = $delete( + context, + resourceGroupName, + resourceName, + privateEndpointConnectionName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => { + return await $delete( + context, + resourceGroupName, + resourceName, + privateEndpointConnectionName, + options, + ); + }, + update: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => + update( + context, + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + options, + ), + beginUpdate: async ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => { + const poller = update( + context, + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => { + return await update( + context, + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + options, + ); + }, + get: ( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams, + ) => get(context, resourceGroupName, resourceName, privateEndpointConnectionName, options), + }; +} + +export function _getPrivateEndpointConnectionsOperations( + context: IotHubContext, +): PrivateEndpointConnectionsOperations { + return { + ..._getPrivateEndpointConnections(context), + }; +} diff --git a/sdk/iothub/arm-iothub/src/classic/privateLinkResources/index.ts b/sdk/iothub/arm-iothub/src/classic/privateLinkResources/index.ts new file mode 100644 index 000000000000..66ab7ace794a --- /dev/null +++ b/sdk/iothub/arm-iothub/src/classic/privateLinkResources/index.ts @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext } from "../../api/iotHubContext.js"; +import { list, get } from "../../api/privateLinkResources/operations.js"; +import type { + PrivateLinkResourcesListOptionalParams, + PrivateLinkResourcesGetOptionalParams, +} from "../../api/privateLinkResources/options.js"; +import type { GroupIdInformation, PrivateLinkResources } from "../../models/models.js"; + +/** Interface representing a PrivateLinkResources operations. */ +export interface PrivateLinkResourcesOperations { + /** List private link resources for the given IotHub */ + list: ( + resourceGroupName: string, + resourceName: string, + options?: PrivateLinkResourcesListOptionalParams, + ) => Promise; + /** Get the specified private link resource for the given IotHub */ + get: ( + resourceGroupName: string, + resourceName: string, + groupId: string, + options?: PrivateLinkResourcesGetOptionalParams, + ) => Promise; +} + +function _getPrivateLinkResources(context: IotHubContext) { + return { + list: ( + resourceGroupName: string, + resourceName: string, + options?: PrivateLinkResourcesListOptionalParams, + ) => list(context, resourceGroupName, resourceName, options), + get: ( + resourceGroupName: string, + resourceName: string, + groupId: string, + options?: PrivateLinkResourcesGetOptionalParams, + ) => get(context, resourceGroupName, resourceName, groupId, options), + }; +} + +export function _getPrivateLinkResourcesOperations( + context: IotHubContext, +): PrivateLinkResourcesOperations { + return { + ..._getPrivateLinkResources(context), + }; +} diff --git a/sdk/iothub/arm-iothub/src/classic/resourceProviderCommon/index.ts b/sdk/iothub/arm-iothub/src/classic/resourceProviderCommon/index.ts new file mode 100644 index 000000000000..7e2722953cfa --- /dev/null +++ b/sdk/iothub/arm-iothub/src/classic/resourceProviderCommon/index.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubContext } from "../../api/iotHubContext.js"; +import { getSubscriptionQuota } from "../../api/resourceProviderCommon/operations.js"; +import type { ResourceProviderCommonGetSubscriptionQuotaOptionalParams } from "../../api/resourceProviderCommon/options.js"; +import type { UserSubscriptionQuotaListResult } from "../../models/models.js"; + +/** Interface representing a ResourceProviderCommon operations. */ +export interface ResourceProviderCommonOperations { + /** Get the number of free and paid iot hubs in the subscription */ + getSubscriptionQuota: ( + options?: ResourceProviderCommonGetSubscriptionQuotaOptionalParams, + ) => Promise; +} + +function _getResourceProviderCommon(context: IotHubContext) { + return { + getSubscriptionQuota: (options?: ResourceProviderCommonGetSubscriptionQuotaOptionalParams) => + getSubscriptionQuota(context, options), + }; +} + +export function _getResourceProviderCommonOperations( + context: IotHubContext, +): ResourceProviderCommonOperations { + return { + ..._getResourceProviderCommon(context), + }; +} diff --git a/sdk/iothub/arm-iothub/src/index.ts b/sdk/iothub/arm-iothub/src/index.ts index 817facb7b2f8..61cbb3b1ffa7 100644 --- a/sdk/iothub/arm-iothub/src/index.ts +++ b/sdk/iothub/arm-iothub/src/index.ts @@ -1,13 +1,203 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { AzureSupportedClouds } from "./static-helpers/cloudSettingHelpers.js"; +import { AzureClouds } from "./static-helpers/cloudSettingHelpers.js"; +import type { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; export { IotHubClient } from "./iotHubClient.js"; -export * from "./operationsInterfaces/index.js"; +export type { SimplePollerLike } from "./static-helpers/simplePollerHelpers.js"; +export type { RestorePollerOptions } from "./restorePollerHelpers.js"; +export { restorePoller } from "./restorePollerHelpers.js"; +export type { + Operation, + OperationDisplay, + ErrorDetails, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + PrivateLinkServiceConnectionStatus, + ProxyResource, + Resource, + SystemData, + CreatedByType, + IotHubDescription, + IotHubProperties, + SharedAccessSignatureAuthorizationRule, + AccessRights, + PublicNetworkAccess, + IpFilterRule, + IpFilterActionType, + NetworkRuleSetProperties, + DefaultAction, + NetworkRuleSetIpRule, + NetworkRuleIPAction, + EventHubProperties, + RoutingProperties, + RoutingEndpoints, + RoutingServiceBusQueueEndpointProperties, + AuthenticationType, + ManagedIdentity, + RoutingServiceBusTopicEndpointProperties, + RoutingEventHubProperties, + RoutingStorageContainerProperties, + RoutingStorageContainerPropertiesEncoding, + RoutingCosmosDBSqlApiProperties, + RouteProperties, + RoutingSource, + FallbackRouteProperties, + EnrichmentProperties, + StorageEndpointProperties, + MessagingEndpointProperties, + CloudToDeviceProperties, + FeedbackProperties, + IotHubPropertiesDeviceStreams, + Capabilities, + EncryptionPropertiesDescription, + KeyVaultKeyProperties, + IotHubLocationDescription, + IotHubReplicaRoleType, + RootCertificateProperties, + IpVersion, + DeviceRegistry, + IotHubDetails, + GatewayVersion, + IotHubSkuInfo, + IotHubSku, + IotHubSkuTier, + ArmIdentity, + ResourceIdentityType, + ArmUserIdentity, + TrackedResource, + TagsResource, + IotHubSkuDescription, + IotHubCapacity, + IotHubScaleType, + JobResponse, + JobType, + JobStatus, + IotHubQuotaMetricInfo, + EndpointHealthData, + EndpointHealthStatus, + TestAllRoutesInput, + RoutingMessage, + RoutingTwin, + RoutingTwinProperties, + TestAllRoutesResult, + MatchedRoute, + TestRouteInput, + TestRouteResult, + TestResultStatus, + TestRouteResultDetails, + RouteCompilationError, + RouteErrorSeverity, + RouteErrorRange, + RouteErrorPosition, + ExportDevicesRequest, + ImportDevicesRequest, + RegistryStatistics, + EventHubConsumerGroupInfo, + EventHubConsumerGroupBodyDescription, + EventHubConsumerGroupName, + OperationInputs, + IotHubNameAvailabilityInfo, + IotHubNameUnavailabilityReason, + FailoverInput, + CertificateDescription, + CertificateProperties, + CertificateListDescription, + CertificateWithNonceDescription, + CertificatePropertiesWithNonce, + CertificateVerificationDescription, + GroupIdInformation, + GroupIdInformationProperties, + PrivateLinkResources, + UserSubscriptionQuotaListResult, + UserSubscriptionQuota, + Name, +} from "./models/index.js"; +export { + KnownPrivateLinkServiceConnectionStatus, + KnownCreatedByType, + KnownPublicNetworkAccess, + KnownDefaultAction, + KnownNetworkRuleIPAction, + KnownAuthenticationType, + KnownRoutingStorageContainerPropertiesEncoding, + KnownRoutingSource, + KnownCapabilities, + KnownIotHubReplicaRoleType, + KnownIpVersion, + KnownGatewayVersion, + KnownIotHubSku, + KnownJobType, + KnownEndpointHealthStatus, + KnownTestResultStatus, + KnownRouteErrorSeverity, + KnownVersions, +} from "./models/index.js"; +export type { IotHubClientOptionalParams } from "./api/index.js"; +export type { + CertificatesVerifyOptionalParams, + CertificatesGenerateVerificationCodeOptionalParams, + CertificatesListByIotHubOptionalParams, + CertificatesDeleteOptionalParams, + CertificatesCreateOrUpdateOptionalParams, + CertificatesGetOptionalParams, +} from "./api/certificates/index.js"; +export type { IotHubManualFailoverOptionalParams } from "./api/iotHub/index.js"; +export type { + IotHubResourceCheckNameAvailabilityOptionalParams, + IotHubResourceListEventHubConsumerGroupsOptionalParams, + IotHubResourceDeleteEventHubConsumerGroupOptionalParams, + IotHubResourceCreateEventHubConsumerGroupOptionalParams, + IotHubResourceGetEventHubConsumerGroupOptionalParams, + IotHubResourceGetStatsOptionalParams, + IotHubResourceImportDevicesOptionalParams, + IotHubResourceExportDevicesOptionalParams, + IotHubResourceGetKeysForKeyNameOptionalParams, + IotHubResourceListKeysOptionalParams, + IotHubResourceTestRouteOptionalParams, + IotHubResourceTestAllRoutesOptionalParams, + IotHubResourceListEndpointHealthOptionalParams, + IotHubResourceListQuotaMetricsOptionalParams, + IotHubResourceGetJobOptionalParams, + IotHubResourceListJobsOptionalParams, + IotHubResourceListValidSkusOptionalParams, + IotHubResourceListBySubscriptionOptionalParams, + IotHubResourceListByResourceGroupOptionalParams, + IotHubResourceDeleteOptionalParams, + IotHubResourceUpdateOptionalParams, + IotHubResourceCreateOrUpdateOptionalParams, + IotHubResourceGetOptionalParams, +} from "./api/iotHubResource/index.js"; +export type { OperationsListOptionalParams } from "./api/operations/index.js"; +export type { + PrivateEndpointConnectionsListOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsUpdateOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, +} from "./api/privateEndpointConnections/index.js"; +export type { + PrivateLinkResourcesListOptionalParams, + PrivateLinkResourcesGetOptionalParams, +} from "./api/privateLinkResources/index.js"; +export type { ResourceProviderCommonGetSubscriptionQuotaOptionalParams } from "./api/resourceProviderCommon/index.js"; +export type { + CertificatesOperations, + IotHubOperations, + IotHubResourceOperations, + OperationsOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResourceProviderCommonOperations, +} from "./classic/index.js"; +export type { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds }; +export type { AzureSupportedClouds }; +export { RestError, isRestError } from "@azure/core-rest-pipeline"; diff --git a/sdk/iothub/arm-iothub/src/iotHubClient.ts b/sdk/iothub/arm-iothub/src/iotHubClient.ts index d810b014999e..eb8762ca13ea 100644 --- a/sdk/iothub/arm-iothub/src/iotHubClient.ts +++ b/sdk/iothub/arm-iothub/src/iotHubClient.ts @@ -1,158 +1,83 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -import * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; -import type { PipelineRequest, PipelineResponse, SendRequest } from "@azure/core-rest-pipeline"; -import type * as coreAuth from "@azure/core-auth"; -import { - OperationsImpl, - IotHubResourceImpl, - ResourceProviderCommonImpl, - CertificatesImpl, - IotHubImpl, - PrivateLinkResourcesOperationsImpl, - PrivateEndpointConnectionsImpl, -} from "./operations/index.js"; -import type { - Operations, - IotHubResource, - ResourceProviderCommon, - Certificates, - IotHub, - PrivateLinkResourcesOperations, - PrivateEndpointConnections, -} from "./operationsInterfaces/index.js"; -import type { IotHubClientOptionalParams } from "./models/index.js"; +import type { IotHubContext, IotHubClientOptionalParams } from "./api/index.js"; +import { createIotHub } from "./api/index.js"; +import type { CertificatesOperations } from "./classic/certificates/index.js"; +import { _getCertificatesOperations } from "./classic/certificates/index.js"; +import type { IotHubOperations } from "./classic/iotHub/index.js"; +import { _getIotHubOperations } from "./classic/iotHub/index.js"; +import type { IotHubResourceOperations } from "./classic/iotHubResource/index.js"; +import { _getIotHubResourceOperations } from "./classic/iotHubResource/index.js"; +import type { OperationsOperations } from "./classic/operations/index.js"; +import { _getOperationsOperations } from "./classic/operations/index.js"; +import type { PrivateEndpointConnectionsOperations } from "./classic/privateEndpointConnections/index.js"; +import { _getPrivateEndpointConnectionsOperations } from "./classic/privateEndpointConnections/index.js"; +import type { PrivateLinkResourcesOperations } from "./classic/privateLinkResources/index.js"; +import { _getPrivateLinkResourcesOperations } from "./classic/privateLinkResources/index.js"; +import type { ResourceProviderCommonOperations } from "./classic/resourceProviderCommon/index.js"; +import { _getResourceProviderCommonOperations } from "./classic/resourceProviderCommon/index.js"; +import type { TokenCredential } from "@azure/core-auth"; +import type { Pipeline } from "@azure/core-rest-pipeline"; -export class IotHubClient extends coreClient.ServiceClient { - $host: string; - apiVersion: string; - subscriptionId: string; +export type { IotHubClientOptionalParams } from "./api/iotHubContext.js"; - /** - * Initializes a new instance of the IotHubClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The subscription identifier. - * @param options The parameter options - */ +export class IotHubClient { + private _client: IotHubContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + constructor(credential: TokenCredential, options?: IotHubClientOptionalParams); constructor( - credentials: coreAuth.TokenCredential, + credential: TokenCredential, subscriptionId: string, options?: IotHubClientOptionalParams, + ); + /** Use this API to manage the IoT hubs in your Azure subscription. */ + constructor( + credential: TokenCredential, + subscriptionIdOrOptions?: string | IotHubClientOptionalParams, + options?: IotHubClientOptionalParams, ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } - if (subscriptionId === undefined) { - throw new Error("'subscriptionId' cannot be null"); - } + let subscriptionId: string | undefined; - // Initializing default values for options - if (!options) { - options = {}; + if (typeof subscriptionIdOrOptions === "string") { + subscriptionId = subscriptionIdOrOptions; + } else if (typeof subscriptionIdOrOptions === "object") { + options = subscriptionIdOrOptions; } - const defaults: IotHubClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials, - }; - - const packageDetails = `azsdk-js-arm-iothub/7.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - const optionsWithDefaults = { - ...defaults, + options = options ?? {}; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createIotHub(credential, subscriptionId ?? "", { ...options, - userAgentOptions: { - userAgentPrefix, - }, - endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com", - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = - options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === coreRestPipeline.bearerTokenAuthenticationPolicyName, - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName, - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge, - }, - }), - ); - } - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2025-08-01-preview"; - this.operations = new OperationsImpl(this); - this.iotHubResource = new IotHubResourceImpl(this); - this.resourceProviderCommon = new ResourceProviderCommonImpl(this); - this.certificates = new CertificatesImpl(this); - this.iotHub = new IotHubImpl(this); - this.privateLinkResourcesOperations = new PrivateLinkResourcesOperationsImpl(this); - this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest(request: PipelineRequest, next: SendRequest): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - }, - }; - this.pipeline.addPolicy(apiVersionPolicy); + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.resourceProviderCommon = _getResourceProviderCommonOperations(this._client); + this.privateLinkResources = _getPrivateLinkResourcesOperations(this._client); + this.certificates = _getCertificatesOperations(this._client); + this.iotHub = _getIotHubOperations(this._client); + this.iotHubResource = _getIotHubResourceOperations(this._client); + this.privateEndpointConnections = _getPrivateEndpointConnectionsOperations(this._client); + this.operations = _getOperationsOperations(this._client); } - operations: Operations; - iotHubResource: IotHubResource; - resourceProviderCommon: ResourceProviderCommon; - certificates: Certificates; - iotHub: IotHub; - privateLinkResourcesOperations: PrivateLinkResourcesOperations; - privateEndpointConnections: PrivateEndpointConnections; + /** The operation groups for resourceProviderCommon */ + public readonly resourceProviderCommon: ResourceProviderCommonOperations; + /** The operation groups for privateLinkResources */ + public readonly privateLinkResources: PrivateLinkResourcesOperations; + /** The operation groups for certificates */ + public readonly certificates: CertificatesOperations; + /** The operation groups for iotHub */ + public readonly iotHub: IotHubOperations; + /** The operation groups for iotHubResource */ + public readonly iotHubResource: IotHubResourceOperations; + /** The operation groups for privateEndpointConnections */ + public readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; } diff --git a/sdk/iothub/arm-iothub/src/logger.ts b/sdk/iothub/arm-iothub/src/logger.ts new file mode 100644 index 000000000000..f9464689b800 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-iothub"); diff --git a/sdk/iothub/arm-iothub/src/lroImpl.ts b/sdk/iothub/arm-iothub/src/lroImpl.ts deleted file mode 100644 index b31bfb513809..000000000000 --- a/sdk/iothub/arm-iothub/src/lroImpl.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { AbortSignalLike } from "@azure/abort-controller"; -import type { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: (path: string, options?: { abortSignal?: AbortSignalLike }) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal, - }); - }, - }; -} diff --git a/sdk/iothub/arm-iothub/src/models/index.ts b/sdk/iothub/arm-iothub/src/models/index.ts index 341f047d1c18..362779ea0253 100644 --- a/sdk/iothub/arm-iothub/src/models/index.ts +++ b/sdk/iothub/arm-iothub/src/models/index.ts @@ -1,2076 +1,131 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type * as coreClient from "@azure/core-client"; - -/** Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. */ -export interface OperationListResult { - /** - * List of IoT Hub operations supported by the Microsoft.Devices resource provider. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Operation[]; - /** - * URL to get the next set of operation list results if there are any. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** IoT Hub REST API operation */ -export interface Operation { - /** - * Operation name: {provider}/{resource}/{read | write | action | delete} - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** The object that represents the operation. */ - display?: OperationDisplay; -} - -/** The object that represents the operation. */ -export interface OperationDisplay { - /** - * Service provider: Microsoft Devices - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provider?: string; - /** - * Resource Type: IotHubs - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resource?: string; - /** - * Name of the operation - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly operation?: string; - /** - * Description of the operation - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** Error details. */ -export interface ErrorDetails { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The HTTP status code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly httpStatusCode?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; - /** - * The error details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: string; -} - -/** The properties of an IoT hub. */ -export interface IotHubProperties { - /** The shared access policies you can use to secure a connection to the IoT hub. */ - authorizationPolicies?: SharedAccessSignatureAuthorizationRule[]; - /** If true, SAS tokens with Iot hub scoped SAS keys cannot be used for authentication. */ - disableLocalAuth?: boolean; - /** If true, all device(including Edge devices but excluding modules) scoped SAS keys cannot be used for authentication. */ - disableDeviceSAS?: boolean; - /** If true, all module scoped SAS keys cannot be used for authentication. */ - disableModuleSAS?: boolean; - /** If true, egress from IotHub will be restricted to only the allowed FQDNs that are configured via allowedFqdnList. */ - restrictOutboundNetworkAccess?: boolean; - /** List of allowed FQDNs(Fully Qualified Domain Name) for egress from Iot Hub. */ - allowedFqdnList?: string[]; - /** Whether requests from Public Network are allowed */ - publicNetworkAccess?: PublicNetworkAccess; - /** The IP filter rules. */ - ipFilterRules?: IpFilterRule[]; - /** Network Rule Set Properties of IotHub */ - networkRuleSets?: NetworkRuleSetProperties; - /** Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to have clients that use a TLS version below 1.2 to be rejected. */ - minTlsVersion?: string; - /** Private endpoint connections created on this IotHub */ - privateEndpointConnections?: PrivateEndpointConnection[]; - /** - * The provisioning state. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: string; - /** - * The hub state. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly state?: string; - /** - * The name of the host. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly hostName?: string; - /** 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 }; - /** The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging */ - routing?: RoutingProperties; - /** The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. */ - storageEndpoints?: { [propertyName: string]: StorageEndpointProperties }; - /** The messaging endpoint properties for the file upload notification queue. */ - messagingEndpoints?: { [propertyName: string]: MessagingEndpointProperties }; - /** If True, file upload notifications are enabled. */ - enableFileUploadNotifications?: boolean; - /** The IoT hub cloud-to-device messaging properties. */ - cloudToDevice?: CloudToDeviceProperties; - /** IoT hub comments. */ - comments?: string; - /** The device streams properties of iothub. */ - deviceStreams?: IotHubPropertiesDeviceStreams; - /** The capabilities and features enabled for the IoT hub. */ - features?: Capabilities; - /** The encryption properties for the IoT hub. */ - encryption?: EncryptionPropertiesDescription; - /** - * Primary and secondary location for iot hub - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly locations?: IotHubLocationDescription[]; - /** This property when set to true, will enable data residency, thus, disabling disaster recovery. */ - enableDataResidency?: boolean; - /** This property store root certificate related information */ - rootCertificate?: RootCertificateProperties; - /** This property specifies the IP Version the hub is currently utilizing. */ - ipVersion?: IpVersion; - /** Represents properties related to the Azure Device Registry (ADR). */ - deviceRegistry?: DeviceRegistry; -} - -/** The properties of an IoT hub shared access policy. */ -export interface SharedAccessSignatureAuthorizationRule { - /** The name of the shared access policy. */ - keyName: string; - /** The primary key. */ - primaryKey?: string; - /** The secondary key. */ - secondaryKey?: string; - /** The permissions assigned to the shared access policy. */ - rights: AccessRights; -} - -/** The IP filter rules for the IoT hub. */ -export interface IpFilterRule { - /** The name of the IP filter rule. */ - filterName: string; - /** The desired action for requests captured by this rule. */ - action: IpFilterActionType; - /** A string that contains the IP address range in CIDR notation for the rule. */ - ipMask: string; -} - -/** Network Rule Set Properties of IotHub */ -export interface NetworkRuleSetProperties { - /** Default Action for Network Rule Set */ - defaultAction?: DefaultAction; - /** If True, then Network Rule Set is also applied to BuiltIn EventHub EndPoint of IotHub */ - applyToBuiltInEventHubEndpoint: boolean; - /** List of IP Rules */ - ipRules: NetworkRuleSetIpRule[]; -} - -/** IP Rule to be applied as part of Network Rule Set */ -export interface NetworkRuleSetIpRule { - /** Name of the IP filter rule. */ - filterName: string; - /** IP Filter Action */ - action?: NetworkRuleIPAction; - /** A string that contains the IP address range in CIDR notation for the rule. */ - ipMask: string; -} - -/** The private endpoint connection of an IotHub */ -export interface PrivateEndpointConnection { - /** - * The resource identifier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The resource name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** The properties of a private endpoint connection */ - properties: PrivateEndpointConnectionProperties; -} - -/** The properties of a private endpoint connection */ -export interface PrivateEndpointConnectionProperties { - /** The private endpoint property of a private endpoint connection */ - privateEndpoint?: PrivateEndpoint; - /** The current state of a private endpoint connection */ - privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; -} - -/** The private endpoint property of a private endpoint connection */ -export interface PrivateEndpoint { - /** - * The resource identifier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; -} - -/** The current state of a private endpoint connection */ -export interface PrivateLinkServiceConnectionState { - /** The status of a private endpoint connection */ - status: PrivateLinkServiceConnectionStatus; - /** The description for the current state of a private endpoint connection */ - description: string; - /** Actions required for a private endpoint connection */ - actionsRequired?: string; -} - -/** The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. */ -export interface EventHubProperties { - /** The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages */ - retentionTimeInDays?: number; - /** The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. */ - partitionCount?: number; - /** - * The partition ids in the Event Hub-compatible endpoint. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly partitionIds?: string[]; - /** - * The Event Hub-compatible name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly path?: string; - /** - * The Event Hub-compatible endpoint. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly endpoint?: string; -} - -/** The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging */ -export interface RoutingProperties { - /** The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. */ - endpoints?: RoutingEndpoints; - /** The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. */ - routes?: RouteProperties[]; - /** The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. */ - fallbackRoute?: FallbackRouteProperties; - /** 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[]; -} - -/** The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. */ -export interface RoutingEndpoints { - /** The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. */ - serviceBusQueues?: RoutingServiceBusQueueEndpointProperties[]; - /** The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. */ - serviceBusTopics?: RoutingServiceBusTopicEndpointProperties[]; - /** The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. */ - eventHubs?: RoutingEventHubProperties[]; - /** The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. */ - storageContainers?: RoutingStorageContainerProperties[]; - /** The list of Cosmos DB container endpoints that IoT hub routes messages to, based on the routing rules. */ - cosmosDBSqlContainers?: RoutingCosmosDBSqlApiProperties[]; -} - -/** The properties related to service bus queue endpoint types. */ -export interface RoutingServiceBusQueueEndpointProperties { - /** Id of the service bus queue endpoint */ - id?: string; - /** The connection string of the service bus queue endpoint. */ - connectionString?: string; - /** The url of the service bus queue endpoint. It must include the protocol sb:// */ - endpointUri?: string; - /** Queue name on the service bus namespace */ - entityPath?: string; - /** Method used to authenticate against the service bus queue endpoint */ - authenticationType?: AuthenticationType; - /** Managed identity properties of routing service bus queue endpoint. */ - identity?: ManagedIdentity; - /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual queue name. */ - name: string; - /** The subscription identifier of the service bus queue endpoint. */ - subscriptionId?: string; - /** The name of the resource group of the service bus queue endpoint. */ - resourceGroup?: string; -} - -/** The properties of the Managed identity. */ -export interface ManagedIdentity { - /** The user assigned identity. */ - userAssignedIdentity?: string; -} - -/** The properties related to service bus topic endpoint types. */ -export interface RoutingServiceBusTopicEndpointProperties { - /** Id of the service bus topic endpoint */ - id?: string; - /** The connection string of the service bus topic endpoint. */ - connectionString?: string; - /** The url of the service bus topic endpoint. It must include the protocol sb:// */ - endpointUri?: string; - /** Queue name on the service bus topic */ - entityPath?: string; - /** Method used to authenticate against the service bus topic endpoint */ - authenticationType?: AuthenticationType; - /** Managed identity properties of routing service bus topic endpoint. */ - identity?: ManagedIdentity; - /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual topic name. */ - name: string; - /** The subscription identifier of the service bus topic endpoint. */ - subscriptionId?: string; - /** The name of the resource group of the service bus topic endpoint. */ - resourceGroup?: string; -} - -/** The properties related to an event hub endpoint. */ -export interface RoutingEventHubProperties { - /** Id of the event hub endpoint */ - id?: string; - /** The connection string of the event hub endpoint. */ - connectionString?: string; - /** The url of the event hub endpoint. It must include the protocol sb:// */ - endpointUri?: string; - /** Event hub name on the event hub namespace */ - entityPath?: string; - /** Method used to authenticate against the event hub endpoint */ - authenticationType?: AuthenticationType; - /** Managed identity properties of routing event hub endpoint. */ - identity?: ManagedIdentity; - /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. */ - name: string; - /** The subscription identifier of the event hub endpoint. */ - subscriptionId?: string; - /** The name of the resource group of the event hub endpoint. */ - resourceGroup?: string; -} - -/** The properties related to a storage container endpoint. */ -export interface RoutingStorageContainerProperties { - /** Id of the storage container endpoint */ - id?: string; - /** The connection string of the storage account. */ - connectionString?: string; - /** The url of the storage endpoint. It must include the protocol https:// */ - endpointUri?: string; - /** Method used to authenticate against the storage endpoint */ - authenticationType?: AuthenticationType; - /** Managed identity properties of routing storage endpoint. */ - identity?: ManagedIdentity; - /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. */ - name: string; - /** The subscription identifier of the storage account. */ - subscriptionId?: string; - /** The name of the resource group of the storage account. */ - resourceGroup?: string; - /** The name of storage container in the storage account. */ - containerName: string; - /** File name format for the blob. Default format is {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be reordered. */ - fileNameFormat?: string; - /** Time interval at which blobs are written to storage. Value should be between 60 and 720 seconds. Default value is 300 seconds. */ - batchFrequencyInSeconds?: number; - /** Maximum number of bytes for each blob written to storage. Value should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). */ - maxChunkSizeInBytes?: number; - /** Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. */ - encoding?: RoutingStorageContainerPropertiesEncoding; -} - -/** The properties related to a cosmos DB sql container endpoint. */ -export interface RoutingCosmosDBSqlApiProperties { - /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. */ - name: string; - /** - * Id of the cosmos DB sql container endpoint - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** The subscription identifier of the cosmos DB account. */ - subscriptionId?: string; - /** The name of the resource group of the cosmos DB account. */ - resourceGroup?: string; - /** The url of the cosmos DB account. It must include the protocol https:// */ - endpointUri: string; - /** Method used to authenticate against the cosmos DB sql container endpoint */ - authenticationType?: AuthenticationType; - /** Managed identity properties of routing cosmos DB container endpoint. */ - identity?: ManagedIdentity; - /** The primary key of the cosmos DB account. */ - primaryKey?: string; - /** The secondary key of the cosmos DB account. */ - secondaryKey?: string; - /** The name of the cosmos DB database in the cosmos DB account. */ - databaseName: string; - /** The name of the cosmos DB sql container in the cosmos DB database. */ - containerName: string; - /** The name of the partition key associated with this cosmos DB sql container if one exists. This is an optional parameter. */ - partitionKeyName?: string; - /** The template for generating a synthetic partition key value for use with this cosmos DB sql container. The template must include at least one of the following placeholders: {iothub}, {deviceid}, {DD}, {MM}, and {YYYY}. Any one placeholder may be specified at most once, but order and non-placeholder components are arbitrary. This parameter is only required if PartitionKeyName is specified. */ - partitionKeyTemplate?: string; -} - -/** The properties of a routing rule that your IoT hub uses to route messages to endpoints. */ -export interface RouteProperties { - /** The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. */ - name: string; - /** The source that the routing rule is to be applied to, such as DeviceMessages. */ - source: RoutingSource; - /** The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language */ - condition?: string; - /** The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed. */ - endpointNames: string[]; - /** Used to specify whether a route is enabled. */ - isEnabled: boolean; -} - -/** The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. */ -export interface FallbackRouteProperties { - /** The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. */ - name?: string; - /** The source to which the routing rule is to be applied to. For example, DeviceMessages */ - source: RoutingSource; - /** The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language */ - condition?: string; - /** The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed. */ - endpointNames: string[]; - /** Used to specify whether the fallback route is enabled. */ - isEnabled: boolean; -} - -/** The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. */ -export interface EnrichmentProperties { - /** The key or name for the enrichment property. */ - key: string; - /** The value for the enrichment property. */ - value: string; - /** The list of endpoints for which the enrichment is applied to the message. */ - endpointNames: string[]; -} - -/** The properties of the Azure Storage endpoint for file upload. */ -export interface StorageEndpointProperties { - /** 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; - /** The connection string for the Azure Storage account to which files are uploaded. */ - connectionString: string; - /** The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified. */ - containerName: string; - /** Specifies authentication type being used for connecting to the storage account. */ - authenticationType?: AuthenticationType; - /** Managed identity properties of storage endpoint for file upload. */ - identity?: ManagedIdentity; -} - -/** The properties of the messaging endpoints used by this IoT hub. */ -export interface MessagingEndpointProperties { - /** The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. */ - lockDurationAsIso8601?: string; - /** The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. */ - ttlAsIso8601?: string; - /** The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. */ - maxDeliveryCount?: number; -} - -/** The IoT hub cloud-to-device messaging properties. */ -export interface CloudToDeviceProperties { - /** The max delivery count for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ - maxDeliveryCount?: number; - /** The default time to live for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ - defaultTtlAsIso8601?: string; - /** The properties of the feedback queue for cloud-to-device messages. */ - feedback?: FeedbackProperties; -} - -/** The properties of the feedback queue for cloud-to-device messages. */ -export interface FeedbackProperties { - /** The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ - lockDurationAsIso8601?: string; - /** The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ - ttlAsIso8601?: string; - /** The number of times the IoT hub attempts to deliver a message on the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ - maxDeliveryCount?: number; -} - -/** The device streams properties of iothub. */ -export interface IotHubPropertiesDeviceStreams { - /** List of Device Streams Endpoints. */ - streamingEndpoints?: string[]; -} - -/** The encryption properties for the IoT hub. */ -export interface EncryptionPropertiesDescription { - /** The source of the key. */ - keySource?: string; - /** The properties of the KeyVault key. */ - keyVaultProperties?: KeyVaultKeyProperties[]; -} - -/** The properties of the KeyVault key. */ -export interface KeyVaultKeyProperties { - /** The identifier of the key. */ - keyIdentifier?: string; - /** Managed identity properties of KeyVault Key. */ - identity?: ManagedIdentity; -} - -/** Public representation of one of the locations where a resource is provisioned. */ -export interface IotHubLocationDescription { - /** The name of the Azure region */ - location?: string; - /** The role of the region, can be either primary or secondary. The primary region is where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. */ - role?: IotHubReplicaRoleType; -} - -/** This property store root certificate related information */ -export interface RootCertificateProperties { - /** This property when set to true, hub will use G2 cert; while it's set to false, hub uses Baltimore Cert. */ - enableRootCertificateV2?: boolean; - /** - * the last update time to root certificate flag. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastUpdatedTimeUtc?: Date; -} - -/** Represents properties related to the Azure Device Registry (ADR). */ -export interface DeviceRegistry { - /** The identifier of the Azure Device Registry namespace associated with the GEN2 SKU hub. */ - namespaceResourceId?: string; - /** The identity used to manage the ADR namespace from the data plane. */ - identityResourceId?: string; -} - -/** Information about the SKU of the IoT hub. */ -export interface IotHubSkuInfo { - /** The name of the SKU. */ - name: IotHubSku; - /** - * The billing tier for the IoT hub. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly tier?: IotHubSkuTier; - /** The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. */ - capacity?: number; -} - -export interface ArmIdentity { - /** - * Principal Id - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly principalId?: string; - /** - * Tenant Id - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly tenantId?: string; - /** The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. */ - type?: ResourceIdentityType; - /** Dictionary of */ - userAssignedIdentities?: { [propertyName: string]: ArmUserIdentity }; -} - -export interface ArmUserIdentity { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly principalId?: string; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly clientId?: string; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** The common properties of an Azure resource. */ -export interface Resource { - /** - * The resource identifier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The resource name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** The resource location. */ - location: string; - /** The resource tags. */ - tags?: { [propertyName: string]: string }; -} - -/** A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. */ -export interface TagsResource { - /** Resource tags */ - tags?: { [propertyName: string]: string }; -} - -/** The JSON-serialized array of IotHubDescription objects with a next link. */ -export interface IotHubDescriptionListResult { - /** The array of IotHubDescription objects. */ - value?: IotHubDescription[]; - /** - * The next link. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Identity registry statistics. */ -export interface RegistryStatistics { - /** - * The total count of devices in the identity registry. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly totalDeviceCount?: number; - /** - * The count of enabled devices in the identity registry. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly enabledDeviceCount?: number; - /** - * The count of disabled devices in the identity registry. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly disabledDeviceCount?: number; -} - -/** The JSON-serialized array of IotHubSkuDescription objects with a next link. */ -export interface IotHubSkuDescriptionListResult { - /** The array of IotHubSkuDescription. */ - value?: IotHubSkuDescription[]; - /** - * The next link. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** SKU properties. */ -export interface IotHubSkuDescription { - /** - * The type of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resourceType?: string; - /** The type of the resource. */ - sku: IotHubSkuInfo; - /** IotHub capacity */ - capacity: IotHubCapacity; -} - -/** IoT Hub capacity information. */ -export interface IotHubCapacity { - /** - * The minimum number of units. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly minimum?: number; - /** - * The maximum number of units. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly maximum?: number; - /** - * The default number of units. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly default?: number; - /** - * The type of the scaling enabled. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly scaleType?: IotHubScaleType; -} - -/** The JSON-serialized array of Event Hub-compatible consumer group names with a next link. */ -export interface EventHubConsumerGroupsListResult { - /** List of consumer groups objects */ - value?: EventHubConsumerGroupInfo[]; - /** - * The next link. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of the EventHubConsumerGroupInfo object. */ -export interface EventHubConsumerGroupInfo { - /** The tags. */ - properties?: { [propertyName: string]: any }; - /** - * The Event Hub-compatible consumer group identifier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The Event Hub-compatible consumer group name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * the resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * The etag. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly etag?: string; -} - -/** The EventHub consumer group. */ -export interface EventHubConsumerGroupBodyDescription { - /** The EventHub consumer group name. */ - properties: EventHubConsumerGroupName; -} - -/** The EventHub consumer group name. */ -export interface EventHubConsumerGroupName { - /** EventHub consumer group name */ - name: string; -} - -/** The JSON-serialized array of JobResponse objects with a next link. */ -export interface JobResponseListResult { - /** The array of JobResponse objects. */ - value?: JobResponse[]; - /** - * The next link. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of the Job Response object. */ -export interface JobResponse { - /** - * The job identifier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly jobId?: string; - /** - * The start time of the job. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly startTimeUtc?: Date; - /** - * The time the job stopped processing. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly endTimeUtc?: Date; - /** - * The type of the job. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: JobType; - /** - * The status of the job. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: JobStatus; - /** - * If status == failed, this string containing the reason for the failure. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly failureReason?: string; - /** - * The status message for the job. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly statusMessage?: string; - /** - * The job identifier of the parent job, if any. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly parentJobId?: string; -} - -/** The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. */ -export interface IotHubQuotaMetricInfoListResult { - /** The array of quota metrics objects. */ - value?: IotHubQuotaMetricInfo[]; - /** - * The next link. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Quota metrics properties. */ -export interface IotHubQuotaMetricInfo { - /** - * The name of the quota metric. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The current value for the quota metric. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly currentValue?: number; - /** - * The maximum value of the quota metric. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly maxValue?: number; -} - -/** The JSON-serialized array of EndpointHealthData objects with a next link. */ -export interface EndpointHealthDataListResult { - /** JSON-serialized array of Endpoint health data */ - value?: EndpointHealthData[]; - /** - * Link to more results - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The health data for an endpoint */ -export interface EndpointHealthData { - /** Id of the endpoint */ - endpointId?: string; - /** 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 */ - healthStatus?: EndpointHealthStatus; - /** Last error obtained when a message failed to be delivered to iot hub */ - lastKnownError?: string; - /** Time at which the last known error occurred */ - lastKnownErrorTime?: Date; - /** Last time iot hub successfully sent a message to the endpoint */ - lastSuccessfulSendAttemptTime?: Date; - /** Last time iot hub tried to send a message to the endpoint */ - lastSendAttemptTime?: Date; -} - -/** Input values. */ -export interface OperationInputs { - /** The name of the IoT hub to check. */ - name: string; -} - -/** The properties indicating whether a given IoT hub name is available. */ -export interface IotHubNameAvailabilityInfo { - /** - * The value which indicates whether the provided name is available. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nameAvailable?: boolean; - /** - * The reason for unavailability. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly reason?: IotHubNameUnavailabilityReason; - /** The detailed reason message. */ - message?: string; -} - -/** Json-serialized array of User subscription quota response */ -export interface UserSubscriptionQuotaListResult { - value?: UserSubscriptionQuota[]; - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly nextLink?: string; -} - -/** User subscription quota response */ -export interface UserSubscriptionQuota { - /** IotHub type id */ - id?: string; - /** Response type */ - type?: string; - /** Unit of IotHub type */ - unit?: string; - /** Current number of IotHub type */ - currentValue?: number; - /** Numerical limit on IotHub type */ - limit?: number; - /** IotHub type */ - name?: Name; -} - -/** Name of Iot Hub type */ -export interface Name { - /** IotHub type */ - value?: string; - /** Localized value of name */ - localizedValue?: string; -} - -/** Input for testing all routes */ -export interface TestAllRoutesInput { - /** Routing source */ - routingSource?: RoutingSource; - /** Routing message */ - message?: RoutingMessage; - /** Routing Twin Reference */ - twin?: RoutingTwin; -} - -/** Routing message */ -export interface RoutingMessage { - /** Body of routing message */ - body?: string; - /** App properties */ - appProperties?: { [propertyName: string]: string }; - /** System properties */ - systemProperties?: { [propertyName: string]: string }; -} - -/** Twin reference input parameter. This is an optional parameter */ -export interface RoutingTwin { - /** Twin Tags */ - tags?: Record; - properties?: RoutingTwinProperties; -} - -export interface RoutingTwinProperties { - /** Twin desired properties */ - desired?: Record; - /** Twin desired properties */ - reported?: Record; -} - -/** Result of testing all routes */ -export interface TestAllRoutesResult { - /** JSON-serialized array of matched routes */ - routes?: MatchedRoute[]; -} - -/** Routes that matched */ -export interface MatchedRoute { - /** Properties of routes that matched */ - properties?: RouteProperties; -} - -/** Input for testing route */ -export interface TestRouteInput { - /** Routing message */ - message?: RoutingMessage; - /** Route properties */ - route: RouteProperties; - /** Routing Twin Reference */ - twin?: RoutingTwin; -} - -/** Result of testing one route */ -export interface TestRouteResult { - /** Result of testing route */ - result?: TestResultStatus; - /** Detailed result of testing route */ - details?: TestRouteResultDetails; -} - -/** Detailed result of testing a route */ -export interface TestRouteResultDetails { - /** JSON-serialized list of route compilation errors */ - compilationErrors?: RouteCompilationError[]; -} - -/** Compilation error when evaluating route */ -export interface RouteCompilationError { - /** Route error message */ - message?: string; - /** Severity of the route error */ - severity?: RouteErrorSeverity; - /** Location where the route error happened */ - location?: RouteErrorRange; -} - -/** Range of route errors */ -export interface RouteErrorRange { - /** Start where the route error happened */ - start?: RouteErrorPosition; - /** End where the route error happened */ - end?: RouteErrorPosition; -} - -/** Position where the route error happened */ -export interface RouteErrorPosition { - /** Line where the route error happened */ - line?: number; - /** Column where the route error happened */ - column?: number; -} - -/** The list of shared access policies with a next link. */ -export interface SharedAccessSignatureAuthorizationRuleListResult { - /** The list of shared access policies. */ - value?: SharedAccessSignatureAuthorizationRule[]; - /** - * The next link. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Use to provide parameters when requesting an export of all devices in the IoT hub. */ -export interface ExportDevicesRequest { - /** The export blob container URI. */ - exportBlobContainerUri: string; - /** The value indicating whether keys should be excluded during export. */ - excludeKeys: boolean; - /** The name of the blob that will be created in the provided output blob container. This blob will contain the exported device registry information for the IoT Hub. */ - exportBlobName?: string; - /** Specifies authentication type being used for connecting to the storage account. */ - authenticationType?: AuthenticationType; - /** Managed identity properties of storage endpoint for export devices. */ - identity?: ManagedIdentity; - /** The value indicating whether configurations should be exported. */ - includeConfigurations?: boolean; - /** The name of the blob that will be created in the provided output blob container. This blob will contain the exported configurations for the Iot Hub. */ - configurationsBlobName?: string; -} - -/** Use to provide parameters when requesting an import of all devices in the hub. */ -export interface ImportDevicesRequest { - /** The input blob container URI. */ - inputBlobContainerUri: string; - /** The output blob container URI. */ - outputBlobContainerUri: string; - /** The blob name to be used when importing from the provided input blob container. */ - inputBlobName?: string; - /** The blob name to use for storing the status of the import job. */ - outputBlobName?: string; - /** Specifies authentication type being used for connecting to the storage account. */ - authenticationType?: AuthenticationType; - /** Managed identity properties of storage endpoint for import devices. */ - identity?: ManagedIdentity; - /** The value indicating whether configurations should be imported. */ - includeConfigurations?: boolean; - /** The blob name to be used when importing configurations from the provided input blob container. */ - configurationsBlobName?: string; -} - -/** The JSON-serialized array of Certificate objects. */ -export interface CertificateListDescription { - /** The array of Certificate objects. */ - value?: CertificateDescription[]; -} - -/** The X509 Certificate. */ -export interface CertificateDescription { - /** The description of an X509 CA Certificate. */ - properties?: CertificateProperties; - /** - * The resource identifier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the certificate. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The entity tag. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly etag?: string; - /** - * The resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; -} - -/** The description of an X509 CA Certificate. */ -export interface CertificateProperties { - /** - * The certificate's subject name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly subject?: string; - /** - * The certificate's expiration date and time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expiry?: Date; - /** - * The certificate's thumbprint. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly thumbprint?: string; - /** Determines whether certificate has been verified. */ - isVerified?: boolean; - /** - * The certificate's create date and time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly created?: Date; - /** - * The certificate's last update date and time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly updated?: Date; - /** The certificate content */ - certificate?: string; - /** The reference to policy stored in Azure Device Registry (ADR). */ - policyResourceId?: string; -} - -/** The X509 Certificate. */ -export interface CertificateWithNonceDescription { - /** The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. */ - properties?: CertificatePropertiesWithNonce; - /** - * The resource identifier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the certificate. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The entity tag. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly etag?: string; - /** - * The resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; -} - -/** The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. */ -export interface CertificatePropertiesWithNonce { - /** - * The certificate's subject name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly subject?: string; - /** - * The certificate's expiration date and time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expiry?: Date; - /** - * The certificate's thumbprint. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly thumbprint?: string; - /** - * Determines whether certificate has been verified. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isVerified?: boolean; - /** - * The certificate's create date and time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly created?: Date; - /** - * The certificate's last update date and time. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly updated?: Date; - /** - * The certificate's verification code that will be used for proof of possession. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly verificationCode?: string; - /** - * The certificate content - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly certificate?: string; - /** The reference to policy stored in Azure Device Registry (ADR). */ - policyResourceId?: string; -} - -/** The JSON-serialized leaf certificate */ -export interface CertificateVerificationDescription { - /** base-64 representation of X509 certificate .cer file or just .pem file content. */ - certificate?: string; -} - -/** Use to provide failover region when requesting manual Failover for a hub. */ -export interface FailoverInput { - /** Region the hub will be failed over to */ - failoverRegion: string; -} - -/** The available private link resources for an IotHub */ -export interface PrivateLinkResources { - /** The list of available private link resources for an IotHub */ - value?: GroupIdInformation[]; -} - -/** The group information for creating a private endpoint on an IotHub */ -export interface GroupIdInformation { - /** - * The resource identifier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The resource name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The resource type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** The properties for a group information object */ - properties: GroupIdInformationProperties; -} - -/** The properties for a group information object */ -export interface GroupIdInformationProperties { - /** The group id */ - groupId?: string; - /** The required members for a specific group id */ - requiredMembers?: string[]; - /** The required DNS zones for a specific group id */ - requiredZoneNames?: string[]; -} - -/** The JSON-serialized X509 Certificate. */ -export interface CertificateBodyDescription { - /** base-64 representation of the X509 leaf certificate .cer file or just .pem file content. */ - certificate?: string; - /** True indicates that the certificate will be created in verified state and proof of possession will not be required. */ - isVerified?: boolean; -} - -/** The description of the IoT hub. */ -export interface IotHubDescription extends Resource { - /** The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention. */ - etag?: string; - /** IotHub properties */ - properties?: IotHubProperties; - /** IotHub SKU info */ - sku: IotHubSkuInfo; - /** The managed identities for the IotHub. */ - identity?: ArmIdentity; - /** - * The system meta data relating to this resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** Defines headers for IotHubResource_createOrUpdate operation. */ -export interface IotHubResourceCreateOrUpdateHeaders { - /** URL to query for status of the operation. */ - azureAsyncOperation?: string; -} - -/** Defines headers for IotHubResource_update operation. */ -export interface IotHubResourceUpdateHeaders { - /** URL to query for status of the operation. */ - azureAsyncOperation?: string; -} - -/** Defines headers for IotHubResource_delete operation. */ -export interface IotHubResourceDeleteHeaders { - /** URL to query for status of the operation. */ - azureAsyncOperation?: string; - location?: string; -} - -/** Defines headers for IotHub_manualFailover operation. */ -export interface IotHubManualFailoverHeaders { - /** URL to query for status of the operation. */ - azureAsyncOperation?: string; - location?: string; -} - -/** Defines headers for PrivateEndpointConnections_update operation. */ -export interface PrivateEndpointConnectionsUpdateHeaders { - /** URL to query for status of the operation. */ - azureAsyncOperation?: string; -} - -/** Defines headers for PrivateEndpointConnections_delete operation. */ -export interface PrivateEndpointConnectionsDeleteHeaders { - /** URL to query for status of the operation. */ - azureAsyncOperation?: string; - location?: string; -} - -/** Known values of {@link PublicNetworkAccess} that the service accepts. */ -export enum KnownPublicNetworkAccess { - /** Enabled */ - Enabled = "Enabled", - /** Disabled */ - Disabled = "Disabled", -} - -/** - * Defines values for PublicNetworkAccess. \ - * {@link KnownPublicNetworkAccess} can be used interchangeably with PublicNetworkAccess, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled** \ - * **Disabled** - */ -export type PublicNetworkAccess = string; - -/** Known values of {@link DefaultAction} that the service accepts. */ -export enum KnownDefaultAction { - /** Deny */ - Deny = "Deny", - /** Allow */ - Allow = "Allow", -} - -/** - * Defines values for DefaultAction. \ - * {@link KnownDefaultAction} can be used interchangeably with DefaultAction, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Deny** \ - * **Allow** - */ -export type DefaultAction = string; - -/** Known values of {@link NetworkRuleIPAction} that the service accepts. */ -export enum KnownNetworkRuleIPAction { - /** Allow */ - Allow = "Allow", -} - -/** - * Defines values for NetworkRuleIPAction. \ - * {@link KnownNetworkRuleIPAction} can be used interchangeably with NetworkRuleIPAction, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Allow** - */ -export type NetworkRuleIPAction = string; - -/** Known values of {@link PrivateLinkServiceConnectionStatus} that the service accepts. */ -export enum KnownPrivateLinkServiceConnectionStatus { - /** Pending */ - Pending = "Pending", - /** Approved */ - Approved = "Approved", - /** Rejected */ - Rejected = "Rejected", - /** Disconnected */ - Disconnected = "Disconnected", -} - -/** - * Defines values for PrivateLinkServiceConnectionStatus. \ - * {@link KnownPrivateLinkServiceConnectionStatus} can be used interchangeably with PrivateLinkServiceConnectionStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Pending** \ - * **Approved** \ - * **Rejected** \ - * **Disconnected** - */ -export type PrivateLinkServiceConnectionStatus = string; - -/** Known values of {@link AuthenticationType} that the service accepts. */ -export enum KnownAuthenticationType { - /** KeyBased */ - KeyBased = "keyBased", - /** IdentityBased */ - IdentityBased = "identityBased", -} - -/** - * Defines values for AuthenticationType. \ - * {@link KnownAuthenticationType} can be used interchangeably with AuthenticationType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **keyBased** \ - * **identityBased** - */ -export type AuthenticationType = string; - -/** Known values of {@link RoutingStorageContainerPropertiesEncoding} that the service accepts. */ -export enum KnownRoutingStorageContainerPropertiesEncoding { - /** Avro */ - Avro = "Avro", - /** AvroDeflate */ - AvroDeflate = "AvroDeflate", - /** Json */ - Json = "JSON", -} - -/** - * Defines values for RoutingStorageContainerPropertiesEncoding. \ - * {@link KnownRoutingStorageContainerPropertiesEncoding} can be used interchangeably with RoutingStorageContainerPropertiesEncoding, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Avro** \ - * **AvroDeflate** \ - * **JSON** - */ -export type RoutingStorageContainerPropertiesEncoding = string; - -/** Known values of {@link RoutingSource} that the service accepts. */ -export enum KnownRoutingSource { - /** Invalid */ - Invalid = "Invalid", - /** DeviceMessages */ - DeviceMessages = "DeviceMessages", - /** TwinChangeEvents */ - TwinChangeEvents = "TwinChangeEvents", - /** DeviceLifecycleEvents */ - DeviceLifecycleEvents = "DeviceLifecycleEvents", - /** DeviceJobLifecycleEvents */ - DeviceJobLifecycleEvents = "DeviceJobLifecycleEvents", - /** DigitalTwinChangeEvents */ - DigitalTwinChangeEvents = "DigitalTwinChangeEvents", - /** DeviceConnectionStateEvents */ - DeviceConnectionStateEvents = "DeviceConnectionStateEvents", - /** MqttBrokerMessages */ - MqttBrokerMessages = "MqttBrokerMessages", -} - -/** - * Defines values for RoutingSource. \ - * {@link KnownRoutingSource} can be used interchangeably with RoutingSource, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Invalid** \ - * **DeviceMessages** \ - * **TwinChangeEvents** \ - * **DeviceLifecycleEvents** \ - * **DeviceJobLifecycleEvents** \ - * **DigitalTwinChangeEvents** \ - * **DeviceConnectionStateEvents** \ - * **MqttBrokerMessages** - */ -export type RoutingSource = string; - -/** Known values of {@link Capabilities} that the service accepts. */ -export enum KnownCapabilities { - /** None */ - None = "None", - /** DeviceManagement */ - DeviceManagement = "DeviceManagement", -} - -/** - * Defines values for Capabilities. \ - * {@link KnownCapabilities} can be used interchangeably with Capabilities, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **None** \ - * **DeviceManagement** - */ -export type Capabilities = string; - -/** Known values of {@link IotHubReplicaRoleType} that the service accepts. */ -export enum KnownIotHubReplicaRoleType { - /** Primary */ - Primary = "primary", - /** Secondary */ - Secondary = "secondary", -} - -/** - * Defines values for IotHubReplicaRoleType. \ - * {@link KnownIotHubReplicaRoleType} can be used interchangeably with IotHubReplicaRoleType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **primary** \ - * **secondary** - */ -export type IotHubReplicaRoleType = string; - -/** Known values of {@link IpVersion} that the service accepts. */ -export enum KnownIpVersion { - /** Ipv4 */ - Ipv4 = "ipv4", - /** Ipv6 */ - Ipv6 = "ipv6", - /** Ipv4Ipv6 */ - Ipv4Ipv6 = "ipv4ipv6", -} - -/** - * Defines values for IpVersion. \ - * {@link KnownIpVersion} can be used interchangeably with IpVersion, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ipv4** \ - * **ipv6** \ - * **ipv4ipv6** - */ -export type IpVersion = string; - -/** Known values of {@link IotHubSku} that the service accepts. */ -export enum KnownIotHubSku { - /** F1 */ - F1 = "F1", - /** S1 */ - S1 = "S1", - /** S2 */ - S2 = "S2", - /** S3 */ - S3 = "S3", - /** B1 */ - B1 = "B1", - /** B2 */ - B2 = "B2", - /** B3 */ - B3 = "B3", - /** GEN2 */ - GEN2 = "GEN2", -} - -/** - * Defines values for IotHubSku. \ - * {@link KnownIotHubSku} can be used interchangeably with IotHubSku, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **F1** \ - * **S1** \ - * **S2** \ - * **S3** \ - * **B1** \ - * **B2** \ - * **B3** \ - * **GEN2** - */ -export type IotHubSku = string; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key", -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link JobType} that the service accepts. */ -export enum KnownJobType { - /** Unknown */ - Unknown = "unknown", - /** Export */ - Export = "export", - /** Import */ - Import = "import", - /** Backup */ - Backup = "backup", - /** ReadDeviceProperties */ - ReadDeviceProperties = "readDeviceProperties", - /** WriteDeviceProperties */ - WriteDeviceProperties = "writeDeviceProperties", - /** UpdateDeviceConfiguration */ - UpdateDeviceConfiguration = "updateDeviceConfiguration", - /** RebootDevice */ - RebootDevice = "rebootDevice", - /** FactoryResetDevice */ - FactoryResetDevice = "factoryResetDevice", - /** FirmwareUpdate */ - FirmwareUpdate = "firmwareUpdate", -} - -/** - * Defines values for JobType. \ - * {@link KnownJobType} can be used interchangeably with JobType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **unknown** \ - * **export** \ - * **import** \ - * **backup** \ - * **readDeviceProperties** \ - * **writeDeviceProperties** \ - * **updateDeviceConfiguration** \ - * **rebootDevice** \ - * **factoryResetDevice** \ - * **firmwareUpdate** - */ -export type JobType = string; - -/** Known values of {@link EndpointHealthStatus} that the service accepts. */ -export enum KnownEndpointHealthStatus { - /** Unknown */ - Unknown = "unknown", - /** Healthy */ - Healthy = "healthy", - /** Degraded */ - Degraded = "degraded", - /** Unhealthy */ - Unhealthy = "unhealthy", - /** Dead */ - Dead = "dead", -} - -/** - * Defines values for EndpointHealthStatus. \ - * {@link KnownEndpointHealthStatus} can be used interchangeably with EndpointHealthStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **unknown** \ - * **healthy** \ - * **degraded** \ - * **unhealthy** \ - * **dead** - */ -export type EndpointHealthStatus = string; - -/** Known values of {@link TestResultStatus} that the service accepts. */ -export enum KnownTestResultStatus { - /** Undefined */ - Undefined = "undefined", - /** False */ - False = "false", - /** True */ - True = "true", -} - -/** - * Defines values for TestResultStatus. \ - * {@link KnownTestResultStatus} can be used interchangeably with TestResultStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **undefined** \ - * **false** \ - * **true** - */ -export type TestResultStatus = string; - -/** Known values of {@link RouteErrorSeverity} that the service accepts. */ -export enum KnownRouteErrorSeverity { - /** Error */ - Error = "error", - /** Warning */ - Warning = "warning", -} - -/** - * Defines values for RouteErrorSeverity. \ - * {@link KnownRouteErrorSeverity} can be used interchangeably with RouteErrorSeverity, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **error** \ - * **warning** - */ -export type RouteErrorSeverity = string; -/** Defines values for AccessRights. */ -export type AccessRights = - | "RegistryRead" - | "RegistryWrite" - | "ServiceConnect" - | "DeviceConnect" - | "RegistryRead, RegistryWrite" - | "RegistryRead, ServiceConnect" - | "RegistryRead, DeviceConnect" - | "RegistryWrite, ServiceConnect" - | "RegistryWrite, DeviceConnect" - | "ServiceConnect, DeviceConnect" - | "RegistryRead, RegistryWrite, ServiceConnect" - | "RegistryRead, RegistryWrite, DeviceConnect" - | "RegistryRead, ServiceConnect, DeviceConnect" - | "RegistryWrite, ServiceConnect, DeviceConnect" - | "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect"; -/** Defines values for IpFilterActionType. */ -export type IpFilterActionType = "Accept" | "Reject"; -/** Defines values for IotHubSkuTier. */ -export type IotHubSkuTier = "Free" | "Standard" | "Basic" | "Generation2"; -/** Defines values for ResourceIdentityType. */ -export type ResourceIdentityType = - | "SystemAssigned" - | "UserAssigned" - | "SystemAssigned, UserAssigned" - | "None"; -/** Defines values for IotHubScaleType. */ -export type IotHubScaleType = "Automatic" | "Manual" | "None"; -/** Defines values for JobStatus. */ -export type JobStatus = "unknown" | "enqueued" | "running" | "completed" | "failed" | "cancelled"; -/** Defines values for IotHubNameUnavailabilityReason. */ -export type IotHubNameUnavailabilityReason = "Invalid" | "AlreadyExists"; - -/** Optional parameters. */ -export interface OperationsListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = OperationListResult; - -/** Optional parameters. */ -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type OperationsListNextResponse = OperationListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type IotHubResourceGetResponse = IotHubDescription; - -/** Optional parameters. */ -export interface IotHubResourceCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - /** ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. */ - ifMatch?: string; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type IotHubResourceCreateOrUpdateResponse = IotHubDescription; - -/** Optional parameters. */ -export interface IotHubResourceUpdateOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type IotHubResourceUpdateResponse = IotHubResourceUpdateHeaders & IotHubDescription; - -/** Optional parameters. */ -export interface IotHubResourceDeleteOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type IotHubResourceDeleteResponse = IotHubDescription; - -/** Optional parameters. */ -export interface IotHubResourceListBySubscriptionOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscription operation. */ -export type IotHubResourceListBySubscriptionResponse = IotHubDescriptionListResult; - -/** Optional parameters. */ -export interface IotHubResourceListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type IotHubResourceListByResourceGroupResponse = IotHubDescriptionListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetStatsOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the getStats operation. */ -export type IotHubResourceGetStatsResponse = RegistryStatistics; - -/** Optional parameters. */ -export interface IotHubResourceGetValidSkusOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the getValidSkus operation. */ -export type IotHubResourceGetValidSkusResponse = IotHubSkuDescriptionListResult; - -/** Optional parameters. */ -export interface IotHubResourceListEventHubConsumerGroupsOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listEventHubConsumerGroups operation. */ -export type IotHubResourceListEventHubConsumerGroupsResponse = EventHubConsumerGroupsListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetEventHubConsumerGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getEventHubConsumerGroup operation. */ -export type IotHubResourceGetEventHubConsumerGroupResponse = EventHubConsumerGroupInfo; - -/** Optional parameters. */ -export interface IotHubResourceCreateEventHubConsumerGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createEventHubConsumerGroup operation. */ -export type IotHubResourceCreateEventHubConsumerGroupResponse = EventHubConsumerGroupInfo; - -/** Optional parameters. */ -export interface IotHubResourceDeleteEventHubConsumerGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface IotHubResourceListJobsOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listJobs operation. */ -export type IotHubResourceListJobsResponse = JobResponseListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetJobOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the getJob operation. */ -export type IotHubResourceGetJobResponse = JobResponse; - -/** Optional parameters. */ -export interface IotHubResourceGetQuotaMetricsOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the getQuotaMetrics operation. */ -export type IotHubResourceGetQuotaMetricsResponse = IotHubQuotaMetricInfoListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetEndpointHealthOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getEndpointHealth operation. */ -export type IotHubResourceGetEndpointHealthResponse = EndpointHealthDataListResult; - -/** Optional parameters. */ -export interface IotHubResourceCheckNameAvailabilityOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the checkNameAvailability operation. */ -export type IotHubResourceCheckNameAvailabilityResponse = IotHubNameAvailabilityInfo; - -/** Optional parameters. */ -export interface IotHubResourceTestAllRoutesOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the testAllRoutes operation. */ -export type IotHubResourceTestAllRoutesResponse = TestAllRoutesResult; - -/** Optional parameters. */ -export interface IotHubResourceTestRouteOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the testRoute operation. */ -export type IotHubResourceTestRouteResponse = TestRouteResult; - -/** Optional parameters. */ -export interface IotHubResourceListKeysOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listKeys operation. */ -export type IotHubResourceListKeysResponse = SharedAccessSignatureAuthorizationRuleListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetKeysForKeyNameOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getKeysForKeyName operation. */ -export type IotHubResourceGetKeysForKeyNameResponse = SharedAccessSignatureAuthorizationRule; - -/** Optional parameters. */ -export interface IotHubResourceExportDevicesOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the exportDevices operation. */ -export type IotHubResourceExportDevicesResponse = JobResponse; - -/** Optional parameters. */ -export interface IotHubResourceImportDevicesOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the importDevices operation. */ -export type IotHubResourceImportDevicesResponse = JobResponse; - -/** Optional parameters. */ -export interface IotHubResourceListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscriptionNext operation. */ -export type IotHubResourceListBySubscriptionNextResponse = IotHubDescriptionListResult; - -/** Optional parameters. */ -export interface IotHubResourceListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type IotHubResourceListByResourceGroupNextResponse = IotHubDescriptionListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetValidSkusNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the getValidSkusNext operation. */ -export type IotHubResourceGetValidSkusNextResponse = IotHubSkuDescriptionListResult; - -/** Optional parameters. */ -export interface IotHubResourceListEventHubConsumerGroupsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listEventHubConsumerGroupsNext operation. */ -export type IotHubResourceListEventHubConsumerGroupsNextResponse = EventHubConsumerGroupsListResult; - -/** Optional parameters. */ -export interface IotHubResourceListJobsNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listJobsNext operation. */ -export type IotHubResourceListJobsNextResponse = JobResponseListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetQuotaMetricsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getQuotaMetricsNext operation. */ -export type IotHubResourceGetQuotaMetricsNextResponse = IotHubQuotaMetricInfoListResult; - -/** Optional parameters. */ -export interface IotHubResourceGetEndpointHealthNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getEndpointHealthNext operation. */ -export type IotHubResourceGetEndpointHealthNextResponse = EndpointHealthDataListResult; - -/** Optional parameters. */ -export interface IotHubResourceListKeysNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listKeysNext operation. */ -export type IotHubResourceListKeysNextResponse = SharedAccessSignatureAuthorizationRuleListResult; - -/** Optional parameters. */ -export interface ResourceProviderCommonGetSubscriptionQuotaOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the getSubscriptionQuota operation. */ -export type ResourceProviderCommonGetSubscriptionQuotaResponse = UserSubscriptionQuotaListResult; - -/** Optional parameters. */ -export interface CertificatesListByIotHubOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByIotHub operation. */ -export type CertificatesListByIotHubResponse = CertificateListDescription; - -/** Optional parameters. */ -export interface CertificatesGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type CertificatesGetResponse = CertificateDescription; - -/** Optional parameters. */ -export interface CertificatesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - /** ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. */ - ifMatch?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type CertificatesCreateOrUpdateResponse = CertificateDescription; - -/** Optional parameters. */ -export interface CertificatesDeleteOptionalParams extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface CertificatesGenerateVerificationCodeOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the generateVerificationCode operation. */ -export type CertificatesGenerateVerificationCodeResponse = CertificateWithNonceDescription; - -/** Optional parameters. */ -export interface CertificatesVerifyOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the verify operation. */ -export type CertificatesVerifyResponse = CertificateDescription; - -/** Optional parameters. */ -export interface IotHubManualFailoverOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Optional parameters. */ -export interface PrivateLinkResourcesListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type PrivateLinkResourcesListResponse = PrivateLinkResources; - -/** Optional parameters. */ -export interface PrivateLinkResourcesGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type PrivateLinkResourcesGetResponse = GroupIdInformation; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type PrivateEndpointConnectionsListResponse = PrivateEndpointConnection[]; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type PrivateEndpointConnectionsUpdateResponse = PrivateEndpointConnection; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type PrivateEndpointConnectionsDeleteResponse = PrivateEndpointConnection; - -/** Optional parameters. */ -export interface IotHubClientOptionalParams extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { + Operation, + OperationDisplay, + ErrorDetails, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + PrivateLinkServiceConnectionStatus, + ProxyResource, + Resource, + SystemData, + CreatedByType, + IotHubDescription, + IotHubProperties, + SharedAccessSignatureAuthorizationRule, + AccessRights, + PublicNetworkAccess, + IpFilterRule, + IpFilterActionType, + NetworkRuleSetProperties, + DefaultAction, + NetworkRuleSetIpRule, + NetworkRuleIPAction, + EventHubProperties, + RoutingProperties, + RoutingEndpoints, + RoutingServiceBusQueueEndpointProperties, + AuthenticationType, + ManagedIdentity, + RoutingServiceBusTopicEndpointProperties, + RoutingEventHubProperties, + RoutingStorageContainerProperties, + RoutingStorageContainerPropertiesEncoding, + RoutingCosmosDBSqlApiProperties, + RouteProperties, + RoutingSource, + FallbackRouteProperties, + EnrichmentProperties, + StorageEndpointProperties, + MessagingEndpointProperties, + CloudToDeviceProperties, + FeedbackProperties, + IotHubPropertiesDeviceStreams, + Capabilities, + EncryptionPropertiesDescription, + KeyVaultKeyProperties, + IotHubLocationDescription, + IotHubReplicaRoleType, + RootCertificateProperties, + IpVersion, + DeviceRegistry, + IotHubDetails, + GatewayVersion, + IotHubSkuInfo, + IotHubSku, + IotHubSkuTier, + ArmIdentity, + ResourceIdentityType, + ArmUserIdentity, + TrackedResource, + TagsResource, + IotHubSkuDescription, + IotHubCapacity, + IotHubScaleType, + JobResponse, + JobType, + JobStatus, + IotHubQuotaMetricInfo, + EndpointHealthData, + EndpointHealthStatus, + TestAllRoutesInput, + RoutingMessage, + RoutingTwin, + RoutingTwinProperties, + TestAllRoutesResult, + MatchedRoute, + TestRouteInput, + TestRouteResult, + TestResultStatus, + TestRouteResultDetails, + RouteCompilationError, + RouteErrorSeverity, + RouteErrorRange, + RouteErrorPosition, + ExportDevicesRequest, + ImportDevicesRequest, + RegistryStatistics, + EventHubConsumerGroupInfo, + EventHubConsumerGroupBodyDescription, + EventHubConsumerGroupName, + OperationInputs, + IotHubNameAvailabilityInfo, + IotHubNameUnavailabilityReason, + FailoverInput, + CertificateDescription, + CertificateProperties, + CertificateListDescription, + CertificateWithNonceDescription, + CertificatePropertiesWithNonce, + CertificateVerificationDescription, + GroupIdInformation, + GroupIdInformationProperties, + PrivateLinkResources, + UserSubscriptionQuotaListResult, + UserSubscriptionQuota, + Name, +} from "./models.js"; +export { + KnownPrivateLinkServiceConnectionStatus, + KnownCreatedByType, + KnownPublicNetworkAccess, + KnownDefaultAction, + KnownNetworkRuleIPAction, + KnownAuthenticationType, + KnownRoutingStorageContainerPropertiesEncoding, + KnownRoutingSource, + KnownCapabilities, + KnownIotHubReplicaRoleType, + KnownIpVersion, + KnownGatewayVersion, + KnownIotHubSku, + KnownJobType, + KnownEndpointHealthStatus, + KnownTestResultStatus, + KnownRouteErrorSeverity, + KnownVersions, +} from "./models.js"; diff --git a/sdk/iothub/arm-iothub/src/models/mappers.ts b/sdk/iothub/arm-iothub/src/models/mappers.ts deleted file mode 100644 index bfab383b701b..000000000000 --- a/sdk/iothub/arm-iothub/src/models/mappers.ts +++ /dev/null @@ -1,3411 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type * as coreClient from "@azure/core-client"; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Operation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay", - }, - }, - }, - }, -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - readOnly: true, - type: { - name: "String", - }, - }, - resource: { - serializedName: "resource", - readOnly: true, - type: { - name: "String", - }, - }, - operation: { - serializedName: "operation", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ErrorDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetails", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String", - }, - }, - httpStatusCode: { - serializedName: "httpStatusCode", - readOnly: true, - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String", - }, - }, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubProperties", - modelProperties: { - authorizationPolicies: { - serializedName: "authorizationPolicies", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SharedAccessSignatureAuthorizationRule", - }, - }, - }, - }, - disableLocalAuth: { - serializedName: "disableLocalAuth", - type: { - name: "Boolean", - }, - }, - disableDeviceSAS: { - serializedName: "disableDeviceSAS", - type: { - name: "Boolean", - }, - }, - disableModuleSAS: { - serializedName: "disableModuleSAS", - type: { - name: "Boolean", - }, - }, - restrictOutboundNetworkAccess: { - serializedName: "restrictOutboundNetworkAccess", - type: { - name: "Boolean", - }, - }, - allowedFqdnList: { - serializedName: "allowedFqdnList", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - publicNetworkAccess: { - serializedName: "publicNetworkAccess", - type: { - name: "String", - }, - }, - ipFilterRules: { - serializedName: "ipFilterRules", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "IpFilterRule", - }, - }, - }, - }, - networkRuleSets: { - serializedName: "networkRuleSets", - type: { - name: "Composite", - className: "NetworkRuleSetProperties", - }, - }, - minTlsVersion: { - serializedName: "minTlsVersion", - type: { - name: "String", - }, - }, - privateEndpointConnections: { - serializedName: "privateEndpointConnections", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateEndpointConnection", - }, - }, - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - state: { - serializedName: "state", - readOnly: true, - type: { - name: "String", - }, - }, - hostName: { - serializedName: "hostName", - readOnly: true, - type: { - name: "String", - }, - }, - eventHubEndpoints: { - serializedName: "eventHubEndpoints", - type: { - name: "Dictionary", - value: { - type: { name: "Composite", className: "EventHubProperties" }, - }, - }, - }, - routing: { - serializedName: "routing", - type: { - name: "Composite", - className: "RoutingProperties", - }, - }, - storageEndpoints: { - serializedName: "storageEndpoints", - type: { - name: "Dictionary", - value: { - type: { name: "Composite", className: "StorageEndpointProperties" }, - }, - }, - }, - messagingEndpoints: { - serializedName: "messagingEndpoints", - type: { - name: "Dictionary", - value: { - type: { - name: "Composite", - className: "MessagingEndpointProperties", - }, - }, - }, - }, - enableFileUploadNotifications: { - serializedName: "enableFileUploadNotifications", - type: { - name: "Boolean", - }, - }, - cloudToDevice: { - serializedName: "cloudToDevice", - type: { - name: "Composite", - className: "CloudToDeviceProperties", - }, - }, - comments: { - serializedName: "comments", - type: { - name: "String", - }, - }, - deviceStreams: { - serializedName: "deviceStreams", - type: { - name: "Composite", - className: "IotHubPropertiesDeviceStreams", - }, - }, - features: { - serializedName: "features", - type: { - name: "String", - }, - }, - encryption: { - serializedName: "encryption", - type: { - name: "Composite", - className: "EncryptionPropertiesDescription", - }, - }, - locations: { - serializedName: "locations", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "IotHubLocationDescription", - }, - }, - }, - }, - enableDataResidency: { - serializedName: "enableDataResidency", - type: { - name: "Boolean", - }, - }, - rootCertificate: { - serializedName: "rootCertificate", - type: { - name: "Composite", - className: "RootCertificateProperties", - }, - }, - ipVersion: { - serializedName: "ipVersion", - type: { - name: "String", - }, - }, - deviceRegistry: { - serializedName: "deviceRegistry", - type: { - name: "Composite", - className: "DeviceRegistry", - }, - }, - }, - }, -}; - -export const SharedAccessSignatureAuthorizationRule: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SharedAccessSignatureAuthorizationRule", - modelProperties: { - keyName: { - serializedName: "keyName", - required: true, - type: { - name: "String", - }, - }, - primaryKey: { - serializedName: "primaryKey", - type: { - name: "String", - }, - }, - secondaryKey: { - serializedName: "secondaryKey", - type: { - name: "String", - }, - }, - rights: { - serializedName: "rights", - required: true, - type: { - name: "Enum", - allowedValues: [ - "RegistryRead", - "RegistryWrite", - "ServiceConnect", - "DeviceConnect", - "RegistryRead, RegistryWrite", - "RegistryRead, ServiceConnect", - "RegistryRead, DeviceConnect", - "RegistryWrite, ServiceConnect", - "RegistryWrite, DeviceConnect", - "ServiceConnect, DeviceConnect", - "RegistryRead, RegistryWrite, ServiceConnect", - "RegistryRead, RegistryWrite, DeviceConnect", - "RegistryRead, ServiceConnect, DeviceConnect", - "RegistryWrite, ServiceConnect, DeviceConnect", - "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect", - ], - }, - }, - }, - }, -}; - -export const IpFilterRule: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IpFilterRule", - modelProperties: { - filterName: { - serializedName: "filterName", - required: true, - type: { - name: "String", - }, - }, - action: { - serializedName: "action", - required: true, - type: { - name: "Enum", - allowedValues: ["Accept", "Reject"], - }, - }, - ipMask: { - serializedName: "ipMask", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NetworkRuleSetProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NetworkRuleSetProperties", - modelProperties: { - defaultAction: { - defaultValue: "Deny", - serializedName: "defaultAction", - type: { - name: "String", - }, - }, - applyToBuiltInEventHubEndpoint: { - serializedName: "applyToBuiltInEventHubEndpoint", - required: true, - type: { - name: "Boolean", - }, - }, - ipRules: { - serializedName: "ipRules", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NetworkRuleSetIpRule", - }, - }, - }, - }, - }, - }, -}; - -export const NetworkRuleSetIpRule: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NetworkRuleSetIpRule", - modelProperties: { - filterName: { - serializedName: "filterName", - required: true, - type: { - name: "String", - }, - }, - action: { - defaultValue: "Allow", - serializedName: "action", - type: { - name: "String", - }, - }, - ipMask: { - serializedName: "ipMask", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnection: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnection", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "PrivateEndpointConnectionProperties", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnectionProperties", - modelProperties: { - privateEndpoint: { - serializedName: "privateEndpoint", - type: { - name: "Composite", - className: "PrivateEndpoint", - }, - }, - privateLinkServiceConnectionState: { - serializedName: "privateLinkServiceConnectionState", - type: { - name: "Composite", - className: "PrivateLinkServiceConnectionState", - }, - }, - }, - }, -}; - -export const PrivateEndpoint: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpoint", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateLinkServiceConnectionState: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkServiceConnectionState", - modelProperties: { - status: { - serializedName: "status", - required: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - required: true, - type: { - name: "String", - }, - }, - actionsRequired: { - serializedName: "actionsRequired", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const EventHubProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EventHubProperties", - modelProperties: { - retentionTimeInDays: { - serializedName: "retentionTimeInDays", - type: { - name: "Number", - }, - }, - partitionCount: { - serializedName: "partitionCount", - type: { - name: "Number", - }, - }, - partitionIds: { - serializedName: "partitionIds", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - path: { - serializedName: "path", - readOnly: true, - type: { - name: "String", - }, - }, - endpoint: { - serializedName: "endpoint", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RoutingProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingProperties", - modelProperties: { - endpoints: { - serializedName: "endpoints", - type: { - name: "Composite", - className: "RoutingEndpoints", - }, - }, - routes: { - serializedName: "routes", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RouteProperties", - }, - }, - }, - }, - fallbackRoute: { - serializedName: "fallbackRoute", - type: { - name: "Composite", - className: "FallbackRouteProperties", - }, - }, - enrichments: { - serializedName: "enrichments", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "EnrichmentProperties", - }, - }, - }, - }, - }, - }, -}; - -export const RoutingEndpoints: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingEndpoints", - modelProperties: { - serviceBusQueues: { - serializedName: "serviceBusQueues", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RoutingServiceBusQueueEndpointProperties", - }, - }, - }, - }, - serviceBusTopics: { - serializedName: "serviceBusTopics", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RoutingServiceBusTopicEndpointProperties", - }, - }, - }, - }, - eventHubs: { - serializedName: "eventHubs", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RoutingEventHubProperties", - }, - }, - }, - }, - storageContainers: { - serializedName: "storageContainers", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RoutingStorageContainerProperties", - }, - }, - }, - }, - cosmosDBSqlContainers: { - serializedName: "cosmosDBSqlContainers", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RoutingCosmosDBSqlApiProperties", - }, - }, - }, - }, - }, - }, -}; - -export const RoutingServiceBusQueueEndpointProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingServiceBusQueueEndpointProperties", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - connectionString: { - serializedName: "connectionString", - type: { - name: "String", - }, - }, - endpointUri: { - serializedName: "endpointUri", - type: { - name: "String", - }, - }, - entityPath: { - serializedName: "entityPath", - type: { - name: "String", - }, - }, - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - name: { - constraints: { - Pattern: new RegExp("^[A-Za-z0-9-._]{1,64}$"), - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - subscriptionId: { - serializedName: "subscriptionId", - type: { - name: "String", - }, - }, - resourceGroup: { - serializedName: "resourceGroup", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ManagedIdentity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ManagedIdentity", - modelProperties: { - userAssignedIdentity: { - serializedName: "userAssignedIdentity", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RoutingServiceBusTopicEndpointProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingServiceBusTopicEndpointProperties", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - connectionString: { - serializedName: "connectionString", - type: { - name: "String", - }, - }, - endpointUri: { - serializedName: "endpointUri", - type: { - name: "String", - }, - }, - entityPath: { - serializedName: "entityPath", - type: { - name: "String", - }, - }, - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - name: { - constraints: { - Pattern: new RegExp("^[A-Za-z0-9-._]{1,64}$"), - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - subscriptionId: { - serializedName: "subscriptionId", - type: { - name: "String", - }, - }, - resourceGroup: { - serializedName: "resourceGroup", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RoutingEventHubProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingEventHubProperties", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - connectionString: { - serializedName: "connectionString", - type: { - name: "String", - }, - }, - endpointUri: { - serializedName: "endpointUri", - type: { - name: "String", - }, - }, - entityPath: { - serializedName: "entityPath", - type: { - name: "String", - }, - }, - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - name: { - constraints: { - Pattern: new RegExp("^[A-Za-z0-9-._]{1,64}$"), - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - subscriptionId: { - serializedName: "subscriptionId", - type: { - name: "String", - }, - }, - resourceGroup: { - serializedName: "resourceGroup", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RoutingStorageContainerProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingStorageContainerProperties", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - connectionString: { - serializedName: "connectionString", - type: { - name: "String", - }, - }, - endpointUri: { - serializedName: "endpointUri", - type: { - name: "String", - }, - }, - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - name: { - constraints: { - Pattern: new RegExp("^[A-Za-z0-9-._]{1,64}$"), - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - subscriptionId: { - serializedName: "subscriptionId", - type: { - name: "String", - }, - }, - resourceGroup: { - serializedName: "resourceGroup", - type: { - name: "String", - }, - }, - containerName: { - serializedName: "containerName", - required: true, - type: { - name: "String", - }, - }, - fileNameFormat: { - serializedName: "fileNameFormat", - type: { - name: "String", - }, - }, - batchFrequencyInSeconds: { - constraints: { - InclusiveMaximum: 720, - InclusiveMinimum: 60, - }, - serializedName: "batchFrequencyInSeconds", - type: { - name: "Number", - }, - }, - maxChunkSizeInBytes: { - constraints: { - InclusiveMaximum: 524288000, - InclusiveMinimum: 10485760, - }, - serializedName: "maxChunkSizeInBytes", - type: { - name: "Number", - }, - }, - encoding: { - serializedName: "encoding", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RoutingCosmosDBSqlApiProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingCosmosDBSqlApiProperties", - modelProperties: { - name: { - constraints: { - Pattern: new RegExp("^[A-Za-z0-9-._]{1,64}$"), - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - subscriptionId: { - serializedName: "subscriptionId", - type: { - name: "String", - }, - }, - resourceGroup: { - serializedName: "resourceGroup", - type: { - name: "String", - }, - }, - endpointUri: { - serializedName: "endpointUri", - required: true, - type: { - name: "String", - }, - }, - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - primaryKey: { - serializedName: "primaryKey", - type: { - name: "String", - }, - }, - secondaryKey: { - serializedName: "secondaryKey", - type: { - name: "String", - }, - }, - databaseName: { - serializedName: "databaseName", - required: true, - type: { - name: "String", - }, - }, - containerName: { - serializedName: "containerName", - required: true, - type: { - name: "String", - }, - }, - partitionKeyName: { - serializedName: "partitionKeyName", - type: { - name: "String", - }, - }, - partitionKeyTemplate: { - serializedName: "partitionKeyTemplate", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RouteProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RouteProperties", - modelProperties: { - name: { - constraints: { - Pattern: new RegExp("^[A-Za-z0-9-._]{1,64}$"), - }, - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - source: { - serializedName: "source", - required: true, - type: { - name: "String", - }, - }, - condition: { - serializedName: "condition", - type: { - name: "String", - }, - }, - endpointNames: { - constraints: { - MinItems: 1, - MaxItems: 1, - }, - serializedName: "endpointNames", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - isEnabled: { - serializedName: "isEnabled", - required: true, - type: { - name: "Boolean", - }, - }, - }, - }, -}; - -export const FallbackRouteProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FallbackRouteProperties", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - source: { - serializedName: "source", - required: true, - type: { - name: "String", - }, - }, - condition: { - serializedName: "condition", - type: { - name: "String", - }, - }, - endpointNames: { - constraints: { - MinItems: 1, - MaxItems: 1, - }, - serializedName: "endpointNames", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - isEnabled: { - serializedName: "isEnabled", - required: true, - type: { - name: "Boolean", - }, - }, - }, - }, -}; - -export const EnrichmentProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EnrichmentProperties", - modelProperties: { - key: { - serializedName: "key", - required: true, - type: { - name: "String", - }, - }, - value: { - serializedName: "value", - required: true, - type: { - name: "String", - }, - }, - endpointNames: { - constraints: { - MinItems: 1, - }, - serializedName: "endpointNames", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const StorageEndpointProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StorageEndpointProperties", - modelProperties: { - sasTtlAsIso8601: { - serializedName: "sasTtlAsIso8601", - type: { - name: "TimeSpan", - }, - }, - connectionString: { - serializedName: "connectionString", - required: true, - type: { - name: "String", - }, - }, - containerName: { - serializedName: "containerName", - required: true, - type: { - name: "String", - }, - }, - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - }, - }, -}; - -export const MessagingEndpointProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MessagingEndpointProperties", - modelProperties: { - lockDurationAsIso8601: { - serializedName: "lockDurationAsIso8601", - type: { - name: "TimeSpan", - }, - }, - ttlAsIso8601: { - serializedName: "ttlAsIso8601", - type: { - name: "TimeSpan", - }, - }, - maxDeliveryCount: { - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 1, - }, - serializedName: "maxDeliveryCount", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const CloudToDeviceProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CloudToDeviceProperties", - modelProperties: { - maxDeliveryCount: { - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 1, - }, - serializedName: "maxDeliveryCount", - type: { - name: "Number", - }, - }, - defaultTtlAsIso8601: { - serializedName: "defaultTtlAsIso8601", - type: { - name: "TimeSpan", - }, - }, - feedback: { - serializedName: "feedback", - type: { - name: "Composite", - className: "FeedbackProperties", - }, - }, - }, - }, -}; - -export const FeedbackProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FeedbackProperties", - modelProperties: { - lockDurationAsIso8601: { - serializedName: "lockDurationAsIso8601", - type: { - name: "TimeSpan", - }, - }, - ttlAsIso8601: { - serializedName: "ttlAsIso8601", - type: { - name: "TimeSpan", - }, - }, - maxDeliveryCount: { - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 1, - }, - serializedName: "maxDeliveryCount", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const IotHubPropertiesDeviceStreams: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubPropertiesDeviceStreams", - modelProperties: { - streamingEndpoints: { - serializedName: "streamingEndpoints", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const EncryptionPropertiesDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EncryptionPropertiesDescription", - modelProperties: { - keySource: { - serializedName: "keySource", - type: { - name: "String", - }, - }, - keyVaultProperties: { - serializedName: "keyVaultProperties", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "KeyVaultKeyProperties", - }, - }, - }, - }, - }, - }, -}; - -export const KeyVaultKeyProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "KeyVaultKeyProperties", - modelProperties: { - keyIdentifier: { - serializedName: "keyIdentifier", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - }, - }, -}; - -export const IotHubLocationDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubLocationDescription", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - role: { - serializedName: "role", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RootCertificateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RootCertificateProperties", - modelProperties: { - enableRootCertificateV2: { - serializedName: "enableRootCertificateV2", - type: { - name: "Boolean", - }, - }, - lastUpdatedTimeUtc: { - serializedName: "lastUpdatedTimeUtc", - readOnly: true, - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const DeviceRegistry: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceRegistry", - modelProperties: { - namespaceResourceId: { - serializedName: "namespaceResourceId", - type: { - name: "String", - }, - }, - identityResourceId: { - serializedName: "identityResourceId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubSkuInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubSkuInfo", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - tier: { - serializedName: "tier", - readOnly: true, - type: { - name: "Enum", - allowedValues: ["Free", "Standard", "Basic", "Generation2"], - }, - }, - capacity: { - serializedName: "capacity", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const ArmIdentity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ArmIdentity", - modelProperties: { - principalId: { - serializedName: "principalId", - readOnly: true, - type: { - name: "String", - }, - }, - tenantId: { - serializedName: "tenantId", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - type: { - name: "Enum", - allowedValues: ["SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None"], - }, - }, - userAssignedIdentities: { - serializedName: "userAssignedIdentities", - type: { - name: "Dictionary", - value: { type: { name: "Composite", className: "ArmUserIdentity" } }, - }, - }, - }, - }, -}; - -export const ArmUserIdentity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ArmUserIdentity", - modelProperties: { - principalId: { - serializedName: "principalId", - readOnly: true, - type: { - name: "String", - }, - }, - clientId: { - serializedName: "clientId", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String", - }, - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String", - }, - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime", - }, - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String", - }, - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String", - }, - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - constraints: { - Pattern: new RegExp("^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$"), - }, - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - location: { - serializedName: "location", - required: true, - type: { - name: "String", - }, - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - }, - }, -}; - -export const TagsResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TagsResource", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - }, - }, -}; - -export const IotHubDescriptionListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubDescriptionListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "IotHubDescription", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RegistryStatistics: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RegistryStatistics", - modelProperties: { - totalDeviceCount: { - serializedName: "totalDeviceCount", - readOnly: true, - type: { - name: "Number", - }, - }, - enabledDeviceCount: { - serializedName: "enabledDeviceCount", - readOnly: true, - type: { - name: "Number", - }, - }, - disabledDeviceCount: { - serializedName: "disabledDeviceCount", - readOnly: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const IotHubSkuDescriptionListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubSkuDescriptionListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "IotHubSkuDescription", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubSkuDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubSkuDescription", - modelProperties: { - resourceType: { - serializedName: "resourceType", - readOnly: true, - type: { - name: "String", - }, - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "IotHubSkuInfo", - }, - }, - capacity: { - serializedName: "capacity", - type: { - name: "Composite", - className: "IotHubCapacity", - }, - }, - }, - }, -}; - -export const IotHubCapacity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubCapacity", - modelProperties: { - minimum: { - constraints: { - InclusiveMaximum: 1, - InclusiveMinimum: 1, - }, - serializedName: "minimum", - readOnly: true, - type: { - name: "Number", - }, - }, - maximum: { - serializedName: "maximum", - readOnly: true, - type: { - name: "Number", - }, - }, - default: { - serializedName: "default", - readOnly: true, - type: { - name: "Number", - }, - }, - scaleType: { - serializedName: "scaleType", - readOnly: true, - type: { - name: "Enum", - allowedValues: ["Automatic", "Manual", "None"], - }, - }, - }, - }, -}; - -export const EventHubConsumerGroupsListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EventHubConsumerGroupsListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "EventHubConsumerGroupInfo", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const EventHubConsumerGroupInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EventHubConsumerGroupInfo", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - etag: { - serializedName: "etag", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const EventHubConsumerGroupBodyDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EventHubConsumerGroupBodyDescription", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "EventHubConsumerGroupName", - }, - }, - }, - }, -}; - -export const EventHubConsumerGroupName: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EventHubConsumerGroupName", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const JobResponseListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "JobResponseListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "JobResponse", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const JobResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "JobResponse", - modelProperties: { - jobId: { - serializedName: "jobId", - readOnly: true, - type: { - name: "String", - }, - }, - startTimeUtc: { - serializedName: "startTimeUtc", - readOnly: true, - type: { - name: "DateTimeRfc1123", - }, - }, - endTimeUtc: { - serializedName: "endTimeUtc", - readOnly: true, - type: { - name: "DateTimeRfc1123", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - status: { - serializedName: "status", - readOnly: true, - type: { - name: "Enum", - allowedValues: ["unknown", "enqueued", "running", "completed", "failed", "cancelled"], - }, - }, - failureReason: { - serializedName: "failureReason", - readOnly: true, - type: { - name: "String", - }, - }, - statusMessage: { - serializedName: "statusMessage", - readOnly: true, - type: { - name: "String", - }, - }, - parentJobId: { - serializedName: "parentJobId", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubQuotaMetricInfoListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubQuotaMetricInfoListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "IotHubQuotaMetricInfo", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubQuotaMetricInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubQuotaMetricInfo", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - currentValue: { - serializedName: "currentValue", - readOnly: true, - type: { - name: "Number", - }, - }, - maxValue: { - serializedName: "maxValue", - readOnly: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const EndpointHealthDataListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EndpointHealthDataListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "EndpointHealthData", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const EndpointHealthData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "EndpointHealthData", - modelProperties: { - endpointId: { - serializedName: "endpointId", - type: { - name: "String", - }, - }, - healthStatus: { - serializedName: "healthStatus", - type: { - name: "String", - }, - }, - lastKnownError: { - serializedName: "lastKnownError", - type: { - name: "String", - }, - }, - lastKnownErrorTime: { - serializedName: "lastKnownErrorTime", - type: { - name: "DateTimeRfc1123", - }, - }, - lastSuccessfulSendAttemptTime: { - serializedName: "lastSuccessfulSendAttemptTime", - type: { - name: "DateTimeRfc1123", - }, - }, - lastSendAttemptTime: { - serializedName: "lastSendAttemptTime", - type: { - name: "DateTimeRfc1123", - }, - }, - }, - }, -}; - -export const OperationInputs: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationInputs", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubNameAvailabilityInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubNameAvailabilityInfo", - modelProperties: { - nameAvailable: { - serializedName: "nameAvailable", - readOnly: true, - type: { - name: "Boolean", - }, - }, - reason: { - serializedName: "reason", - readOnly: true, - type: { - name: "Enum", - allowedValues: ["Invalid", "AlreadyExists"], - }, - }, - message: { - serializedName: "message", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const UserSubscriptionQuotaListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserSubscriptionQuotaListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "UserSubscriptionQuota", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const UserSubscriptionQuota: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserSubscriptionQuota", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - type: { - name: "String", - }, - }, - unit: { - serializedName: "unit", - type: { - name: "String", - }, - }, - currentValue: { - serializedName: "currentValue", - type: { - name: "Number", - }, - }, - limit: { - serializedName: "limit", - type: { - name: "Number", - }, - }, - name: { - serializedName: "name", - type: { - name: "Composite", - className: "Name", - }, - }, - }, - }, -}; - -export const Name: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Name", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "String", - }, - }, - localizedValue: { - serializedName: "localizedValue", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TestAllRoutesInput: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TestAllRoutesInput", - modelProperties: { - routingSource: { - serializedName: "routingSource", - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - type: { - name: "Composite", - className: "RoutingMessage", - }, - }, - twin: { - serializedName: "twin", - type: { - name: "Composite", - className: "RoutingTwin", - }, - }, - }, - }, -}; - -export const RoutingMessage: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingMessage", - modelProperties: { - body: { - serializedName: "body", - type: { - name: "String", - }, - }, - appProperties: { - serializedName: "appProperties", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - systemProperties: { - serializedName: "systemProperties", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - }, - }, -}; - -export const RoutingTwin: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingTwin", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "RoutingTwinProperties", - }, - }, - }, - }, -}; - -export const RoutingTwinProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RoutingTwinProperties", - modelProperties: { - desired: { - serializedName: "desired", - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - reported: { - serializedName: "reported", - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - }, - }, -}; - -export const TestAllRoutesResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TestAllRoutesResult", - modelProperties: { - routes: { - serializedName: "routes", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MatchedRoute", - }, - }, - }, - }, - }, - }, -}; - -export const MatchedRoute: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MatchedRoute", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "RouteProperties", - }, - }, - }, - }, -}; - -export const TestRouteInput: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TestRouteInput", - modelProperties: { - message: { - serializedName: "message", - type: { - name: "Composite", - className: "RoutingMessage", - }, - }, - route: { - serializedName: "route", - type: { - name: "Composite", - className: "RouteProperties", - }, - }, - twin: { - serializedName: "twin", - type: { - name: "Composite", - className: "RoutingTwin", - }, - }, - }, - }, -}; - -export const TestRouteResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TestRouteResult", - modelProperties: { - result: { - serializedName: "result", - type: { - name: "String", - }, - }, - details: { - serializedName: "details", - type: { - name: "Composite", - className: "TestRouteResultDetails", - }, - }, - }, - }, -}; - -export const TestRouteResultDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TestRouteResultDetails", - modelProperties: { - compilationErrors: { - serializedName: "compilationErrors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RouteCompilationError", - }, - }, - }, - }, - }, - }, -}; - -export const RouteCompilationError: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RouteCompilationError", - modelProperties: { - message: { - serializedName: "message", - type: { - name: "String", - }, - }, - severity: { - serializedName: "severity", - type: { - name: "String", - }, - }, - location: { - serializedName: "location", - type: { - name: "Composite", - className: "RouteErrorRange", - }, - }, - }, - }, -}; - -export const RouteErrorRange: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RouteErrorRange", - modelProperties: { - start: { - serializedName: "start", - type: { - name: "Composite", - className: "RouteErrorPosition", - }, - }, - end: { - serializedName: "end", - type: { - name: "Composite", - className: "RouteErrorPosition", - }, - }, - }, - }, -}; - -export const RouteErrorPosition: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RouteErrorPosition", - modelProperties: { - line: { - serializedName: "line", - type: { - name: "Number", - }, - }, - column: { - serializedName: "column", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const SharedAccessSignatureAuthorizationRuleListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SharedAccessSignatureAuthorizationRuleListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SharedAccessSignatureAuthorizationRule", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ExportDevicesRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExportDevicesRequest", - modelProperties: { - exportBlobContainerUri: { - serializedName: "exportBlobContainerUri", - required: true, - type: { - name: "String", - }, - }, - excludeKeys: { - serializedName: "excludeKeys", - required: true, - type: { - name: "Boolean", - }, - }, - exportBlobName: { - serializedName: "exportBlobName", - type: { - name: "String", - }, - }, - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - includeConfigurations: { - serializedName: "includeConfigurations", - type: { - name: "Boolean", - }, - }, - configurationsBlobName: { - serializedName: "configurationsBlobName", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ImportDevicesRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ImportDevicesRequest", - modelProperties: { - inputBlobContainerUri: { - serializedName: "inputBlobContainerUri", - required: true, - type: { - name: "String", - }, - }, - outputBlobContainerUri: { - serializedName: "outputBlobContainerUri", - required: true, - type: { - name: "String", - }, - }, - inputBlobName: { - serializedName: "inputBlobName", - type: { - name: "String", - }, - }, - outputBlobName: { - serializedName: "outputBlobName", - type: { - name: "String", - }, - }, - authenticationType: { - serializedName: "authenticationType", - type: { - name: "String", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ManagedIdentity", - }, - }, - includeConfigurations: { - serializedName: "includeConfigurations", - type: { - name: "Boolean", - }, - }, - configurationsBlobName: { - serializedName: "configurationsBlobName", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CertificateListDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateListDescription", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CertificateDescription", - }, - }, - }, - }, - }, - }, -}; - -export const CertificateDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateDescription", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "CertificateProperties", - }, - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - etag: { - serializedName: "etag", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CertificateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateProperties", - modelProperties: { - subject: { - serializedName: "subject", - readOnly: true, - type: { - name: "String", - }, - }, - expiry: { - serializedName: "expiry", - readOnly: true, - type: { - name: "DateTimeRfc1123", - }, - }, - thumbprint: { - serializedName: "thumbprint", - readOnly: true, - type: { - name: "String", - }, - }, - isVerified: { - serializedName: "isVerified", - type: { - name: "Boolean", - }, - }, - created: { - serializedName: "created", - readOnly: true, - type: { - name: "DateTimeRfc1123", - }, - }, - updated: { - serializedName: "updated", - readOnly: true, - type: { - name: "DateTimeRfc1123", - }, - }, - certificate: { - serializedName: "certificate", - type: { - name: "String", - }, - }, - policyResourceId: { - serializedName: "policyResourceId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CertificateWithNonceDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateWithNonceDescription", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "CertificatePropertiesWithNonce", - }, - }, - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - etag: { - serializedName: "etag", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CertificatePropertiesWithNonce: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificatePropertiesWithNonce", - modelProperties: { - subject: { - serializedName: "subject", - readOnly: true, - type: { - name: "String", - }, - }, - expiry: { - serializedName: "expiry", - readOnly: true, - type: { - name: "DateTimeRfc1123", - }, - }, - thumbprint: { - serializedName: "thumbprint", - readOnly: true, - type: { - name: "String", - }, - }, - isVerified: { - serializedName: "isVerified", - readOnly: true, - type: { - name: "Boolean", - }, - }, - created: { - serializedName: "created", - readOnly: true, - type: { - name: "DateTimeRfc1123", - }, - }, - updated: { - serializedName: "updated", - readOnly: true, - type: { - name: "DateTimeRfc1123", - }, - }, - verificationCode: { - serializedName: "verificationCode", - readOnly: true, - type: { - name: "String", - }, - }, - certificate: { - serializedName: "certificate", - readOnly: true, - type: { - name: "String", - }, - }, - policyResourceId: { - serializedName: "policyResourceId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CertificateVerificationDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateVerificationDescription", - modelProperties: { - certificate: { - serializedName: "certificate", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const FailoverInput: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FailoverInput", - modelProperties: { - failoverRegion: { - serializedName: "failoverRegion", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateLinkResources: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkResources", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "GroupIdInformation", - }, - }, - }, - }, - }, - }, -}; - -export const GroupIdInformation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GroupIdInformation", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "GroupIdInformationProperties", - }, - }, - }, - }, -}; - -export const GroupIdInformationProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GroupIdInformationProperties", - modelProperties: { - groupId: { - serializedName: "groupId", - type: { - name: "String", - }, - }, - requiredMembers: { - serializedName: "requiredMembers", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - requiredZoneNames: { - serializedName: "requiredZoneNames", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const CertificateBodyDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateBodyDescription", - modelProperties: { - certificate: { - serializedName: "certificate", - type: { - name: "String", - }, - }, - isVerified: { - serializedName: "isVerified", - type: { - name: "Boolean", - }, - }, - }, - }, -}; - -export const IotHubDescription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubDescription", - modelProperties: { - ...Resource.type.modelProperties, - etag: { - serializedName: "etag", - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "IotHubProperties", - }, - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "IotHubSkuInfo", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "ArmIdentity", - }, - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - }, - }, -}; - -export const IotHubResourceCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubResourceCreateOrUpdateHeaders", - modelProperties: { - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubResourceUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubResourceUpdateHeaders", - modelProperties: { - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubResourceDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubResourceDeleteHeaders", - modelProperties: { - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const IotHubManualFailoverHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "IotHubManualFailoverHeaders", - modelProperties: { - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionsUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnectionsUpdateHeaders", - modelProperties: { - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnectionsDeleteHeaders", - modelProperties: { - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; diff --git a/sdk/iothub/arm-iothub/src/models/models.ts b/sdk/iothub/arm-iothub/src/models/models.ts new file mode 100644 index 000000000000..44bd11460787 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/models/models.ts @@ -0,0 +1,3189 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * This file contains only generated model types and their (de)serializers. + * Disable the following rules for internal models with '_' prefix and deserializers which require 'any' for raw JSON input. + */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/** Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. */ +export interface _OperationListResult { + /** List of IoT Hub operations supported by the Microsoft.Devices resource provider. */ + readonly value?: Operation[]; + /** URL to get the next set of operation list results if there are any. */ + readonly nextLink?: string; +} + +export function _operationListResultDeserializer(item: any): _OperationListResult { + return { + value: !item["value"] ? item["value"] : operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** IoT Hub REST API operation */ +export interface Operation { + /** Operation name: {provider}/{resource}/{read | write | action | delete} */ + readonly name?: string; + /** The object that represents the operation. */ + display?: OperationDisplay; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + }; +} + +/** The object that represents the operation. */ +export interface OperationDisplay { + /** Service provider: Microsoft Devices */ + readonly provider?: string; + /** Resource Type: IotHubs */ + readonly resource?: string; + /** Name of the operation */ + readonly operation?: string; + /** Description of the operation */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** Error details. */ +export interface ErrorDetails { + /** The error code. */ + readonly code?: string; + /** The HTTP status code. */ + readonly httpStatusCode?: string; + /** The error message. */ + readonly message?: string; + /** The error details. */ + readonly details?: string; +} + +export function errorDetailsDeserializer(item: any): ErrorDetails { + return { + code: item["code"], + httpStatusCode: item["httpStatusCode"], + message: item["message"], + details: item["details"], + }; +} + +/** The private endpoint connection of an IotHub */ +export interface PrivateEndpointConnection extends ProxyResource { + /** The properties of a private endpoint connection */ + properties: PrivateEndpointConnectionProperties; +} + +export function privateEndpointConnectionSerializer(item: PrivateEndpointConnection): any { + return { properties: privateEndpointConnectionPropertiesSerializer(item["properties"]) }; +} + +export function privateEndpointConnectionDeserializer(item: any): PrivateEndpointConnection { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: privateEndpointConnectionPropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of a private endpoint connection */ +export interface PrivateEndpointConnectionProperties { + /** The private endpoint property of a private endpoint connection */ + privateEndpoint?: PrivateEndpoint; + /** The current state of a private endpoint connection */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; +} + +export function privateEndpointConnectionPropertiesSerializer( + item: PrivateEndpointConnectionProperties, +): any { + return { + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointSerializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: privateLinkServiceConnectionStateSerializer( + item["privateLinkServiceConnectionState"], + ), + }; +} + +export function privateEndpointConnectionPropertiesDeserializer( + item: any, +): PrivateEndpointConnectionProperties { + return { + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointDeserializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: privateLinkServiceConnectionStateDeserializer( + item["privateLinkServiceConnectionState"], + ), + }; +} + +/** The private endpoint property of a private endpoint connection */ +export interface PrivateEndpoint { + /** The resource identifier. */ + readonly id?: string; +} + +export function privateEndpointSerializer(_item: PrivateEndpoint): any { + return {}; +} + +export function privateEndpointDeserializer(item: any): PrivateEndpoint { + return { + id: item["id"], + }; +} + +/** The current state of a private endpoint connection */ +export interface PrivateLinkServiceConnectionState { + /** The status of a private endpoint connection */ + status: PrivateLinkServiceConnectionStatus; + /** The description for the current state of a private endpoint connection */ + description: string; + /** Actions required for a private endpoint connection */ + actionsRequired?: string; +} + +export function privateLinkServiceConnectionStateSerializer( + item: PrivateLinkServiceConnectionState, +): any { + return { + status: item["status"], + description: item["description"], + actionsRequired: item["actionsRequired"], + }; +} + +export function privateLinkServiceConnectionStateDeserializer( + item: any, +): PrivateLinkServiceConnectionState { + return { + status: item["status"], + description: item["description"], + actionsRequired: item["actionsRequired"], + }; +} + +/** The status of a private endpoint connection */ +export enum KnownPrivateLinkServiceConnectionStatus { + /** Pending */ + Pending = "Pending", + /** Approved */ + Approved = "Approved", + /** Rejected */ + Rejected = "Rejected", + /** Disconnected */ + Disconnected = "Disconnected", +} + +/** + * The status of a private endpoint connection \ + * {@link KnownPrivateLinkServiceConnectionStatus} can be used interchangeably with PrivateLinkServiceConnectionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending**: Pending \ + * **Approved**: Approved \ + * **Rejected**: Rejected \ + * **Disconnected**: Disconnected + */ +export type PrivateLinkServiceConnectionStatus = string; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(_item: ProxyResource): any { + return {}; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(_item: Resource): any { + return {}; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** The description of the IoT hub. */ +export interface IotHubDescription extends TrackedResource { + /** IotHub properties */ + properties?: IotHubProperties; + /** The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention. */ + etag?: string; + /** IotHub SKU info */ + sku: IotHubSkuInfo; + /** The managed identities for the IotHub. */ + identity?: ArmIdentity; +} + +export function iotHubDescriptionSerializer(item: IotHubDescription): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : iotHubPropertiesSerializer(item["properties"]), + etag: item["etag"], + sku: iotHubSkuInfoSerializer(item["sku"]), + identity: !item["identity"] ? item["identity"] : armIdentitySerializer(item["identity"]), + }; +} + +export function iotHubDescriptionDeserializer(item: any): IotHubDescription { + return { + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : iotHubPropertiesDeserializer(item["properties"]), + etag: item["etag"], + sku: iotHubSkuInfoDeserializer(item["sku"]), + identity: !item["identity"] ? item["identity"] : armIdentityDeserializer(item["identity"]), + }; +} + +/** The properties of an IoT hub. */ +export interface IotHubProperties { + /** The shared access policies you can use to secure a connection to the IoT hub. */ + authorizationPolicies?: SharedAccessSignatureAuthorizationRule[]; + /** If true, SAS tokens with Iot hub scoped SAS keys cannot be used for authentication. */ + disableLocalAuth?: boolean; + /** If true, all device(including Edge devices but excluding modules) scoped SAS keys cannot be used for authentication. */ + disableDeviceSAS?: boolean; + /** If true, all module scoped SAS keys cannot be used for authentication. */ + disableModuleSAS?: boolean; + /** If true, egress from IotHub will be restricted to only the allowed FQDNs that are configured via allowedFqdnList. */ + restrictOutboundNetworkAccess?: boolean; + /** List of allowed FQDNs(Fully Qualified Domain Name) for egress from Iot Hub. */ + allowedFqdnList?: string[]; + /** Whether requests from Public Network are allowed */ + publicNetworkAccess?: PublicNetworkAccess; + /** The IP filter rules. */ + ipFilterRules?: IpFilterRule[]; + /** Network Rule Set Properties of IotHub */ + networkRuleSets?: NetworkRuleSetProperties; + /** Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to have clients that use a TLS version below 1.2 to be rejected. */ + minTlsVersion?: string; + /** Private endpoint connections created on this IotHub */ + privateEndpointConnections?: PrivateEndpointConnection[]; + /** The provisioning state. */ + readonly provisioningState?: string; + /** The hub state. */ + readonly state?: string; + /** The name of the host. */ + readonly hostName?: string; + /** The name of the device host. Supports secure connections over TLS 1.3. */ + readonly deviceHostName?: string; + /** The name of the service host. Supports secure connections over TLS 1.3. */ + readonly serviceHostName?: string; + /** 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?: Record; + /** The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging */ + routing?: RoutingProperties; + /** The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. */ + storageEndpoints?: Record; + /** The messaging endpoint properties for the file upload notification queue. */ + messagingEndpoints?: Record; + /** If True, file upload notifications are enabled. */ + enableFileUploadNotifications?: boolean; + /** The IoT hub cloud-to-device messaging properties. */ + cloudToDevice?: CloudToDeviceProperties; + /** IoT hub comments. */ + comments?: string; + /** The device streams properties of iothub. */ + deviceStreams?: IotHubPropertiesDeviceStreams; + /** The capabilities and features enabled for the IoT hub. */ + features?: Capabilities; + /** The encryption properties for the IoT hub. */ + encryption?: EncryptionPropertiesDescription; + /** Primary and secondary location for iot hub */ + readonly locations?: IotHubLocationDescription[]; + /** This property when set to true, will enable data residency, thus, disabling disaster recovery. */ + enableDataResidency?: boolean; + /** This property store root certificate related information */ + rootCertificate?: RootCertificateProperties; + /** This property specifies the IP Version the hub is currently utilizing. */ + ipVersion?: IpVersion; + /** Represents properties related to the Azure Device Registry (ADR). */ + deviceRegistry?: DeviceRegistry; + /** Set of additional read-only properties for the IoT hub. */ + readonly iotHubDetails?: IotHubDetails; +} + +export function iotHubPropertiesSerializer(item: IotHubProperties): any { + return { + authorizationPolicies: !item["authorizationPolicies"] + ? item["authorizationPolicies"] + : sharedAccessSignatureAuthorizationRuleArraySerializer(item["authorizationPolicies"]), + disableLocalAuth: item["disableLocalAuth"], + disableDeviceSAS: item["disableDeviceSAS"], + disableModuleSAS: item["disableModuleSAS"], + restrictOutboundNetworkAccess: item["restrictOutboundNetworkAccess"], + allowedFqdnList: !item["allowedFqdnList"] + ? item["allowedFqdnList"] + : item["allowedFqdnList"].map((p: any) => { + return p; + }), + publicNetworkAccess: item["publicNetworkAccess"], + ipFilterRules: !item["ipFilterRules"] + ? item["ipFilterRules"] + : ipFilterRuleArraySerializer(item["ipFilterRules"]), + networkRuleSets: !item["networkRuleSets"] + ? item["networkRuleSets"] + : networkRuleSetPropertiesSerializer(item["networkRuleSets"]), + minTlsVersion: item["minTlsVersion"], + privateEndpointConnections: !item["privateEndpointConnections"] + ? item["privateEndpointConnections"] + : privateEndpointConnectionArraySerializer(item["privateEndpointConnections"]), + eventHubEndpoints: !item["eventHubEndpoints"] + ? item["eventHubEndpoints"] + : eventHubPropertiesRecordSerializer(item["eventHubEndpoints"]), + routing: !item["routing"] ? item["routing"] : routingPropertiesSerializer(item["routing"]), + storageEndpoints: !item["storageEndpoints"] + ? item["storageEndpoints"] + : storageEndpointPropertiesRecordSerializer(item["storageEndpoints"]), + messagingEndpoints: !item["messagingEndpoints"] + ? item["messagingEndpoints"] + : messagingEndpointPropertiesRecordSerializer(item["messagingEndpoints"]), + enableFileUploadNotifications: item["enableFileUploadNotifications"], + cloudToDevice: !item["cloudToDevice"] + ? item["cloudToDevice"] + : cloudToDevicePropertiesSerializer(item["cloudToDevice"]), + comments: item["comments"], + deviceStreams: !item["deviceStreams"] + ? item["deviceStreams"] + : iotHubPropertiesDeviceStreamsSerializer(item["deviceStreams"]), + features: item["features"], + encryption: !item["encryption"] + ? item["encryption"] + : encryptionPropertiesDescriptionSerializer(item["encryption"]), + enableDataResidency: item["enableDataResidency"], + rootCertificate: !item["rootCertificate"] + ? item["rootCertificate"] + : rootCertificatePropertiesSerializer(item["rootCertificate"]), + ipVersion: item["ipVersion"], + deviceRegistry: !item["deviceRegistry"] + ? item["deviceRegistry"] + : deviceRegistrySerializer(item["deviceRegistry"]), + }; +} + +export function iotHubPropertiesDeserializer(item: any): IotHubProperties { + return { + authorizationPolicies: !item["authorizationPolicies"] + ? item["authorizationPolicies"] + : sharedAccessSignatureAuthorizationRuleArrayDeserializer(item["authorizationPolicies"]), + disableLocalAuth: item["disableLocalAuth"], + disableDeviceSAS: item["disableDeviceSAS"], + disableModuleSAS: item["disableModuleSAS"], + restrictOutboundNetworkAccess: item["restrictOutboundNetworkAccess"], + allowedFqdnList: !item["allowedFqdnList"] + ? item["allowedFqdnList"] + : item["allowedFqdnList"].map((p: any) => { + return p; + }), + publicNetworkAccess: item["publicNetworkAccess"], + ipFilterRules: !item["ipFilterRules"] + ? item["ipFilterRules"] + : ipFilterRuleArrayDeserializer(item["ipFilterRules"]), + networkRuleSets: !item["networkRuleSets"] + ? item["networkRuleSets"] + : networkRuleSetPropertiesDeserializer(item["networkRuleSets"]), + minTlsVersion: item["minTlsVersion"], + privateEndpointConnections: !item["privateEndpointConnections"] + ? item["privateEndpointConnections"] + : privateEndpointConnectionArrayDeserializer(item["privateEndpointConnections"]), + provisioningState: item["provisioningState"], + state: item["state"], + hostName: item["hostName"], + deviceHostName: item["deviceHostName"], + serviceHostName: item["serviceHostName"], + eventHubEndpoints: !item["eventHubEndpoints"] + ? item["eventHubEndpoints"] + : eventHubPropertiesRecordDeserializer(item["eventHubEndpoints"]), + routing: !item["routing"] ? item["routing"] : routingPropertiesDeserializer(item["routing"]), + storageEndpoints: !item["storageEndpoints"] + ? item["storageEndpoints"] + : storageEndpointPropertiesRecordDeserializer(item["storageEndpoints"]), + messagingEndpoints: !item["messagingEndpoints"] + ? item["messagingEndpoints"] + : messagingEndpointPropertiesRecordDeserializer(item["messagingEndpoints"]), + enableFileUploadNotifications: item["enableFileUploadNotifications"], + cloudToDevice: !item["cloudToDevice"] + ? item["cloudToDevice"] + : cloudToDevicePropertiesDeserializer(item["cloudToDevice"]), + comments: item["comments"], + deviceStreams: !item["deviceStreams"] + ? item["deviceStreams"] + : iotHubPropertiesDeviceStreamsDeserializer(item["deviceStreams"]), + features: item["features"], + encryption: !item["encryption"] + ? item["encryption"] + : encryptionPropertiesDescriptionDeserializer(item["encryption"]), + locations: !item["locations"] + ? item["locations"] + : iotHubLocationDescriptionArrayDeserializer(item["locations"]), + enableDataResidency: item["enableDataResidency"], + rootCertificate: !item["rootCertificate"] + ? item["rootCertificate"] + : rootCertificatePropertiesDeserializer(item["rootCertificate"]), + ipVersion: item["ipVersion"], + deviceRegistry: !item["deviceRegistry"] + ? item["deviceRegistry"] + : deviceRegistryDeserializer(item["deviceRegistry"]), + iotHubDetails: !item["iotHubDetails"] + ? item["iotHubDetails"] + : iotHubDetailsDeserializer(item["iotHubDetails"]), + }; +} + +export function sharedAccessSignatureAuthorizationRuleArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return sharedAccessSignatureAuthorizationRuleSerializer(item); + }); +} + +export function sharedAccessSignatureAuthorizationRuleArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return sharedAccessSignatureAuthorizationRuleDeserializer(item); + }); +} + +/** The properties of an IoT hub shared access policy. */ +export interface SharedAccessSignatureAuthorizationRule { + /** The name of the shared access policy. */ + keyName: string; + /** The primary key. */ + primaryKey?: string; + /** The secondary key. */ + secondaryKey?: string; + /** The permissions assigned to the shared access policy. */ + rights: AccessRights; +} + +export function sharedAccessSignatureAuthorizationRuleSerializer( + item: SharedAccessSignatureAuthorizationRule, +): any { + return { + keyName: item["keyName"], + primaryKey: item["primaryKey"], + secondaryKey: item["secondaryKey"], + rights: item["rights"], + }; +} + +export function sharedAccessSignatureAuthorizationRuleDeserializer( + item: any, +): SharedAccessSignatureAuthorizationRule { + return { + keyName: item["keyName"], + primaryKey: item["primaryKey"], + secondaryKey: item["secondaryKey"], + rights: item["rights"], + }; +} + +/** The permissions assigned to the shared access policy. */ +export type AccessRights = + | "RegistryRead" + | "RegistryWrite" + | "ServiceConnect" + | "DeviceConnect" + | "RegistryRead, RegistryWrite" + | "RegistryRead, ServiceConnect" + | "RegistryRead, DeviceConnect" + | "RegistryWrite, ServiceConnect" + | "RegistryWrite, DeviceConnect" + | "ServiceConnect, DeviceConnect" + | "RegistryRead, RegistryWrite, ServiceConnect" + | "RegistryRead, RegistryWrite, DeviceConnect" + | "RegistryRead, ServiceConnect, DeviceConnect" + | "RegistryWrite, ServiceConnect, DeviceConnect" + | "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect"; + +/** Whether requests from Public Network are allowed */ +export enum KnownPublicNetworkAccess { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Whether requests from Public Network are allowed \ + * {@link KnownPublicNetworkAccess} can be used interchangeably with PublicNetworkAccess, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: Enabled \ + * **Disabled**: Disabled + */ +export type PublicNetworkAccess = string; + +export function ipFilterRuleArraySerializer(result: Array): any[] { + return result.map((item) => { + return ipFilterRuleSerializer(item); + }); +} + +export function ipFilterRuleArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return ipFilterRuleDeserializer(item); + }); +} + +/** The IP filter rules for the IoT hub. */ +export interface IpFilterRule { + /** The name of the IP filter rule. */ + filterName: string; + /** The desired action for requests captured by this rule. */ + action: IpFilterActionType; + /** A string that contains the IP address range in CIDR notation for the rule. */ + ipMask: string; +} + +export function ipFilterRuleSerializer(item: IpFilterRule): any { + return { filterName: item["filterName"], action: item["action"], ipMask: item["ipMask"] }; +} + +export function ipFilterRuleDeserializer(item: any): IpFilterRule { + return { + filterName: item["filterName"], + action: item["action"], + ipMask: item["ipMask"], + }; +} + +/** The desired action for requests captured by this rule. */ +export type IpFilterActionType = "Accept" | "Reject"; + +/** Network Rule Set Properties of IotHub */ +export interface NetworkRuleSetProperties { + /** Default Action for Network Rule Set */ + defaultAction?: DefaultAction; + /** If True, then Network Rule Set is also applied to BuiltIn EventHub EndPoint of IotHub */ + applyToBuiltInEventHubEndpoint: boolean; + /** List of IP Rules */ + ipRules: NetworkRuleSetIpRule[]; +} + +export function networkRuleSetPropertiesSerializer(item: NetworkRuleSetProperties): any { + return { + defaultAction: item["defaultAction"], + applyToBuiltInEventHubEndpoint: item["applyToBuiltInEventHubEndpoint"], + ipRules: networkRuleSetIpRuleArraySerializer(item["ipRules"]), + }; +} + +export function networkRuleSetPropertiesDeserializer(item: any): NetworkRuleSetProperties { + return { + defaultAction: item["defaultAction"], + applyToBuiltInEventHubEndpoint: item["applyToBuiltInEventHubEndpoint"], + ipRules: networkRuleSetIpRuleArrayDeserializer(item["ipRules"]), + }; +} + +/** Default Action for Network Rule Set */ +export enum KnownDefaultAction { + /** Deny */ + Deny = "Deny", + /** Allow */ + Allow = "Allow", +} + +/** + * Default Action for Network Rule Set \ + * {@link KnownDefaultAction} can be used interchangeably with DefaultAction, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Deny**: Deny \ + * **Allow**: Allow + */ +export type DefaultAction = string; + +export function networkRuleSetIpRuleArraySerializer(result: Array): any[] { + return result.map((item) => { + return networkRuleSetIpRuleSerializer(item); + }); +} + +export function networkRuleSetIpRuleArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return networkRuleSetIpRuleDeserializer(item); + }); +} + +/** IP Rule to be applied as part of Network Rule Set */ +export interface NetworkRuleSetIpRule { + /** Name of the IP filter rule. */ + filterName: string; + /** IP Filter Action */ + action?: NetworkRuleIPAction; + /** A string that contains the IP address range in CIDR notation for the rule. */ + ipMask: string; +} + +export function networkRuleSetIpRuleSerializer(item: NetworkRuleSetIpRule): any { + return { filterName: item["filterName"], action: item["action"], ipMask: item["ipMask"] }; +} + +export function networkRuleSetIpRuleDeserializer(item: any): NetworkRuleSetIpRule { + return { + filterName: item["filterName"], + action: item["action"], + ipMask: item["ipMask"], + }; +} + +/** IP Filter Action */ +export enum KnownNetworkRuleIPAction { + /** Allow */ + Allow = "Allow", +} + +/** + * IP Filter Action \ + * {@link KnownNetworkRuleIPAction} can be used interchangeably with NetworkRuleIPAction, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Allow**: Allow + */ +export type NetworkRuleIPAction = string; + +export function privateEndpointConnectionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return privateEndpointConnectionSerializer(item); + }); +} + +export function privateEndpointConnectionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return privateEndpointConnectionDeserializer(item); + }); +} + +export function eventHubPropertiesRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : eventHubPropertiesSerializer(item[key]); + }); + return result; +} + +export function eventHubPropertiesRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : eventHubPropertiesDeserializer(item[key]); + }); + return result; +} + +/** The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. */ +export interface EventHubProperties { + /** The retention time for device-to-cloud messages in days. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages */ + retentionTimeInDays?: number; + /** The number of partitions for receiving device-to-cloud messages in the Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. */ + partitionCount?: number; + /** The partition ids in the Event Hub-compatible endpoint. */ + readonly partitionIds?: string[]; + /** The Event Hub-compatible name. */ + readonly path?: string; + /** The Event Hub-compatible endpoint. */ + readonly endpoint?: string; +} + +export function eventHubPropertiesSerializer(item: EventHubProperties): any { + return { + retentionTimeInDays: item["retentionTimeInDays"], + partitionCount: item["partitionCount"], + }; +} + +export function eventHubPropertiesDeserializer(item: any): EventHubProperties { + return { + retentionTimeInDays: item["retentionTimeInDays"], + partitionCount: item["partitionCount"], + partitionIds: !item["partitionIds"] + ? item["partitionIds"] + : item["partitionIds"].map((p: any) => { + return p; + }), + path: item["path"], + endpoint: item["endpoint"], + }; +} + +/** The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging */ +export interface RoutingProperties { + /** The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. */ + endpoints?: RoutingEndpoints; + /** The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. */ + routes?: RouteProperties[]; + /** The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. */ + fallbackRoute?: FallbackRouteProperties; + /** 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[]; +} + +export function routingPropertiesSerializer(item: RoutingProperties): any { + return { + endpoints: !item["endpoints"] + ? item["endpoints"] + : routingEndpointsSerializer(item["endpoints"]), + routes: !item["routes"] ? item["routes"] : routePropertiesArraySerializer(item["routes"]), + fallbackRoute: !item["fallbackRoute"] + ? item["fallbackRoute"] + : fallbackRoutePropertiesSerializer(item["fallbackRoute"]), + enrichments: !item["enrichments"] + ? item["enrichments"] + : enrichmentPropertiesArraySerializer(item["enrichments"]), + }; +} + +export function routingPropertiesDeserializer(item: any): RoutingProperties { + return { + endpoints: !item["endpoints"] + ? item["endpoints"] + : routingEndpointsDeserializer(item["endpoints"]), + routes: !item["routes"] ? item["routes"] : routePropertiesArrayDeserializer(item["routes"]), + fallbackRoute: !item["fallbackRoute"] + ? item["fallbackRoute"] + : fallbackRoutePropertiesDeserializer(item["fallbackRoute"]), + enrichments: !item["enrichments"] + ? item["enrichments"] + : enrichmentPropertiesArrayDeserializer(item["enrichments"]), + }; +} + +/** The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. */ +export interface RoutingEndpoints { + /** The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. */ + serviceBusQueues?: RoutingServiceBusQueueEndpointProperties[]; + /** The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. */ + serviceBusTopics?: RoutingServiceBusTopicEndpointProperties[]; + /** The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. */ + eventHubs?: RoutingEventHubProperties[]; + /** The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. */ + storageContainers?: RoutingStorageContainerProperties[]; + /** The list of Cosmos DB container endpoints that IoT hub routes messages to, based on the routing rules. */ + cosmosDBSqlContainers?: RoutingCosmosDBSqlApiProperties[]; +} + +export function routingEndpointsSerializer(item: RoutingEndpoints): any { + return { + serviceBusQueues: !item["serviceBusQueues"] + ? item["serviceBusQueues"] + : routingServiceBusQueueEndpointPropertiesArraySerializer(item["serviceBusQueues"]), + serviceBusTopics: !item["serviceBusTopics"] + ? item["serviceBusTopics"] + : routingServiceBusTopicEndpointPropertiesArraySerializer(item["serviceBusTopics"]), + eventHubs: !item["eventHubs"] + ? item["eventHubs"] + : routingEventHubPropertiesArraySerializer(item["eventHubs"]), + storageContainers: !item["storageContainers"] + ? item["storageContainers"] + : routingStorageContainerPropertiesArraySerializer(item["storageContainers"]), + cosmosDBSqlContainers: !item["cosmosDBSqlContainers"] + ? item["cosmosDBSqlContainers"] + : routingCosmosDBSqlApiPropertiesArraySerializer(item["cosmosDBSqlContainers"]), + }; +} + +export function routingEndpointsDeserializer(item: any): RoutingEndpoints { + return { + serviceBusQueues: !item["serviceBusQueues"] + ? item["serviceBusQueues"] + : routingServiceBusQueueEndpointPropertiesArrayDeserializer(item["serviceBusQueues"]), + serviceBusTopics: !item["serviceBusTopics"] + ? item["serviceBusTopics"] + : routingServiceBusTopicEndpointPropertiesArrayDeserializer(item["serviceBusTopics"]), + eventHubs: !item["eventHubs"] + ? item["eventHubs"] + : routingEventHubPropertiesArrayDeserializer(item["eventHubs"]), + storageContainers: !item["storageContainers"] + ? item["storageContainers"] + : routingStorageContainerPropertiesArrayDeserializer(item["storageContainers"]), + cosmosDBSqlContainers: !item["cosmosDBSqlContainers"] + ? item["cosmosDBSqlContainers"] + : routingCosmosDBSqlApiPropertiesArrayDeserializer(item["cosmosDBSqlContainers"]), + }; +} + +export function routingServiceBusQueueEndpointPropertiesArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return routingServiceBusQueueEndpointPropertiesSerializer(item); + }); +} + +export function routingServiceBusQueueEndpointPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return routingServiceBusQueueEndpointPropertiesDeserializer(item); + }); +} + +/** The properties related to service bus queue endpoint types. */ +export interface RoutingServiceBusQueueEndpointProperties { + /** Id of the service bus queue endpoint */ + id?: string; + /** The connection string of the service bus queue endpoint. */ + connectionString?: string; + /** The url of the service bus queue endpoint. It must include the protocol sb:// */ + endpointUri?: string; + /** Queue name on the service bus namespace */ + entityPath?: string; + /** Method used to authenticate against the service bus queue endpoint */ + authenticationType?: AuthenticationType; + /** Managed identity properties of routing service bus queue endpoint. */ + identity?: ManagedIdentity; + /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual queue name. */ + name: string; + /** The subscription identifier of the service bus queue endpoint. */ + subscriptionId?: string; + /** The name of the resource group of the service bus queue endpoint. */ + resourceGroup?: string; +} + +export function routingServiceBusQueueEndpointPropertiesSerializer( + item: RoutingServiceBusQueueEndpointProperties, +): any { + return { + id: item["id"], + connectionString: item["connectionString"], + endpointUri: item["endpointUri"], + entityPath: item["entityPath"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + }; +} + +export function routingServiceBusQueueEndpointPropertiesDeserializer( + item: any, +): RoutingServiceBusQueueEndpointProperties { + return { + id: item["id"], + connectionString: item["connectionString"], + endpointUri: item["endpointUri"], + entityPath: item["entityPath"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentityDeserializer(item["identity"]), + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + }; +} + +/** Specifies authentication type being used for connecting to the storage account. */ +export enum KnownAuthenticationType { + /** keyBased */ + KeyBased = "keyBased", + /** identityBased */ + IdentityBased = "identityBased", +} + +/** + * Specifies authentication type being used for connecting to the storage account. \ + * {@link KnownAuthenticationType} can be used interchangeably with AuthenticationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **keyBased**: keyBased \ + * **identityBased**: identityBased + */ +export type AuthenticationType = string; + +/** The properties of the Managed identity. */ +export interface ManagedIdentity { + /** The user assigned identity. */ + userAssignedIdentity?: string; +} + +export function managedIdentitySerializer(item: ManagedIdentity): any { + return { userAssignedIdentity: item["userAssignedIdentity"] }; +} + +export function managedIdentityDeserializer(item: any): ManagedIdentity { + return { + userAssignedIdentity: item["userAssignedIdentity"], + }; +} + +export function routingServiceBusTopicEndpointPropertiesArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return routingServiceBusTopicEndpointPropertiesSerializer(item); + }); +} + +export function routingServiceBusTopicEndpointPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return routingServiceBusTopicEndpointPropertiesDeserializer(item); + }); +} + +/** The properties related to service bus topic endpoint types. */ +export interface RoutingServiceBusTopicEndpointProperties { + /** Id of the service bus topic endpoint */ + id?: string; + /** The connection string of the service bus topic endpoint. */ + connectionString?: string; + /** The url of the service bus topic endpoint. It must include the protocol sb:// */ + endpointUri?: string; + /** Queue name on the service bus topic */ + entityPath?: string; + /** Method used to authenticate against the service bus topic endpoint */ + authenticationType?: AuthenticationType; + /** Managed identity properties of routing service bus topic endpoint. */ + identity?: ManagedIdentity; + /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual topic name. */ + name: string; + /** The subscription identifier of the service bus topic endpoint. */ + subscriptionId?: string; + /** The name of the resource group of the service bus topic endpoint. */ + resourceGroup?: string; +} + +export function routingServiceBusTopicEndpointPropertiesSerializer( + item: RoutingServiceBusTopicEndpointProperties, +): any { + return { + id: item["id"], + connectionString: item["connectionString"], + endpointUri: item["endpointUri"], + entityPath: item["entityPath"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + }; +} + +export function routingServiceBusTopicEndpointPropertiesDeserializer( + item: any, +): RoutingServiceBusTopicEndpointProperties { + return { + id: item["id"], + connectionString: item["connectionString"], + endpointUri: item["endpointUri"], + entityPath: item["entityPath"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentityDeserializer(item["identity"]), + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + }; +} + +export function routingEventHubPropertiesArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return routingEventHubPropertiesSerializer(item); + }); +} + +export function routingEventHubPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return routingEventHubPropertiesDeserializer(item); + }); +} + +/** The properties related to an event hub endpoint. */ +export interface RoutingEventHubProperties { + /** Id of the event hub endpoint */ + id?: string; + /** The connection string of the event hub endpoint. */ + connectionString?: string; + /** The url of the event hub endpoint. It must include the protocol sb:// */ + endpointUri?: string; + /** Event hub name on the event hub namespace */ + entityPath?: string; + /** Method used to authenticate against the event hub endpoint */ + authenticationType?: AuthenticationType; + /** Managed identity properties of routing event hub endpoint. */ + identity?: ManagedIdentity; + /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. */ + name: string; + /** The subscription identifier of the event hub endpoint. */ + subscriptionId?: string; + /** The name of the resource group of the event hub endpoint. */ + resourceGroup?: string; +} + +export function routingEventHubPropertiesSerializer(item: RoutingEventHubProperties): any { + return { + id: item["id"], + connectionString: item["connectionString"], + endpointUri: item["endpointUri"], + entityPath: item["entityPath"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + }; +} + +export function routingEventHubPropertiesDeserializer(item: any): RoutingEventHubProperties { + return { + id: item["id"], + connectionString: item["connectionString"], + endpointUri: item["endpointUri"], + entityPath: item["entityPath"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentityDeserializer(item["identity"]), + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + }; +} + +export function routingStorageContainerPropertiesArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return routingStorageContainerPropertiesSerializer(item); + }); +} + +export function routingStorageContainerPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return routingStorageContainerPropertiesDeserializer(item); + }); +} + +/** The properties related to a storage container endpoint. */ +export interface RoutingStorageContainerProperties { + /** Id of the storage container endpoint */ + id?: string; + /** The connection string of the storage account. */ + connectionString?: string; + /** The url of the storage endpoint. It must include the protocol https:// */ + endpointUri?: string; + /** Method used to authenticate against the storage endpoint */ + authenticationType?: AuthenticationType; + /** Managed identity properties of routing storage endpoint. */ + identity?: ManagedIdentity; + /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. */ + name: string; + /** The subscription identifier of the storage account. */ + subscriptionId?: string; + /** The name of the resource group of the storage account. */ + resourceGroup?: string; + /** The name of storage container in the storage account. */ + containerName: string; + /** File name format for the blob. Default format is {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be reordered. */ + fileNameFormat?: string; + /** Time interval at which blobs are written to storage. Value should be between 60 and 720 seconds. Default value is 300 seconds. */ + batchFrequencyInSeconds?: number; + /** Maximum number of bytes for each blob written to storage. Value should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). */ + maxChunkSizeInBytes?: number; + /** Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. */ + encoding?: RoutingStorageContainerPropertiesEncoding; +} + +export function routingStorageContainerPropertiesSerializer( + item: RoutingStorageContainerProperties, +): any { + return { + id: item["id"], + connectionString: item["connectionString"], + endpointUri: item["endpointUri"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + containerName: item["containerName"], + fileNameFormat: item["fileNameFormat"], + batchFrequencyInSeconds: item["batchFrequencyInSeconds"], + maxChunkSizeInBytes: item["maxChunkSizeInBytes"], + encoding: item["encoding"], + }; +} + +export function routingStorageContainerPropertiesDeserializer( + item: any, +): RoutingStorageContainerProperties { + return { + id: item["id"], + connectionString: item["connectionString"], + endpointUri: item["endpointUri"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentityDeserializer(item["identity"]), + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + containerName: item["containerName"], + fileNameFormat: item["fileNameFormat"], + batchFrequencyInSeconds: item["batchFrequencyInSeconds"], + maxChunkSizeInBytes: item["maxChunkSizeInBytes"], + encoding: item["encoding"], + }; +} + +/** Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. */ +export enum KnownRoutingStorageContainerPropertiesEncoding { + /** Avro */ + Avro = "Avro", + /** AvroDeflate */ + AvroDeflate = "AvroDeflate", + /** JSON */ + Json = "JSON", +} + +/** + * Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. \ + * {@link KnownRoutingStorageContainerPropertiesEncoding} can be used interchangeably with RoutingStorageContainerPropertiesEncoding, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Avro**: Avro \ + * **AvroDeflate**: AvroDeflate \ + * **JSON**: JSON + */ +export type RoutingStorageContainerPropertiesEncoding = string; + +export function routingCosmosDBSqlApiPropertiesArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return routingCosmosDBSqlApiPropertiesSerializer(item); + }); +} + +export function routingCosmosDBSqlApiPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return routingCosmosDBSqlApiPropertiesDeserializer(item); + }); +} + +/** The properties related to a cosmos DB sql container endpoint. */ +export interface RoutingCosmosDBSqlApiProperties { + /** 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, fileNotifications, $default. Endpoint names must be unique across endpoint types. */ + name: string; + /** Id of the cosmos DB sql container endpoint */ + readonly id?: string; + /** The subscription identifier of the cosmos DB account. */ + subscriptionId?: string; + /** The name of the resource group of the cosmos DB account. */ + resourceGroup?: string; + /** The url of the cosmos DB account. It must include the protocol https:// */ + endpointUri: string; + /** Method used to authenticate against the cosmos DB sql container endpoint */ + authenticationType?: AuthenticationType; + /** Managed identity properties of routing cosmos DB container endpoint. */ + identity?: ManagedIdentity; + /** The primary key of the cosmos DB account. */ + primaryKey?: string; + /** The secondary key of the cosmos DB account. */ + secondaryKey?: string; + /** The name of the cosmos DB database in the cosmos DB account. */ + databaseName: string; + /** The name of the cosmos DB sql container in the cosmos DB database. */ + containerName: string; + /** The name of the partition key associated with this cosmos DB sql container if one exists. This is an optional parameter. */ + partitionKeyName?: string; + /** The template for generating a synthetic partition key value for use with this cosmos DB sql container. The template must include at least one of the following placeholders: {iothub}, {deviceid}, {DD}, {MM}, and {YYYY}. Any one placeholder may be specified at most once, but order and non-placeholder components are arbitrary. This parameter is only required if PartitionKeyName is specified. */ + partitionKeyTemplate?: string; +} + +export function routingCosmosDBSqlApiPropertiesSerializer( + item: RoutingCosmosDBSqlApiProperties, +): any { + return { + name: item["name"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + endpointUri: item["endpointUri"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + primaryKey: item["primaryKey"], + secondaryKey: item["secondaryKey"], + databaseName: item["databaseName"], + containerName: item["containerName"], + partitionKeyName: item["partitionKeyName"], + partitionKeyTemplate: item["partitionKeyTemplate"], + }; +} + +export function routingCosmosDBSqlApiPropertiesDeserializer( + item: any, +): RoutingCosmosDBSqlApiProperties { + return { + name: item["name"], + id: item["id"], + subscriptionId: item["subscriptionId"], + resourceGroup: item["resourceGroup"], + endpointUri: item["endpointUri"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentityDeserializer(item["identity"]), + primaryKey: item["primaryKey"], + secondaryKey: item["secondaryKey"], + databaseName: item["databaseName"], + containerName: item["containerName"], + partitionKeyName: item["partitionKeyName"], + partitionKeyTemplate: item["partitionKeyTemplate"], + }; +} + +export function routePropertiesArraySerializer(result: Array): any[] { + return result.map((item) => { + return routePropertiesSerializer(item); + }); +} + +export function routePropertiesArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return routePropertiesDeserializer(item); + }); +} + +/** The properties of a routing rule that your IoT hub uses to route messages to endpoints. */ +export interface RouteProperties { + /** The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. */ + name: string; + /** The source that the routing rule is to be applied to, such as DeviceMessages. */ + source: RoutingSource; + /** The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language */ + condition?: string; + /** The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed. */ + endpointNames: string[]; + /** Used to specify whether a route is enabled. */ + isEnabled: boolean; +} + +export function routePropertiesSerializer(item: RouteProperties): any { + return { + name: item["name"], + source: item["source"], + condition: item["condition"], + endpointNames: item["endpointNames"].map((p: any) => { + return p; + }), + isEnabled: item["isEnabled"], + }; +} + +export function routePropertiesDeserializer(item: any): RouteProperties { + return { + name: item["name"], + source: item["source"], + condition: item["condition"], + endpointNames: item["endpointNames"].map((p: any) => { + return p; + }), + isEnabled: item["isEnabled"], + }; +} + +/** The source that the routing rule is to be applied to, such as DeviceMessages. */ +export enum KnownRoutingSource { + /** Invalid */ + Invalid = "Invalid", + /** DeviceMessages */ + DeviceMessages = "DeviceMessages", + /** TwinChangeEvents */ + TwinChangeEvents = "TwinChangeEvents", + /** DeviceLifecycleEvents */ + DeviceLifecycleEvents = "DeviceLifecycleEvents", + /** DeviceJobLifecycleEvents */ + DeviceJobLifecycleEvents = "DeviceJobLifecycleEvents", + /** DigitalTwinChangeEvents */ + DigitalTwinChangeEvents = "DigitalTwinChangeEvents", + /** DeviceConnectionStateEvents */ + DeviceConnectionStateEvents = "DeviceConnectionStateEvents", + /** MqttBrokerMessages */ + MqttBrokerMessages = "MqttBrokerMessages", +} + +/** + * The source that the routing rule is to be applied to, such as DeviceMessages. \ + * {@link KnownRoutingSource} can be used interchangeably with RoutingSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid**: Invalid \ + * **DeviceMessages**: DeviceMessages \ + * **TwinChangeEvents**: TwinChangeEvents \ + * **DeviceLifecycleEvents**: DeviceLifecycleEvents \ + * **DeviceJobLifecycleEvents**: DeviceJobLifecycleEvents \ + * **DigitalTwinChangeEvents**: DigitalTwinChangeEvents \ + * **DeviceConnectionStateEvents**: DeviceConnectionStateEvents \ + * **MqttBrokerMessages**: MqttBrokerMessages + */ +export type RoutingSource = string; + +/** The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. */ +export interface FallbackRouteProperties { + /** The name of the route. The name can only include alphanumeric characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique. */ + name?: string; + /** The source to which the routing rule is to be applied to. For example, DeviceMessages */ + source: RoutingSource; + /** The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language */ + condition?: string; + /** The list of endpoints to which the messages that satisfy the condition are routed to. Currently only 1 endpoint is allowed. */ + endpointNames: string[]; + /** Used to specify whether the fallback route is enabled. */ + isEnabled: boolean; +} + +export function fallbackRoutePropertiesSerializer(item: FallbackRouteProperties): any { + return { + name: item["name"], + source: item["source"], + condition: item["condition"], + endpointNames: item["endpointNames"].map((p: any) => { + return p; + }), + isEnabled: item["isEnabled"], + }; +} + +export function fallbackRoutePropertiesDeserializer(item: any): FallbackRouteProperties { + return { + name: item["name"], + source: item["source"], + condition: item["condition"], + endpointNames: item["endpointNames"].map((p: any) => { + return p; + }), + isEnabled: item["isEnabled"], + }; +} + +export function enrichmentPropertiesArraySerializer(result: Array): any[] { + return result.map((item) => { + return enrichmentPropertiesSerializer(item); + }); +} + +export function enrichmentPropertiesArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return enrichmentPropertiesDeserializer(item); + }); +} + +/** The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. */ +export interface EnrichmentProperties { + /** The key or name for the enrichment property. */ + key: string; + /** The value for the enrichment property. */ + value: string; + /** The list of endpoints for which the enrichment is applied to the message. */ + endpointNames: string[]; +} + +export function enrichmentPropertiesSerializer(item: EnrichmentProperties): any { + return { + key: item["key"], + value: item["value"], + endpointNames: item["endpointNames"].map((p: any) => { + return p; + }), + }; +} + +export function enrichmentPropertiesDeserializer(item: any): EnrichmentProperties { + return { + key: item["key"], + value: item["value"], + endpointNames: item["endpointNames"].map((p: any) => { + return p; + }), + }; +} + +export function storageEndpointPropertiesRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : storageEndpointPropertiesSerializer(item[key]); + }); + return result; +} + +export function storageEndpointPropertiesRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : storageEndpointPropertiesDeserializer(item[key]); + }); + return result; +} + +/** The properties of the Azure Storage endpoint for file upload. */ +export interface StorageEndpointProperties { + /** 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; + /** The connection string for the Azure Storage account to which files are uploaded. */ + connectionString: string; + /** The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified. */ + containerName: string; + /** Specifies authentication type being used for connecting to the storage account. */ + authenticationType?: AuthenticationType; + /** Managed identity properties of storage endpoint for file upload. */ + identity?: ManagedIdentity; +} + +export function storageEndpointPropertiesSerializer(item: StorageEndpointProperties): any { + return { + sasTtlAsIso8601: item["sasTtlAsIso8601"], + connectionString: item["connectionString"], + containerName: item["containerName"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + }; +} + +export function storageEndpointPropertiesDeserializer(item: any): StorageEndpointProperties { + return { + sasTtlAsIso8601: item["sasTtlAsIso8601"], + connectionString: item["connectionString"], + containerName: item["containerName"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentityDeserializer(item["identity"]), + }; +} + +export function messagingEndpointPropertiesRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : messagingEndpointPropertiesSerializer(item[key]); + }); + return result; +} + +export function messagingEndpointPropertiesRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : messagingEndpointPropertiesDeserializer(item[key]); + }); + return result; +} + +/** The properties of the messaging endpoints used by this IoT hub. */ +export interface MessagingEndpointProperties { + /** The lock duration. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. */ + lockDurationAsIso8601?: string; + /** The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. */ + ttlAsIso8601?: string; + /** The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. */ + maxDeliveryCount?: number; +} + +export function messagingEndpointPropertiesSerializer(item: MessagingEndpointProperties): any { + return { + lockDurationAsIso8601: item["lockDurationAsIso8601"], + ttlAsIso8601: item["ttlAsIso8601"], + maxDeliveryCount: item["maxDeliveryCount"], + }; +} + +export function messagingEndpointPropertiesDeserializer(item: any): MessagingEndpointProperties { + return { + lockDurationAsIso8601: item["lockDurationAsIso8601"], + ttlAsIso8601: item["ttlAsIso8601"], + maxDeliveryCount: item["maxDeliveryCount"], + }; +} + +/** The IoT hub cloud-to-device messaging properties. */ +export interface CloudToDeviceProperties { + /** The max delivery count for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ + maxDeliveryCount?: number; + /** The default time to live for cloud-to-device messages in the device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ + defaultTtlAsIso8601?: string; + /** The properties of the feedback queue for cloud-to-device messages. */ + feedback?: FeedbackProperties; +} + +export function cloudToDevicePropertiesSerializer(item: CloudToDeviceProperties): any { + return { + maxDeliveryCount: item["maxDeliveryCount"], + defaultTtlAsIso8601: item["defaultTtlAsIso8601"], + feedback: !item["feedback"] ? item["feedback"] : feedbackPropertiesSerializer(item["feedback"]), + }; +} + +export function cloudToDevicePropertiesDeserializer(item: any): CloudToDeviceProperties { + return { + maxDeliveryCount: item["maxDeliveryCount"], + defaultTtlAsIso8601: item["defaultTtlAsIso8601"], + feedback: !item["feedback"] + ? item["feedback"] + : feedbackPropertiesDeserializer(item["feedback"]), + }; +} + +/** The properties of the feedback queue for cloud-to-device messages. */ +export interface FeedbackProperties { + /** The lock duration for the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ + lockDurationAsIso8601?: string; + /** The period of time for which a message is available to consume before it is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ + ttlAsIso8601?: string; + /** The number of times the IoT hub attempts to deliver a message on the feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. */ + maxDeliveryCount?: number; +} + +export function feedbackPropertiesSerializer(item: FeedbackProperties): any { + return { + lockDurationAsIso8601: item["lockDurationAsIso8601"], + ttlAsIso8601: item["ttlAsIso8601"], + maxDeliveryCount: item["maxDeliveryCount"], + }; +} + +export function feedbackPropertiesDeserializer(item: any): FeedbackProperties { + return { + lockDurationAsIso8601: item["lockDurationAsIso8601"], + ttlAsIso8601: item["ttlAsIso8601"], + maxDeliveryCount: item["maxDeliveryCount"], + }; +} + +/** The device streams properties of iothub. */ +export interface IotHubPropertiesDeviceStreams { + /** List of Device Streams Endpoints. */ + streamingEndpoints?: string[]; +} + +export function iotHubPropertiesDeviceStreamsSerializer(item: IotHubPropertiesDeviceStreams): any { + return { + streamingEndpoints: !item["streamingEndpoints"] + ? item["streamingEndpoints"] + : item["streamingEndpoints"].map((p: any) => { + return p; + }), + }; +} + +export function iotHubPropertiesDeviceStreamsDeserializer( + item: any, +): IotHubPropertiesDeviceStreams { + return { + streamingEndpoints: !item["streamingEndpoints"] + ? item["streamingEndpoints"] + : item["streamingEndpoints"].map((p: any) => { + return p; + }), + }; +} + +/** The capabilities and features enabled for the IoT hub. */ +export enum KnownCapabilities { + /** None */ + None = "None", + /** DeviceManagement */ + DeviceManagement = "DeviceManagement", +} + +/** + * The capabilities and features enabled for the IoT hub. \ + * {@link KnownCapabilities} can be used interchangeably with Capabilities, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: None \ + * **DeviceManagement**: DeviceManagement + */ +export type Capabilities = string; + +/** The encryption properties for the IoT hub. */ +export interface EncryptionPropertiesDescription { + /** The source of the key. */ + keySource?: string; + /** The properties of the KeyVault key. */ + keyVaultProperties?: KeyVaultKeyProperties[]; +} + +export function encryptionPropertiesDescriptionSerializer( + item: EncryptionPropertiesDescription, +): any { + return { + keySource: item["keySource"], + keyVaultProperties: !item["keyVaultProperties"] + ? item["keyVaultProperties"] + : keyVaultKeyPropertiesArraySerializer(item["keyVaultProperties"]), + }; +} + +export function encryptionPropertiesDescriptionDeserializer( + item: any, +): EncryptionPropertiesDescription { + return { + keySource: item["keySource"], + keyVaultProperties: !item["keyVaultProperties"] + ? item["keyVaultProperties"] + : keyVaultKeyPropertiesArrayDeserializer(item["keyVaultProperties"]), + }; +} + +export function keyVaultKeyPropertiesArraySerializer(result: Array): any[] { + return result.map((item) => { + return keyVaultKeyPropertiesSerializer(item); + }); +} + +export function keyVaultKeyPropertiesArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return keyVaultKeyPropertiesDeserializer(item); + }); +} + +/** The properties of the KeyVault key. */ +export interface KeyVaultKeyProperties { + /** The identifier of the key. */ + keyIdentifier?: string; + /** Managed identity properties of KeyVault Key. */ + identity?: ManagedIdentity; +} + +export function keyVaultKeyPropertiesSerializer(item: KeyVaultKeyProperties): any { + return { + keyIdentifier: item["keyIdentifier"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + }; +} + +export function keyVaultKeyPropertiesDeserializer(item: any): KeyVaultKeyProperties { + return { + keyIdentifier: item["keyIdentifier"], + identity: !item["identity"] ? item["identity"] : managedIdentityDeserializer(item["identity"]), + }; +} + +export function iotHubLocationDescriptionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return iotHubLocationDescriptionDeserializer(item); + }); +} + +/** Public representation of one of the locations where a resource is provisioned. */ +export interface IotHubLocationDescription { + /** The name of the Azure region */ + location?: string; + /** The role of the region, can be either primary or secondary. The primary region is where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. */ + role?: IotHubReplicaRoleType; +} + +export function iotHubLocationDescriptionDeserializer(item: any): IotHubLocationDescription { + return { + location: item["location"], + role: item["role"], + }; +} + +/** The role of the region, can be either primary or secondary. The primary region is where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. */ +export enum KnownIotHubReplicaRoleType { + /** primary */ + Primary = "primary", + /** secondary */ + Secondary = "secondary", +} + +/** + * The role of the region, can be either primary or secondary. The primary region is where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. \ + * {@link KnownIotHubReplicaRoleType} can be used interchangeably with IotHubReplicaRoleType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **primary**: primary \ + * **secondary**: secondary + */ +export type IotHubReplicaRoleType = string; + +/** This property store root certificate related information */ +export interface RootCertificateProperties { + /** This property when set to true, hub will use G2 cert; while it's set to false, hub uses Baltimore Cert. */ + enableRootCertificateV2?: boolean; + /** the last update time to root certificate flag. */ + readonly lastUpdatedTimeUtc?: Date; +} + +export function rootCertificatePropertiesSerializer(item: RootCertificateProperties): any { + return { enableRootCertificateV2: item["enableRootCertificateV2"] }; +} + +export function rootCertificatePropertiesDeserializer(item: any): RootCertificateProperties { + return { + enableRootCertificateV2: item["enableRootCertificateV2"], + lastUpdatedTimeUtc: !item["lastUpdatedTimeUtc"] + ? item["lastUpdatedTimeUtc"] + : new Date(item["lastUpdatedTimeUtc"]), + }; +} + +/** This property specifies the IP Version the hub is currently utilizing. */ +export enum KnownIpVersion { + /** ipv4 */ + Ipv4 = "ipv4", + /** ipv6 */ + Ipv6 = "ipv6", + /** ipv4ipv6 */ + Ipv4Ipv6 = "ipv4ipv6", +} + +/** + * This property specifies the IP Version the hub is currently utilizing. \ + * {@link KnownIpVersion} can be used interchangeably with IpVersion, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ipv4**: ipv4 \ + * **ipv6**: ipv6 \ + * **ipv4ipv6**: ipv4ipv6 + */ +export type IpVersion = string; + +/** Represents properties related to the Azure Device Registry (ADR). */ +export interface DeviceRegistry { + /** The identifier of the Azure Device Registry namespace associated with the GEN2 SKU hub. */ + namespaceResourceId?: string; + /** The identity used to manage the ADR namespace from the data plane. */ + identityResourceId?: string; +} + +export function deviceRegistrySerializer(item: DeviceRegistry): any { + return { + namespaceResourceId: item["namespaceResourceId"], + identityResourceId: item["identityResourceId"], + }; +} + +export function deviceRegistryDeserializer(item: any): DeviceRegistry { + return { + namespaceResourceId: item["namespaceResourceId"], + identityResourceId: item["identityResourceId"], + }; +} + +/** Set of additional read-only properties for the IoT hub. */ +export interface IotHubDetails { + /** The IoT hub Gateway version. */ + gatewayVersion?: GatewayVersion; +} + +export function iotHubDetailsDeserializer(item: any): IotHubDetails { + return { + gatewayVersion: item["gatewayVersion"], + }; +} + +/** The IoT hub Gateway version. */ +export enum KnownGatewayVersion { + /** V1 */ + V1 = "V1", + /** V2 */ + V2 = "V2", +} + +/** + * The IoT hub Gateway version. \ + * {@link KnownGatewayVersion} can be used interchangeably with GatewayVersion, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **V1**: V1 \ + * **V2**: V2 + */ +export type GatewayVersion = string; + +/** Information about the SKU of the IoT hub. */ +export interface IotHubSkuInfo { + /** The name of the SKU. */ + name: IotHubSku; + /** The billing tier for the IoT hub. */ + readonly tier?: IotHubSkuTier; + /** The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. */ + capacity?: number; +} + +export function iotHubSkuInfoSerializer(item: IotHubSkuInfo): any { + return { name: item["name"], capacity: item["capacity"] }; +} + +export function iotHubSkuInfoDeserializer(item: any): IotHubSkuInfo { + return { + name: item["name"], + tier: item["tier"], + capacity: item["capacity"], + }; +} + +/** The name of the SKU. */ +export enum KnownIotHubSku { + /** F1 */ + F1 = "F1", + /** S1 */ + S1 = "S1", + /** S2 */ + S2 = "S2", + /** S3 */ + S3 = "S3", + /** B1 */ + B1 = "B1", + /** B2 */ + B2 = "B2", + /** B3 */ + B3 = "B3", + /** GEN2 */ + GEN2 = "GEN2", +} + +/** + * The name of the SKU. \ + * {@link KnownIotHubSku} can be used interchangeably with IotHubSku, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **F1**: F1 \ + * **S1**: S1 \ + * **S2**: S2 \ + * **S3**: S3 \ + * **B1**: B1 \ + * **B2**: B2 \ + * **B3**: B3 \ + * **GEN2**: GEN2 + */ +export type IotHubSku = string; +/** The billing tier for the IoT hub. */ +export type IotHubSkuTier = "Free" | "Standard" | "Basic" | "Generation2"; + +/** model interface ArmIdentity */ +export interface ArmIdentity { + /** Principal Id */ + readonly principalId?: string; + /** Tenant Id */ + readonly tenantId?: string; + /** The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. */ + type?: ResourceIdentityType; + /** Dictionary of */ + userAssignedIdentities?: Record; +} + +export function armIdentitySerializer(item: ArmIdentity): any { + return { + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : armUserIdentityRecordSerializer(item["userAssignedIdentities"]), + }; +} + +export function armIdentityDeserializer(item: any): ArmIdentity { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : armUserIdentityRecordDeserializer(item["userAssignedIdentities"]), + }; +} + +/** The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. */ +export type ResourceIdentityType = + | "SystemAssigned" + | "UserAssigned" + | "SystemAssigned, UserAssigned" + | "None"; + +export function armUserIdentityRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : armUserIdentitySerializer(item[key]); + }); + return result; +} + +export function armUserIdentityRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : armUserIdentityDeserializer(item[key]); + }); + return result; +} + +/** model interface ArmUserIdentity */ +export interface ArmUserIdentity { + readonly principalId?: string; + readonly clientId?: string; +} + +export function armUserIdentitySerializer(_item: ArmUserIdentity): any { + return {}; +} + +export function armUserIdentityDeserializer(item: any): ArmUserIdentity { + return { + principalId: item["principalId"], + clientId: item["clientId"], + }; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + }; +} + +/** A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. */ +export interface TagsResource { + /** Resource tags */ + tags?: Record; +} + +export function tagsResourceSerializer(item: TagsResource): any { + return { tags: item["tags"] }; +} + +/** The response of a IotHubDescription list operation. */ +export interface _IotHubDescriptionListResult { + /** The IotHubDescription items on this page */ + value: IotHubDescription[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _iotHubDescriptionListResultDeserializer(item: any): _IotHubDescriptionListResult { + return { + value: iotHubDescriptionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function iotHubDescriptionArraySerializer(result: Array): any[] { + return result.map((item) => { + return iotHubDescriptionSerializer(item); + }); +} + +export function iotHubDescriptionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return iotHubDescriptionDeserializer(item); + }); +} + +/** The JSON-serialized array of IotHubSkuDescription objects with a next link. */ +export interface _IotHubSkuDescriptionListResult { + /** The IotHubSkuDescription items on this page */ + value: IotHubSkuDescription[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _iotHubSkuDescriptionListResultDeserializer( + item: any, +): _IotHubSkuDescriptionListResult { + return { + value: iotHubSkuDescriptionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function iotHubSkuDescriptionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return iotHubSkuDescriptionDeserializer(item); + }); +} + +/** SKU properties. */ +export interface IotHubSkuDescription { + /** The type of the resource. */ + readonly resourceType?: string; + /** The type of the resource. */ + sku: IotHubSkuInfo; + /** IotHub capacity */ + capacity: IotHubCapacity; +} + +export function iotHubSkuDescriptionDeserializer(item: any): IotHubSkuDescription { + return { + resourceType: item["resourceType"], + sku: iotHubSkuInfoDeserializer(item["sku"]), + capacity: iotHubCapacityDeserializer(item["capacity"]), + }; +} + +/** IoT Hub capacity information. */ +export interface IotHubCapacity { + /** The minimum number of units. */ + readonly minimum?: number; + /** The maximum number of units. */ + readonly maximum?: number; + /** The default number of units. */ + readonly default?: number; + /** The type of the scaling enabled. */ + readonly scaleType?: IotHubScaleType; +} + +export function iotHubCapacityDeserializer(item: any): IotHubCapacity { + return { + minimum: item["minimum"], + maximum: item["maximum"], + default: item["default"], + scaleType: item["scaleType"], + }; +} + +/** The type of the scaling enabled. */ +export type IotHubScaleType = "Automatic" | "Manual" | "None"; + +/** The JSON-serialized array of JobResponse objects with a next link. */ +export interface _JobResponseListResult { + /** The JobResponse items on this page */ + value: JobResponse[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _jobResponseListResultDeserializer(item: any): _JobResponseListResult { + return { + value: jobResponseArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function jobResponseArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return jobResponseDeserializer(item); + }); +} + +/** The properties of the Job Response object. */ +export interface JobResponse { + /** The job identifier. */ + readonly jobId?: string; + /** The start time of the job. */ + readonly startTimeUtc?: Date; + /** The time the job stopped processing. */ + readonly endTimeUtc?: Date; + /** The type of the job. */ + readonly type?: JobType; + /** The status of the job. */ + readonly status?: JobStatus; + /** If status == failed, this string containing the reason for the failure. */ + readonly failureReason?: string; + /** The status message for the job. */ + readonly statusMessage?: string; + /** The job identifier of the parent job, if any. */ + readonly parentJobId?: string; +} + +export function jobResponseDeserializer(item: any): JobResponse { + return { + jobId: item["jobId"], + startTimeUtc: !item["startTimeUtc"] ? item["startTimeUtc"] : new Date(item["startTimeUtc"]), + endTimeUtc: !item["endTimeUtc"] ? item["endTimeUtc"] : new Date(item["endTimeUtc"]), + type: item["type"], + status: item["status"], + failureReason: item["failureReason"], + statusMessage: item["statusMessage"], + parentJobId: item["parentJobId"], + }; +} + +/** The type of the job. */ +export enum KnownJobType { + /** unknown */ + Unknown = "unknown", + /** export */ + Export = "export", + /** import */ + Import = "import", + /** backup */ + Backup = "backup", + /** readDeviceProperties */ + ReadDeviceProperties = "readDeviceProperties", + /** writeDeviceProperties */ + WriteDeviceProperties = "writeDeviceProperties", + /** updateDeviceConfiguration */ + UpdateDeviceConfiguration = "updateDeviceConfiguration", + /** rebootDevice */ + RebootDevice = "rebootDevice", + /** factoryResetDevice */ + FactoryResetDevice = "factoryResetDevice", + /** firmwareUpdate */ + FirmwareUpdate = "firmwareUpdate", +} + +/** + * The type of the job. \ + * {@link KnownJobType} can be used interchangeably with JobType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **unknown**: unknown \ + * **export**: export \ + * **import**: import \ + * **backup**: backup \ + * **readDeviceProperties**: readDeviceProperties \ + * **writeDeviceProperties**: writeDeviceProperties \ + * **updateDeviceConfiguration**: updateDeviceConfiguration \ + * **rebootDevice**: rebootDevice \ + * **factoryResetDevice**: factoryResetDevice \ + * **firmwareUpdate**: firmwareUpdate + */ +export type JobType = string; +/** The status of the job. */ +export type JobStatus = "unknown" | "enqueued" | "running" | "completed" | "failed" | "cancelled"; + +/** The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. */ +export interface _IotHubQuotaMetricInfoListResult { + /** The IotHubQuotaMetricInfo items on this page */ + value: IotHubQuotaMetricInfo[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _iotHubQuotaMetricInfoListResultDeserializer( + item: any, +): _IotHubQuotaMetricInfoListResult { + return { + value: iotHubQuotaMetricInfoArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function iotHubQuotaMetricInfoArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return iotHubQuotaMetricInfoDeserializer(item); + }); +} + +/** Quota metrics properties. */ +export interface IotHubQuotaMetricInfo { + /** The name of the quota metric. */ + readonly name?: string; + /** The current value for the quota metric. */ + readonly currentValue?: number; + /** The maximum value of the quota metric. */ + readonly maxValue?: number; +} + +export function iotHubQuotaMetricInfoDeserializer(item: any): IotHubQuotaMetricInfo { + return { + name: item["name"], + currentValue: item["currentValue"], + maxValue: item["maxValue"], + }; +} + +/** The JSON-serialized array of EndpointHealthData objects with a next link. */ +export interface _EndpointHealthDataListResult { + /** The EndpointHealthData items on this page */ + value: EndpointHealthData[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _endpointHealthDataListResultDeserializer( + item: any, +): _EndpointHealthDataListResult { + return { + value: endpointHealthDataArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function endpointHealthDataArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return endpointHealthDataDeserializer(item); + }); +} + +/** The health data for an endpoint */ +export interface EndpointHealthData { + /** Id of the endpoint */ + endpointId?: string; + /** 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 */ + healthStatus?: EndpointHealthStatus; + /** Last error obtained when a message failed to be delivered to iot hub */ + lastKnownError?: string; + /** Time at which the last known error occurred */ + lastKnownErrorTime?: Date; + /** Last time iot hub successfully sent a message to the endpoint */ + lastSuccessfulSendAttemptTime?: Date; + /** Last time iot hub tried to send a message to the endpoint */ + lastSendAttemptTime?: Date; +} + +export function endpointHealthDataDeserializer(item: any): EndpointHealthData { + return { + endpointId: item["endpointId"], + healthStatus: item["healthStatus"], + lastKnownError: item["lastKnownError"], + lastKnownErrorTime: !item["lastKnownErrorTime"] + ? item["lastKnownErrorTime"] + : new Date(item["lastKnownErrorTime"]), + lastSuccessfulSendAttemptTime: !item["lastSuccessfulSendAttemptTime"] + ? item["lastSuccessfulSendAttemptTime"] + : new Date(item["lastSuccessfulSendAttemptTime"]), + lastSendAttemptTime: !item["lastSendAttemptTime"] + ? item["lastSendAttemptTime"] + : new Date(item["lastSendAttemptTime"]), + }; +} + +/** 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 */ +export enum KnownEndpointHealthStatus { + /** unknown */ + Unknown = "unknown", + /** healthy */ + Healthy = "healthy", + /** degraded */ + Degraded = "degraded", + /** unhealthy */ + Unhealthy = "unhealthy", + /** dead */ + Dead = "dead", +} + +/** + * 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 \ + * {@link KnownEndpointHealthStatus} can be used interchangeably with EndpointHealthStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **unknown**: unknown \ + * **healthy**: healthy \ + * **degraded**: degraded \ + * **unhealthy**: unhealthy \ + * **dead**: dead + */ +export type EndpointHealthStatus = string; + +/** Input for testing all routes */ +export interface TestAllRoutesInput { + /** Routing source */ + routingSource?: RoutingSource; + /** Routing message */ + message?: RoutingMessage; + /** Routing Twin Reference */ + twin?: RoutingTwin; +} + +export function testAllRoutesInputSerializer(item: TestAllRoutesInput): any { + return { + routingSource: item["routingSource"], + message: !item["message"] ? item["message"] : routingMessageSerializer(item["message"]), + twin: !item["twin"] ? item["twin"] : routingTwinSerializer(item["twin"]), + }; +} + +/** Routing message */ +export interface RoutingMessage { + /** Body of routing message */ + body?: string; + /** App properties */ + appProperties?: Record; + /** System properties */ + systemProperties?: Record; +} + +export function routingMessageSerializer(item: RoutingMessage): any { + return { + body: item["body"], + appProperties: item["appProperties"], + systemProperties: item["systemProperties"], + }; +} + +/** Twin reference input parameter. This is an optional parameter */ +export interface RoutingTwin { + /** Twin Tags */ + tags?: any; + properties?: RoutingTwinProperties; +} + +export function routingTwinSerializer(item: RoutingTwin): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : routingTwinPropertiesSerializer(item["properties"]), + }; +} + +/** model interface RoutingTwinProperties */ +export interface RoutingTwinProperties { + /** Twin desired properties */ + desired?: any; + /** Twin desired properties */ + reported?: any; +} + +export function routingTwinPropertiesSerializer(item: RoutingTwinProperties): any { + return { desired: item["desired"], reported: item["reported"] }; +} + +/** Result of testing all routes */ +export interface TestAllRoutesResult { + /** JSON-serialized array of matched routes */ + routes?: MatchedRoute[]; +} + +export function testAllRoutesResultDeserializer(item: any): TestAllRoutesResult { + return { + routes: !item["routes"] ? item["routes"] : matchedRouteArrayDeserializer(item["routes"]), + }; +} + +export function matchedRouteArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return matchedRouteDeserializer(item); + }); +} + +/** Routes that matched */ +export interface MatchedRoute { + /** Properties of routes that matched */ + properties?: RouteProperties; +} + +export function matchedRouteDeserializer(item: any): MatchedRoute { + return { + properties: !item["properties"] + ? item["properties"] + : routePropertiesDeserializer(item["properties"]), + }; +} + +/** Input for testing route */ +export interface TestRouteInput { + /** Routing message */ + message?: RoutingMessage; + /** Route properties */ + route: RouteProperties; + /** Routing Twin Reference */ + twin?: RoutingTwin; +} + +export function testRouteInputSerializer(item: TestRouteInput): any { + return { + message: !item["message"] ? item["message"] : routingMessageSerializer(item["message"]), + route: routePropertiesSerializer(item["route"]), + twin: !item["twin"] ? item["twin"] : routingTwinSerializer(item["twin"]), + }; +} + +/** Result of testing one route */ +export interface TestRouteResult { + /** Result of testing route */ + result?: TestResultStatus; + /** Detailed result of testing route */ + details?: TestRouteResultDetails; +} + +export function testRouteResultDeserializer(item: any): TestRouteResult { + return { + result: item["result"], + details: !item["details"] + ? item["details"] + : testRouteResultDetailsDeserializer(item["details"]), + }; +} + +/** Result of testing route */ +export enum KnownTestResultStatus { + /** undefined */ + Undefined = "undefined", + /** false */ + False = "false", + /** true */ + True = "true", +} + +/** + * Result of testing route \ + * {@link KnownTestResultStatus} can be used interchangeably with TestResultStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **undefined**: undefined \ + * **false**: false \ + * **true**: true + */ +export type TestResultStatus = string; + +/** Detailed result of testing a route */ +export interface TestRouteResultDetails { + /** JSON-serialized list of route compilation errors */ + compilationErrors?: RouteCompilationError[]; +} + +export function testRouteResultDetailsDeserializer(item: any): TestRouteResultDetails { + return { + compilationErrors: !item["compilationErrors"] + ? item["compilationErrors"] + : routeCompilationErrorArrayDeserializer(item["compilationErrors"]), + }; +} + +export function routeCompilationErrorArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return routeCompilationErrorDeserializer(item); + }); +} + +/** Compilation error when evaluating route */ +export interface RouteCompilationError { + /** Route error message */ + message?: string; + /** Severity of the route error */ + severity?: RouteErrorSeverity; + /** Location where the route error happened */ + location?: RouteErrorRange; +} + +export function routeCompilationErrorDeserializer(item: any): RouteCompilationError { + return { + message: item["message"], + severity: item["severity"], + location: !item["location"] ? item["location"] : routeErrorRangeDeserializer(item["location"]), + }; +} + +/** Severity of the route error */ +export enum KnownRouteErrorSeverity { + /** error */ + Error = "error", + /** warning */ + Warning = "warning", +} + +/** + * Severity of the route error \ + * {@link KnownRouteErrorSeverity} can be used interchangeably with RouteErrorSeverity, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **error**: error \ + * **warning**: warning + */ +export type RouteErrorSeverity = string; + +/** Range of route errors */ +export interface RouteErrorRange { + /** Start where the route error happened */ + start?: RouteErrorPosition; + /** End where the route error happened */ + end?: RouteErrorPosition; +} + +export function routeErrorRangeDeserializer(item: any): RouteErrorRange { + return { + start: !item["start"] ? item["start"] : routeErrorPositionDeserializer(item["start"]), + end: !item["end"] ? item["end"] : routeErrorPositionDeserializer(item["end"]), + }; +} + +/** Position where the route error happened */ +export interface RouteErrorPosition { + /** Line where the route error happened */ + line?: number; + /** Column where the route error happened */ + column?: number; +} + +export function routeErrorPositionDeserializer(item: any): RouteErrorPosition { + return { + line: item["line"], + column: item["column"], + }; +} + +/** The list of shared access policies with a next link. */ +export interface _SharedAccessSignatureAuthorizationRuleListResult { + /** The SharedAccessSignatureAuthorizationRule items on this page */ + value: SharedAccessSignatureAuthorizationRule[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _sharedAccessSignatureAuthorizationRuleListResultDeserializer( + item: any, +): _SharedAccessSignatureAuthorizationRuleListResult { + return { + value: sharedAccessSignatureAuthorizationRuleArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +/** Use to provide parameters when requesting an export of all devices in the IoT hub. */ +export interface ExportDevicesRequest { + /** The export blob container URI. */ + exportBlobContainerUri: string; + /** The value indicating whether keys should be excluded during export. */ + excludeKeys: boolean; + /** The name of the blob that will be created in the provided output blob container. This blob will contain the exported device registry information for the IoT Hub. */ + exportBlobName?: string; + /** Specifies authentication type being used for connecting to the storage account. */ + authenticationType?: AuthenticationType; + /** Managed identity properties of storage endpoint for export devices. */ + identity?: ManagedIdentity; + /** The value indicating whether configurations should be exported. */ + includeConfigurations?: boolean; + /** The name of the blob that will be created in the provided output blob container. This blob will contain the exported configurations for the Iot Hub. */ + configurationsBlobName?: string; +} + +export function exportDevicesRequestSerializer(item: ExportDevicesRequest): any { + return { + exportBlobContainerUri: item["exportBlobContainerUri"], + excludeKeys: item["excludeKeys"], + exportBlobName: item["exportBlobName"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + includeConfigurations: item["includeConfigurations"], + configurationsBlobName: item["configurationsBlobName"], + }; +} + +/** Use to provide parameters when requesting an import of all devices in the hub. */ +export interface ImportDevicesRequest { + /** The input blob container URI. */ + inputBlobContainerUri: string; + /** The output blob container URI. */ + outputBlobContainerUri: string; + /** The blob name to be used when importing from the provided input blob container. */ + inputBlobName?: string; + /** The blob name to use for storing the status of the import job. */ + outputBlobName?: string; + /** Specifies authentication type being used for connecting to the storage account. */ + authenticationType?: AuthenticationType; + /** Managed identity properties of storage endpoint for import devices. */ + identity?: ManagedIdentity; + /** The value indicating whether configurations should be imported. */ + includeConfigurations?: boolean; + /** The blob name to be used when importing configurations from the provided input blob container. */ + configurationsBlobName?: string; +} + +export function importDevicesRequestSerializer(item: ImportDevicesRequest): any { + return { + inputBlobContainerUri: item["inputBlobContainerUri"], + outputBlobContainerUri: item["outputBlobContainerUri"], + inputBlobName: item["inputBlobName"], + outputBlobName: item["outputBlobName"], + authenticationType: item["authenticationType"], + identity: !item["identity"] ? item["identity"] : managedIdentitySerializer(item["identity"]), + includeConfigurations: item["includeConfigurations"], + configurationsBlobName: item["configurationsBlobName"], + }; +} + +/** Identity registry statistics. */ +export interface RegistryStatistics { + /** The total count of devices in the identity registry. */ + readonly totalDeviceCount?: number; + /** The count of enabled devices in the identity registry. */ + readonly enabledDeviceCount?: number; + /** The count of disabled devices in the identity registry. */ + readonly disabledDeviceCount?: number; +} + +export function registryStatisticsDeserializer(item: any): RegistryStatistics { + return { + totalDeviceCount: item["totalDeviceCount"], + enabledDeviceCount: item["enabledDeviceCount"], + disabledDeviceCount: item["disabledDeviceCount"], + }; +} + +/** The properties of the EventHubConsumerGroupInfo object. */ +export interface EventHubConsumerGroupInfo extends ProxyResource { + /** The tags. */ + properties?: Record; + /** The etag. */ + readonly etag?: string; +} + +export function eventHubConsumerGroupInfoDeserializer(item: any): EventHubConsumerGroupInfo { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : Object.fromEntries( + Object.entries(item["properties"]).map(([k, p]: [string, any]) => [k, p]), + ), + etag: item["etag"], + }; +} + +/** The EventHub consumer group. */ +export interface EventHubConsumerGroupBodyDescription { + /** The EventHub consumer group name. */ + properties: EventHubConsumerGroupName; +} + +export function eventHubConsumerGroupBodyDescriptionSerializer( + item: EventHubConsumerGroupBodyDescription, +): any { + return { properties: eventHubConsumerGroupNameSerializer(item["properties"]) }; +} + +/** The EventHub consumer group name. */ +export interface EventHubConsumerGroupName { + /** EventHub consumer group name */ + name: string; +} + +export function eventHubConsumerGroupNameSerializer(item: EventHubConsumerGroupName): any { + return { name: item["name"] }; +} + +/** The JSON-serialized list of consumer groups for the Event Hub-compatible endpoint. */ +export interface _EventHubConsumerGroupsListResult { + /** The EventHubConsumerGroupInfo items on this page */ + value: EventHubConsumerGroupInfo[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _eventHubConsumerGroupsListResultDeserializer( + item: any, +): _EventHubConsumerGroupsListResult { + return { + value: eventHubConsumerGroupInfoArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function eventHubConsumerGroupInfoArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return eventHubConsumerGroupInfoDeserializer(item); + }); +} + +/** Input values. */ +export interface OperationInputs { + /** The name of the IoT hub to check. */ + name: string; +} + +export function operationInputsSerializer(item: OperationInputs): any { + return { name: item["name"] }; +} + +/** The properties indicating whether a given IoT hub name is available. */ +export interface IotHubNameAvailabilityInfo { + /** The value which indicates whether the provided name is available. */ + readonly nameAvailable?: boolean; + /** The reason for unavailability. */ + readonly reason?: IotHubNameUnavailabilityReason; + /** The detailed reason message. */ + message?: string; +} + +export function iotHubNameAvailabilityInfoDeserializer(item: any): IotHubNameAvailabilityInfo { + return { + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + }; +} + +/** The reason for unavailability. */ +export type IotHubNameUnavailabilityReason = "Invalid" | "AlreadyExists"; + +/** Use to provide failover region when requesting manual Failover for a hub. */ +export interface FailoverInput { + /** Region the hub will be failed over to */ + failoverRegion: string; +} + +export function failoverInputSerializer(item: FailoverInput): any { + return { failoverRegion: item["failoverRegion"] }; +} + +/** The X509 Certificate. */ +export interface CertificateDescription extends ProxyResource { + /** The description of an X509 CA Certificate. */ + properties?: CertificateProperties; + /** The entity tag. */ + readonly etag?: string; +} + +export function certificateDescriptionSerializer(item: CertificateDescription): any { + return { + properties: !item["properties"] + ? item["properties"] + : certificatePropertiesSerializer(item["properties"]), + }; +} + +export function certificateDescriptionDeserializer(item: any): CertificateDescription { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : certificatePropertiesDeserializer(item["properties"]), + etag: item["etag"], + }; +} + +/** The description of an X509 CA Certificate. */ +export interface CertificateProperties { + /** The certificate's subject name. */ + readonly subject?: string; + /** The certificate's expiration date and time. */ + readonly expiry?: Date; + /** The certificate's thumbprint. */ + readonly thumbprint?: string; + /** Determines whether certificate has been verified. */ + isVerified?: boolean; + /** The certificate's create date and time. */ + readonly created?: Date; + /** The certificate's last update date and time. */ + readonly updated?: Date; + /** The certificate content */ + certificate?: string; + /** The reference to policy stored in Azure Device Registry (ADR). */ + policyResourceId?: string; +} + +export function certificatePropertiesSerializer(item: CertificateProperties): any { + return { + isVerified: item["isVerified"], + certificate: item["certificate"], + policyResourceId: item["policyResourceId"], + }; +} + +export function certificatePropertiesDeserializer(item: any): CertificateProperties { + return { + subject: item["subject"], + expiry: !item["expiry"] ? item["expiry"] : new Date(item["expiry"]), + thumbprint: item["thumbprint"], + isVerified: item["isVerified"], + created: !item["created"] ? item["created"] : new Date(item["created"]), + updated: !item["updated"] ? item["updated"] : new Date(item["updated"]), + certificate: item["certificate"], + policyResourceId: item["policyResourceId"], + }; +} + +/** The JSON-serialized array of Certificate objects. */ +export interface CertificateListDescription { + /** The array of Certificate objects. */ + value?: CertificateDescription[]; +} + +export function certificateListDescriptionDeserializer(item: any): CertificateListDescription { + return { + value: !item["value"] ? item["value"] : certificateDescriptionArrayDeserializer(item["value"]), + }; +} + +export function certificateDescriptionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return certificateDescriptionSerializer(item); + }); +} + +export function certificateDescriptionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return certificateDescriptionDeserializer(item); + }); +} + +/** The X509 Certificate. */ +export interface CertificateWithNonceDescription { + /** The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. */ + properties?: CertificatePropertiesWithNonce; + /** The resource identifier. */ + readonly id?: string; + /** The name of the certificate. */ + readonly name?: string; + /** The entity tag. */ + readonly etag?: string; + /** The resource type. */ + readonly type?: string; +} + +export function certificateWithNonceDescriptionDeserializer( + item: any, +): CertificateWithNonceDescription { + return { + properties: !item["properties"] + ? item["properties"] + : certificatePropertiesWithNonceDeserializer(item["properties"]), + id: item["id"], + name: item["name"], + etag: item["etag"], + type: item["type"], + }; +} + +/** The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. */ +export interface CertificatePropertiesWithNonce { + /** The certificate's subject name. */ + readonly subject?: string; + /** The certificate's expiration date and time. */ + readonly expiry?: Date; + /** The certificate's thumbprint. */ + readonly thumbprint?: string; + /** Determines whether certificate has been verified. */ + readonly isVerified?: boolean; + /** The certificate's create date and time. */ + readonly created?: Date; + /** The certificate's last update date and time. */ + readonly updated?: Date; + /** The certificate's verification code that will be used for proof of possession. */ + readonly verificationCode?: string; + /** The certificate content */ + readonly certificate?: string; + /** The reference to policy stored in Azure Device Registry (ADR). */ + policyResourceId?: string; +} + +export function certificatePropertiesWithNonceDeserializer( + item: any, +): CertificatePropertiesWithNonce { + return { + subject: item["subject"], + expiry: !item["expiry"] ? item["expiry"] : new Date(item["expiry"]), + thumbprint: item["thumbprint"], + isVerified: item["isVerified"], + created: !item["created"] ? item["created"] : new Date(item["created"]), + updated: !item["updated"] ? item["updated"] : new Date(item["updated"]), + verificationCode: item["verificationCode"], + certificate: item["certificate"], + policyResourceId: item["policyResourceId"], + }; +} + +/** The JSON-serialized leaf certificate */ +export interface CertificateVerificationDescription { + /** base-64 representation of X509 certificate .cer file or just .pem file content. */ + certificate?: string; +} + +export function certificateVerificationDescriptionSerializer( + item: CertificateVerificationDescription, +): any { + return { certificate: item["certificate"] }; +} + +/** The group information for creating a private endpoint on an IotHub */ +export interface GroupIdInformation { + /** The resource identifier. */ + readonly id?: string; + /** The resource name. */ + readonly name?: string; + /** The resource type. */ + readonly type?: string; + /** The properties for a group information object */ + properties: GroupIdInformationProperties; +} + +export function groupIdInformationDeserializer(item: any): GroupIdInformation { + return { + id: item["id"], + name: item["name"], + type: item["type"], + properties: groupIdInformationPropertiesDeserializer(item["properties"]), + }; +} + +/** The properties for a group information object */ +export interface GroupIdInformationProperties { + /** The group id */ + groupId?: string; + /** The required members for a specific group id */ + requiredMembers?: string[]; + /** The required DNS zones for a specific group id */ + requiredZoneNames?: string[]; +} + +export function groupIdInformationPropertiesDeserializer(item: any): GroupIdInformationProperties { + return { + groupId: item["groupId"], + requiredMembers: !item["requiredMembers"] + ? item["requiredMembers"] + : item["requiredMembers"].map((p: any) => { + return p; + }), + requiredZoneNames: !item["requiredZoneNames"] + ? item["requiredZoneNames"] + : item["requiredZoneNames"].map((p: any) => { + return p; + }), + }; +} + +/** The available private link resources for an IotHub */ +export interface PrivateLinkResources { + /** The list of available private link resources for an IotHub */ + value?: GroupIdInformation[]; +} + +export function privateLinkResourcesDeserializer(item: any): PrivateLinkResources { + return { + value: !item["value"] ? item["value"] : groupIdInformationArrayDeserializer(item["value"]), + }; +} + +export function groupIdInformationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return groupIdInformationDeserializer(item); + }); +} + +/** Json-serialized array of User subscription quota response */ +export interface UserSubscriptionQuotaListResult { + /** The UserSubscriptionQuota items on this page */ + value?: UserSubscriptionQuota[]; + /** The link to the next page of items */ + readonly nextLink?: string; +} + +export function userSubscriptionQuotaListResultDeserializer( + item: any, +): UserSubscriptionQuotaListResult { + return { + value: !item["value"] ? item["value"] : userSubscriptionQuotaArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function userSubscriptionQuotaArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return userSubscriptionQuotaDeserializer(item); + }); +} + +/** User subscription quota response */ +export interface UserSubscriptionQuota { + /** IotHub type id */ + id?: string; + /** Response type */ + type?: string; + /** Unit of IotHub type */ + unit?: string; + /** Current number of IotHub type */ + currentValue?: number; + /** Numerical limit on IotHub type */ + limit?: number; + /** IotHub type */ + name?: Name; +} + +export function userSubscriptionQuotaDeserializer(item: any): UserSubscriptionQuota { + return { + id: item["id"], + type: item["type"], + unit: item["unit"], + currentValue: item["currentValue"], + limit: item["limit"], + name: !item["name"] ? item["name"] : nameDeserializer(item["name"]), + }; +} + +/** Name of Iot Hub type */ +export interface Name { + /** IotHub type */ + value?: string; + /** Localized value of name */ + localizedValue?: string; +} + +export function nameDeserializer(item: any): Name { + return { + value: item["value"], + localizedValue: item["localizedValue"], + }; +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2026-03-01-preview API version. */ + V20260301Preview = "2026-03-01-preview", +} diff --git a/sdk/iothub/arm-iothub/src/models/parameters.ts b/sdk/iothub/arm-iothub/src/models/parameters.ts deleted file mode 100644 index 6478e5eb6c8b..000000000000 --- a/sdk/iothub/arm-iothub/src/models/parameters.ts +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { - OperationParameter, - OperationURLParameter, - OperationQueryParameter, -} from "@azure/core-client"; -import { - IotHubDescription as IotHubDescriptionMapper, - TagsResource as TagsResourceMapper, - EventHubConsumerGroupBodyDescription as EventHubConsumerGroupBodyDescriptionMapper, - OperationInputs as OperationInputsMapper, - TestAllRoutesInput as TestAllRoutesInputMapper, - TestRouteInput as TestRouteInputMapper, - ExportDevicesRequest as ExportDevicesRequestMapper, - ImportDevicesRequest as ImportDevicesRequestMapper, - CertificateDescription as CertificateDescriptionMapper, - CertificateVerificationDescription as CertificateVerificationDescriptionMapper, - FailoverInput as FailoverInputMapper, - PrivateEndpointConnection as PrivateEndpointConnectionMapper, -} from "../models/mappers.js"; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String", - }, - }, -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2025-08-01-preview", - isConstant: true, - serializedName: "api-version", - type: { - name: "String", - }, - }, -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - serializedName: "subscriptionId", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resourceGroupName: OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - serializedName: "resourceGroupName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resourceName: OperationURLParameter = { - parameterPath: "resourceName", - mapper: { - serializedName: "resourceName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String", - }, - }, -}; - -export const iotHubDescription: OperationParameter = { - parameterPath: "iotHubDescription", - mapper: IotHubDescriptionMapper, -}; - -export const ifMatch: OperationParameter = { - parameterPath: ["options", "ifMatch"], - mapper: { - serializedName: "If-Match", - type: { - name: "String", - }, - }, -}; - -export const iotHubTags: OperationParameter = { - parameterPath: "iotHubTags", - mapper: TagsResourceMapper, -}; - -export const eventHubEndpointName: OperationURLParameter = { - parameterPath: "eventHubEndpointName", - mapper: { - serializedName: "eventHubEndpointName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const name: OperationURLParameter = { - parameterPath: "name", - mapper: { - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, -}; - -export const consumerGroupBody: OperationParameter = { - parameterPath: "consumerGroupBody", - mapper: EventHubConsumerGroupBodyDescriptionMapper, -}; - -export const jobId: OperationURLParameter = { - parameterPath: "jobId", - mapper: { - serializedName: "jobId", - required: true, - type: { - name: "String", - }, - }, -}; - -export const iotHubName: OperationURLParameter = { - parameterPath: "iotHubName", - mapper: { - serializedName: "iotHubName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const operationInputs: OperationParameter = { - parameterPath: "operationInputs", - mapper: OperationInputsMapper, -}; - -export const input: OperationParameter = { - parameterPath: "input", - mapper: TestAllRoutesInputMapper, -}; - -export const input1: OperationParameter = { - parameterPath: "input", - mapper: TestRouteInputMapper, -}; - -export const keyName: OperationURLParameter = { - parameterPath: "keyName", - mapper: { - serializedName: "keyName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const exportDevicesParameters: OperationParameter = { - parameterPath: "exportDevicesParameters", - mapper: ExportDevicesRequestMapper, -}; - -export const importDevicesParameters: OperationParameter = { - parameterPath: "importDevicesParameters", - mapper: ImportDevicesRequestMapper, -}; - -export const certificateName: OperationURLParameter = { - parameterPath: "certificateName", - mapper: { - constraints: { - Pattern: new RegExp("^[A-Za-z0-9-._]{1,64}$"), - }, - serializedName: "certificateName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const certificateDescription: OperationParameter = { - parameterPath: "certificateDescription", - mapper: CertificateDescriptionMapper, -}; - -export const ifMatch1: OperationParameter = { - parameterPath: "ifMatch", - mapper: { - serializedName: "If-Match", - required: true, - type: { - name: "String", - }, - }, -}; - -export const certificateVerificationBody: OperationParameter = { - parameterPath: "certificateVerificationBody", - mapper: CertificateVerificationDescriptionMapper, -}; - -export const failoverInput: OperationParameter = { - parameterPath: "failoverInput", - mapper: FailoverInputMapper, -}; - -export const groupId: OperationURLParameter = { - parameterPath: "groupId", - mapper: { - serializedName: "groupId", - required: true, - type: { - name: "String", - }, - }, -}; - -export const privateEndpointConnectionName: OperationURLParameter = { - parameterPath: "privateEndpointConnectionName", - mapper: { - serializedName: "privateEndpointConnectionName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const privateEndpointConnection: OperationParameter = { - parameterPath: "privateEndpointConnection", - mapper: PrivateEndpointConnectionMapper, -}; diff --git a/sdk/iothub/arm-iothub/src/operations/certificates.ts b/sdk/iothub/arm-iothub/src/operations/certificates.ts deleted file mode 100644 index 82de0372ec72..000000000000 --- a/sdk/iothub/arm-iothub/src/operations/certificates.ts +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { Certificates } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { IotHubClient } from "../iotHubClient.js"; -import type { - CertificatesListByIotHubOptionalParams, - CertificatesListByIotHubResponse, - CertificatesGetOptionalParams, - CertificatesGetResponse, - CertificateDescription, - CertificatesCreateOrUpdateOptionalParams, - CertificatesCreateOrUpdateResponse, - CertificatesDeleteOptionalParams, - CertificatesGenerateVerificationCodeOptionalParams, - CertificatesGenerateVerificationCodeResponse, - CertificateVerificationDescription, - CertificatesVerifyOptionalParams, - CertificatesVerifyResponse, -} from "../models/index.js"; - -/** Class containing Certificates operations. */ -export class CertificatesImpl implements Certificates { - private readonly client: IotHubClient; - - /** - * Initialize a new instance of the class Certificates class. - * @param client Reference to the service client - */ - constructor(client: IotHubClient) { - this.client = client; - } - - /** - * Returns the list of certificates. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - listByIotHub( - resourceGroupName: string, - resourceName: string, - options?: CertificatesListByIotHubOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - listByIotHubOperationSpec, - ); - } - - /** - * Returns the certificate. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param options The options parameters. - */ - get( - resourceGroupName: string, - resourceName: string, - certificateName: string, - options?: CertificatesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, certificateName, options }, - getOperationSpec, - ); - } - - /** - * Adds new or replaces existing certificate. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param certificateDescription The certificate body. - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - resourceName: string, - certificateName: string, - certificateDescription: CertificateDescription, - options?: CertificatesCreateOrUpdateOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - certificateName, - certificateDescription, - options, - }, - createOrUpdateOperationSpec, - ); - } - - /** - * Deletes an existing X509 certificate or does nothing if it does not exist. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param ifMatch ETag of the Certificate. - * @param options The options parameters. - */ - delete( - resourceGroupName: string, - resourceName: string, - certificateName: string, - ifMatch: string, - options?: CertificatesDeleteOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, certificateName, ifMatch, options }, - deleteOperationSpec, - ); - } - - /** - * Generates verification code for proof of possession flow. The verification code will be used to - * generate a leaf certificate. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param ifMatch ETag of the Certificate. - * @param options The options parameters. - */ - generateVerificationCode( - resourceGroupName: string, - resourceName: string, - certificateName: string, - ifMatch: string, - options?: CertificatesGenerateVerificationCodeOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, certificateName, ifMatch, options }, - generateVerificationCodeOperationSpec, - ); - } - - /** - * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying - * pre uploaded certificate. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param ifMatch ETag of the Certificate. - * @param certificateVerificationBody The name of the certificate - * @param options The options parameters. - */ - verify( - resourceGroupName: string, - resourceName: string, - certificateName: string, - ifMatch: string, - certificateVerificationBody: CertificateVerificationDescription, - options?: CertificatesVerifyOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - certificateName, - ifMatch, - certificateVerificationBody, - options, - }, - verifyOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByIotHubOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CertificateListDescription, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CertificateDescription, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.certificateName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.CertificateDescription, - }, - 201: { - bodyMapper: Mappers.CertificateDescription, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.certificateDescription, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.certificateName, - ], - headerParameters: [Parameters.accept, Parameters.contentType, Parameters.ifMatch], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.certificateName, - ], - headerParameters: [Parameters.accept, Parameters.ifMatch1], - serializer, -}; -const generateVerificationCodeOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CertificateWithNonceDescription, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.certificateName, - ], - headerParameters: [Parameters.accept, Parameters.ifMatch1], - serializer, -}; -const verifyOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CertificateDescription, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.certificateVerificationBody, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.certificateName, - ], - headerParameters: [Parameters.accept, Parameters.contentType, Parameters.ifMatch1], - mediaType: "json", - serializer, -}; diff --git a/sdk/iothub/arm-iothub/src/operations/index.ts b/sdk/iothub/arm-iothub/src/operations/index.ts deleted file mode 100644 index b5c8fc0fe2b3..000000000000 --- a/sdk/iothub/arm-iothub/src/operations/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./operations.js"; -export * from "./iotHubResource.js"; -export * from "./resourceProviderCommon.js"; -export * from "./certificates.js"; -export * from "./iotHub.js"; -export * from "./privateLinkResourcesOperations.js"; -export * from "./privateEndpointConnections.js"; diff --git a/sdk/iothub/arm-iothub/src/operations/iotHub.ts b/sdk/iothub/arm-iothub/src/operations/iotHub.ts deleted file mode 100644 index aa55a7a7a52a..000000000000 --- a/sdk/iothub/arm-iothub/src/operations/iotHub.ts +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { IotHub } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { IotHubClient } from "../iotHubClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { FailoverInput, IotHubManualFailoverOptionalParams } from "../models/index.js"; - -/** Class containing IotHub operations. */ -export class IotHubImpl implements IotHub { - private readonly client: IotHubClient; - - /** - * Initialize a new instance of the class IotHub class. - * @param client Reference to the service client - */ - constructor(client: IotHubClient) { - this.client = client; - } - - /** - * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see - * https://aka.ms/manualfailover - * @param iotHubName Name of the IoT hub to failover - * @param resourceGroupName Name of the resource group containing the IoT hub resource - * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the - * secondary location in the locations property. To learn more, see - * https://aka.ms/manualfailover/region - * @param options The options parameters. - */ - async beginManualFailover( - iotHubName: string, - resourceGroupName: string, - failoverInput: FailoverInput, - options?: IotHubManualFailoverOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { iotHubName, resourceGroupName, failoverInput, options }, - spec: manualFailoverOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see - * https://aka.ms/manualfailover - * @param iotHubName Name of the IoT hub to failover - * @param resourceGroupName Name of the resource group containing the IoT hub resource - * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the - * secondary location in the locations property. To learn more, see - * https://aka.ms/manualfailover/region - * @param options The options parameters. - */ - async beginManualFailoverAndWait( - iotHubName: string, - resourceGroupName: string, - failoverInput: FailoverInput, - options?: IotHubManualFailoverOptionalParams, - ): Promise { - const poller = await this.beginManualFailover( - iotHubName, - resourceGroupName, - failoverInput, - options, - ); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const manualFailoverOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover", - httpMethod: "POST", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.failoverInput, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.iotHubName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; diff --git a/sdk/iothub/arm-iothub/src/operations/iotHubResource.ts b/sdk/iothub/arm-iothub/src/operations/iotHubResource.ts deleted file mode 100644 index 39b7ed754882..000000000000 --- a/sdk/iothub/arm-iothub/src/operations/iotHubResource.ts +++ /dev/null @@ -1,2140 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { IotHubResource } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { IotHubClient } from "../iotHubClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - IotHubDescription, - IotHubResourceListBySubscriptionNextOptionalParams, - IotHubResourceListBySubscriptionOptionalParams, - IotHubResourceListBySubscriptionResponse, - IotHubResourceListByResourceGroupNextOptionalParams, - IotHubResourceListByResourceGroupOptionalParams, - IotHubResourceListByResourceGroupResponse, - IotHubSkuDescription, - IotHubResourceGetValidSkusNextOptionalParams, - IotHubResourceGetValidSkusOptionalParams, - IotHubResourceGetValidSkusResponse, - EventHubConsumerGroupInfo, - IotHubResourceListEventHubConsumerGroupsNextOptionalParams, - IotHubResourceListEventHubConsumerGroupsOptionalParams, - IotHubResourceListEventHubConsumerGroupsResponse, - JobResponse, - IotHubResourceListJobsNextOptionalParams, - IotHubResourceListJobsOptionalParams, - IotHubResourceListJobsResponse, - IotHubQuotaMetricInfo, - IotHubResourceGetQuotaMetricsNextOptionalParams, - IotHubResourceGetQuotaMetricsOptionalParams, - IotHubResourceGetQuotaMetricsResponse, - EndpointHealthData, - IotHubResourceGetEndpointHealthNextOptionalParams, - IotHubResourceGetEndpointHealthOptionalParams, - IotHubResourceGetEndpointHealthResponse, - SharedAccessSignatureAuthorizationRule, - IotHubResourceListKeysNextOptionalParams, - IotHubResourceListKeysOptionalParams, - IotHubResourceListKeysResponse, - IotHubResourceGetOptionalParams, - IotHubResourceGetResponse, - IotHubResourceCreateOrUpdateOptionalParams, - IotHubResourceCreateOrUpdateResponse, - TagsResource, - IotHubResourceUpdateOptionalParams, - IotHubResourceUpdateResponse, - IotHubResourceDeleteOptionalParams, - IotHubResourceDeleteResponse, - IotHubResourceGetStatsOptionalParams, - IotHubResourceGetStatsResponse, - IotHubResourceGetEventHubConsumerGroupOptionalParams, - IotHubResourceGetEventHubConsumerGroupResponse, - EventHubConsumerGroupBodyDescription, - IotHubResourceCreateEventHubConsumerGroupOptionalParams, - IotHubResourceCreateEventHubConsumerGroupResponse, - IotHubResourceDeleteEventHubConsumerGroupOptionalParams, - IotHubResourceGetJobOptionalParams, - IotHubResourceGetJobResponse, - OperationInputs, - IotHubResourceCheckNameAvailabilityOptionalParams, - IotHubResourceCheckNameAvailabilityResponse, - TestAllRoutesInput, - IotHubResourceTestAllRoutesOptionalParams, - IotHubResourceTestAllRoutesResponse, - TestRouteInput, - IotHubResourceTestRouteOptionalParams, - IotHubResourceTestRouteResponse, - IotHubResourceGetKeysForKeyNameOptionalParams, - IotHubResourceGetKeysForKeyNameResponse, - ExportDevicesRequest, - IotHubResourceExportDevicesOptionalParams, - IotHubResourceExportDevicesResponse, - ImportDevicesRequest, - IotHubResourceImportDevicesOptionalParams, - IotHubResourceImportDevicesResponse, - IotHubResourceListBySubscriptionNextResponse, - IotHubResourceListByResourceGroupNextResponse, - IotHubResourceGetValidSkusNextResponse, - IotHubResourceListEventHubConsumerGroupsNextResponse, - IotHubResourceListJobsNextResponse, - IotHubResourceGetQuotaMetricsNextResponse, - IotHubResourceGetEndpointHealthNextResponse, - IotHubResourceListKeysNextResponse, -} from "../models/index.js"; - -/// -/** Class containing IotHubResource operations. */ -export class IotHubResourceImpl implements IotHubResource { - private readonly client: IotHubClient; - - /** - * Initialize a new instance of the class IotHubResource class. - * @param client Reference to the service client - */ - constructor(client: IotHubClient) { - this.client = client; - } - - /** - * Get all the IoT hubs in a subscription. - * @param options The options parameters. - */ - public listBySubscription( - options?: IotHubResourceListBySubscriptionOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listBySubscriptionPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listBySubscriptionPagingPage(options, settings); - }, - }; - } - - private async *listBySubscriptionPagingPage( - options?: IotHubResourceListBySubscriptionOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: IotHubResourceListBySubscriptionResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listBySubscription(options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listBySubscriptionNext(continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listBySubscriptionPagingAll( - options?: IotHubResourceListBySubscriptionOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listBySubscriptionPagingPage(options)) { - yield* page; - } - } - - /** - * Get all the IoT hubs in a resource group. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroupName: string, - options?: IotHubResourceListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage(resourceGroupName, options, settings); - }, - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: IotHubResourceListByResourceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: IotHubResourceListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext(resourceGroupName, continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroupName: string, - options?: IotHubResourceListByResourceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage(resourceGroupName, options)) { - yield* page; - } - } - - /** - * Get the list of valid SKUs for an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - public listValidSkus( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetValidSkusOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.getValidSkusPagingAll(resourceGroupName, resourceName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.getValidSkusPagingPage(resourceGroupName, resourceName, options, settings); - }, - }; - } - - private async *getValidSkusPagingPage( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetValidSkusOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: IotHubResourceGetValidSkusResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._getValidSkus(resourceGroupName, resourceName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._getValidSkusNext( - resourceGroupName, - resourceName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *getValidSkusPagingAll( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetValidSkusOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.getValidSkusPagingPage( - resourceGroupName, - resourceName, - options, - )) { - yield* page; - } - } - - /** - * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT - * hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. - * @param options The options parameters. - */ - public listEventHubConsumerGroups( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - options?: IotHubResourceListEventHubConsumerGroupsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listEventHubConsumerGroupsPagingAll( - resourceGroupName, - resourceName, - eventHubEndpointName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listEventHubConsumerGroupsPagingPage( - resourceGroupName, - resourceName, - eventHubEndpointName, - options, - settings, - ); - }, - }; - } - - private async *listEventHubConsumerGroupsPagingPage( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - options?: IotHubResourceListEventHubConsumerGroupsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: IotHubResourceListEventHubConsumerGroupsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listEventHubConsumerGroups( - resourceGroupName, - resourceName, - eventHubEndpointName, - options, - ); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listEventHubConsumerGroupsNext( - resourceGroupName, - resourceName, - eventHubEndpointName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listEventHubConsumerGroupsPagingAll( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - options?: IotHubResourceListEventHubConsumerGroupsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listEventHubConsumerGroupsPagingPage( - resourceGroupName, - resourceName, - eventHubEndpointName, - options, - )) { - yield* page; - } - } - - /** - * Get a list of all the jobs in an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - public listJobs( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListJobsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listJobsPagingAll(resourceGroupName, resourceName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listJobsPagingPage(resourceGroupName, resourceName, options, settings); - }, - }; - } - - private async *listJobsPagingPage( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListJobsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: IotHubResourceListJobsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listJobs(resourceGroupName, resourceName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listJobsNext( - resourceGroupName, - resourceName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listJobsPagingAll( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListJobsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listJobsPagingPage(resourceGroupName, resourceName, options)) { - yield* page; - } - } - - /** - * Get the quota metrics for an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - public listQuotaMetrics( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetQuotaMetricsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.getQuotaMetricsPagingAll(resourceGroupName, resourceName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.getQuotaMetricsPagingPage(resourceGroupName, resourceName, options, settings); - }, - }; - } - - private async *getQuotaMetricsPagingPage( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetQuotaMetricsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: IotHubResourceGetQuotaMetricsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._getQuotaMetrics(resourceGroupName, resourceName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._getQuotaMetricsNext( - resourceGroupName, - resourceName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *getQuotaMetricsPagingAll( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetQuotaMetricsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.getQuotaMetricsPagingPage( - resourceGroupName, - resourceName, - options, - )) { - yield* page; - } - } - - /** - * Get the health for routing endpoints. - * @param resourceGroupName - * @param iotHubName - * @param options The options parameters. - */ - public listEndpointHealth( - resourceGroupName: string, - iotHubName: string, - options?: IotHubResourceGetEndpointHealthOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.getEndpointHealthPagingAll(resourceGroupName, iotHubName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.getEndpointHealthPagingPage(resourceGroupName, iotHubName, options, settings); - }, - }; - } - - private async *getEndpointHealthPagingPage( - resourceGroupName: string, - iotHubName: string, - options?: IotHubResourceGetEndpointHealthOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: IotHubResourceGetEndpointHealthResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._getEndpointHealth(resourceGroupName, iotHubName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._getEndpointHealthNext( - resourceGroupName, - iotHubName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *getEndpointHealthPagingAll( - resourceGroupName: string, - iotHubName: string, - options?: IotHubResourceGetEndpointHealthOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.getEndpointHealthPagingPage( - resourceGroupName, - iotHubName, - options, - )) { - yield* page; - } - } - - /** - * Get the security metadata for an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - public listKeys( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListKeysOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listKeysPagingAll(resourceGroupName, resourceName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listKeysPagingPage(resourceGroupName, resourceName, options, settings); - }, - }; - } - - private async *listKeysPagingPage( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListKeysOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: IotHubResourceListKeysResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listKeys(resourceGroupName, resourceName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listKeysNext( - resourceGroupName, - resourceName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listKeysPagingAll( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListKeysOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listKeysPagingPage(resourceGroupName, resourceName, options)) { - yield* page; - } - } - - /** - * Get the non-security related metadata of an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - getOperationSpec, - ); - } - - /** - * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve - * the IoT hub metadata and security metadata, and then combine them with the modified values in a new - * body to update the IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param iotHubDescription The IoT hub metadata and security metadata. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - resourceName: string, - iotHubDescription: IotHubDescription, - options?: IotHubResourceCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - IotHubResourceCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, resourceName, iotHubDescription, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - IotHubResourceCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve - * the IoT hub metadata and security metadata, and then combine them with the modified values in a new - * body to update the IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param iotHubDescription The IoT hub metadata and security metadata. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - resourceName: string, - iotHubDescription: IotHubDescription, - options?: IotHubResourceCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - resourceName, - iotHubDescription, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * @param resourceGroupName Resource group identifier. - * @param resourceName Name of iot hub to update. - * @param iotHubTags Updated tag information to set into the iot hub instance. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - resourceName: string, - iotHubTags: TagsResource, - options?: IotHubResourceUpdateOptionalParams, - ): Promise< - SimplePollerLike, IotHubResourceUpdateResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, resourceName, iotHubTags, options }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - IotHubResourceUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * @param resourceGroupName Resource group identifier. - * @param resourceName Name of iot hub to update. - * @param iotHubTags Updated tag information to set into the iot hub instance. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - resourceName: string, - iotHubTags: TagsResource, - options?: IotHubResourceUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate(resourceGroupName, resourceName, iotHubTags, options); - return poller.pollUntilDone(); - } - - /** - * Delete an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceDeleteOptionalParams, - ): Promise< - SimplePollerLike, IotHubResourceDeleteResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, resourceName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - IotHubResourceDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Delete an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete(resourceGroupName, resourceName, options); - return poller.pollUntilDone(); - } - - /** - * Get all the IoT hubs in a subscription. - * @param options The options parameters. - */ - private _listBySubscription( - options?: IotHubResourceListBySubscriptionOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listBySubscriptionOperationSpec); - } - - /** - * Get all the IoT hubs in a resource group. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroupName: string, - options?: IotHubResourceListByResourceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec, - ); - } - - /** - * Get the statistics from an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - getStats( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetStatsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - getStatsOperationSpec, - ); - } - - /** - * Get the list of valid SKUs for an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - private _getValidSkus( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetValidSkusOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - getValidSkusOperationSpec, - ); - } - - /** - * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT - * hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. - * @param options The options parameters. - */ - private _listEventHubConsumerGroups( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - options?: IotHubResourceListEventHubConsumerGroupsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, eventHubEndpointName, options }, - listEventHubConsumerGroupsOperationSpec, - ); - } - - /** - * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. - * @param name The name of the consumer group to retrieve. - * @param options The options parameters. - */ - getEventHubConsumerGroup( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - name: string, - options?: IotHubResourceGetEventHubConsumerGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, eventHubEndpointName, name, options }, - getEventHubConsumerGroupOperationSpec, - ); - } - - /** - * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. - * @param name The name of the consumer group to add. - * @param consumerGroupBody The consumer group to add. - * @param options The options parameters. - */ - createEventHubConsumerGroup( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - name: string, - consumerGroupBody: EventHubConsumerGroupBodyDescription, - options?: IotHubResourceCreateEventHubConsumerGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - eventHubEndpointName, - name, - consumerGroupBody, - options, - }, - createEventHubConsumerGroupOperationSpec, - ); - } - - /** - * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. - * @param name The name of the consumer group to delete. - * @param options The options parameters. - */ - deleteEventHubConsumerGroup( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - name: string, - options?: IotHubResourceDeleteEventHubConsumerGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, eventHubEndpointName, name, options }, - deleteEventHubConsumerGroupOperationSpec, - ); - } - - /** - * Get a list of all the jobs in an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - private _listJobs( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListJobsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - listJobsOperationSpec, - ); - } - - /** - * Get the details of a job from an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param jobId The job identifier. - * @param options The options parameters. - */ - getJob( - resourceGroupName: string, - resourceName: string, - jobId: string, - options?: IotHubResourceGetJobOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, jobId, options }, - getJobOperationSpec, - ); - } - - /** - * Get the quota metrics for an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - private _getQuotaMetrics( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetQuotaMetricsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - getQuotaMetricsOperationSpec, - ); - } - - /** - * Get the health for routing endpoints. - * @param resourceGroupName - * @param iotHubName - * @param options The options parameters. - */ - private _getEndpointHealth( - resourceGroupName: string, - iotHubName: string, - options?: IotHubResourceGetEndpointHealthOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, iotHubName, options }, - getEndpointHealthOperationSpec, - ); - } - - /** - * Check if an IoT hub name is available. - * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the - * IoT hub to check. - * @param options The options parameters. - */ - checkNameAvailability( - operationInputs: OperationInputs, - options?: IotHubResourceCheckNameAvailabilityOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { operationInputs, options }, - checkNameAvailabilityOperationSpec, - ); - } - - /** - * Test all routes configured in this Iot Hub - * @param iotHubName IotHub to be tested - * @param resourceGroupName resource group which Iot Hub belongs to - * @param input Input for testing all routes - * @param options The options parameters. - */ - testAllRoutes( - iotHubName: string, - resourceGroupName: string, - input: TestAllRoutesInput, - options?: IotHubResourceTestAllRoutesOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { iotHubName, resourceGroupName, input, options }, - testAllRoutesOperationSpec, - ); - } - - /** - * Test the new route for this Iot Hub - * @param iotHubName IotHub to be tested - * @param resourceGroupName resource group which Iot Hub belongs to - * @param input Route that needs to be tested - * @param options The options parameters. - */ - testRoute( - iotHubName: string, - resourceGroupName: string, - input: TestRouteInput, - options?: IotHubResourceTestRouteOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { iotHubName, resourceGroupName, input, options }, - testRouteOperationSpec, - ); - } - - /** - * Get the security metadata for an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - private _listKeys( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListKeysOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - listKeysOperationSpec, - ); - } - - /** - * Get a shared access policy by name from an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param keyName The name of the shared access policy. - * @param options The options parameters. - */ - getKeysForKeyName( - resourceGroupName: string, - resourceName: string, - keyName: string, - options?: IotHubResourceGetKeysForKeyNameOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, keyName, options }, - getKeysForKeyNameOperationSpec, - ); - } - - /** - * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - * container. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param exportDevicesParameters The parameters that specify the export devices operation. - * @param options The options parameters. - */ - exportDevices( - resourceGroupName: string, - resourceName: string, - exportDevicesParameters: ExportDevicesRequest, - options?: IotHubResourceExportDevicesOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, exportDevicesParameters, options }, - exportDevicesOperationSpec, - ); - } - - /** - * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more - * information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param importDevicesParameters The parameters that specify the import devices operation. - * @param options The options parameters. - */ - importDevices( - resourceGroupName: string, - resourceName: string, - importDevicesParameters: ImportDevicesRequest, - options?: IotHubResourceImportDevicesOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, importDevicesParameters, options }, - importDevicesOperationSpec, - ); - } - - /** - * ListBySubscriptionNext - * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. - * @param options The options parameters. - */ - private _listBySubscriptionNext( - nextLink: string, - options?: IotHubResourceListBySubscriptionNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listBySubscriptionNextOperationSpec, - ); - } - - /** - * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroupName: string, - nextLink: string, - options?: IotHubResourceListByResourceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec, - ); - } - - /** - * GetValidSkusNext - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param nextLink The nextLink from the previous successful call to the GetValidSkus method. - * @param options The options parameters. - */ - private _getValidSkusNext( - resourceGroupName: string, - resourceName: string, - nextLink: string, - options?: IotHubResourceGetValidSkusNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, nextLink, options }, - getValidSkusNextOperationSpec, - ); - } - - /** - * ListEventHubConsumerGroupsNext - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. - * @param nextLink The nextLink from the previous successful call to the ListEventHubConsumerGroups - * method. - * @param options The options parameters. - */ - private _listEventHubConsumerGroupsNext( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - nextLink: string, - options?: IotHubResourceListEventHubConsumerGroupsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - eventHubEndpointName, - nextLink, - options, - }, - listEventHubConsumerGroupsNextOperationSpec, - ); - } - - /** - * ListJobsNext - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param nextLink The nextLink from the previous successful call to the ListJobs method. - * @param options The options parameters. - */ - private _listJobsNext( - resourceGroupName: string, - resourceName: string, - nextLink: string, - options?: IotHubResourceListJobsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, nextLink, options }, - listJobsNextOperationSpec, - ); - } - - /** - * GetQuotaMetricsNext - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param nextLink The nextLink from the previous successful call to the GetQuotaMetrics method. - * @param options The options parameters. - */ - private _getQuotaMetricsNext( - resourceGroupName: string, - resourceName: string, - nextLink: string, - options?: IotHubResourceGetQuotaMetricsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, nextLink, options }, - getQuotaMetricsNextOperationSpec, - ); - } - - /** - * GetEndpointHealthNext - * @param resourceGroupName - * @param iotHubName - * @param nextLink The nextLink from the previous successful call to the GetEndpointHealth method. - * @param options The options parameters. - */ - private _getEndpointHealthNext( - resourceGroupName: string, - iotHubName: string, - nextLink: string, - options?: IotHubResourceGetEndpointHealthNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, iotHubName, nextLink, options }, - getEndpointHealthNextOperationSpec, - ); - } - - /** - * ListKeysNext - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param nextLink The nextLink from the previous successful call to the ListKeys method. - * @param options The options parameters. - */ - private _listKeysNext( - resourceGroupName: string, - resourceName: string, - nextLink: string, - options?: IotHubResourceListKeysNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, nextLink, options }, - listKeysNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubDescription, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.IotHubDescription, - }, - 201: { - bodyMapper: Mappers.IotHubDescription, - }, - 202: { - bodyMapper: Mappers.IotHubDescription, - }, - 204: { - bodyMapper: Mappers.IotHubDescription, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.iotHubDescription, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept, Parameters.contentType, Parameters.ifMatch], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.IotHubDescription, - headersMapper: Mappers.IotHubResourceUpdateHeaders, - }, - 201: { - bodyMapper: Mappers.IotHubDescription, - headersMapper: Mappers.IotHubResourceUpdateHeaders, - }, - 202: { - bodyMapper: Mappers.IotHubDescription, - headersMapper: Mappers.IotHubResourceUpdateHeaders, - }, - 204: { - bodyMapper: Mappers.IotHubDescription, - headersMapper: Mappers.IotHubResourceUpdateHeaders, - }, - }, - requestBody: Parameters.iotHubTags, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", - httpMethod: "DELETE", - responses: { - 200: { - bodyMapper: Mappers.IotHubDescription, - }, - 201: { - bodyMapper: Mappers.IotHubDescription, - }, - 202: { - bodyMapper: Mappers.IotHubDescription, - }, - 204: { - bodyMapper: Mappers.IotHubDescription, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubDescriptionListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubDescriptionListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName], - headerParameters: [Parameters.accept], - serializer, -}; -const getStatsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.RegistryStatistics, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getValidSkusOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubSkuDescriptionListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listEventHubConsumerGroupsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.EventHubConsumerGroupsListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.eventHubEndpointName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getEventHubConsumerGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.EventHubConsumerGroupInfo, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.eventHubEndpointName, - Parameters.name, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createEventHubConsumerGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.EventHubConsumerGroupInfo, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.consumerGroupBody, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.eventHubEndpointName, - Parameters.name, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteEventHubConsumerGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", - httpMethod: "DELETE", - responses: { - 200: {}, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.eventHubEndpointName, - Parameters.name, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listJobsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.JobResponseListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getJobOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.JobResponse, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.jobId, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getQuotaMetricsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubQuotaMetricInfoListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getEndpointHealthOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.EndpointHealthDataListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.iotHubName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.IotHubNameAvailabilityInfo, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.operationInputs, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const testAllRoutesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.TestAllRoutesResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.input, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.iotHubName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const testRouteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.TestRouteResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.input1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.iotHubName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listKeysOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.SharedAccessSignatureAuthorizationRuleListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getKeysForKeyNameOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.SharedAccessSignatureAuthorizationRule, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.keyName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const exportDevicesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.JobResponse, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.exportDevicesParameters, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const importDevicesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.JobResponse, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.importDevicesParameters, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubDescriptionListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubDescriptionListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getValidSkusNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubSkuDescriptionListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listEventHubConsumerGroupsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.EventHubConsumerGroupsListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.eventHubEndpointName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listJobsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.JobResponseListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getQuotaMetricsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.IotHubQuotaMetricInfoListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getEndpointHealthNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.EndpointHealthDataListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.iotHubName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listKeysNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.SharedAccessSignatureAuthorizationRuleListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/iothub/arm-iothub/src/operations/operations.ts b/sdk/iothub/arm-iothub/src/operations/operations.ts deleted file mode 100644 index 09126ed0a68e..000000000000 --- a/sdk/iothub/arm-iothub/src/operations/operations.ts +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { Operations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { IotHubClient } from "../iotHubClient.js"; -import type { - Operation, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: IotHubClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: IotHubClient) { - this.client = client; - } - - /** - * Lists all of the available IoT Hub REST API operations. - * @param options The options parameters. - */ - public list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - }, - }; - } - - private async *listPagingPage( - options?: OperationsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: OperationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: OperationsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * Lists all of the available IoT Hub REST API operations. - * @param options The options parameters. - */ - private _list(options?: OperationsListOptionalParams): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.Devices/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/iothub/arm-iothub/src/operations/privateEndpointConnections.ts b/sdk/iothub/arm-iothub/src/operations/privateEndpointConnections.ts deleted file mode 100644 index 529d3e520816..000000000000 --- a/sdk/iothub/arm-iothub/src/operations/privateEndpointConnections.ts +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { PrivateEndpointConnections } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { IotHubClient } from "../iotHubClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - PrivateEndpointConnectionsListOptionalParams, - PrivateEndpointConnectionsListResponse, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsGetResponse, - PrivateEndpointConnection, - PrivateEndpointConnectionsUpdateOptionalParams, - PrivateEndpointConnectionsUpdateResponse, - PrivateEndpointConnectionsDeleteOptionalParams, - PrivateEndpointConnectionsDeleteResponse, -} from "../models/index.js"; - -/** Class containing PrivateEndpointConnections operations. */ -export class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { - private readonly client: IotHubClient; - - /** - * Initialize a new instance of the class PrivateEndpointConnections class. - * @param client Reference to the service client - */ - constructor(client: IotHubClient) { - this.client = client; - } - - /** - * List private endpoint connection properties - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - list( - resourceGroupName: string, - resourceName: string, - options?: PrivateEndpointConnectionsListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - listOperationSpec, - ); - } - - /** - * Get private endpoint connection properties - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param options The options parameters. - */ - get( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - privateEndpointConnectionName, - options, - }, - getOperationSpec, - ); - } - - /** - * Update the status of a private endpoint connection with the specified name - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param privateEndpointConnection The private endpoint connection with updated properties - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - privateEndpointConnection: PrivateEndpointConnection, - options?: PrivateEndpointConnectionsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - resourceName, - privateEndpointConnectionName, - privateEndpointConnection, - options, - }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - PrivateEndpointConnectionsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Update the status of a private endpoint connection with the specified name - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param privateEndpointConnection The private endpoint connection with updated properties - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - privateEndpointConnection: PrivateEndpointConnection, - options?: PrivateEndpointConnectionsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - resourceName, - privateEndpointConnectionName, - privateEndpointConnection, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete private endpoint connection with the specified name - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsDeleteResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - resourceName, - privateEndpointConnectionName, - options, - }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - PrivateEndpointConnectionsDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - }); - await poller.poll(); - return poller; - } - - /** - * Delete private endpoint connection with the specified name - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - resourceName, - privateEndpointConnectionName, - options, - ); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: { - type: { - name: "Sequence", - element: { - type: { name: "Composite", className: "PrivateEndpointConnection" }, - }, - }, - }, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 201: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 202: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 204: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - requestBody: Parameters.privateEndpointConnection, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "DELETE", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 201: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 202: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 204: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/iothub/arm-iothub/src/operations/privateLinkResourcesOperations.ts b/sdk/iothub/arm-iothub/src/operations/privateLinkResourcesOperations.ts deleted file mode 100644 index b7dcfee321f4..000000000000 --- a/sdk/iothub/arm-iothub/src/operations/privateLinkResourcesOperations.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { PrivateLinkResourcesOperations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { IotHubClient } from "../iotHubClient.js"; -import type { - PrivateLinkResourcesListOptionalParams, - PrivateLinkResourcesListResponse, - PrivateLinkResourcesGetOptionalParams, - PrivateLinkResourcesGetResponse, -} from "../models/index.js"; - -/** Class containing PrivateLinkResourcesOperations operations. */ -export class PrivateLinkResourcesOperationsImpl implements PrivateLinkResourcesOperations { - private readonly client: IotHubClient; - - /** - * Initialize a new instance of the class PrivateLinkResourcesOperations class. - * @param client Reference to the service client - */ - constructor(client: IotHubClient) { - this.client = client; - } - - /** - * List private link resources for the given IotHub - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - list( - resourceGroupName: string, - resourceName: string, - options?: PrivateLinkResourcesListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, options }, - listOperationSpec, - ); - } - - /** - * Get the specified private link resource for the given IotHub - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param groupId The name of the private link resource - * @param options The options parameters. - */ - get( - resourceGroupName: string, - resourceName: string, - groupId: string, - options?: PrivateLinkResourcesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, resourceName, groupId, options }, - getOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateLinkResources, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.GroupIdInformation, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.groupId, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/iothub/arm-iothub/src/operations/resourceProviderCommon.ts b/sdk/iothub/arm-iothub/src/operations/resourceProviderCommon.ts deleted file mode 100644 index bbc1f1704b82..000000000000 --- a/sdk/iothub/arm-iothub/src/operations/resourceProviderCommon.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { ResourceProviderCommon } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { IotHubClient } from "../iotHubClient.js"; -import type { - ResourceProviderCommonGetSubscriptionQuotaOptionalParams, - ResourceProviderCommonGetSubscriptionQuotaResponse, -} from "../models/index.js"; - -/** Class containing ResourceProviderCommon operations. */ -export class ResourceProviderCommonImpl implements ResourceProviderCommon { - private readonly client: IotHubClient; - - /** - * Initialize a new instance of the class ResourceProviderCommon class. - * @param client Reference to the service client - */ - constructor(client: IotHubClient) { - this.client = client; - } - - /** - * Get the number of free and paid iot hubs in the subscription - * @param options The options parameters. - */ - getSubscriptionQuota( - options?: ResourceProviderCommonGetSubscriptionQuotaOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, getSubscriptionQuotaOperationSpec); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getSubscriptionQuotaOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.UserSubscriptionQuotaListResult, - }, - default: { - bodyMapper: Mappers.ErrorDetails, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/certificates.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/certificates.ts deleted file mode 100644 index 98c8e0e393a9..000000000000 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/certificates.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { - CertificatesListByIotHubOptionalParams, - CertificatesListByIotHubResponse, - CertificatesGetOptionalParams, - CertificatesGetResponse, - CertificateDescription, - CertificatesCreateOrUpdateOptionalParams, - CertificatesCreateOrUpdateResponse, - CertificatesDeleteOptionalParams, - CertificatesGenerateVerificationCodeOptionalParams, - CertificatesGenerateVerificationCodeResponse, - CertificateVerificationDescription, - CertificatesVerifyOptionalParams, - CertificatesVerifyResponse, -} from "../models/index.js"; - -/** Interface representing a Certificates. */ -export interface Certificates { - /** - * Returns the list of certificates. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - listByIotHub( - resourceGroupName: string, - resourceName: string, - options?: CertificatesListByIotHubOptionalParams, - ): Promise; - /** - * Returns the certificate. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param options The options parameters. - */ - get( - resourceGroupName: string, - resourceName: string, - certificateName: string, - options?: CertificatesGetOptionalParams, - ): Promise; - /** - * Adds new or replaces existing certificate. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param certificateDescription The certificate body. - * @param options The options parameters. - */ - createOrUpdate( - resourceGroupName: string, - resourceName: string, - certificateName: string, - certificateDescription: CertificateDescription, - options?: CertificatesCreateOrUpdateOptionalParams, - ): Promise; - /** - * Deletes an existing X509 certificate or does nothing if it does not exist. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param ifMatch ETag of the Certificate. - * @param options The options parameters. - */ - delete( - resourceGroupName: string, - resourceName: string, - certificateName: string, - ifMatch: string, - options?: CertificatesDeleteOptionalParams, - ): Promise; - /** - * Generates verification code for proof of possession flow. The verification code will be used to - * generate a leaf certificate. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param ifMatch ETag of the Certificate. - * @param options The options parameters. - */ - generateVerificationCode( - resourceGroupName: string, - resourceName: string, - certificateName: string, - ifMatch: string, - options?: CertificatesGenerateVerificationCodeOptionalParams, - ): Promise; - /** - * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying - * pre uploaded certificate. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param certificateName The name of the certificate - * @param ifMatch ETag of the Certificate. - * @param certificateVerificationBody The name of the certificate - * @param options The options parameters. - */ - verify( - resourceGroupName: string, - resourceName: string, - certificateName: string, - ifMatch: string, - certificateVerificationBody: CertificateVerificationDescription, - options?: CertificatesVerifyOptionalParams, - ): Promise; -} diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/index.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/index.ts deleted file mode 100644 index b5c8fc0fe2b3..000000000000 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./operations.js"; -export * from "./iotHubResource.js"; -export * from "./resourceProviderCommon.js"; -export * from "./certificates.js"; -export * from "./iotHub.js"; -export * from "./privateLinkResourcesOperations.js"; -export * from "./privateEndpointConnections.js"; diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHub.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHub.ts deleted file mode 100644 index 6f0672202d47..000000000000 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHub.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { FailoverInput, IotHubManualFailoverOptionalParams } from "../models/index.js"; - -/** Interface representing a IotHub. */ -export interface IotHub { - /** - * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see - * https://aka.ms/manualfailover - * @param iotHubName Name of the IoT hub to failover - * @param resourceGroupName Name of the resource group containing the IoT hub resource - * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the - * secondary location in the locations property. To learn more, see - * https://aka.ms/manualfailover/region - * @param options The options parameters. - */ - beginManualFailover( - iotHubName: string, - resourceGroupName: string, - failoverInput: FailoverInput, - options?: IotHubManualFailoverOptionalParams, - ): Promise, void>>; - /** - * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see - * https://aka.ms/manualfailover - * @param iotHubName Name of the IoT hub to failover - * @param resourceGroupName Name of the resource group containing the IoT hub resource - * @param failoverInput Region to failover to. Must be the Azure paired region. Get the value from the - * secondary location in the locations property. To learn more, see - * https://aka.ms/manualfailover/region - * @param options The options parameters. - */ - beginManualFailoverAndWait( - iotHubName: string, - resourceGroupName: string, - failoverInput: FailoverInput, - options?: IotHubManualFailoverOptionalParams, - ): Promise; -} diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHubResource.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHubResource.ts deleted file mode 100644 index b168cfdad280..000000000000 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHubResource.ts +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - IotHubDescription, - IotHubResourceListBySubscriptionOptionalParams, - IotHubResourceListByResourceGroupOptionalParams, - IotHubSkuDescription, - IotHubResourceGetValidSkusOptionalParams, - EventHubConsumerGroupInfo, - IotHubResourceListEventHubConsumerGroupsOptionalParams, - JobResponse, - IotHubResourceListJobsOptionalParams, - IotHubQuotaMetricInfo, - IotHubResourceGetQuotaMetricsOptionalParams, - EndpointHealthData, - IotHubResourceGetEndpointHealthOptionalParams, - SharedAccessSignatureAuthorizationRule, - IotHubResourceListKeysOptionalParams, - IotHubResourceGetOptionalParams, - IotHubResourceGetResponse, - IotHubResourceCreateOrUpdateOptionalParams, - IotHubResourceCreateOrUpdateResponse, - TagsResource, - IotHubResourceUpdateOptionalParams, - IotHubResourceUpdateResponse, - IotHubResourceDeleteOptionalParams, - IotHubResourceDeleteResponse, - IotHubResourceGetStatsOptionalParams, - IotHubResourceGetStatsResponse, - IotHubResourceGetEventHubConsumerGroupOptionalParams, - IotHubResourceGetEventHubConsumerGroupResponse, - EventHubConsumerGroupBodyDescription, - IotHubResourceCreateEventHubConsumerGroupOptionalParams, - IotHubResourceCreateEventHubConsumerGroupResponse, - IotHubResourceDeleteEventHubConsumerGroupOptionalParams, - IotHubResourceGetJobOptionalParams, - IotHubResourceGetJobResponse, - OperationInputs, - IotHubResourceCheckNameAvailabilityOptionalParams, - IotHubResourceCheckNameAvailabilityResponse, - TestAllRoutesInput, - IotHubResourceTestAllRoutesOptionalParams, - IotHubResourceTestAllRoutesResponse, - TestRouteInput, - IotHubResourceTestRouteOptionalParams, - IotHubResourceTestRouteResponse, - IotHubResourceGetKeysForKeyNameOptionalParams, - IotHubResourceGetKeysForKeyNameResponse, - ExportDevicesRequest, - IotHubResourceExportDevicesOptionalParams, - IotHubResourceExportDevicesResponse, - ImportDevicesRequest, - IotHubResourceImportDevicesOptionalParams, - IotHubResourceImportDevicesResponse, -} from "../models/index.js"; - -/// -/** Interface representing a IotHubResource. */ -export interface IotHubResource { - /** - * Get all the IoT hubs in a subscription. - * @param options The options parameters. - */ - listBySubscription( - options?: IotHubResourceListBySubscriptionOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get all the IoT hubs in a resource group. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroupName: string, - options?: IotHubResourceListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get the list of valid SKUs for an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - listValidSkus( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetValidSkusOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT - * hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint. - * @param options The options parameters. - */ - listEventHubConsumerGroups( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - options?: IotHubResourceListEventHubConsumerGroupsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a list of all the jobs in an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - listJobs( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListJobsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get the quota metrics for an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - listQuotaMetrics( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetQuotaMetricsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get the health for routing endpoints. - * @param resourceGroupName - * @param iotHubName - * @param options The options parameters. - */ - listEndpointHealth( - resourceGroupName: string, - iotHubName: string, - options?: IotHubResourceGetEndpointHealthOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get the security metadata for an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - listKeys( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceListKeysOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get the non-security related metadata of an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetOptionalParams, - ): Promise; - /** - * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve - * the IoT hub metadata and security metadata, and then combine them with the modified values in a new - * body to update the IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param iotHubDescription The IoT hub metadata and security metadata. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - resourceName: string, - iotHubDescription: IotHubDescription, - options?: IotHubResourceCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - IotHubResourceCreateOrUpdateResponse - > - >; - /** - * Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve - * the IoT hub metadata and security metadata, and then combine them with the modified values in a new - * body to update the IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param iotHubDescription The IoT hub metadata and security metadata. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - resourceName: string, - iotHubDescription: IotHubDescription, - options?: IotHubResourceCreateOrUpdateOptionalParams, - ): Promise; - /** - * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * @param resourceGroupName Resource group identifier. - * @param resourceName Name of iot hub to update. - * @param iotHubTags Updated tag information to set into the iot hub instance. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - resourceName: string, - iotHubTags: TagsResource, - options?: IotHubResourceUpdateOptionalParams, - ): Promise< - SimplePollerLike, IotHubResourceUpdateResponse> - >; - /** - * Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method - * @param resourceGroupName Resource group identifier. - * @param resourceName Name of iot hub to update. - * @param iotHubTags Updated tag information to set into the iot hub instance. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - resourceName: string, - iotHubTags: TagsResource, - options?: IotHubResourceUpdateOptionalParams, - ): Promise; - /** - * Delete an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceDeleteOptionalParams, - ): Promise< - SimplePollerLike, IotHubResourceDeleteResponse> - >; - /** - * Delete an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceDeleteOptionalParams, - ): Promise; - /** - * Get the statistics from an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - getStats( - resourceGroupName: string, - resourceName: string, - options?: IotHubResourceGetStatsOptionalParams, - ): Promise; - /** - * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. - * @param name The name of the consumer group to retrieve. - * @param options The options parameters. - */ - getEventHubConsumerGroup( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - name: string, - options?: IotHubResourceGetEventHubConsumerGroupOptionalParams, - ): Promise; - /** - * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. - * @param name The name of the consumer group to add. - * @param consumerGroupBody The consumer group to add. - * @param options The options parameters. - */ - createEventHubConsumerGroup( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - name: string, - consumerGroupBody: EventHubConsumerGroupBodyDescription, - options?: IotHubResourceCreateEventHubConsumerGroupOptionalParams, - ): Promise; - /** - * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. - * @param name The name of the consumer group to delete. - * @param options The options parameters. - */ - deleteEventHubConsumerGroup( - resourceGroupName: string, - resourceName: string, - eventHubEndpointName: string, - name: string, - options?: IotHubResourceDeleteEventHubConsumerGroupOptionalParams, - ): Promise; - /** - * Get the details of a job from an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param jobId The job identifier. - * @param options The options parameters. - */ - getJob( - resourceGroupName: string, - resourceName: string, - jobId: string, - options?: IotHubResourceGetJobOptionalParams, - ): Promise; - /** - * Check if an IoT hub name is available. - * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the - * IoT hub to check. - * @param options The options parameters. - */ - checkNameAvailability( - operationInputs: OperationInputs, - options?: IotHubResourceCheckNameAvailabilityOptionalParams, - ): Promise; - /** - * Test all routes configured in this Iot Hub - * @param iotHubName IotHub to be tested - * @param resourceGroupName resource group which Iot Hub belongs to - * @param input Input for testing all routes - * @param options The options parameters. - */ - testAllRoutes( - iotHubName: string, - resourceGroupName: string, - input: TestAllRoutesInput, - options?: IotHubResourceTestAllRoutesOptionalParams, - ): Promise; - /** - * Test the new route for this Iot Hub - * @param iotHubName IotHub to be tested - * @param resourceGroupName resource group which Iot Hub belongs to - * @param input Route that needs to be tested - * @param options The options parameters. - */ - testRoute( - iotHubName: string, - resourceGroupName: string, - input: TestRouteInput, - options?: IotHubResourceTestRouteOptionalParams, - ): Promise; - /** - * Get a shared access policy by name from an IoT hub. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param keyName The name of the shared access policy. - * @param options The options parameters. - */ - getKeysForKeyName( - resourceGroupName: string, - resourceName: string, - keyName: string, - options?: IotHubResourceGetKeysForKeyNameOptionalParams, - ): Promise; - /** - * Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - * container. For more information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param exportDevicesParameters The parameters that specify the export devices operation. - * @param options The options parameters. - */ - exportDevices( - resourceGroupName: string, - resourceName: string, - exportDevicesParameters: ExportDevicesRequest, - options?: IotHubResourceExportDevicesOptionalParams, - ): Promise; - /** - * Import, update, or delete device identities in the IoT hub identity registry from a blob. For more - * information, see: - * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param importDevicesParameters The parameters that specify the import devices operation. - * @param options The options parameters. - */ - importDevices( - resourceGroupName: string, - resourceName: string, - importDevicesParameters: ImportDevicesRequest, - options?: IotHubResourceImportDevicesOptionalParams, - ): Promise; -} diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/operations.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/operations.ts deleted file mode 100644 index 24a4c170a0bb..000000000000 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { Operation, OperationsListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * Lists all of the available IoT Hub REST API operations. - * @param options The options parameters. - */ - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; -} diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/privateEndpointConnections.ts deleted file mode 100644 index 4e9d89495c9b..000000000000 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/privateEndpointConnections.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - PrivateEndpointConnectionsListOptionalParams, - PrivateEndpointConnectionsListResponse, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsGetResponse, - PrivateEndpointConnection, - PrivateEndpointConnectionsUpdateOptionalParams, - PrivateEndpointConnectionsUpdateResponse, - PrivateEndpointConnectionsDeleteOptionalParams, - PrivateEndpointConnectionsDeleteResponse, -} from "../models/index.js"; - -/** Interface representing a PrivateEndpointConnections. */ -export interface PrivateEndpointConnections { - /** - * List private endpoint connection properties - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - list( - resourceGroupName: string, - resourceName: string, - options?: PrivateEndpointConnectionsListOptionalParams, - ): Promise; - /** - * Get private endpoint connection properties - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param options The options parameters. - */ - get( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsGetOptionalParams, - ): Promise; - /** - * Update the status of a private endpoint connection with the specified name - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param privateEndpointConnection The private endpoint connection with updated properties - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - privateEndpointConnection: PrivateEndpointConnection, - options?: PrivateEndpointConnectionsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsUpdateResponse - > - >; - /** - * Update the status of a private endpoint connection with the specified name - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param privateEndpointConnection The private endpoint connection with updated properties - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - privateEndpointConnection: PrivateEndpointConnection, - options?: PrivateEndpointConnectionsUpdateOptionalParams, - ): Promise; - /** - * Delete private endpoint connection with the specified name - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsDeleteResponse - > - >; - /** - * Delete private endpoint connection with the specified name - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - resourceName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/privateLinkResourcesOperations.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/privateLinkResourcesOperations.ts deleted file mode 100644 index c9929705fef8..000000000000 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/privateLinkResourcesOperations.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { - PrivateLinkResourcesListOptionalParams, - PrivateLinkResourcesListResponse, - PrivateLinkResourcesGetOptionalParams, - PrivateLinkResourcesGetResponse, -} from "../models/index.js"; - -/** Interface representing a PrivateLinkResourcesOperations. */ -export interface PrivateLinkResourcesOperations { - /** - * List private link resources for the given IotHub - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param options The options parameters. - */ - list( - resourceGroupName: string, - resourceName: string, - options?: PrivateLinkResourcesListOptionalParams, - ): Promise; - /** - * Get the specified private link resource for the given IotHub - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param groupId The name of the private link resource - * @param options The options parameters. - */ - get( - resourceGroupName: string, - resourceName: string, - groupId: string, - options?: PrivateLinkResourcesGetOptionalParams, - ): Promise; -} diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/resourceProviderCommon.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/resourceProviderCommon.ts deleted file mode 100644 index 06654609f5fd..000000000000 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/resourceProviderCommon.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import type { - ResourceProviderCommonGetSubscriptionQuotaOptionalParams, - ResourceProviderCommonGetSubscriptionQuotaResponse, -} from "../models/index.js"; - -/** Interface representing a ResourceProviderCommon. */ -export interface ResourceProviderCommon { - /** - * Get the number of free and paid iot hubs in the subscription - * @param options The options parameters. - */ - getSubscriptionQuota( - options?: ResourceProviderCommonGetSubscriptionQuotaOptionalParams, - ): Promise; -} diff --git a/sdk/iothub/arm-iothub/src/pagingHelper.ts b/sdk/iothub/arm-iothub/src/pagingHelper.ts deleted file mode 100644 index e362819bdfc4..000000000000 --- a/sdk/iothub/arm-iothub/src/pagingHelper.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken(page: unknown, continuationToken: string | undefined): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/iothub/arm-iothub/src/restorePollerHelpers.ts b/sdk/iothub/arm-iothub/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..d3eeadba73dc --- /dev/null +++ b/sdk/iothub/arm-iothub/src/restorePollerHelpers.ts @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { IotHubClient } from "./iotHubClient.js"; +import { _manualFailoverDeserialize } from "./api/iotHub/operations.js"; +import { + _$deleteDeserialize, + _updateDeserialize, + _createOrUpdateDeserialize, +} from "./api/iotHubResource/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializePrivateEndpointConnections, + _updateDeserialize as _updateDeserializePrivateEndpointConnections, +} from "./api/privateEndpointConnections/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import type { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { PollerLike, OperationState, ResourceLocationConfig } from "@azure/core-lro"; +import { deserializeState } from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: IotHubClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + const apiVersion = getApiVersionFromUrl(initialRequestUrl); + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + apiVersion, + }, + ); +} + +interface DeserializationHelper { + deserializer: (result: PathUncheckedResponse) => Promise; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover": + { deserializer: _manualFailoverDeserialize, expectedStatuses: ["202", "200", "201"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}": + { deserializer: _$deleteDeserialize, expectedStatuses: ["200", "202", "204"] }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}": + { deserializer: _updateDeserialize, expectedStatuses: ["200", "201", "202"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}": + { deserializer: _createOrUpdateDeserialize, expectedStatuses: ["200", "201", "202"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}": + { + deserializer: _$deleteDeserializePrivateEndpointConnections, + expectedStatuses: ["200", "202", "204"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}": + { + deserializer: _updateDeserializePrivateEndpointConnections, + expectedStatuses: ["200", "201", "202"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} + +function getApiVersionFromUrl(urlStr: string): string | undefined { + const url = new URL(urlStr); + return url.searchParams.get("api-version") ?? undefined; +} diff --git a/sdk/iothub/arm-iothub/src/static-helpers/cloudSettingHelpers.ts b/sdk/iothub/arm-iothub/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 000000000000..613112c6e397 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * An enum to describe Azure Cloud environments. + * @enum {string} + */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT", +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +/** + * Gets the Azure Resource Manager endpoint URL for the specified cloud setting. + * @param cloudSetting - The Azure cloud environment setting. Use one of the AzureClouds enum values. + * @returns The ARM endpoint URL for the specified cloud, or undefined if cloudSetting is undefined. + * @throws {Error} Throws an error if an unknown cloud setting is provided. + */ +export function getArmEndpoint(cloudSetting?: AzureSupportedClouds): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/", + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.`, + ); + } +} diff --git a/sdk/iothub/arm-iothub/src/static-helpers/pagingHelpers.ts b/sdk/iothub/arm-iothub/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..4b0ff077dafd --- /dev/null +++ b/sdk/iothub/arm-iothub/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; + nextLinkMethod?: "GET" | "POST"; + apiVersion?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const nextLinkMethod = options.nextLinkMethod ?? "GET"; + const apiVersion = options.apiVersion; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + let result; + if (pageLink === undefined) { + result = await getInitialResponse(); + } else { + const resolvedPageLink = apiVersion ? addApiVersionToUrl(pageLink, apiVersion) : pageLink; + result = + nextLinkMethod === "POST" + ? await client.pathUnchecked(resolvedPageLink).post() + : await client.pathUnchecked(resolvedPageLink).get(); + } + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${urlObj.search ? "&" : "?"}api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/iothub/arm-iothub/src/static-helpers/pollingHelpers.ts b/sdk/iothub/arm-iothub/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..5c66c00d28e8 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + OperationResponse, +} from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; + /** + * The api-version of the LRO + */ + apiVersion?: string; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse, apiVersion } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + const pollingPath = apiVersion ? addApiVersionToUrl(path, apiVersion) : path; + response = await client.pathUnchecked(pollingPath).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${urlObj.search ? "&" : "?"}api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/iothub/arm-iothub/src/static-helpers/simplePollerHelpers.ts b/sdk/iothub/arm-iothub/src/static-helpers/simplePollerHelpers.ts new file mode 100644 index 000000000000..f6996f3cee67 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/static-helpers/simplePollerHelpers.ts @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PollerLike, OperationState, CancelOnProgress } from "@azure/core-lro"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +/** + * A simple poller that can be used to poll a long running operation. + */ +export interface SimplePollerLike, TResult> { + /** + * Returns true if the poller has finished polling. + */ + isDone(): boolean; + /** + * Returns the state of the operation. + */ + getOperationState(): TState; + /** + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. + */ + getResult(): TResult | undefined; + /** + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + */ + poll(options?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Returns a promise that will resolve once the underlying operation is completed. + */ + pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. + */ + onProgress(callback: (state: TState) => void): CancelOnProgress; + + /** + * Returns a promise that could be used for serialized version of the poller's operation + * by invoking the operation's serialize method. + */ + serialize(): Promise; + + /** + * Wait the poller to be submitted. + */ + submitted(): Promise; + + /** + * Returns a string representation of the poller's operation. Similar to serialize but returns a string. + * @deprecated Use serialize() instead. + */ + toString(): string; + + /** + * Stops the poller from continuing to poll. Please note this will only stop the client-side polling + * @deprecated Use abortSignal to stop polling instead. + */ + stopPolling(): void; + + /** + * Returns true if the poller is stopped. + * @deprecated Use abortSignal status to track this instead. + */ + isStopped(): boolean; +} + +/** + * Create the deprecated SimplePollerLike from PollerLike + * @param poller PollerLike to convert + * @returns SimplePollerLike + */ +export function getSimplePoller( + poller: PollerLike, TResult>, +): SimplePollerLike, TResult> { + const simplePoller: SimplePollerLike, TResult> = { + isDone() { + return poller.isDone; + }, + isStopped() { + throw new Error("isStopped is deprecated. Use abortSignal status to track this instead."); + }, + getOperationState() { + if (!poller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return poller.operationState; + }, + getResult() { + return poller.result; + }, + toString() { + if (!poller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return JSON.stringify({ + state: poller.operationState, + }); + }, + stopPolling() { + throw new Error("stopPolling is deprecated. Use abortSignal to stop polling instead."); + }, + onProgress: poller.onProgress, + poll: poller.poll, + pollUntilDone: poller.pollUntilDone, + serialize: poller.serialize, + submitted: poller.submitted, + }; + return simplePoller; +} diff --git a/sdk/iothub/arm-iothub/src/static-helpers/urlTemplate.ts b/sdk/iothub/arm-iothub/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..e8af8cd3ab73 --- /dev/null +++ b/sdk/iothub/arm-iothub/src/static-helpers/urlTemplate.ts @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// --------------------- +// interfaces +// --------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string): string { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string): string { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string): string { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any): boolean { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false): string { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions): string { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + if (named && val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions): string | undefined { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + const result = template.replace(/\{([^{}]+)\}|([^{}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + op = expr[0]; + expr = expr.slice(1); + } + const varList = expr.split(/,/g); + const innerResult = []; + for (const varSpec of varList) { + const varMatch = /([^:*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: innerResult.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + innerResult.push(varValue); + } + } + return innerResult.join(""); + }); + + return normalizeUnreserved(result); +} + +/** + * Normalize an expanded URI by decoding percent-encoded unreserved characters. + * RFC 3986 unreserved: "-" / "." / "~" + */ +function normalizeUnreserved(uri: string): string { + return uri.replace(/%([0-9A-Fa-f]{2})/g, (match, hex) => { + const char = String.fromCharCode(parseInt(hex, 16)); + // Decode only if it's unreserved + if (/[.~-]/.test(char)) { + return char; + } + return match; // leave other encodings intact + }); +} diff --git a/sdk/iothub/arm-iothub/test/snippets.spec.ts b/sdk/iothub/arm-iothub/test/snippets.spec.ts index fbe4f412b978..b3963707cae8 100644 --- a/sdk/iothub/arm-iothub/test/snippets.spec.ts +++ b/sdk/iothub/arm-iothub/test/snippets.spec.ts @@ -1,10 +1,5 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. import { IotHubClient } from "../src/index.js"; import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity"; @@ -18,11 +13,11 @@ describe("snippets", () => { }); it("ReadmeSampleCreateClient_Browser", async () => { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new IotHubClient(credential, subscriptionId); }); diff --git a/sdk/iothub/arm-iothub/tsconfig.json b/sdk/iothub/arm-iothub/tsconfig.json index 4f50981fb333..d0a44aae0734 100644 --- a/sdk/iothub/arm-iothub/tsconfig.json +++ b/sdk/iothub/arm-iothub/tsconfig.json @@ -4,19 +4,22 @@ "path": "./config/tsconfig.src.esm.json" }, { - "path": "./config/tsconfig.src.cjs.json" + "path": "./config/tsconfig.src.browser.json" }, { - "path": "./config/tsconfig.src.browser.json" + "path": "./config/tsconfig.src.cjs.json" }, { "path": "./config/tsconfig.test.node.json" }, { - "path": "./config/tsconfig.snippets.json" + "path": "./config/tsconfig.test.browser.json" }, { "path": "./config/tsconfig.samples.json" + }, + { + "path": "./config/tsconfig.snippets.json" } ], "files": [] diff --git a/sdk/iothub/arm-iothub/tsp-location.yaml b/sdk/iothub/arm-iothub/tsp-location.yaml new file mode 100644 index 000000000000..967418134d00 --- /dev/null +++ b/sdk/iothub/arm-iothub/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/iothub/resource-manager/Microsoft.Devices/IoTHub +commit: 4375d0c4eb36e73152199e484c0d4537ddd4c9da +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/iothub/arm-iothub/vitest.browser.config.ts b/sdk/iothub/arm-iothub/vitest.browser.config.ts index d4cf432eb610..3005cfd05093 100644 --- a/sdk/iothub/arm-iothub/vitest.browser.config.ts +++ b/sdk/iothub/arm-iothub/vitest.browser.config.ts @@ -1,21 +1,4 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -import { defineConfig, mergeConfig } from "vitest/config"; -import viteConfig from "../../../vitest.browser.shared.config.ts"; - -export default mergeConfig( - viteConfig, - defineConfig({ - test: { - include: ["dist-test/browser/test/**/*.spec.js"], - testTimeout: 1200000, - hookTimeout: 1200000, - }, - }), -); +export { default } from "../../../eng/vitestconfigs/browser.config.ts"; diff --git a/sdk/iothub/arm-iothub/vitest.config.ts b/sdk/iothub/arm-iothub/vitest.config.ts index 42f4f102130b..0dfa15cc4498 100644 --- a/sdk/iothub/arm-iothub/vitest.config.ts +++ b/sdk/iothub/arm-iothub/vitest.config.ts @@ -1,20 +1,6 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -import { defineConfig, mergeConfig } from "vitest/config"; import viteConfig from "../../../vitest.shared.config.ts"; -export default mergeConfig( - viteConfig, - defineConfig({ - test: { - testTimeout: 1200000, - hookTimeout: 1200000, - }, - }), -); +export default viteConfig; diff --git a/sdk/iothub/arm-iothub/warp.config.yml b/sdk/iothub/arm-iothub/warp.config.yml index 326e6c0415c8..6f7536c17cc2 100644 --- a/sdk/iothub/arm-iothub/warp.config.yml +++ b/sdk/iothub/arm-iothub/warp.config.yml @@ -1,5 +1,17 @@ +# warp.config.yml — build configuration -extends: ../../../warp.base.config.yml +exports: + "./package.json": "./package.json" + ".": "./src/index.ts" + "./api": "./src/api/index.ts" + "./api/resourceProviderCommon": "./src/api/resourceProviderCommon/index.ts" + "./api/privateLinkResources": "./src/api/privateLinkResources/index.ts" + "./api/certificates": "./src/api/certificates/index.ts" + "./api/iotHub": "./src/api/iotHub/index.ts" + "./api/iotHubResource": "./src/api/iotHubResource/index.ts" + "./api/privateEndpointConnections": "./src/api/privateEndpointConnections/index.ts" + "./api/operations": "./src/api/operations/index.ts" + "./models": "./src/models/index.ts" targets: - name: browser diff --git a/sdk/iothub/ci.mgmt.yml b/sdk/iothub/ci.mgmt.yml index 3fc7d7022352..1afcfa32fdb2 100644 --- a/sdk/iothub/ci.mgmt.yml +++ b/sdk/iothub/ci.mgmt.yml @@ -1,11 +1,13 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: - main - release/* - hotfix/* + exclude: + - feature/v4 paths: include: - sdk/iothub/ci.mgmt.yml