diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.cs new file mode 100644 index 0000000000..b08254c0cd --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.cs @@ -0,0 +1,45 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json +// this example is just showing the usage of "Certificates_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// get the collection of this IotHubCertificateDescriptionResource +IotHubCertificateDescriptionCollection collection = iotHubDescription.GetIotHubCertificateDescriptions(); + +// invoke the operation +string certificateName = "cert"; +IotHubCertificateDescriptionData data = new IotHubCertificateDescriptionData +{ + Properties = new IotHubCertificateProperties + { + Certificate = BinaryData.FromObjectAsJson("############################################"), + }, +}; +ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, certificateName, data); +IotHubCertificateDescriptionResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubCertificateDescriptionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_Certificates_With_DeviceRegistryPolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_IoTHub_With_DeviceRegistry.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_IoTHub_With_DeviceRegistry.cs new file mode 100644 index 0000000000..ba9243f2cd --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_IoTHub_With_DeviceRegistry.cs @@ -0,0 +1,130 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using System.Xml; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/CreateOrReplace_IoTHub_With_DeviceRegistry.json +// this example is just showing the usage of "IotHubResource_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this ResourceGroupResource created on azure +// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); +ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + +// get the collection of this IotHubDescriptionResource +IotHubDescriptionCollection collection = resourceGroupResource.GetIotHubDescriptions(); + +// invoke the operation +string resourceName = "testHub"; +IotHubDescriptionData data = new IotHubDescriptionData(new AzureLocation("centraluseuap"), new IotHubSkuInfo(IotHubSku.Gen2) +{ + Capacity = 1L, +}) +{ + ETag = new ETag("AAAAAAFD6M4="), + Properties = new IotHubProperties + { + IPFilterRules = { }, + NetworkRuleSets = new IotHubNetworkRuleSetProperties(true, new IotHubNetworkRuleSetIPRule[] +{ +new IotHubNetworkRuleSetIPRule("rule1", "131.117.159.53") +{ +Action = IotHubNetworkRuleIPAction.Allow, +}, +new IotHubNetworkRuleSetIPRule("rule2", "157.55.59.128/25") +{ +Action = IotHubNetworkRuleIPAction.Allow, +} +}) + { + DefaultAction = IotHubNetworkRuleSetDefaultAction.Deny, + }, + MinTlsVersion = "1.2", + EventHubEndpoints = + { + ["events"] = new EventHubCompatibleEndpointProperties + { + RetentionTimeInDays = 1L, + PartitionCount = 2, + } + }, + Routing = new IotHubRoutingProperties + { + Endpoints = new RoutingEndpoints + { + ServiceBusQueues = { }, + ServiceBusTopics = { }, + EventHubs = { }, + StorageContainers = { }, + }, + Routes = { }, + FallbackRoute = new IotHubFallbackRouteProperties(IotHubRoutingSource.DeviceMessages, new string[] { "events" }, true) + { + Name = "$fallback", + Condition = "true", + }, + }, + StorageEndpoints = + { + ["$default"] = new IotHubStorageEndpointProperties("", "") + { + SasTtlAsIso8601 = XmlConvert.ToTimeSpan("PT1H"), + } + }, + MessagingEndpoints = + { + ["fileNotifications"] = new MessagingEndpointProperties + { + LockDurationAsIso8601 = XmlConvert.ToTimeSpan("PT1M"), + TtlAsIso8601 = XmlConvert.ToTimeSpan("PT1H"), + MaxDeliveryCount = 10, + } + }, + EnableFileUploadNotifications = false, + CloudToDevice = new CloudToDeviceProperties + { + MaxDeliveryCount = 10, + DefaultTtlAsIso8601 = XmlConvert.ToTimeSpan("PT1H"), + Feedback = new CloudToDeviceFeedbackQueueProperties + { + LockDurationAsIso8601 = XmlConvert.ToTimeSpan("PT1M"), + TtlAsIso8601 = XmlConvert.ToTimeSpan("PT1H"), + MaxDeliveryCount = 10, + }, + }, + Features = IotHubCapability.None, + EnableDataResidency = true, + RootCertificate = new IotHubRootCertificateProperties + { + IsRootCertificateV2Enabled = true, + }, + IPVersion = IotHubIPVersion.IPv4IPv6, + DeviceRegistry = new IotHubDeviceRegistry + { + NamespaceResourceId = new ResourceIdentifier("/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/namespaces/testNamespace"), + IdentityResourceId = new ResourceIdentifier("/subscriptions/ae24ff83-d2ca-4fc8-9717-05dae4bba489/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testIdentity"), + }, + }, + Tags = { }, +}; +ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); +IotHubDescriptionResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubDescriptionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_IoTHub_With_DeviceRegistry.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_IoTHub_With_DeviceRegistry.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/CreateOrReplace_IoTHub_With_DeviceRegistry.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/IotHub_ManualFailover.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/IotHub_ManualFailover.cs new file mode 100644 index 0000000000..05aacd0580 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/IotHub_ManualFailover.cs @@ -0,0 +1,30 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/IotHub_ManualFailover.json +// this example is just showing the usage of "IotHub_ManualFailover" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string iotHubName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, iotHubName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +IotHubFailoverContent content = new IotHubFailoverContent("testHub"); +await iotHubDescription.ManualFailoverIotHubAsync(WaitUntil.Completed, content); + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/IotHub_ManualFailover.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/IotHub_ManualFailover.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/IotHub_ManualFailover.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/checkNameAvailability.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/checkNameAvailability.cs new file mode 100644 index 0000000000..7ba848dc1e --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/checkNameAvailability.cs @@ -0,0 +1,29 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/checkNameAvailability.json +// this example is just showing the usage of "IotHubResource_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this SubscriptionResource created on azure +// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); +SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + +// invoke the operation +IotHubNameAvailabilityContent content = new IotHubNameAvailabilityContent("test-request"); +IotHubNameAvailabilityResponse result = await subscriptionResource.CheckIotHubNameAvailabilityAsync(content); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/checkNameAvailability.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/checkNameAvailability.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/checkNameAvailability.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatescreateorupdate.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatescreateorupdate.cs new file mode 100644 index 0000000000..f1ff092795 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatescreateorupdate.cs @@ -0,0 +1,45 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_certificatescreateorupdate.json +// this example is just showing the usage of "Certificates_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "iothub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// get the collection of this IotHubCertificateDescriptionResource +IotHubCertificateDescriptionCollection collection = iotHubDescription.GetIotHubCertificateDescriptions(); + +// invoke the operation +string certificateName = "cert"; +IotHubCertificateDescriptionData data = new IotHubCertificateDescriptionData +{ + Properties = new IotHubCertificateProperties + { + Certificate = BinaryData.FromObjectAsJson("############################################"), + }, +}; +ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, certificateName, data); +IotHubCertificateDescriptionResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubCertificateDescriptionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatescreateorupdate.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatescreateorupdate.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatescreateorupdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatesdelete.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatesdelete.cs new file mode 100644 index 0000000000..6bdda5b61f --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatesdelete.cs @@ -0,0 +1,31 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_certificatesdelete.json +// this example is just showing the usage of "Certificates_Delete" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubCertificateDescriptionResource created on azure +// for more information of creating IotHubCertificateDescriptionResource, please refer to the document of IotHubCertificateDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "myhub"; +string certificateName = "cert"; +ResourceIdentifier iotHubCertificateDescriptionResourceId = IotHubCertificateDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, certificateName); +IotHubCertificateDescriptionResource iotHubCertificateDescription = client.GetIotHubCertificateDescriptionResource(iotHubCertificateDescriptionResourceId); + +// invoke the operation +string ifMatch = "AAAAAAAADGk="; +await iotHubCertificateDescription.DeleteAsync(WaitUntil.Completed, ifMatch); + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatesdelete.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatesdelete.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certificatesdelete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certverify.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certverify.cs new file mode 100644 index 0000000000..a9ccc81124 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certverify.cs @@ -0,0 +1,39 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_certverify.json +// this example is just showing the usage of "Certificates_Verify" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubCertificateDescriptionResource created on azure +// for more information of creating IotHubCertificateDescriptionResource, please refer to the document of IotHubCertificateDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "myFirstProvisioningService"; +string certificateName = "cert"; +ResourceIdentifier iotHubCertificateDescriptionResourceId = IotHubCertificateDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, certificateName); +IotHubCertificateDescriptionResource iotHubCertificateDescription = client.GetIotHubCertificateDescriptionResource(iotHubCertificateDescriptionResourceId); + +// invoke the operation +string ifMatch = "AAAAAAAADGk="; +IotHubCertificateVerificationContent content = new IotHubCertificateVerificationContent +{ + Certificate = BinaryData.FromObjectAsJson("#####################################"), +}; +IotHubCertificateDescriptionResource result = await iotHubCertificateDescription.VerifyAsync(ifMatch, content); + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubCertificateDescriptionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certverify.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certverify.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_certverify.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createOrUpdate.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createOrUpdate.cs new file mode 100644 index 0000000000..0e873e1815 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createOrUpdate.cs @@ -0,0 +1,125 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using System.Xml; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_createOrUpdate.json +// this example is just showing the usage of "IotHubResource_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this ResourceGroupResource created on azure +// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); +ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + +// get the collection of this IotHubDescriptionResource +IotHubDescriptionCollection collection = resourceGroupResource.GetIotHubDescriptions(); + +// invoke the operation +string resourceName = "testHub"; +IotHubDescriptionData data = new IotHubDescriptionData(new AzureLocation("centraluseuap"), new IotHubSkuInfo(IotHubSku.S1) +{ + Capacity = 1L, +}) +{ + ETag = new ETag("AAAAAAFD6M4="), + Properties = new IotHubProperties + { + IPFilterRules = { }, + NetworkRuleSets = new IotHubNetworkRuleSetProperties(true, new IotHubNetworkRuleSetIPRule[] +{ +new IotHubNetworkRuleSetIPRule("rule1", "131.117.159.53") +{ +Action = IotHubNetworkRuleIPAction.Allow, +}, +new IotHubNetworkRuleSetIPRule("rule2", "157.55.59.128/25") +{ +Action = IotHubNetworkRuleIPAction.Allow, +} +}) + { + DefaultAction = IotHubNetworkRuleSetDefaultAction.Deny, + }, + MinTlsVersion = "1.2", + EventHubEndpoints = + { + ["events"] = new EventHubCompatibleEndpointProperties + { + RetentionTimeInDays = 1L, + PartitionCount = 2, + } + }, + Routing = new IotHubRoutingProperties + { + Endpoints = new RoutingEndpoints + { + ServiceBusQueues = { }, + ServiceBusTopics = { }, + EventHubs = { }, + StorageContainers = { }, + }, + Routes = { }, + FallbackRoute = new IotHubFallbackRouteProperties(IotHubRoutingSource.DeviceMessages, new string[] { "events" }, true) + { + Name = "$fallback", + Condition = "true", + }, + }, + StorageEndpoints = + { + ["$default"] = new IotHubStorageEndpointProperties("", "") + { + SasTtlAsIso8601 = XmlConvert.ToTimeSpan("PT1H"), + } + }, + MessagingEndpoints = + { + ["fileNotifications"] = new MessagingEndpointProperties + { + LockDurationAsIso8601 = XmlConvert.ToTimeSpan("PT1M"), + TtlAsIso8601 = XmlConvert.ToTimeSpan("PT1H"), + MaxDeliveryCount = 10, + } + }, + EnableFileUploadNotifications = false, + CloudToDevice = new CloudToDeviceProperties + { + MaxDeliveryCount = 10, + DefaultTtlAsIso8601 = XmlConvert.ToTimeSpan("PT1H"), + Feedback = new CloudToDeviceFeedbackQueueProperties + { + LockDurationAsIso8601 = XmlConvert.ToTimeSpan("PT1M"), + TtlAsIso8601 = XmlConvert.ToTimeSpan("PT1H"), + MaxDeliveryCount = 10, + }, + }, + Features = IotHubCapability.None, + EnableDataResidency = true, + RootCertificate = new IotHubRootCertificateProperties + { + IsRootCertificateV2Enabled = true, + }, + IPVersion = IotHubIPVersion.IPv4IPv6, + }, + Tags = { }, +}; +ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); +IotHubDescriptionResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubDescriptionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createOrUpdate.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createOrUpdate.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createconsumergroup.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createconsumergroup.cs new file mode 100644 index 0000000000..609393d50c --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createconsumergroup.cs @@ -0,0 +1,37 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_createconsumergroup.json +// this example is just showing the usage of "IotHubResource_CreateEventHubConsumerGroup" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this EventHubConsumerGroupInfoResource created on azure +// for more information of creating EventHubConsumerGroupInfoResource, please refer to the document of EventHubConsumerGroupInfoResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +string eventHubEndpointName = "events"; +string name = "test"; +ResourceIdentifier eventHubConsumerGroupInfoResourceId = EventHubConsumerGroupInfoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, eventHubEndpointName, name); +EventHubConsumerGroupInfoResource eventHubConsumerGroupInfo = client.GetEventHubConsumerGroupInfoResource(eventHubConsumerGroupInfoResourceId); + +// invoke the operation +EventHubConsumerGroupInfoCreateOrUpdateContent content = new EventHubConsumerGroupInfoCreateOrUpdateContent("test"); +ArmOperation lro = await eventHubConsumerGroupInfo.UpdateAsync(WaitUntil.Completed, content); +EventHubConsumerGroupInfoResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +EventHubConsumerGroupInfoData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createconsumergroup.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createconsumergroup.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_createconsumergroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_delete.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_delete.cs new file mode 100644 index 0000000000..528f2dda84 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_delete.cs @@ -0,0 +1,34 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_delete.json +// this example is just showing the usage of "IotHubResource_Delete" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +ArmOperation lro = await iotHubDescription.DeleteAsync(WaitUntil.Completed); +IotHubDescriptionResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubDescriptionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_delete.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_delete.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteconsumergroup.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteconsumergroup.cs new file mode 100644 index 0000000000..ef522ff2bb --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteconsumergroup.cs @@ -0,0 +1,31 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_deleteconsumergroup.json +// this example is just showing the usage of "IotHubResource_DeleteEventHubConsumerGroup" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this EventHubConsumerGroupInfoResource created on azure +// for more information of creating EventHubConsumerGroupInfoResource, please refer to the document of EventHubConsumerGroupInfoResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +string eventHubEndpointName = "events"; +string name = "test"; +ResourceIdentifier eventHubConsumerGroupInfoResourceId = EventHubConsumerGroupInfoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, eventHubEndpointName, name); +EventHubConsumerGroupInfoResource eventHubConsumerGroupInfo = client.GetEventHubConsumerGroupInfoResource(eventHubConsumerGroupInfoResourceId); + +// invoke the operation +await eventHubConsumerGroupInfo.DeleteAsync(WaitUntil.Completed); + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteconsumergroup.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteconsumergroup.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteconsumergroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteprivateendpointconnection.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteprivateendpointconnection.cs new file mode 100644 index 0000000000..72352dc43d --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteprivateendpointconnection.cs @@ -0,0 +1,35 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_deleteprivateendpointconnection.json +// this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubPrivateEndpointConnectionResource created on azure +// for more information of creating IotHubPrivateEndpointConnectionResource, please refer to the document of IotHubPrivateEndpointConnectionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +string privateEndpointConnectionName = "myPrivateEndpointConnection"; +ResourceIdentifier iotHubPrivateEndpointConnectionResourceId = IotHubPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName); +IotHubPrivateEndpointConnectionResource iotHubPrivateEndpointConnection = client.GetIotHubPrivateEndpointConnectionResource(iotHubPrivateEndpointConnectionResourceId); + +// invoke the operation +ArmOperation lro = await iotHubPrivateEndpointConnection.DeleteAsync(WaitUntil.Completed); +IotHubPrivateEndpointConnectionResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubPrivateEndpointConnectionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteprivateendpointconnection.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteprivateendpointconnection.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_deleteprivateendpointconnection.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_exportdevices.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_exportdevices.cs new file mode 100644 index 0000000000..f97981be37 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_exportdevices.cs @@ -0,0 +1,34 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_exportdevices.json +// this example is just showing the usage of "IotHubResource_ExportDevices" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +ExportDevicesContent content = new ExportDevicesContent(new Uri("testBlob"), true) +{ + AuthenticationType = IotHubAuthenticationType.IdentityBased, + UserAssignedIdentity = new ResourceIdentifier("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"), +}; +IotHubJobInfo result = await iotHubDescription.ExportDevicesAsync(content); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_exportdevices.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_exportdevices.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_exportdevices.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_generateverificationcode.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_generateverificationcode.cs new file mode 100644 index 0000000000..2378151aa9 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_generateverificationcode.cs @@ -0,0 +1,31 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_generateverificationcode.json +// this example is just showing the usage of "Certificates_GenerateVerificationCode" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubCertificateDescriptionResource created on azure +// for more information of creating IotHubCertificateDescriptionResource, please refer to the document of IotHubCertificateDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +string certificateName = "cert"; +ResourceIdentifier iotHubCertificateDescriptionResourceId = IotHubCertificateDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, certificateName); +IotHubCertificateDescriptionResource iotHubCertificateDescription = client.GetIotHubCertificateDescriptionResource(iotHubCertificateDescriptionResourceId); + +// invoke the operation +string ifMatch = "AAAAAAAADGk="; +IotHubCertificateWithNonceDescription result = await iotHubCertificateDescription.GenerateVerificationCodeAsync(ifMatch); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_generateverificationcode.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_generateverificationcode.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_generateverificationcode.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_get.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_get.cs new file mode 100644 index 0000000000..44714db91a --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_get.cs @@ -0,0 +1,33 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_get.json +// this example is just showing the usage of "IotHubResource_Get" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +IotHubDescriptionResource result = await iotHubDescription.GetAsync(); + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubDescriptionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_get.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_get.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getcertificate.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getcertificate.cs new file mode 100644 index 0000000000..c51b93e7e2 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getcertificate.cs @@ -0,0 +1,45 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_getcertificate.json +// this example is just showing the usage of "Certificates_Get" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testhub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// get the collection of this IotHubCertificateDescriptionResource +IotHubCertificateDescriptionCollection collection = iotHubDescription.GetIotHubCertificateDescriptions(); + +// invoke the operation +string certificateName = "cert"; +NullableResponse response = await collection.GetIfExistsAsync(certificateName); +IotHubCertificateDescriptionResource result = response.HasValue ? response.Value : null; + +if (result == null) +{ + Console.WriteLine("Succeeded with null as result"); +} +else +{ + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IotHubCertificateDescriptionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); +} diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getcertificate.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getcertificate.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getcertificate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getconsumergroup.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getconsumergroup.cs new file mode 100644 index 0000000000..8e84ae4add --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getconsumergroup.cs @@ -0,0 +1,35 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_getconsumergroup.json +// this example is just showing the usage of "IotHubResource_GetEventHubConsumerGroup" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this EventHubConsumerGroupInfoResource created on azure +// for more information of creating EventHubConsumerGroupInfoResource, please refer to the document of EventHubConsumerGroupInfoResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +string eventHubEndpointName = "events"; +string name = "test"; +ResourceIdentifier eventHubConsumerGroupInfoResourceId = EventHubConsumerGroupInfoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, eventHubEndpointName, name); +EventHubConsumerGroupInfoResource eventHubConsumerGroupInfo = client.GetEventHubConsumerGroupInfoResource(eventHubConsumerGroupInfoResourceId); + +// invoke the operation +EventHubConsumerGroupInfoResource result = await eventHubConsumerGroupInfo.GetAsync(); + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +EventHubConsumerGroupInfoData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getconsumergroup.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getconsumergroup.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getconsumergroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getjob.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getjob.cs new file mode 100644 index 0000000000..b678c7863e --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getjob.cs @@ -0,0 +1,30 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_getjob.json +// this example is just showing the usage of "IotHubResource_GetJob" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +string jobId = "test"; +IotHubJobInfo result = await iotHubDescription.GetJobAsync(jobId); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getjob.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getjob.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getjob.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getkey.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getkey.cs new file mode 100644 index 0000000000..d35f4c3d87 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getkey.cs @@ -0,0 +1,30 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_getkey.json +// this example is just showing the usage of "IotHubResource_GetKeysForKeyName" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +string keyName = "iothubowner"; +SharedAccessSignatureAuthorizationRule result = await iotHubDescription.GetKeysForKeyNameAsync(keyName); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getkey.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getkey.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getkey.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivateendpointconnection.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivateendpointconnection.cs new file mode 100644 index 0000000000..e19333c029 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivateendpointconnection.cs @@ -0,0 +1,34 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_getprivateendpointconnection.json +// this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubPrivateEndpointConnectionResource created on azure +// for more information of creating IotHubPrivateEndpointConnectionResource, please refer to the document of IotHubPrivateEndpointConnectionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +string privateEndpointConnectionName = "myPrivateEndpointConnection"; +ResourceIdentifier iotHubPrivateEndpointConnectionResourceId = IotHubPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName); +IotHubPrivateEndpointConnectionResource iotHubPrivateEndpointConnection = client.GetIotHubPrivateEndpointConnectionResource(iotHubPrivateEndpointConnectionResourceId); + +// invoke the operation +IotHubPrivateEndpointConnectionResource result = await iotHubPrivateEndpointConnection.GetAsync(); + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubPrivateEndpointConnectionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivateendpointconnection.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivateendpointconnection.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivateendpointconnection.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivatelinkresources.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivatelinkresources.cs new file mode 100644 index 0000000000..f4d7f80d41 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivatelinkresources.cs @@ -0,0 +1,33 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_getprivatelinkresources.json +// this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubPrivateEndpointGroupInformationResource created on azure +// for more information of creating IotHubPrivateEndpointGroupInformationResource, please refer to the document of IotHubPrivateEndpointGroupInformationResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +string groupId = "iotHub"; +ResourceIdentifier iotHubPrivateEndpointGroupInformationResourceId = IotHubPrivateEndpointGroupInformationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, groupId); +IotHubPrivateEndpointGroupInformationResource iotHubPrivateEndpointGroupInformation = client.GetIotHubPrivateEndpointGroupInformationResource(iotHubPrivateEndpointGroupInformationResourceId); + +// invoke the operation +IotHubPrivateEndpointGroupInformationResource result = await iotHubPrivateEndpointGroupInformation.GetAsync(); + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubPrivateEndpointGroupInformationData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivatelinkresources.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivatelinkresources.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getprivatelinkresources.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getskus.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getskus.cs new file mode 100644 index 0000000000..e2bd3f10ed --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getskus.cs @@ -0,0 +1,32 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_getskus.json +// this example is just showing the usage of "IotHubResource_GetValidSkus" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation and iterate over the result +await foreach (IotHubSkuDescription item in iotHubDescription.GetValidSkusAsync()) +{ + Console.WriteLine($"Succeeded: {item}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getskus.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getskus.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_getskus.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_importdevices.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_importdevices.cs new file mode 100644 index 0000000000..41c6931376 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_importdevices.cs @@ -0,0 +1,30 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_importdevices.json +// this example is just showing the usage of "IotHubResource_ImportDevices" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +IotHubImportDevicesContent content = new IotHubImportDevicesContent(new Uri("testBlob"), new Uri("testBlob")); +IotHubJobInfo result = await iotHubDescription.ImportDevicesAsync(content); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_importdevices.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_importdevices.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_importdevices.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbyrg.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbyrg.cs new file mode 100644 index 0000000000..7ae6bd2a5e --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbyrg.cs @@ -0,0 +1,40 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using System.Xml; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_listbyrg.json +// this example is just showing the usage of "IotHubResource_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this ResourceGroupResource created on azure +// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); +ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + +// get the collection of this IotHubDescriptionResource +IotHubDescriptionCollection collection = resourceGroupResource.GetIotHubDescriptions(); + +// invoke the operation and iterate over the result +await foreach (IotHubDescriptionResource item in collection.GetAllAsync()) +{ + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IotHubDescriptionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbyrg.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbyrg.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbyrg.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbysubscription.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbysubscription.cs new file mode 100644 index 0000000000..acf51fb3f5 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbysubscription.cs @@ -0,0 +1,35 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_listbysubscription.json +// this example is just showing the usage of "IotHubResource_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this SubscriptionResource created on azure +// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); +SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + +// invoke the operation and iterate over the result +await foreach (IotHubDescriptionResource item in subscriptionResource.GetIotHubDescriptionsAsync()) +{ + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IotHubDescriptionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbysubscription.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbysubscription.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listbysubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listcertificates.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listcertificates.cs new file mode 100644 index 0000000000..ca1c9dfb65 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listcertificates.cs @@ -0,0 +1,39 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_listcertificates.json +// this example is just showing the usage of "Certificates_ListByIotHub" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testhub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// get the collection of this IotHubCertificateDescriptionResource +IotHubCertificateDescriptionCollection collection = iotHubDescription.GetIotHubCertificateDescriptions(); + +// invoke the operation and iterate over the result +await foreach (IotHubCertificateDescriptionResource item in collection.GetAllAsync()) +{ + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IotHubCertificateDescriptionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listcertificates.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listcertificates.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listcertificates.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listehgroups.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listehgroups.cs new file mode 100644 index 0000000000..8801944374 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listehgroups.cs @@ -0,0 +1,40 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_listehgroups.json +// this example is just showing the usage of "IotHubResource_ListEventHubConsumerGroups" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// get the collection of this EventHubConsumerGroupInfoResource +string eventHubEndpointName = "events"; +EventHubConsumerGroupInfoCollection collection = iotHubDescription.GetEventHubConsumerGroupInfos(eventHubEndpointName); + +// invoke the operation and iterate over the result +await foreach (EventHubConsumerGroupInfoResource item in collection.GetAllAsync()) +{ + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + EventHubConsumerGroupInfoData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listehgroups.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listehgroups.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listehgroups.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listjobs.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listjobs.cs new file mode 100644 index 0000000000..055281fb90 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listjobs.cs @@ -0,0 +1,32 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_listjobs.json +// this example is just showing the usage of "IotHubResource_ListJobs" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation and iterate over the result +await foreach (IotHubJobInfo item in iotHubDescription.GetJobsAsync()) +{ + Console.WriteLine($"Succeeded: {item}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listjobs.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listjobs.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listjobs.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listkeys.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listkeys.cs new file mode 100644 index 0000000000..5696e24f1e --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listkeys.cs @@ -0,0 +1,32 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_listkeys.json +// this example is just showing the usage of "IotHubResource_ListKeys" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation and iterate over the result +await foreach (SharedAccessSignatureAuthorizationRule item in iotHubDescription.GetKeysAsync()) +{ + Console.WriteLine($"Succeeded: {item}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listkeys.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listkeys.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listkeys.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivateendpointconnections.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivateendpointconnections.cs new file mode 100644 index 0000000000..cde49ca08e --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivateendpointconnections.cs @@ -0,0 +1,39 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_listprivateendpointconnections.json +// this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// get the collection of this IotHubPrivateEndpointConnectionResource +IotHubPrivateEndpointConnectionCollection collection = iotHubDescription.GetIotHubPrivateEndpointConnections(); + +// invoke the operation and iterate over the result +await foreach (IotHubPrivateEndpointConnectionResource item in collection.GetAllAsync()) +{ + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IotHubPrivateEndpointConnectionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivateendpointconnections.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivateendpointconnections.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivateendpointconnections.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivatelinkresources.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivatelinkresources.cs new file mode 100644 index 0000000000..b16936b32e --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivatelinkresources.cs @@ -0,0 +1,38 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_listprivatelinkresources.json +// this example is just showing the usage of "PrivateLinkResources_List" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// get the collection of this IotHubPrivateEndpointGroupInformationResource +IotHubPrivateEndpointGroupInformationCollection collection = iotHubDescription.GetAllIotHubPrivateEndpointGroupInformation(); + +// invoke the operation and iterate over the result +await foreach (IotHubPrivateEndpointGroupInformationResource item in collection.GetAllAsync()) +{ + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IotHubPrivateEndpointGroupInformationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivatelinkresources.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivatelinkresources.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_listprivatelinkresources.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_patch.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_patch.cs new file mode 100644 index 0000000000..686150eeda --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_patch.cs @@ -0,0 +1,41 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_patch.json +// this example is just showing the usage of "IotHubResource_Update" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "myHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +IotHubDescriptionPatch patch = new IotHubDescriptionPatch +{ + Tags = + { + ["foo"] = "bar" + }, +}; +ArmOperation lro = await iotHubDescription.UpdateAsync(WaitUntil.Completed, patch); +IotHubDescriptionResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubDescriptionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_patch.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_patch.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_patch.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_quotametrics.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_quotametrics.cs new file mode 100644 index 0000000000..d986c433a6 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_quotametrics.cs @@ -0,0 +1,32 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_quotametrics.json +// this example is just showing the usage of "IotHubResource_GetQuotaMetrics" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation and iterate over the result +await foreach (IotHubQuotaMetricInfo item in iotHubDescription.GetQuotaMetricsAsync()) +{ + Console.WriteLine($"Succeeded: {item}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_quotametrics.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_quotametrics.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_quotametrics.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_routingendpointhealth.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_routingendpointhealth.cs new file mode 100644 index 0000000000..1814782ca7 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_routingendpointhealth.cs @@ -0,0 +1,32 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_routingendpointhealth.json +// this example is just showing the usage of "IotHubResource_GetEndpointHealth" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string iotHubName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, iotHubName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation and iterate over the result +await foreach (IotHubEndpointHealthInfo item in iotHubDescription.GetEndpointHealthAsync()) +{ + Console.WriteLine($"Succeeded: {item}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_routingendpointhealth.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_routingendpointhealth.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_routingendpointhealth.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_stats.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_stats.cs new file mode 100644 index 0000000000..a419ae88ec --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_stats.cs @@ -0,0 +1,29 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_stats.json +// this example is just showing the usage of "IotHubResource_GetStats" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +IotHubRegistryStatistics result = await iotHubDescription.GetStatsAsync(); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_stats.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_stats.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_stats.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testallroutes.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testallroutes.cs new file mode 100644 index 0000000000..89ac27a89f --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testallroutes.cs @@ -0,0 +1,45 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_testallroutes.json +// this example is just showing the usage of "IotHubResource_TestAllRoutes" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string iotHubName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, iotHubName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +IotHubTestAllRoutesContent content = new IotHubTestAllRoutesContent +{ + RoutingSource = IotHubRoutingSource.DeviceMessages, + Message = new RoutingMessage + { + Body = "Body of message", + AppProperties = + { + ["key1"] = "value1" + }, + SystemProperties = + { + ["key1"] = "value1" + }, + }, +}; +IotHubTestAllRoutesResult result = await iotHubDescription.TestAllRoutesAsync(content); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testallroutes.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testallroutes.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testallroutes.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testnewroute.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testnewroute.cs new file mode 100644 index 0000000000..705219792d --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testnewroute.cs @@ -0,0 +1,44 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_testnewroute.json +// this example is just showing the usage of "IotHubResource_TestRoute" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubDescriptionResource created on azure +// for more information of creating IotHubDescriptionResource, please refer to the document of IotHubDescriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string iotHubName = "testHub"; +ResourceIdentifier iotHubDescriptionResourceId = IotHubDescriptionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, iotHubName); +IotHubDescriptionResource iotHubDescription = client.GetIotHubDescriptionResource(iotHubDescriptionResourceId); + +// invoke the operation +IotHubTestRouteContent content = new IotHubTestRouteContent(new RoutingRuleProperties("Routeid", IotHubRoutingSource.DeviceMessages, new string[] { "id1" }, true)) +{ + Message = new RoutingMessage + { + Body = "Body of message", + AppProperties = + { + ["key1"] = "value1" + }, + SystemProperties = + { + ["key1"] = "value1" + }, + }, +}; +IotHubTestRouteResult result = await iotHubDescription.TestRouteAsync(content); + +Console.WriteLine($"Succeeded: {result}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testnewroute.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testnewroute.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_testnewroute.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_updateprivateendpointconnection.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_updateprivateendpointconnection.cs new file mode 100644 index 0000000000..33d496a3a0 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_updateprivateendpointconnection.cs @@ -0,0 +1,36 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_updateprivateendpointconnection.json +// this example is just showing the usage of "PrivateEndpointConnections_Update" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this IotHubPrivateEndpointConnectionResource created on azure +// for more information of creating IotHubPrivateEndpointConnectionResource, please refer to the document of IotHubPrivateEndpointConnectionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +string resourceGroupName = "myResourceGroup"; +string resourceName = "testHub"; +string privateEndpointConnectionName = "myPrivateEndpointConnection"; +ResourceIdentifier iotHubPrivateEndpointConnectionResourceId = IotHubPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName); +IotHubPrivateEndpointConnectionResource iotHubPrivateEndpointConnection = client.GetIotHubPrivateEndpointConnectionResource(iotHubPrivateEndpointConnectionResourceId); + +// invoke the operation +IotHubPrivateEndpointConnectionData data = new IotHubPrivateEndpointConnectionData(new IotHubPrivateEndpointConnectionProperties(new IotHubPrivateLinkServiceConnectionState(IotHubPrivateLinkServiceConnectionStatus.Approved, "Approved by johndoe@contoso.com"))); +ArmOperation lro = await iotHubPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); +IotHubPrivateEndpointConnectionResource result = lro.Value; + +// the variable result is a resource, you could call other operations on this instance as well +// but just for demo, we get its data from this resource instance +IotHubPrivateEndpointConnectionData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_updateprivateendpointconnection.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_updateprivateendpointconnection.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_updateprivateendpointconnection.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_usages.cs b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_usages.cs new file mode 100644 index 0000000000..68985918a3 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_usages.cs @@ -0,0 +1,31 @@ +using Azure; +using Azure.ResourceManager; +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IotHub.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.IotHub; + +// Generated from example definition: specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples/iothub_usages.json +// this example is just showing the usage of "ResourceProviderCommon_GetSubscriptionQuota" operation, for the dependent resources, they will have to be created separately. + +// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line +TokenCredential cred = new DefaultAzureCredential(); +// authenticate your client +ArmClient client = new ArmClient(cred); + +// this example assumes you already have this SubscriptionResource created on azure +// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource +string subscriptionId = "91d12660-3dec-467a-be2a-213b5544ddc0"; +ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); +SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + +// invoke the operation and iterate over the result +await foreach (IotHubUserSubscriptionQuota item in subscriptionResource.GetIotHubUserSubscriptionQuotaAsync()) +{ + Console.WriteLine($"Succeeded: {item}"); +} + +Console.WriteLine("Succeeded"); diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_usages.json b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_usages.json new file mode 100644 index 0000000000..8a8f87e336 --- /dev/null +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/preview/2025-08-01-preview/examples-dotnet/iothub_usages.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.IotHub_1.2.0-beta.2/sdk/iothub/Azure.ResourceManager.IotHub/README.md"} \ No newline at end of file